windows compilation bugfixes, removed many warnings

metadata
Wenzel Jakob 2010-09-14 15:53:11 -07:00
parent 35adc5aca8
commit 768bacccdc
30 changed files with 102 additions and 81 deletions

View File

@ -13,8 +13,9 @@ OEXRINCLUDE = ['#tools/windows/include/OpenEXR']
OEXRFLAGS = ['/D', 'OPENEXR_DLL'] OEXRFLAGS = ['/D', 'OPENEXR_DLL']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib1', 'Half'] OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib1', 'Half']
BOOSTINCLUDE = ['#tools/boost'] BOOSTINCLUDE = ['#tools/boost']
BOOSTLIB = ['libboost_system', 'libboost_filesystem']
COLLADAINCLUDE = ['#tools/windows/include/colladadom', '#tools/windows/include/colladadom/1.4'] COLLADAINCLUDE = ['#tools/windows/include/colladadom', '#tools/windows/include/colladadom/1.4']
COLLADALIB = ['libcollada14dom21', 'libboost_system', 'libboost_filesystem'] COLLADALIB = ['libcollada14dom21']
XERCESLIB = ['xerces-c_3'] XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng13'] PNGLIB = ['libpng13']
JPEGLIB = ['jpeg62'] JPEGLIB = ['jpeg62']

View File

@ -13,8 +13,9 @@ OEXRINCLUDE = ['#tools/windows/include/OpenEXR']
OEXRFLAGS = ['/D', 'OPENEXR_DLL'] OEXRFLAGS = ['/D', 'OPENEXR_DLL']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib1', 'Half'] OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib1', 'Half']
BOOSTINCLUDE = ['#tools/boost'] BOOSTINCLUDE = ['#tools/boost']
BOOSTLIB = ['libboost_system', 'libboost_filesystem']
COLLADAINCLUDE = ['#tools/windows/include/colladadom', '#tools/windows/include/colladadom/1.4'] COLLADAINCLUDE = ['#tools/windows/include/colladadom', '#tools/windows/include/colladadom/1.4']
COLLADALIB = ['libcollada14dom21', 'libboost_system', 'libboost_filesystem'] COLLADALIB = ['libcollada14dom21']
XERCESLIB = ['xerces-c_3'] XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng13'] PNGLIB = ['libpng13']
JPEGLIB = ['jpeg62'] JPEGLIB = ['jpeg62']

View File

