Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Core library

Classes

struct  mitsuba::TAABB< T >
 Generic multi-dimensional bounding box data structure. More...
 
struct  mitsuba::AABB
 Axis-aligned bounding box data structure in three dimensions. More...
 
class  mitsuba::Appender
 This class defines an abstract destination for logging-relevant information. More...
 
class  mitsuba::StreamAppender
 Appender implementation, which writes to an arbitrary C++ output stream More...
 
class  mitsuba::UnbufferedAppender
 Appender implementation, which writes directly to an UNIX-style unbuffered file descriptor. More...
 
class  mitsuba::Bitmap
 General-purpose bitmap class with read and write support for several common file formats. More...
 
class  mitsuba::FormatConverter
 Bitmap format conversion helper class. More...
 
class  mitsuba::BrentSolver
 Brent's method nonlinear zero finder. More...
 
struct  mitsuba::BSphere
 Bounding sphere data structure in three dimensions. More...
 
class  mitsuba::ChiSquare
 Chi-square goodness-of-fit test on the sphere. More...
 
class  Class
 Stores meta-information about Object instances. More...
 
class  mitsuba::ConfigurableObject
 Generic serializable object, which supports construction from a Properties instance. More...
 
class  mitsuba::ConsoleStream
 Stream-style interface to the default stdin/stdout console streams. More...
 
class  mitsuba::Formatter
 Abstract interface for converting log information into a human-readable format. More...
 
class  mitsuba::DefaultFormatter
 The default formatter used to turn log messages into a human-readable form. More...
 
struct  mitsuba::Frame
 Stores a three-dimensional orthonormal coordinate frame. More...
 
class  mitsuba::FileResolver
 File resolution helper. More...
 
class  mitsuba::FileStream
 Simple Stream implementation for accessing files. More...
 
struct  mitsuba::SimpleKDNode< _PointType, _DataRecord >
 Simple kd-tree node for use with PointKDTree. More...
 
struct  mitsuba::LeftBalancedKDNode< _PointType, _DataRecord >
 Left-balanced kd-tree node for use with PointKDTree. More...
 
class  mitsuba::PointKDTree< _NodeType >
 Generic multi-dimensional kd-tree data structure for point data. More...
 
class  mitsuba::Mutex
 Thin wrapper around the recursive boost thread lock. More...
 
class  mitsuba::WaitFlag
 Wait flag synchronization primitive. Can be used to wait for a certain event to occur. More...
 
class  mitsuba::ConditionVariable
 Condition variable synchronization primitive. Can be used to wait for a condition to become true in a safe way. More...
 
class  mitsuba::LockGuard
 Simple RAII-style locking of a Mutex. On construction it locks the mutex and unlocks it on destruction. Based on boost::lock_guard, assumes the Mutex will outlive the lock. More...
 
class  mitsuba::Logger
 Responsible for processing log messages. More...
 
struct  mitsuba::LRUCache< K, KComp, V >
 Generic LRU cache implementation. More...
 
struct  mitsuba::Matrix< M, N, T >
 Generic fixed-size dense matrix class using a row-major storage format. More...
 
struct  mitsuba::Matrix2x2
 Basic 2x2 matrix data type. More...
 
struct  mitsuba::Matrix3x3
 Basic 3x3 matrix data type. More...
 
struct  mitsuba::Matrix4x4
 Basic 4x4 matrix data type. More...
 
class  mitsuba::BasicMemoryPool< T >
 Basic memory pool for efficient allocation and deallocation of objects of the same type. More...
 
class  mitsuba::MemoryMappedFile
 Basic cross-platform abstraction for memory mapped files. More...
 
class  mitsuba::MemoryStream
 Simple memory buffer-based stream with automatic memory management. More...
 
class  mitsuba::NetworkedObject
 Abstract interface for objects that reference shared network resources. More...
 
struct  mitsuba::Normal
 Three-dimensional normal data structure. More...
 
class  Object
 Parent of all Mitsuba classes. More...
 
class  mitsuba::LockFreeList< T >
 Lock-free linked list data structure. More...
 
class  mitsuba::StaticOctree< Item, NodeData >
 Generic single-reference static octree. More...
 
class  mitsuba::DynamicOctree< Item >
 Generic multiple-reference octree with support for parallel dynamic updates. More...
 
class  mitsuba::Plugin
 Abstract plugin class – represents loadable configurable objects and utilities. More...
 
class  mitsuba::PluginManager
 The plugin manager is responsible for resolving and loading external plugins. More...
 
struct  mitsuba::DiscreteDistribution
 Discrete probability distribution. More...
 
struct  mitsuba::TPoint1< T >
 Parameterizable one-dimensional point data structure. More...
 
struct  mitsuba::TPoint2< T >
 Parameterizable two-dimensional point data structure. More...
 
struct  mitsuba::TPoint3< T >
 Parameterizable three-dimensional point data structure. More...
 
struct  mitsuba::TPoint4< T >
 Parameterizable four-dimensional point data structure. More...
 
class  mitsuba::Properties
 Associative parameter map for constructing subclasses of ConfigurableObject. More...
 
class  mitsuba::GaussLobattoIntegrator
 Computes the integral of a one-dimensional function using adaptive Gauss-Lobatto quadrature. More...
 
class  mitsuba::NDIntegrator
 Adaptively computes the integral of a multidimensional function using either a Gauss-Kronod (1D) or a Genz-Malik (>1D) cubature rule. More...
 
struct  mitsuba::TQuaternion< T >
 Parameterizable quaternion data structure. More...
 
class  mitsuba::Random
 Random number generator based on SIMD-oriented Fast Mersenne Twister More...
 
struct  mitsuba::TRay< _PointType, _VectorType >
 Simple n-dimensional ray data structure with minimum / maximum extent information. More...
 
struct  mitsuba::RayDifferential
 Ray differential – enhances the basic ray class with information about the rays of adjacent pixels on the view plane More...
 
class  ref< T >
 Reference counting helper. More...
 
class  mitsuba::WorkUnit
 Abstract work unit – represents a small amount of information that encodes part of a larger processing task. More...
 
class  mitsuba::WorkResult
 Abstract work result – represents the result of a processed WorkUnit instance. More...
 
class  mitsuba::WorkProcessor
 Abstract work processor – takes work units and turns them into WorkResult instances. More...
 
class  mitsuba::ParallelProcess
 Abstract parallelizable task. More...
 
class  mitsuba::Scheduler
 Centralized task scheduler implementation. More...
 
class  mitsuba::LocalWorker
 Acquires work from the scheduler and executes it locally. More...
 
class  mitsuba::DummyWorkUnit
 Dummy work unit without contents. More...
 
class  mitsuba::RemoteWorker
 Acquires work from the scheduler and forwards it to a processing node reachable through a Stream. More...
 
class  mitsuba::RemoteProcess
 Parallel process facade used to insert work units from a remote scheduler into the local one. More...
 
class  mitsuba::StreamBackend
 Network processing communication backend. More...
 
class  mitsuba::SerializableObject
 Base class of all reference-counted objects with serialization support. More...
 
class  mitsuba::InstanceManager
 Coordinates the serialization and unserialization of object graphs. More...
 
class  mitsuba::HilbertCurve2D< T >
 2D version of the Hilbert space-filling curve More...
 
struct  mitsuba::SHRotation
 Stores the diagonal blocks of a spherical harmonic rotation matrix. More...
 
struct  mitsuba::SHVector
 Stores a truncated real spherical harmonics representation of an L2-integrable function. More...
 
class  mitsuba::SHSampler
 Implementation of 'Importance Sampling Spherical Harmonics' by W. Jarsz, N. Carr and H. W. Jensen (EUROGRAPHICS 2009) More...
 
class  mitsuba::ContinuousSpectrum
 Abstract continous spectral power distribution data type, which supports evaluation at arbitrary wavelengths. More...
 
class  mitsuba::BlackBodySpectrum
 Spectral power distribution based on Planck's black body law. More...
 
class  mitsuba::RayleighSpectrum
 Spectral distribution for rendering participating media with Rayleigh scattering. More...
 
class  mitsuba::InterpolatedSpectrum
 Linearly interpolated spectral power distribution. More...
 
struct  mitsuba::TSpectrum< T, N >
 Abstract spectral power distribution data type. More...
 
struct  mitsuba::Color3
 RGB color data type. More...
 
struct  mitsuba::Spectrum
 Discrete spectral power distribution based on a number of wavelength bins over the 360-830 nm range. More...
 
class  mitsuba::SSHStream
 Stream implementation based on an encrypted SSH tunnel. More...
 
class  mitsuba::SocketStream
 Portable Stream implementation, which encapsulates a socket for IPv4/IPv6 network communications. More...
 
class  mitsuba::StatsCounter
 General-purpose statistics counter. More...
 
class  mitsuba::ProgressReporter
 General-purpose progress reporter. More...
 
class  mitsuba::Statistics
 Collects various rendering statistics and presents them in a human-readable form. More...
 
class  mitsuba::Stream
 Abstract seekable stream class. More...
 
class  mitsuba::Thread
 Cross-platform thread implementation. More...
 
class  mitsuba::Timer
 Platform independent milli/micro/nanosecond timerThis class implements a simple cross-platform timer with nanosecond resolution. It operates similarly to a good stop watch: it can be started and stopped and records both the time since the last start() invocation, and the total time collected in separate intervals. More...
 
class  mitsuba::ThreadLocal< ValueType >
 ! More...
 
class  mitsuba::PrimitiveThreadLocal< ValueType >
 Thin wrapper around posix thread local storage. Stores heap-allocated data other than Object instances. More...
 
struct  mitsuba::Transform
 Encapsulates a 4x4 linear transformation and its inverse. More...
 
struct  mitsuba::Triangle
 Simple triangle class including a collection of routines for analysis and transformation. More...
 
struct  SimpleStringOrdering
 Simple functor for sorting string parameters by length and content. More...
 
struct  mitsuba::TVector1< T >
 Parameterizable one-dimensional vector data structure. More...
 
struct  mitsuba::TVector2< T >
 Parameterizable two-dimensional vector data structure. More...
 
struct  mitsuba::TVector3< T >
 Parameterizable three-dimensional vector data structure. More...
 
struct  mitsuba::TVector4< T >
 Parameterizable four-dimensional vector data structure. More...
 
struct  Version
 A simple data structure for representing and comparing Mitsuba version strings. More...
 
struct  mitsuba::VonMisesFisherDistr
 Von Mises-Fisher distribution on the 2-sphere. More...
 
class  mitsuba::ZStream
 Transparent compression/decompression stream based on zlib. More...
 

Macros

#define MTS_CLASS(x)   x::m_theClass
 Return the Class object corresponding to a named class. More...
 
#define MTS_DECLARE_CLASS()
 This macro must be used in the initial definition in classes that derive from Object. More...
 
#define MTS_IMPLEMENT_CLASS(name, abstract, super)
 Creates basic RTTI support for a class. More...
 
#define MTS_IMPLEMENT_CLASS_I(name, abstract, super)
 Creates basic RTTI support for a class. To be used when the class has a simple constructor (i.e. one wich does not take any arguments) More...
 
#define MTS_IMPLEMENT_CLASS_S(name, abstract, super)
 Creates basic RTTI support for a class. To be used when the class can be unserialized from a binary data stream. More...
 
#define MTS_IMPLEMENT_CLASS_IS(name, abstract, super)
 Creates basic RTTI support for a class. To be used when the class can be unserialized from a binary data stream as well as instantiated by a constructor that does not take any arguments. More...
 
#define MTS_EXPORT_PLUGIN(name, descr)
 This macro creates the binary interface, which Mitsuba requires to load a plugin. More...
 