@ -27,7 +27,7 @@ MTS_NAMESPACE_BEGIN
* This class can be used to transform uniformly distributed samples * This class can be used to transform uniformly distributed samples
* so that they match the stored distribution. * so that they match the stored distribution.
*/ */
class DiscretePDF { struct DiscretePDF {
public: public:
/// Allocate a PDF with the given number of entries /// Allocate a PDF with the given number of entries
explicit inline DiscretePDF(int nEntries = 0) : m_ready(false) { explicit inline DiscretePDF(int nEntries = 0) : m_ready(false) {

View File

@ -90,6 +90,8 @@
#endif #endif
#define SIZE_T_FMT "%Iu" #define SIZE_T_FMT "%Iu"
#define BOOST_FILESYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#else #else
#define MTS_EXPORT #define MTS_EXPORT
#define MTS_EXPORT_CORE #define MTS_EXPORT_CORE

View File

@ -44,8 +44,13 @@ template <typename T> struct TPoint2 {
/// Initialize the point with the specified X, Y and Z components /// Initialize the point with the specified X, Y and Z components
TPoint2(T x, T y) : x(x), y(y) { } TPoint2(T x, T y) : x(x), y(y) { }
/// Initialize the point from a point data structure /// Initialize the point with the components of another point
TPoint2(const TVector2<T> &vec) : x(vec.x), y(vec.y) { } template <typename T2> explicit TPoint2(const TPoint2<T2> &p)
: x((T) p.x), y((T) p.y) { }
/// Initialize the point with the components of a vector data structure
template <typename T2> explicit TPoint2(const TVector2<T2> &v)
: x((T) v.x), y((T) v.y) { }
/// Initialize all components of the the point with the specified value /// Initialize all components of the the point with the specified value
explicit TPoint2(T val) : x(val), y(val) { } explicit TPoint2(T val) : x(val), y(val) { }
@ -110,7 +115,7 @@ template <typename T> struct TPoint2 {
return TPoint2(-x, -y); return TPoint2(-x, -y);
} }
/// Divide the point's coordinates by the given scalar /// Divide the point's coordinates by the given scalar and return the result
TPoint2 operator/(T f) const { TPoint2 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -120,6 +125,7 @@ template <typename T> struct TPoint2 {
return TPoint2(x * recip, y * recip); return TPoint2(x * recip, y * recip);
} }
/// Divide the point's coordinates by the given scalar
TPoint2 &operator/=(T f) { TPoint2 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -173,10 +179,6 @@ template <typename T> inline TPoint2<T> operator*(T f, const TPoint2<T> &v) {
return v*f; return v*f;
} }
template <typename T> inline TVector2<T>::TVector2(const TPoint2<T> &p)
: x(p.x), y(p.y) { }
template <typename T> inline T distance(const TPoint2<T> &p1, const TPoint2<T> &p2) { template <typename T> inline T distance(const TPoint2<T> &p1, const TPoint2<T> &p2) {
return (p1-p2).length(); return (p1-p2).length();
} }
@ -224,8 +226,13 @@ template <typename T> struct TPoint3 {
/// Initialize the point with the specified X, Y and Z components /// Initialize the point with the specified X, Y and Z components
TPoint3(T x, T y, T z) : x(x), y(y), z(z) { } TPoint3(T x, T y, T z) : x(x), y(y), z(z) { }
/// Initialize the point from a point data structure /// Initialize the point with the components of another point
TPoint3(const TVector3<T> &vec) : x(vec.x), y(vec.y), z(vec.z) { } template <typename T2> explicit TPoint3(const TPoint3<T2> &p)
: x((T) p.x), y((T) p.y), z((T) p.z) { }
/// Initialize the point with the components of a vector data structure
template <typename T2> explicit TPoint3(const TVector3<T2> &v)
: x((T) v.x), y((T) v.y), z((T) v.z) { }
/// Initialize all components of the the point with the specified value /// Initialize all components of the the point with the specified value
explicit TPoint3(T val) : x(val), y(val), z(val) { } explicit TPoint3(T val) : x(val), y(val), z(val) { }
@ -291,7 +298,7 @@ template <typename T> struct TPoint3 {
return TPoint3(-x, -y, -z); return TPoint3(-x, -y, -z);
} }
/// Divide the point's coordinates by the given scalar /// Divide the point's coordinates by the given scalar and return the result
TPoint3 operator/(T f) const { TPoint3 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -301,6 +308,7 @@ template <typename T> struct TPoint3 {
return TPoint3(x * recip, y * recip, z * recip); return TPoint3(x * recip, y * recip, z * recip);
} }
/// Divide the point's coordinates by the given scalar
TPoint3 &operator/=(T f) { TPoint3 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -355,10 +363,6 @@ template <typename T> inline TPoint3<T> operator*(T f, const TPoint3<T> &v) {
return v*f; return v*f;
} }
template <typename T> inline TVector3<T>::TVector3(const TPoint3<T> &p)
: x(p.x), y(p.y), z(p.z) { }
template <typename T> inline T distance(const TPoint3<T> &p1, const TPoint3<T> &p2) { template <typename T> inline T distance(const TPoint3<T> &p1, const TPoint3<T> &p2) {
return (p1-p2).length(); return (p1-p2).length();
} }
@ -407,8 +411,13 @@ template <typename T> struct TPoint4 {
/// Initialize the point with the specified X, Y and Z components /// Initialize the point with the specified X, Y and Z components
TPoint4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) { } TPoint4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) { }
/// Initialize the point from a point data structure /// Initialize the point with the components of another point
TPoint4(const TVector4<T> &vec) : x(vec.x), y(vec.y), z(vec.z), w(vec.w) { } template <typename T2> explicit TPoint4(const TPoint4<T2> &p)
: x((T) p.x), y((T) p.y), z((T) p.z), w((T) p.w) { }
/// Initialize the point with the components of a vector data structure
template <typename T2> explicit TPoint4(const TVector4<T2> &v)
: x((T) v.x), y((T) v.y), z((T) v.z), w((T) v.w) { }
/// Initialize all components of the the point with the specified value /// Initialize all components of the the point with the specified value
explicit TPoint4(T val) : x(val), y(val), z(val), w(val) { } explicit TPoint4(T val) : x(val), y(val), z(val), w(val) { }
@ -475,7 +484,7 @@ template <typename T> struct TPoint4 {
return TPoint4(-x, -y, -z, -w); return TPoint4(-x, -y, -z, -w);
} }
/// Divide the point's coordinates by the given scalar /// Divide the point's coordinates by the given scalar and return the result
TPoint4 operator/(T f) const { TPoint4 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -485,6 +494,7 @@ template <typename T> struct TPoint4 {
return TPoint4(x * recip, y * recip, z * recip, w * recip); return TPoint4(x * recip, y * recip, z * recip, w * recip);
} }
/// Divide the point's coordinates by the given scalar
TPoint4 &operator/=(T f) { TPoint4 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -540,10 +550,6 @@ template <typename T> inline TPoint4<T> operator*(T f, const TPoint4<T> &v) {
return v*f; return v*f;
} }
template <typename T> inline TVector4<T>::TVector4(const TPoint4<T> &p)
: x(p.x), y(p.y), z(p.z), w(p.w) { }
template <typename T> inline T distance(const TPoint4<T> &p1, const TPoint4<T> &p2) { template <typename T> inline T distance(const TPoint4<T> &p1, const TPoint4<T> &p2) {
return (p1-p2).length(); return (p1-p2).length();
} }

View File

@ -101,7 +101,7 @@ private:
* When SPECTRUM_SAMPLES is set to 3 (the default), this class * When SPECTRUM_SAMPLES is set to 3 (the default), this class
* falls back to linear RGB as its internal representation. * falls back to linear RGB as its internal representation.
*/ */
class MTS_EXPORT_CORE Spectrum { struct MTS_EXPORT_CORE Spectrum {
public: public:
/// Create a new spectral power distribution, but don't initialize the contents /// Create a new spectral power distribution, but don't initialize the contents
inline Spectrum() { } inline Spectrum() { }
@ -446,7 +446,9 @@ protected:
static const int CIE_end = 830; static const int CIE_end = 830;
static const int CIE_count = CIE_end - CIE_start + 1; static const int CIE_count = CIE_end - CIE_start + 1;
static const Float CIE_normalization; static const Float CIE_normalization;
static const Float CIE_X[CIE_count], CIE_Y[CIE_count], CIE_Z[CIE_count]; static const Float CIE_X[CIE_count];
static const Float CIE_Y[CIE_count];
static const Float CIE_Z[CIE_count];
/// @} /// @}
}; };

View File

@ -62,8 +62,6 @@ namespace std {
/// @endcond /// @endcond
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h> #include <float.h>
#define snprintf _snprintf #define snprintf _snprintf

View File

@ -76,12 +76,10 @@ protected:
virtual ~Matrix4x4() { } virtual ~Matrix4x4() { }
}; };
struct Frame;
/** /**
* \brief Encapsulates a 4x4 linear transformation and its inverse * \brief Encapsulates a 4x4 linear transformation and its inverse
*/ */
class MTS_EXPORT_CORE Transform { struct MTS_EXPORT_CORE Transform {
public: public:
/// Create an identity transformation /// Create an identity transformation
Transform(); Transform();

View File

@ -164,12 +164,12 @@ extern MTS_EXPORT_CORE Point2 squareToTriangle(const Point2 &sample);
/// Convert radians to degrees /// Convert radians to degrees
inline Float radToDeg(Float rad) { inline Float radToDeg(Float rad) {
return 180.0f*rad/M_PI; return 180.0f * rad / M_PI;
} }
/// Convert degrees to radians /// Convert degrees to radians
inline Float degToRad(Float deg) { inline Float degToRad(Float deg) {
return deg*M_PI/180.0f; return deg * M_PI / 180.0f;
} }
/// Simple floating point clamping function /// Simple floating point clamping function

View File

@ -48,8 +48,13 @@ public:
/// Initialize all components of the the vector with the specified value /// Initialize all components of the the vector with the specified value
explicit TVector2(T val) : x(val), y(val) { } explicit TVector2(T val) : x(val), y(val) { }
/// Initialize a vector with the components of a point data structure /// Initialize the vector with the components of a point data structure
explicit TVector2(const TPoint2<T> &point); template <typename T2> explicit TVector2(const TVector2<T2> &v)
: x((T) v.x), y((T) v.y) { }
/// Initialize the vector with the components of another vector data structure
template <typename T2> explicit TVector2(const TPoint2<T2> &p)
: x((T) p.x), y((T) p.y) { }
/// Unserialize a vector from a binary data stream /// Unserialize a vector from a binary data stream
TVector2(Stream *stream) { TVector2(Stream *stream) {
@ -95,7 +100,7 @@ public:
return TVector2(-x, -y); return TVector2(-x, -y);
} }
/// Divide the vector by the given scalar /// Divide the vector by the given scalar and return the result
TVector2 operator/(T f) const { TVector2 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -105,6 +110,7 @@ public:
return TVector2(x * recip, y * recip); return TVector2(x * recip, y * recip);
} }
/// Divide the vector by the given scalar
TVector2 &operator/=(T f) { TVector2 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -224,8 +230,13 @@ public:
/// Initialize all components of the the vector with the specified value /// Initialize all components of the the vector with the specified value
explicit TVector3(T val) : x(val), y(val), z(val) { } explicit TVector3(T val) : x(val), y(val), z(val) { }
/// Initialize a vector with the components of a point data structure /// Initialize the vector with the components of a point data structure
explicit TVector3(const TPoint3<T> &point); template <typename T2> explicit TVector3(const TVector3<T2> &v)
: x((T) v.x), y((T) v.y), z((T) v.z) { }
/// Initialize the vector with the components of another vector data structure
template <typename T2> explicit TVector3(const TPoint3<T2> &p)
: x((T) p.x), y((T) p.y), z((T) p.z) { }
/// Unserialize a vector from a binary data stream /// Unserialize a vector from a binary data stream
TVector3(Stream *stream) { TVector3(Stream *stream) {
@ -272,7 +283,7 @@ public:
return TVector3(-x, -y, -z); return TVector3(-x, -y, -z);
} }
/// Divide the vector by the given scalar /// Divide the vector by the given scalar and return the result
TVector3 operator/(T f) const { TVector3 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -282,6 +293,7 @@ public:
return TVector3(x * recip, y * recip, z * recip); return TVector3(x * recip, y * recip, z * recip);
} }
/// Divide the vector by the given scalar
TVector3 &operator/=(T f) { TVector3 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -413,8 +425,13 @@ public:
/// Initialize all components of the the vector with the specified value /// Initialize all components of the the vector with the specified value
explicit TVector4(T val) : x(val), y(val), z(val), w(val) { } explicit TVector4(T val) : x(val), y(val), z(val), w(val) { }
/// Initialize a vector with the components of a point data structure /// Initialize the vector with the components of a point data structure
explicit TVector4(const TPoint4<T> &point); template <typename T2> explicit TVector4(const TVector4<T2> &v)
: x((T) v.x), y((T) v.y), z((T) v.z), w((T) v.w) { }
/// Initialize the vector with the components of another vector data structure
template <typename T2> explicit TVector4(const TPoint4<T2> &p)
: x((T) p.x), y((T) p.y), z((T) p.z), w((T) p.w) { }
/// Unserialize a vector from a binary data stream /// Unserialize a vector from a binary data stream
TVector4(Stream *stream) { TVector4(Stream *stream) {
@ -462,7 +479,7 @@ public:
return TVector4(-x, -y, -z, -w); return TVector4(-x, -y, -z, -w);
} }
/// Divide the vector by the given scalar /// Divide the vector by the given scalar and return the result
TVector4 operator/(T f) const { TVector4 operator/(T f) const {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)
@ -472,6 +489,7 @@ public:
return TVector4(x * recip, y * recip, z * recip, w * recip); return TVector4(x * recip, y * recip, z * recip, w * recip);
} }
/// Divide the vector by the given scalar
TVector4 &operator/=(T f) { TVector4 &operator/=(T f) {
#ifdef MTS_DEBUG #ifdef MTS_DEBUG
if (f == 0) if (f == 0)

View File

@ -51,7 +51,7 @@ class PhaseFunction;
class PhotonMap; class PhotonMap;
class PreviewWorker; class PreviewWorker;
class ProjectiveCamera; class ProjectiveCamera;
class RadianceQueryRecord; struct RadianceQueryRecord;
class Random; class Random;
class RangeWorkUnit; class RangeWorkUnit;
class ReconstructionFilter; class ReconstructionFilter;
@ -65,7 +65,7 @@ class Scene;
class SceneHandler; class SceneHandler;
class Shader; class Shader;
class Shape; class Shape;
class ShapeSamplingRecord; struct ShapeSamplingRecord;
class SparseMipmap3D; class SparseMipmap3D;
class Spiral; class Spiral;
class Subsurface; class Subsurface;

View File

@ -53,6 +53,8 @@
#define MTS_USE_MT 1 #define MTS_USE_MT 1
#endif #endif
#include <mitsuba/render/triaccel.h>
/** /**
* Pre-defined max. stack size for the ray traversal algorithm * Pre-defined max. stack size for the ray traversal algorithm
*/ */

View File

@ -16,9 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define BOOST_FILESYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#include <mitsuba/mitsuba.h> #include <mitsuba/mitsuba.h>
#include <mitsuba/render/trimesh.h> #include <mitsuba/render/trimesh.h>
#include <mitsuba/core/fresolver.h> #include <mitsuba/core/fresolver.h>
@ -154,9 +151,9 @@ VertexData *fetchVertexData(Transform transform, std::ostream &os,
domAccessor *accessor = techniqueCommon->getAccessor(); domAccessor *accessor = techniqueCommon->getAccessor();
if (!accessor) if (!accessor)
SLog(EError, "Data source does not have a <accessor> tag!"); SLog(EError, "Data source does not have a <accessor> tag!");
unsigned int nParams = accessor->getParam_array().getCount(), unsigned int nParams = (unsigned int) accessor->getParam_array().getCount(),
stride = accessor->getStride(); stride = (unsigned int) accessor->getStride();
size_t size = accessor->getCount(); size_t size = (size_t) accessor->getCount();
SAssert(nParams <= 4); SAssert(nParams <= 4);
Vec4 *target = new Vec4[size]; Vec4 *target = new Vec4[size];

View File

@ -100,7 +100,7 @@ int colladaMain(int argc, char **argv) {
logLevel = EDebug; logLevel = EDebug;
break; break;
case 'f': case 'f':
fov = strtod(optarg, &end_ptr); fov = (Float) strtod(optarg, &end_ptr);
if (*end_ptr != '\0') if (*end_ptr != '\0')
SLog(EError, "Invalid field of view value!"); SLog(EError, "Invalid field of view value!");
break; break;

View File

@ -21,7 +21,7 @@
#if defined(WIN32) #if defined(WIN32)
#undef _CRT_SECURE_NO_WARNINGS #undef _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES #define _MATH_DEFINES_DEFINED
#endif #endif
#include <ImfRgba.h> #include <ImfRgba.h>

View File

@ -90,7 +90,7 @@ void FileStream::open(const fs::path &path, EFileMode mode) {
break; break;
} }
m_file = CreateFile(filename.c_str(), dwDesiredAccess, m_file = CreateFile(path.file_string().c_str(), dwDesiredAccess,
FILE_SHARE_WRITE | FILE_SHARE_READ, 0, FILE_SHARE_WRITE | FILE_SHARE_READ, 0,
dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0); dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0);

View File

@ -65,7 +65,7 @@ Plugin::Plugin(const std::string &shortName, const fs::path &path)
try { try {
m_createInstance = (CreateInstanceFunc) getSymbol("CreateInstance"); m_createInstance = (CreateInstanceFunc) getSymbol("CreateInstance");
} catch (const std::exception &ex) { } catch (const std::exception &) {
m_createUtility = (CreateUtilityFunc) getSymbol("CreateUtility"); m_createUtility = (CreateUtilityFunc) getSymbol("CreateUtility");
m_isUtility = true; m_isUtility = true;
} }

View File

@ -73,7 +73,7 @@ Float SHVector::eval(Float theta, Float phi) const {
} }
Float SHVector::findMinimum(int res = 32) const { Float SHVector::findMinimum(int res = 32) const {
Float hExt = M_PI / res, hInt = (2*M_PI)/(res*2); Float hExt = (Float) M_PI / res, hInt = (2 * (Float) M_PI)/(res*2);
Float minimum = std::numeric_limits<Float>::infinity(); Float minimum = std::numeric_limits<Float>::infinity();
for (int i=0; i<=res; ++i) { for (int i=0; i<=res; ++i) {
@ -88,7 +88,7 @@ Float SHVector::findMinimum(int res = 32) const {
} }
void SHVector::offset(Float value) { void SHVector::offset(Float value) {
operator()(0, 0) += 2 * value * std::sqrt(M_PI); operator()(0, 0) += 2 * value * (Float) std::sqrt(M_PI);
} }
Float SHVector::eval(const Vector &v) const { Float SHVector::eval(const Vector &v) const {
@ -160,7 +160,7 @@ Float SHVector::legendre(int l, int m, Float x) {
} }
void SHVector::normalize() { void SHVector::normalize() {
Float correction = 1/(2*std::sqrt(M_PI)*operator()(0,0)); Float correction = 1/(2 * (Float) std::sqrt(M_PI)*operator()(0,0));
for (size_t i=0; i<m_coeffs.size(); ++i) for (size_t i=0; i<m_coeffs.size(); ++i)
m_coeffs[i] *= correction; m_coeffs[i] *= correction;
@ -170,7 +170,7 @@ void SHVector::convolve(const SHVector &kernel) {
SAssert(kernel.getBands() == m_bands); SAssert(kernel.getBands() == m_bands);
for (int l=0; l<m_bands; ++l) { for (int l=0; l<m_bands; ++l) {
Float alpha = std::sqrt(4*M_PI / (2*l + 1)); Float alpha = std::sqrt(4 * (Float) M_PI / (2*l + 1));
for (int m=-l; m<=l; ++m) for (int m=-l; m<=l; ++m)
operator()(l, m) *= alpha * kernel(l, 0); operator()(l, m) *= alpha * kernel(l, 0);
} }
@ -199,7 +199,7 @@ ublas::matrix<Float> SHVector::mu2() const {
result(2, 2) += 2*sqrto3*operator()(2,0); result(2, 2) += 2*sqrto3*operator()(2,0);
} }
return result * (2*std::sqrt(M_PI/15)); return result * (2*std::sqrt((Float) M_PI / 15));
} }
std::string SHVector::toString() const { std::string SHVector::toString() const {
@ -225,7 +225,7 @@ Float SHVector::computeNormalization(int l, int m) {
SAssert(m>=0); SAssert(m>=0);
return std::sqrt( return std::sqrt(
((2*l+1) * boost::math::factorial<Float>(l-m)) ((2*l+1) * boost::math::factorial<Float>(l-m))
/ (4*M_PI * boost::math::factorial<Float>(l+m))); / (4 * (Float) M_PI * boost::math::factorial<Float>(l+m)));
} }
void SHVector::staticInitialization() { void SHVector::staticInitialization() {
@ -392,7 +392,7 @@ SHSampler::SHSampler(int bands, int depth) : m_bands(bands), m_depth(depth) {
for (int i=0; i<=depth; ++i) { for (int i=0; i<=depth; ++i) {
int res = 1 << i; int res = 1 << i;
Float zStep = -2 / (Float) res; Float zStep = -2 / (Float) res;
Float phiStep = 2*M_PI / (Float) res; Float phiStep = 2 * (Float) M_PI / (Float) res;
m_phiMap[i] = new Float*[res]; m_phiMap[i] = new Float*[res];
m_legendreMap[i] = new Float*[res]; m_legendreMap[i] = new Float*[res];
@ -406,7 +406,7 @@ SHSampler::SHSampler(int bands, int depth) : m_bands(bands), m_depth(depth) {
for (int m=0; m<=l; ++m) { for (int m=0; m<=l; ++m) {
Float normFactor = boost::math::tgamma_delta_ratio( Float normFactor = boost::math::tgamma_delta_ratio(
(Float) (l - m + 1), (Float) (2 * m), boost::math::policies::policy<>()); (Float) (l - m + 1), (Float) (2 * m), boost::math::policies::policy<>());
normFactor = std::sqrt(normFactor * (2 * l + 1) / (4 * M_PI)); normFactor = std::sqrt(normFactor * (2 * l + 1) / (4 * (Float) M_PI));
if (m != 0) if (m != 0)
normFactor *= SQRT_TWO; normFactor *= SQRT_TWO;
m_normalization[I(l, m)] = normFactor; m_normalization[I(l, m)] = normFactor;
@ -461,7 +461,7 @@ Float SHSampler::warp(const SHVector &f, Point2 &sample) const {
} }
Float zStep = -2 / (Float) (1 << m_depth); Float zStep = -2 / (Float) (1 << m_depth);
Float phiStep = 2 * M_PI / (Float) (1 << m_depth); Float phiStep = 2 * (Float) M_PI / (Float) (1 << m_depth);
i >>= 1; j >>= 1; i >>= 1; j >>= 1;
Float z = 1 + zStep * i + zStep * sample.x; Float z = 1 + zStep * i + zStep * sample.x;

View File

@ -583,13 +583,13 @@ Point2 squareToDiskConcentric(const Point2 &sample) {
} }
Float squareToConePdf(Float cosCutoff) { Float squareToConePdf(Float cosCutoff) {
return 1 / (2 * (Float) M_PI * (1 - cosCutoff)); return 1 / (2 * M_PI * (1 - cosCutoff));
} }
Vector squareToCone(Float cosCutoff, const Point2 &sample) { Vector squareToCone(Float cosCutoff, const Point2 &sample) {
Float cosTheta = (1-sample.x) + sample.x * cosCutoff; Float cosTheta = (1-sample.x) + sample.x * cosCutoff;
Float sinTheta = std::sqrt(1 - cosTheta * cosTheta); Float sinTheta = std::sqrt(1 - cosTheta * cosTheta);
Float phi = sample.y * (2 * (Float) M_PI); Float phi = sample.y * (2 * M_PI);
return Vector(std::cos(phi) * sinTheta, return Vector(std::cos(phi) * sinTheta,
std::sin(phi) * sinTheta, cosTheta); std::sin(phi) * sinTheta, cosTheta);
} }

View File

@ -38,7 +38,7 @@ Device::Device(Session *name) {
m_fullscreen = false; m_fullscreen = false;
m_fsaa = 1; m_fsaa = 1;
m_dimension = Vector2i(640, 480); m_dimension = Vector2i(640, 480);
m_position = Vector2i(0, 0); m_position = Point2i(0, 0);
m_center = true; m_center = true;
m_session = name; m_session = name;
m_showFPS = true; m_showFPS = true;

View File

@ -385,7 +385,7 @@ void GLRenderer::blitTexture(const GPUTexture *tex, bool flipVertically,
if (flipVertically) if (flipVertically)
std::swap(upperLeft.y, lowerRight.y); std::swap(upperLeft.y, lowerRight.y);
const Float zDepth = -1.0f; // just before the far plane const float zDepth = -1.0f; // just before the far plane
glTexCoord2f(0.0f, 0.0f); glTexCoord2f(0.0f, 0.0f);
glVertex3f(upperLeft.x, upperLeft.y, zDepth); glVertex3f(upperLeft.x, upperLeft.y, zDepth);
glTexCoord2f(1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f);

View File

@ -409,7 +409,7 @@ void VPLShaderManager::configure(const VPL &vpl, const BSDF *bsdf, const Luminai
program->setSource(GPUProgram::EFragmentProgram, oss.str()); program->setSource(GPUProgram::EFragmentProgram, oss.str());
try { try {
program->init(); program->init();
} catch (const std::exception &ex) { } catch (const std::exception &) {
Log(EWarn, "Unable to compile the following VPL program:\n%s", oss.str().c_str()); Log(EWarn, "Unable to compile the following VPL program:\n%s", oss.str().c_str());
throw; throw;
} }

View File

@ -66,7 +66,7 @@ LONG WINAPI WGLDevice::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
device->initPixelFormat(hWnd); device->initPixelFormat(hWnd);
break; break;
case WM_SIZE: case WM_SIZE:
device->m_dimension = Point2i(LOWORD(lParam), HIWORD(lParam)); device->m_dimension = Vector2i(LOWORD(lParam), HIWORD(lParam));
break; break;
case WM_PAINT: case WM_PAINT:
BeginPaint(hWnd, &ps); BeginPaint(hWnd, &ps);
@ -424,7 +424,7 @@ bool WGLDevice::translateMouse(UINT uMsg, WPARAM wParam, DeviceEvent &event) {
if (m_mouse != Point2i(-1, -1)) { if (m_mouse != Point2i(-1, -1)) {
event.setMouseRelative(event.getMousePosition() - m_mouse); event.setMouseRelative(event.getMousePosition() - m_mouse);
} else { } else {
event.setMouseRelative(Point2i(0, 0)); event.setMouseRelative(Vector2i(0, 0));
} }
m_mouse = event.getMousePosition(); m_mouse = event.getMousePosition();

View File

@ -18,7 +18,6 @@
#include <mitsuba/render/kdtree.h> #include <mitsuba/render/kdtree.h>
#include <mitsuba/render/trimesh.h> #include <mitsuba/render/trimesh.h>
#include <mitsuba/render/triaccel.h>
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN

View File

@ -19,7 +19,6 @@
#include <mitsuba/core/triangle.h> #include <mitsuba/core/triangle.h>
#include <mitsuba/core/statistics.h> #include <mitsuba/core/statistics.h>
#include <mitsuba/render/kdtree.h> #include <mitsuba/render/kdtree.h>
#include <mitsuba/render/triaccel.h>
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN

View File

@ -17,7 +17,6 @@
*/ */
#include <mitsuba/render/kdtree.h> #include <mitsuba/render/kdtree.h>
#include <mitsuba/render/triaccel.h>
#include <mitsuba/core/timer.h> #include <mitsuba/core/timer.h>
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN

View File

@ -19,7 +19,6 @@
#include <mitsuba/core/triangle.h> #include <mitsuba/core/triangle.h>
#include <mitsuba/core/statistics.h> #include <mitsuba/core/statistics.h>
#include <mitsuba/render/kdtree.h> #include <mitsuba/render/kdtree.h>
#include <mitsuba/render/triaccel.h>
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN

View File

@ -28,7 +28,7 @@
using namespace mitsuba; using namespace mitsuba;
class SceneContext; struct SceneContext;
/** /**
* Asynchronous preview rendering thread * Asynchronous preview rendering thread

View File

@ -22,7 +22,7 @@
#include <QtGui> #include <QtGui>
#include <mitsuba/mitsuba.h> #include <mitsuba/mitsuba.h>
class SceneContext; struct SceneContext;
using namespace mitsuba; using namespace mitsuba;

View File

@ -187,7 +187,7 @@ public:
m_res.x, m_res.y, m_res.z, m_channels, nEntries*sizeof(float)/1024, m_res.x, m_res.y, m_res.z, m_channels, nEntries*sizeof(float)/1024,
m_originalAABB.toString().c_str()); m_originalAABB.toString().c_str());
stream->close(); stream->close();
m_file = CreateFile(resolved.c_str(), GENERIC_READ, m_file = CreateFile(resolved.file_string().c_str(), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);
if (m_file == INVALID_HANDLE_VALUE) if (m_file == INVALID_HANDLE_VALUE)
@ -213,9 +213,9 @@ public:
} }
/** /**
* This is needed since Mitsuba might be * This is needed since Mitsuba might be
* compiled with either single/double precision * compiled with either single/double precision
*/ */
struct float3 { struct float3 {
float value[3]; float value[3];