#define Log(level, fmt,...)
 Write a Log message to the console (to be used within subclasses of Object) More...
 
#define SLog(level, fmt,...)
 Write a Log message to the console (static version - to be used outside of classes that derive from Object) More...
 
#define Assert(cond)
 Assert that a condition is true (to be used inside of classes that derive from Object) More...
 
#define SAssert(cond)
 ``Static'' assertion (to be used outside of classes that derive from Object) More...
 
#define AssertEx(cond, explanation)
 Assertion with a customizable error explanation. More...
 
#define SAssertEx(cond, explanation)
 Static assertion with a customizable error explanation (see SLog) More...
 
#define NotImplementedError(funcName)
 Throw an exception reporting that the given function is not implemented. More...
 
#define MTS_VERSION   "0.5.0"
 Current release of Mitsuba. More...
 
#define MTS_YEAR   "2014"
 Year of the current release. More...
 

Functions

template<typename T >
bool mitsuba::atomicCompareAndExchangePtr (T **v, T *newValue, T *oldValue)
 Atomically attempt to exchange a pointer with another value. More...
 
bool mitsuba::atomicCompareAndExchange (volatile int32_t *v, int32_t newValue, int32_t oldValue)
 Atomically attempt to exchange a 32-bit integer with another value. More...
 
bool mitsuba::atomicCompareAndExchange (volatile int64_t *v, int64_t newValue, int64_t oldValue)
 Atomically attempt to exchange a 64-bit integer with another value. More...
 
float mitsuba::atomicAdd (volatile float *dst, float delta)
 Atomically add delta to the floating point destination dst. More...
 
double mitsuba::atomicAdd (volatile double *dst, double delta)
 Atomically add delta to the floating point destination dst. More...
 
int32_t mitsuba::atomicAdd (volatile int32_t *dst, int32_t delta)
 Atomically add delta to the 32-bit integer destination dst. More...
 
int64_t mitsuba::atomicAdd (volatile int64_t *dst, int64_t delta)
 Atomically add delta to the 64-bit integer destination dst. More...
 
int64_t mitsuba::atomicMaximum (volatile int64_t *dst, int64_t value)
 Atomically set dst to the maximum of itself and value. More...
 
int32_t mitsuba::atomicMaximum (volatile int32_t *dst, int32_t value)
 
bool SimpleStringOrdering::operator() (const std::string &a, const std::string &b) const
 

Functions for evaluating and sampling Catmull-Rom splines

Float mitsuba::evalCubicInterp1D (Float x, const Float *values, size_t size, Float min, Float max, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a uniformly sampled 1D function. More...
 
Float mitsuba::evalCubicInterp1DN (Float x, const Float *nodes, const Float *values, size_t size, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a nonuniformly sampled 1D function. More...
 
Float mitsuba::integrateCubicInterp1D (size_t idx, const Float *values, size_t size, Float min, Float max)
 Computes the definite integral over a segment of a uniformly sampled 1D Catmull-Rom spline interpolant. More...
 
Float mitsuba::integrateCubicInterp1DN (size_t idx, const Float *nodes, const Float *values, size_t size)
 Computes the definite integral over a segment of a nonuniformly sampled 1D Catmull-Rom spline interpolant. More...
 
Float mitsuba::sampleCubicInterp1D (size_t idx, const Float *values, size_t size, Float min, Float max, Float sample, Float *fval=NULL)
 Importance sample a segment of a uniformly sampled 1D Catmull-Rom spline interpolant. More...
 
Float mitsuba::sampleCubicInterp1DN (size_t idx, const Float *nodes, const Float *values, size_t size, Float sample, Float *fval=NULL)
 Importance sample a segment of a nonuniformly sampled 1D Catmull-Rom spline interpolant. More...
 
Float mitsuba::evalCubicInterp2D (const Point2 &p, const Float *values, const Size2 &size, const Point2 &min, const Point2 &max, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a uniformly sampled 2D function. More...
 
Float mitsuba::evalCubicInterp2DN (const Point2 &p, const Float **nodes, const Float *values, const Size2 &size, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a nonuniformly sampled 2D function. More...
 
Float mitsuba::evalCubicInterp3D (const Point3 &p, const Float *values, const Size3 &size, const Point3 &min, const Point3 &max, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a uniformly sampled 3D function. More...
 
Float mitsuba::evalCubicInterp3DN (const Point3 &p, const Float **nodes, const Float *values, const Size3 &size, bool extrapolate=false)
 Evaluate a cubic spline interpolant of a nonuniformly sampled 3D function. More...
 

String-related utility functions

MTS_EXPORT_CORE std::vector
< std::string > 
tokenize (const std::string &string, const std::string &delim)
 Given a list of delimiters, tokenize a std::string into a vector of strings. More...
 
MTS_EXPORT_CORE std::string trim (const std::string &str)
 Trim spaces (' ', '\n', '\r', '\t') from the ends of a string. More...
 
MTS_EXPORT_CORE std::string indent (const std::string &string, int amount=1)
 Indent a string (Used for recursive toString() structure dumping) More...
 
MTS_EXPORT_CORE std::string formatString (const char *pFmt,...)
 Wrapped snprintf. More...
 
MTS_EXPORT_CORE std::string timeString (Float time, bool precise=false)
 Convert a time difference (in seconds) to a string representation. More...
 
MTS_EXPORT_CORE std::string memString (size_t size, bool precise=false)
 Turn a memory size into a human-readable string. More...
 
template<class Iterator >
std::string containerToString (const Iterator &start, const Iterator &end)
 Return a string representation of a list of objects. More...
 

Miscellaneous

MTS_EXPORT_CORE void *__restrict allocAligned (size_t size)
 Allocate an aligned region of memory. More...
 
MTS_EXPORT_CORE void freeAligned (void *ptr)
 Free an aligned region of memory. More...
 
MTS_EXPORT_CORE int getCoreCount ()
 Determine the number of available CPU cores. More...
 
MTS_EXPORT_CORE std::string getHostName ()
 Return the host name of this machine. More...
 
MTS_EXPORT_CORE size_t getPrivateMemoryUsage ()
 Return the process private memory usage in bytes. More...
 
MTS_EXPORT_CORE size_t getTotalSystemMemory ()
 Returns the total amount of memory available to the OS. More...
 
MTS_EXPORT_CORE std::string getFQDN ()
 Return the fully qualified domain name of this machine. More...
 
MTS_EXPORT_CORE bool enableFPExceptions ()
 Enable floating point exceptions (to catch NaNs, overflows, arithmetic with infinity). More...
 
MTS_EXPORT_CORE bool disableFPExceptions ()
 Disable floating point exceptions. More...
 
MTS_EXPORT_CORE void restoreFPExceptions (bool state)
 Restore floating point exceptions to the specified state. More...
 
template<typename T , typename U >
union_cast (const U &val)
 Cast between types that have an identical binary representation. More...
 
template<typename T >
endianness_swap (T value)
 Swaps the byte order of the underlying representation. More...
 
template<typename DataType , typename IndexType >
void permute_inplace (DataType *data, std::vector< IndexType > &perm)
 Apply an arbitrary permutation to an array in linear time. More...
 

Numerical utility functions

MTS_EXPORT_CORE bool solveQuadratic (Float a, Float b, Float c, Float &x0, Float &x1)
 Solve a quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
MTS_EXPORT_CORE bool solveQuadraticDouble (double a, double b, double c, double &x0, double &x1)
 Solve a double-precision quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
Float radToDeg (Float value)
 Solve a quadratic equation of the form a*x^2 + b*x + c = 0. More...
 
Float degToRad (Float value)
 Convert degrees to radians. More...
 
template<typename VectorType >
Float unitAngle (const VectorType &u, const VectorType &v)
 Numerically well-behaved routine for computing the angle between two unit direction vectors. More...
 

Warping and sampling-related utility functions

MTS_EXPORT_CORE bool solveLinearSystem2x2 (const Float a[2][2], const Float b[2], Float x[2])
 Solve a 2x2 linear equation system using basic linear algebra. More...
 
MTS_EXPORT_CORE void computeShadingFrame (const Vector &n, const Vector &dpdu, Frame &frame)
 Given a smoothly varying shading normal and a tangent of a shape parameterization, compute a smoothly varying orthonormal frame. More...
 
MTS_EXPORT_CORE void computeShadingFrameDerivative (const Vector &n, const Vector &dpdu, const Vector &dndu, const Vector &dndv, Frame &du, Frame &dv)
 Compute the spatial derivative of computeShadingFrame. More...
 
MTS_EXPORT_CORE void stratifiedSample1D (Random *random, Float *dest, int count, bool jitter)
 Generate (optionally jittered) stratified 1D samples. More...
 
MTS_EXPORT_CORE void stratifiedSample2D (Random *random, Point2 *dest, int countX, int countY, bool jitter)
 Generate (optionally jittered) stratified 2D samples. More...
 
MTS_EXPORT_CORE void latinHypercube (Random *random, Float *dest, size_t nSamples, size_t nDim)
 Generate latin hypercube samples. More...
 
MTS_EXPORT_CORE Vector sphericalDirection (Float theta, Float phi)
 Convert spherical coordinates to a direction. More...
 
MTS_EXPORT_CORE Point2 toSphericalCoordinates (const Vector &v)
 Convert a direction to spherical coordinates. More...
 
MTS_EXPORT_CORE void coordinateSystem (const Vector &a, Vector &b, Vector &c)
 Complete the set {a} to an orthonormal base. More...
 

Fresnel reflectance computation and related things

Float fresnelDielectricExt (Float cosThetaI, Float eta)
 Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics (extended version) More...
 
MTS_EXPORT_CORE Vector refract (const Vector &wi, const Normal &n, Float eta)
 Specularly refract the direction wi into a planar dielectric with the given surface normal and index of refraction. More...
 

Detailed Description

This library contains the core support API of Mitsuba

The following implementations are based on PBRT

Macro Definition Documentation

#define Assert (   cond)
Value:
do { \
if (!(cond)) Log(EError, "Assertion \"%s\" failed in %s:%i", \
#cond, __FILE__, __LINE__); \
} while (0)
#define Log(level, fmt,...)
Write a Log message to the console (to be used within subclasses of Object)
Definition: logger.h:35
Error message, causes an exception to be thrown.
Definition: formatter.h:33

Assert that a condition is true (to be used inside of classes that derive from Object)

#define AssertEx (   cond,
  explanation 
)
Value:
do { \
if (!(cond)) Log(EError, "Assertion \"%s\" failed in %s:%i (" explanation ")", \
#cond, __FILE__, __LINE__); \
} while (0)
#define Log(level, fmt,...)
Write a Log message to the console (to be used within subclasses of Object)
Definition: logger.h:35
Error message, causes an exception to be thrown.
Definition: formatter.h:33

Assertion with a customizable error explanation.

#define Log (   level,
  fmt,
  ... 
)
Value:
do { \
mitsuba::Thread *thread = mitsuba::Thread::getThread(); \
if (EXPECT_NOT_TAKEN(thread == NULL)) \
throw std::runtime_error("Null thread pointer"); \
mitsuba::Logger *logger = thread->getLogger(); \
if (logger != NULL && level >= logger->getLogLevel()) \
logger->log(level, m_theClass, \
__FILE__, __LINE__, fmt, ## __VA_ARGS__); \
} while (0)
static Thread * getThread()
Return the current thread.

Write a Log message to the console (to be used within subclasses of Object)

#define MTS_CLASS (   x)    x::m_theClass

Return the Class object corresponding to a named class.

Call the Macro without quotes, e.g. MTS_CLASS(SerializableObject)

#define MTS_DECLARE_CLASS ( )
Value:
virtual const Class *getClass() const; \
public: \
static Class *m_theClass;
Stores meta-information about Object instances.
Definition: class.h:43

This macro must be used in the initial definition in classes that derive from Object.

This is needed for the basic RTTI support provided by Mitsuba objects. For instance, a class definition might look like the following:

class MyObject : public Object {
public:
MyObject();
/// Important: declare RTTI data structures
protected:
/// Important: needs to declare a protected virtual destructor
virtual ~MyObject();
};
#define MTS_EXPORT_PLUGIN (   name,
  descr 
)
Value:
extern "C" { \
void MTS_EXPORT *CreateInstance(const Properties &props) { \
return new name(props); \
} \
const char MTS_EXPORT *GetDescription() { \
return descr; \
} \
}
#define MTS_EXPORT
Definition: platform.h:86

This macro creates the binary interface, which Mitsuba requires to load a plugin.

#define MTS_IMPLEMENT_CLASS (   name,
  abstract,
  super 
)
Value:
Class *name::m_theClass = new Class(#name, abstract, #super); \
const Class *name::getClass() const { \
return m_theClass;\
}
Stores meta-information about Object instances.
Definition: class.h:43

Creates basic RTTI support for a class.

This macro or one of its variants should be invoked in the main implementation .cpp file of any class that derives from Object. This is needed for the basic RTTI support provided by Mitsuba objects. For instance, the corresponding piece for the example shown in the documentation of MTS_DECLARE_CLASS might look like this:

MTS_IMPLEMENT_CLASS(MyObject, false, Object)
Parameters
nameName of the class
abstracttrue if the class contains pure virtual methods
superName of the parent class
#define MTS_IMPLEMENT_CLASS_I (   name,
  abstract,
  super 
)
Value:
Object *__##name ##_inst() { \
return new name(); \
} \
Class *name::m_theClass = new Class(#name, abstract, #super, (void *) &__##name ##_inst, NULL); \
const Class *name::getClass() const { \
return m_theClass;\
}
Stores meta-information about Object instances.
Definition: class.h:43
Parent of all Mitsuba classes.
Definition: object.h:38

Creates basic RTTI support for a class. To be used when the class has a simple constructor (i.e. one wich does not take any arguments)

This macro or one of its variants should be invoked in the main implementation .cpp file of any class that derives from Object. This is needed for the basic RTTI support provided by Mitsuba objects.

Parameters
nameName of the class
abstracttrue if the class contains pure virtual methods
superName of the parent class
#define MTS_IMPLEMENT_CLASS_IS (   name,
  abstract,
  super 
)
Value:
Object *__##name ##_unSer(Stream *stream, InstanceManager *manager) { \
return new name(stream, manager); \
} \
Object *__##name ##_inst() { \
return new name(); \
} \
Class *name::m_theClass = new Class(#name, abstract, #super, (void *) &__##name ##_inst, (void *) &__##name ##_unSer); \
const Class *name::getClass() const { \
return m_theClass;\
}
Stores meta-information about Object instances.
Definition: class.h:43
Parent of all Mitsuba classes.
Definition: object.h:38

Creates basic RTTI support for a class. To be used when the class can be unserialized from a binary data stream as well as instantiated by a constructor that does not take any arguments.

This macro or one of its variants should be invoked in the main implementation .cpp file of any class that derives from Object. This is needed for the basic RTTI support provided by Mitsuba objects.

Parameters
nameName of the class
abstracttrue if the class contains pure virtual methods
superName of the parent class
#define MTS_IMPLEMENT_CLASS_S (   name,
  abstract,
  super 
)
Value:
Object *__##name ##_unSer(Stream *stream, InstanceManager *manager) { \
return new name(stream, manager); \
} \
Class *name::m_theClass = new Class(#name, abstract, #super, NULL, (void *) &__##name ##_unSer); \
const Class *name::getClass() const { \
return m_theClass;\
}
Stores meta-information about Object instances.
Definition: class.h:43
Parent of all Mitsuba classes.
Definition: object.h:38

Creates basic RTTI support for a class. To be used when the class can be unserialized from a binary data stream.

This macro or one of its variants should be invoked in the main implementation .cpp file of any class that derives from Object. This is needed for the basic RTTI support provided by Mitsuba objects.

Parameters
nameName of the class
abstracttrue if the class contains pure virtual methods
superName of the parent class
#define MTS_VERSION   "0.5.0"

Current release of Mitsuba.

#define MTS_YEAR   "2014"

Year of the current release.

#define NotImplementedError (   funcName)
Value:
throw std::runtime_error(formatString("%s::" funcName "(): Not implemented!", \
getClass()->getName().c_str()));
MTS_EXPORT_CORE std::string formatString(const char *pFmt,...)
Wrapped snprintf.

Throw an exception reporting that the given function is not implemented.

#define SAssert (   cond)
Value:
do { \
if (!(cond)) SLog(EError, "Assertion \"%s\" failed in %s:%i", \
#cond, __FILE__, __LINE__); \
} while (0)
#define SLog(level, fmt,...)
Write a Log message to the console (static version - to be used outside of classes that derive from O...
Definition: logger.h:49
Error message, causes an exception to be thrown.
Definition: formatter.h:33

``Static'' assertion (to be used outside of classes that derive from Object)

#define SAssertEx (   cond,
  explanation 
)
Value:
do { \
if (!(cond)) SLog(EError, "Assertion \"%s\" failed in %s:%i (" explanation ")", \
#cond, __FILE__, __LINE__); \
} while (0)
#define SLog(level, fmt,...)
Write a Log message to the console (static version - to be used outside of classes that derive from O...
Definition: logger.h:49
Error message, causes an exception to be thrown.
Definition: formatter.h:33

Static assertion with a customizable error explanation (see SLog)

#define SLog (   level,
  fmt,
  ... 
)
Value:
do { \
mitsuba::Thread *thread = mitsuba::Thread::getThread(); \
if (EXPECT_NOT_TAKEN(thread == NULL)) \
throw std::runtime_error("Null thread pointer"); \
mitsuba::Logger *logger = thread->getLogger(); \
if (logger != NULL && level >= logger->getLogLevel()) \
logger->log(level, NULL, \
__FILE__, __LINE__, fmt, ## __VA_ARGS__); \
} while (0)
static Thread * getThread()
Return the current thread.

Write a Log message to the console (static version - to be used outside of classes that derive from Object)

Function Documentation

MTS_EXPORT_CORE void* __restrict allocAligned ( size_t  size)

Allocate an aligned region of memory.

float mitsuba::atomicAdd ( volatile float *  dst,
float  delta 
)
inline

Atomically add delta to the floating point destination dst.

Returns
The final value written to dst
double mitsuba::atomicAdd ( volatile double *  dst,
double  delta 
)
inline

Atomically add delta to the floating point destination dst.

Returns
The final value written to dst
int32_t mitsuba::atomicAdd ( volatile int32_t *  dst,
int32_t  delta 
)
inline

Atomically add delta to the 32-bit integer destination dst.

Returns
The final value written to dst
int64_t mitsuba::atomicAdd ( volatile int64_t *  dst,
int64_t  delta 
)
inline

Atomically add delta to the 64-bit integer destination dst.

Returns
The final value written to dst
bool mitsuba::atomicCompareAndExchange ( volatile int32_t *  v,
int32_t  newValue,
int32_t  oldValue 
)
inline

Atomically attempt to exchange a 32-bit integer with another value.

Parameters
vPointer to the memory region in question
oldValueLast known value of the destination v
newValueReplacement value for the destination v
Returns
true if *v was equal to oldValue and the exchange was successful.
bool mitsuba::atomicCompareAndExchange ( volatile int64_t *  v,
int64_t  newValue,
int64_t  oldValue 
)
inline

Atomically attempt to exchange a 64-bit integer with another value.

Parameters
vPointer to the memory region in question
oldValueLast known value of the destination v
newValueReplacement value for the destination v
Returns
true if *v was equal to oldValue and the exchange was successful.
template<typename T >
bool mitsuba::atomicCompareAndExchangePtr ( T **  v,
T *  newValue,
T *  oldValue 
)
inline

Atomically attempt to exchange a pointer with another value.

Parameters
vPointer to the pointer in question
oldValueLast known value of the destination v
newValueReplacement value for the destination v
Template Parameters
TBase type of the pointer
Returns
true if *v was equal to oldValue and the exchange was successful.
int64_t mitsuba::atomicMaximum ( volatile int64_t *  dst,
int64_t  value 
)
inline

Atomically set dst to the maximum of itself and value.

Returns
The maximum value now stored in dst
int32_t mitsuba::atomicMaximum ( volatile int32_t *  dst,
int32_t  value 
)
inline
MTS_EXPORT_CORE void computeShadingFrame ( const Vector n,
const Vector dpdu,
Frame &  frame 
)

Given a smoothly varying shading normal and a tangent of a shape parameterization, compute a smoothly varying orthonormal frame.

Parameters
nA shading normal at a surface position
dpduPosition derivative of the underlying parameterization with respect to the 'u' coordinate
frameUsed to return the computed frame

Mitsuba uses this function to compute the field Intersection::shFrame

MTS_EXPORT_CORE void computeShadingFrameDerivative ( const Vector n,
const Vector dpdu,
const Vector dndu,
const Vector dndv,
Frame &  du,
Frame &  dv 
)

Compute the spatial derivative of computeShadingFrame.

This is used by Manifold Exploration and Half Vector Light Transport

Parameters
nA shading normal at a surface position
dpduPosition derivative of the underlying parameterization with respect to the 'u' coordinate
dnduDerivative of the shading normal along the 'u' coordinate
dndvDerivative of the shading normal along the 'v' coordinate
duUsed to return the 'u' derivative of the frame
dvUsed to return the 'v' derivative of the frame
template<class Iterator >
std::string containerToString ( const Iterator &  start,
const Iterator &  end 
)

Return a string representation of a list of objects.

MTS_EXPORT_CORE void coordinateSystem ( const Vector a,
Vector b,
Vector c 
)

Complete the set {a} to an orthonormal base.

Remarks
In Python, this function is used as follows: s, t = coordinateSystem(n)
Float degToRad ( Float  value)
inline

Convert degrees to radians.

MTS_EXPORT_CORE bool disableFPExceptions ( )

Disable floating point exceptions.

Returns
true if floating point exceptions were active before calling the function
MTS_EXPORT_CORE bool enableFPExceptions ( )

Enable floating point exceptions (to catch NaNs, overflows, arithmetic with infinity).

On Intel processors, this applies to both x87 and SSE2 math

Returns
true if floating point exceptions were active before calling the function
template<typename T >
T endianness_swap ( value)
inline

Swaps the byte order of the underlying representation.

Float mitsuba::evalCubicInterp1D ( Float  x,
const Float values,
size_t  size,
Float  min,
Float  max,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a uniformly sampled 1D function.

This implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment.

Parameters
xEvaluation point
valuesFloating point array containing size regularly spaced evaluations in the range [min,max] of the function to be approximated.
sizeDenotes the size of the values array
minPosition of the first knot
maxPosition of the last knot
extrapolateExtrapolate values when x is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and x lies outside of [min, max]
Float mitsuba::evalCubicInterp1DN ( Float  x,
const Float nodes,
const Float values,
size_t  size,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a nonuniformly sampled 1D function.

This implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment.

Parameters
xEvaluation point
nodesFloating point array containing size nonuniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.
valuesFloating point array containing function evaluations matched to the entries of nodes.
sizeDenotes the size of the values array
extrapolateExtrapolate values when x is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and x lies outside of [min, max]
Float mitsuba::evalCubicInterp2D ( const Point2 p,
const Float values,
const Size2 size,
const Point2 min,
const Point2 max,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a uniformly sampled 2D function.

This implementation relies on a tensor product of Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline patch.

Parameters
pEvaluation point
valuesA 2D floating point array of size.x*size.y cells containing regularly spaced evaluations of the function to be interpolated on the domain [min, max]. Consecutive entries of this array correspond to increments in the 'x' coordinate.
sizeDenotes the size of the values array (along each dimension)
minPosition of the first knot on each dimension
maxPosition of the last knot on each dimension
extrapolateExtrapolate values when p is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and p lies outside of the knot range
Float mitsuba::evalCubicInterp2DN ( const Point2 p,
const Float **  nodes,
const Float values,
const Size2 size,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a nonuniformly sampled 2D function.

This implementation relies on a tensor product of Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline region.

When the underlying function is sampled on a regular grid, evalCubicInterp2D() should be preferred, since value lookups will be considerably faster.

Parameters
pEvaluation point
nodesPointer to a list for each dimension denoting the positions where the function to be interpolated was evaluated. The i-th array must have size size[i] and contain position values in increasing order.
valuesA 2D floating point array of size.x*size.y cells containing nonuniformly spaced evaluations of the function to be interpolated on the domain [min, max]. Consecutive entries of this array correspond to increments in the 'x' coordinate.
sizeDenotes the size of the values array (along each dimension)
extrapolateExtrapolate values when p is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and p lies outside of the knot range
Float mitsuba::evalCubicInterp3D ( const Point3 p,
const Float values,
const Size3 size,
const Point3 min,
const Point3 max,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a uniformly sampled 3D function.

This implementation relies on a tensor product of Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline region.

Parameters
pEvaluation point of the interpolant
valuesA 3D floating point array of size.x*size.y*size.z cells containing regularly spaced evaluations of the function to be interpolated on the domain [min, max]. Consecutive entries of this array correspond to increments in the 'x' coordinate, then 'y', and finally 'z' increments.
sizeDenotes the size of the values array (along each dimension)
minPosition of the first knot on each dimension
maxPosition of the last knot on each dimension
extrapolateExtrapolate values when p is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and p lies outside of the knot range
Float mitsuba::evalCubicInterp3DN ( const Point3 p,
const Float **  nodes,
const Float values,
const Size3 size,
bool  extrapolate = false 
)

Evaluate a cubic spline interpolant of a nonuniformly sampled 3D function.

This implementation relies on a tensor product of Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline region.

When the underlying function is sampled on a regular grid, evalCubicInterp3D() should be preferred, since value lookups will be considerably faster.

Parameters
pEvaluation point
nodesPointer to a list for each dimension denoting the positions where the function to be interpolated was evaluated. The i-th array must have size size[i] and contain position values in increasing order.
valuesA 2D floating point array of size.x*size.y cells containing nonuniformly spaced evaluations of the function to be interpolated on the domain [min, max]. Consecutive entries of this array correspond to increments in the 'x' coordinate, then 'y', and finally 'z' increments.
sizeDenotes the size of the values array (along each dimension)
extrapolateExtrapolate values when p is out of range? (default: false)
Returns
The interpolated value or zero when extrapolate=falsett> and p lies outside of the knot range
MTS_EXPORT_CORE std::string formatString ( const char *  pFmt,
  ... 
)

Wrapped snprintf.

MTS_EXPORT_CORE void freeAligned ( void *  ptr)

Free an aligned region of memory.

Float fresnelDielectricExt ( Float  cosThetaI,
Float  eta 
)
inline

Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics (extended version)

This is just a convenience wrapper function around the other fresnelDielectricExt function, which does not return the transmitted direction cosine in case it is not needed by the application.

Parameters
cosThetaICosine of the angle between the normal and the incident ray
etaRelative refractive index
MTS_EXPORT_CORE int getCoreCount ( )

Determine the number of available CPU cores.

MTS_EXPORT_CORE std::string getFQDN ( )

Return the fully qualified domain name of this machine.

MTS_EXPORT_CORE std::string getHostName ( )

Return the host name of this machine.

MTS_EXPORT_CORE size_t getPrivateMemoryUsage ( )

Return the process private memory usage in bytes.

MTS_EXPORT_CORE size_t getTotalSystemMemory ( )

Returns the total amount of memory available to the OS.

MTS_EXPORT_CORE std::string indent ( const std::string &  string,
int  amount = 1 
)

Indent a string (Used for recursive toString() structure dumping)

Float mitsuba::integrateCubicInterp1D ( size_t  idx,
const Float values,
size_t  size,
Float  min,
Float  max 
)

Computes the definite integral over a segment of a uniformly sampled 1D Catmull-Rom spline interpolant.

This is useful for sampling spline segments as part of an importance sampling scheme (in conjunction with sampleCubicInterp1D)

Parameters
idxDenotes the desires spline segment (must be between 0 and size-2)
valuesFloating point array containing size regularly spaced evaluations in the range [min,max] of the function to be approximated.
sizeDenotes the size of the values array
minPosition of the first knot
maxPosition of the last knot
Returns
The definite integral over the specified segment
Float mitsuba::integrateCubicInterp1DN ( size_t  idx,
const Float nodes,
const Float values,
size_t  size 
)

Computes the definite integral over a segment of a nonuniformly sampled 1D Catmull-Rom spline interpolant.

This is useful for sampling spline segments as part of an importance sampling scheme (in conjunction with sampleCubicInterp1D)

Parameters
idxDenotes the desires spline segment (must be between 0 and size-2)
nodesFloating point array containing size nonuniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.
valuesFloating point array containing function evaluations matched to the entries of nodes.
sizeDenotes the size of the values array
Returns
The definite integral over the specified segment
MTS_EXPORT_CORE void latinHypercube ( Random *  random,
Float dest,
size_t  nSamples,
size_t  nDim 
)

Generate latin hypercube samples.

MTS_EXPORT_CORE std::string memString ( size_t  size,
bool  precise = false 
)

Turn a memory size into a human-readable string.

bool SimpleStringOrdering::operator() ( const std::string &  a,
const std::string &  b 
) const
inline
template<typename DataType , typename IndexType >
void permute_inplace ( DataType *  data,
std::vector< IndexType > &  perm 
)

Apply an arbitrary permutation to an array in linear time.

This algorithm is based on Donald Knuth's book "The Art of Computer Programming, Volume 3: Sorting and Searching" (1st edition, section 5.2, page 595)

Given a permutation and an array of values, it applies the permutation in linear time without requiring additional memory. This is based on the fact that each permutation can be decomposed into a disjoint set of permutations, which can then be applied individually.

Parameters
dataPointer to the data that should be permuted
permInput permutation vector having the same size as data. After the function terminates, this vector will be set to the identity permutation.
Float radToDeg ( Float  value)
inline

Solve a quadratic equation of the form a*x^2 + b*x + c = 0.

Returns
true if a solution could be found
MTS_EXPORT_CORE Vector refract ( const Vector wi,
const Normal &  n,
Float  eta 
)

Specularly refract the direction wi into a planar dielectric with the given surface normal and index of refraction.

This function is a simple convenience function that only returns the refracted direction while not computing the Frensel reflectance.

Parameters
wiIncident direction
nSurface normal
etaRelative index of refraction at the interface
Returns
Specularly transmitted direction (or zero in the case of total internal reflection)
MTS_EXPORT_CORE void restoreFPExceptions ( bool  state)

Restore floating point exceptions to the specified state.

Float mitsuba::sampleCubicInterp1D ( size_t  idx,
const Float values,
size_t  size,
Float  min,
Float  max,
Float  sample,
Float fval = NULL 
)

Importance sample a segment of a uniformly sampled 1D Catmull-Rom spline interpolant.

Parameters
idxDenotes the desires spline segment (must be between 0 and size-2)
valuesFloating point array containing size regularly spaced evaluations in the range [min,max] of the function to be approximated.
sizeDenotes the size of the values array
minPosition of the first knot
maxPosition of the last knot
sampleA uniformly distributed random sample in the interval [0,1]
fvalIf set to a non-NULL pointer, this argument will be used to return the value of the spline at the sampled position
Returns
The sampled position
Float mitsuba::sampleCubicInterp1DN ( size_t  idx,
const Float nodes,
const Float values,
size_t  size,
Float  sample,
Float fval = NULL 
)

Importance sample a segment of a nonuniformly sampled 1D Catmull-Rom spline interpolant.

Parameters
idxDenotes the desires spline segment (must be between 0 and size-2)
nodesFloating point array containing size nonuniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.
valuesFloating point array containing function evaluations matched to the entries of nodes.
sizeDenotes the size of the values array
sampleA uniformly distributed random sample in the interval [0,1]
fvalIf set to a non-NULL pointer, this argument will be used to return the value of the spline at the sampled position
Returns
The sampled position
MTS_EXPORT_CORE bool solveLinearSystem2x2 ( const Float  a[2][2],
const Float  b[2],
Float  x[2] 
)

Solve a 2x2 linear equation system using basic linear algebra.

MTS_EXPORT_CORE bool solveQuadratic ( Float  a,
Float  b,
Float  c,
Float x0,
Float x1 
)

Solve a quadratic equation of the form a*x^2 + b*x + c = 0.

Returns
true if a solution could be found
MTS_EXPORT_CORE bool solveQuadraticDouble ( double  a,
double  b,
double  c,
double &  x0,
double &  x1 
)

Solve a double-precision quadratic equation of the form a*x^2 + b*x + c = 0.

Returns
true if a solution could be found
MTS_EXPORT_CORE Vector sphericalDirection ( Float  theta,
Float  phi 
)

Convert spherical coordinates to a direction.

MTS_EXPORT_CORE void stratifiedSample1D ( Random *  random,
Float dest,
int  count,
bool  jitter 
)

Generate (optionally jittered) stratified 1D samples.

Parameters
randomSource of random numbers
destA pointer to a floating point array with at least count entries
countThe interval [0, 1] is split into count strata
jitterRandomly jitter the samples?
MTS_EXPORT_CORE void stratifiedSample2D ( Random *  random,
Point2 dest,
int  countX,
int  countY,
bool  jitter 
)

Generate (optionally jittered) stratified 2D samples.

Parameters
randomSource of random numbers
destA pointer to a floating point array
countXThe X axis interval [0, 1] is split into countX strata
countYThe Y axis interval [0, 1] is split into countY strata
jitterRandomly jitter the samples?
MTS_EXPORT_CORE std::string timeString ( Float  time,
bool  precise = false 
)

Convert a time difference (in seconds) to a string representation.

Parameters
timeTime difference in (fractional) sections
preciseWhen set to true, a higher-precision string representation is generated.
MTS_EXPORT_CORE std::vector<std::string> tokenize ( const std::string &  string,
const std::string &  delim 
)

Given a list of delimiters, tokenize a std::string into a vector of strings.

MTS_EXPORT_CORE Point2 toSphericalCoordinates ( const Vector v)

Convert a direction to spherical coordinates.

MTS_EXPORT_CORE std::string trim ( const std::string &  str)

Trim spaces (' ', '\n', '\r', '\t') from the ends of a string.

template<typename T , typename U >
T union_cast ( const U &  val)
inline

Cast between types that have an identical binary representation.

template<typename VectorType >
Float unitAngle ( const VectorType &  u,
const VectorType &  v 
)
inline

Numerically well-behaved routine for computing the angle between two unit direction vectors.

This should be used wherever one is tempted to compute the arc cosine of a dot product!

Proposed by Don Hatch at http://www.plunk.org/~hatch/rightway.php