merge
commit
75462c11d2
|
@ -31,7 +31,7 @@ PROJECT_NAME = Mitsuba
|
|||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.1.3
|
||||
PROJECT_NUMBER = 0.2.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/**
|
||||
\defgroup libcore Core library
|
||||
This module contains the core support API of Mitsuba
|
||||
*/
|
||||
/**
|
||||
\defgroup librender Render library
|
||||
This module contains the rendering-related API of Mitsuba
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\mainpage Mitsuba Renderer API Documentation
|
||||
|
||||
|
@ -9,19 +19,16 @@
|
|||
|
||||
<div class="featuretitle">Basic Information</div>
|
||||
- <a href="http://www.mitsuba-renderer.org/documentation.pdf">Reference Manual (PDF)</a>
|
||||
</div>
|
||||
|
||||
<div class="featuretitle">API Documentation</div>
|
||||
- <a href="annotated.html">Annotated Class List</a>
|
||||
- <a href="classes.html">Alphabetical Class List</a>
|
||||
- <a href="hierarchy.html">Class Hierarchy</a>
|
||||
</div>
|
||||
|
||||
<div class="featuretitle">Community</div>
|
||||
- <a href="http://www.mitsuba-renderer.org/devblog">Development Blog</a>
|
||||
- <a href="https://www.mitsuba-renderer.org/bugtracker/projects/mitsuba">Bug Tracker</a>
|
||||
- <a href="https://www.mitsuba-renderer.org/hg">List of repositories</a>
|
||||
</div>
|
||||
|
||||
</td></tr></table>
|
||||
</center>
|
||||
|
|
|
@ -30,7 +30,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* Maintains a component-wise minimum and maximum position and provides
|
||||
* various convenience functions to query or change them.
|
||||
*
|
||||
* \tparam T Underlying point data type (e.g. \ref TPoint3<float>)
|
||||
* \tparam T Underlying point data type (e.g. \c TPoint3<float>)
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TAABB {
|
||||
typedef T point_type;
|
||||
|
@ -292,6 +293,8 @@ template <typename T> struct TAABB {
|
|||
*
|
||||
* Maintains a component-wise minimum and maximum position and provides
|
||||
* various convenience functions to query or change them.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE AABB : public TAABB<Point> {
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,8 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/** \brief This class defines an abstract destination
|
||||
* for logging-relevant information
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Appender : public Object {
|
||||
public:
|
||||
|
@ -48,8 +50,10 @@ protected:
|
|||
virtual ~Appender() { }
|
||||
};
|
||||
|
||||
/** \brief Appender implementation, which writes to an
|
||||
* arbitrary C++ stream
|
||||
/** \brief %Appender implementation, which writes to an
|
||||
* arbitrary C++ output stream
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE StreamAppender : public Appender {
|
||||
public:
|
||||
|
@ -84,8 +88,10 @@ private:
|
|||
bool m_lastMessageWasProgress;
|
||||
};
|
||||
|
||||
/** \brief Appender implementation, which writes to an
|
||||
* unbuffered file descriptor.
|
||||
/** \brief %Appender implementation, which writes directly
|
||||
* to an UNIX-style unbuffered file descriptor.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE UnbufferedAppender : public Appender {
|
||||
public:
|
||||
|
|
|
@ -31,8 +31,24 @@ MTS_NAMESPACE_BEGIN
|
|||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
/* The following implementations are based on PBRT */
|
||||
/**
|
||||
* The following implementations are based on PBRT
|
||||
*
|
||||
* \addtogroup libcore
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* \brief Atomically attempt to exchange a pointer with another value
|
||||
*
|
||||
* \param v Pointer to the pointer in question
|
||||
* \param oldValue Last known value of the destination \a v
|
||||
* \param newValue Replacement value for the destination \a v
|
||||
* \tparam T Base type of the pointer
|
||||
* \return \c true if \c *v was equal to \c oldValue and the exchange
|
||||
* was successful.
|
||||
*/
|
||||
template <typename T> inline bool atomicCompareAndExchangePtr(T **v, T *newValue, T *oldValue) {
|
||||
#if defined(WIN32)
|
||||
return InterlockedCompareExchangePointer(
|
||||
|
@ -54,6 +70,16 @@ template <typename T> inline bool atomicCompareAndExchangePtr(T **v, T *newValue
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Atomically attempt to exchange a 32-bit integer with another value
|
||||
*
|
||||
* \param v Pointer to the memory region in question
|
||||
* \param oldValue Last known value of the destination \a v
|
||||
* \param newValue Replacement value for the destination \a v
|
||||
* \return \c true if \c *v was equal to \c oldValue and the exchange
|
||||
* was successful.
|
||||
*/
|
||||
|
||||
inline bool atomicCompareAndExchange(volatile int32_t *v, int32_t newValue, int32_t oldValue) {
|
||||
#if defined(WIN32)
|
||||
return InterlockedCompareExchange(
|
||||
|
@ -63,6 +89,16 @@ inline bool atomicCompareAndExchange(volatile int32_t *v, int32_t newValue, int3
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Atomically attempt to exchange a 64-bit integer with another value
|
||||
*
|
||||
* \param v Pointer to the memory region in question
|
||||
* \param oldValue Last known value of the destination \a v
|
||||
* \param newValue Replacement value for the destination \a v
|
||||
* \return \c true if \c *v was equal to \c oldValue and the exchange
|
||||
* was successful.
|
||||
*/
|
||||
|
||||
inline bool atomicCompareAndExchange(volatile int64_t *v, int64_t newValue, int64_t oldValue) {
|
||||
#if defined(WIN32)
|
||||
return _InterlockedCompareExchange64(
|
||||
|
@ -145,6 +181,8 @@ inline int64_t atomicAdd(volatile int64_t *dst, int64_t delta) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/*! }@ */
|
||||
|
||||
MTS_NAMESPACE_END
|
||||
|
||||
#endif /* __ATOMIC_H */
|
||||
|
|
|
@ -29,6 +29,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* the implementation switches to HDR and the EXR file format.
|
||||
*
|
||||
* This class can efficiently handle 1-bit masks
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Bitmap : public Object {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* The implementation is transcribed from the Apache Commons
|
||||
* Java implementation. The function \a Func is required to be
|
||||
* continuous, but not necessarily smooth.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T, typename Func> class BrentSolver {
|
||||
public:
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Bounding sphere data structure in three dimensions
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct BSphere {
|
||||
Point center;
|
||||
|
|
|
@ -36,6 +36,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* </ul>
|
||||
*
|
||||
* \sa ref, Object
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Class {
|
||||
public:
|
||||
|
@ -115,6 +116,10 @@ private:
|
|||
void *m_instPtr, *m_unSerPtr;
|
||||
};
|
||||
|
||||
/*! \addtogroup libcore */
|
||||
|
||||
/*! @{ */
|
||||
|
||||
/**
|
||||
* \brief This macro must be used in the declaration of
|
||||
* all classes derived from \ref Object.
|
||||
|
@ -188,6 +193,8 @@ public: \
|
|||
return m_theClass;\
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
||||
MTS_NAMESPACE_END
|
||||
|
||||
#endif /* __CLASS_H */
|
||||
|
|
|
@ -31,6 +31,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* lets them accept parameters specified in an external XML file. Additionally,
|
||||
* they can have child objects, which correspond to nested instantiation
|
||||
* requests in the XML file.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ConfigurableObject : public SerializableObject {
|
||||
public:
|
||||
|
@ -71,6 +73,8 @@ protected:
|
|||
|
||||
/** \brief This macro creates the binary interface, which Mitsuba
|
||||
* requires to load a plugin.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
#define MTS_EXPORT_PLUGIN(name, descr) \
|
||||
extern "C" { \
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Interface to the default stdin/stdout console streams
|
||||
/** \brief Stream-style interface to the default stdin/stdout console streams
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ConsoleStream : public Stream {
|
||||
public:
|
||||
|
|
|
@ -34,6 +34,8 @@ enum ELogLevel {
|
|||
|
||||
/** \brief Abstract interface for converting log information into
|
||||
* a human-readable format
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Formatter : public Object {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* This class is mostly used to quickly convert between different
|
||||
* cartesian coordinate systems and to efficiently compute certain
|
||||
* quantities (e.g. \ref cosTheta(), \ref tanTheta, ..).
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct Frame {
|
||||
Vector s, t;
|
||||
|
|
|
@ -34,6 +34,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* within a set of specifiable search paths in a cross-platform
|
||||
* compatible manner (similar to the $PATH variable on various
|
||||
* operating systems).
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE FileResolver : public Object {
|
||||
public:
|
||||
|
|
|
@ -31,6 +31,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* This class uses POSIX streams on Linux and OSX and the native
|
||||
* WIN32 API when used on Windows.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE FileStream : public Stream {
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,8 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* \brief Uniform 3D grid for storing and manipulating arbitrary quantities
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename ValueType> class Grid {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* \tparam PointType Underlying point data type (e.g. \ref TPoint3<float>)
|
||||
* \tparam DataRecord Custom payload to be attached to each node
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename PointType, typename DataRecord> struct BasicKDNode {
|
||||
typedef PointType point_type;
|
||||
|
@ -93,6 +95,8 @@ template <typename PointType, typename DataRecord> struct BasicKDNode {
|
|||
*
|
||||
* \tparam KDNode Underlying node data structure. See \ref BasicKDNode as
|
||||
* an example for the required public interface
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename KDNode> class TKDTree {
|
||||
public:
|
||||
|
@ -192,7 +196,7 @@ public:
|
|||
*
|
||||
* \param p Search position
|
||||
* \param k Maximum number of search results
|
||||
* \param result Index list of search results
|
||||
* \param results Index list of search results
|
||||
* \param searchRadius Maximum search radius (this can be used to
|
||||
* restrict the knn query to a subset of the data)
|
||||
* \return The number of used traversal steps
|
||||
|
@ -284,7 +288,7 @@ public:
|
|||
* a \a KDNode as its argument.
|
||||
*
|
||||
* \param p Search position
|
||||
* \param result Index list of search results
|
||||
* \param functor Functor to be called on each search result
|
||||
* \param searchRadius Search radius
|
||||
* \return The number of used traversal steps
|
||||
*/
|
||||
|
@ -348,7 +352,7 @@ public:
|
|||
* a constant reference to a \a KDNode as its argument.
|
||||
*
|
||||
* \param p Search position
|
||||
* \param result Index list of search results
|
||||
* \param functor Functor to be called on each search result
|
||||
* \param searchRadius Search radius
|
||||
* \return The number of used traversal steps
|
||||
*/
|
||||
|
@ -410,7 +414,7 @@ public:
|
|||
* \brief Run a search query
|
||||
*
|
||||
* \param p Search position
|
||||
* \param result Index list of search results
|
||||
* \param results Index list of search results
|
||||
* \param searchRadius Search radius
|
||||
* \return The number of used traversal steps
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,8 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* \brief Thin wrapper around the recursive pthreads lock
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Mutex : public Object {
|
||||
friend class ConditionVariable;
|
||||
|
@ -53,6 +55,8 @@ private:
|
|||
/**
|
||||
* \brief Wait flag synchronization primitive. Can be used to
|
||||
* wait for a certain event to occur.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE WaitFlag : public Object {
|
||||
public:
|
||||
|
@ -97,6 +101,8 @@ private:
|
|||
/**
|
||||
* \brief Condition variable synchronization primitive. Can be used to
|
||||
* wait for a condition to become true in a safe way.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ConditionVariable : public Object {
|
||||
public:
|
||||
|
|
|
@ -27,14 +27,22 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/*! \addtogroup libcore */
|
||||
/*! @{ */
|
||||
|
||||
/// Write a Log message to the console (to be used within subclasses of <tt>Object</tt>)
|
||||
#define Log(level, fmt, ...) Thread::getThread()->getLogger()->log(level, m_theClass, \
|
||||
__FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
|
||||
/// Write a Log message to the console (static version - to be used where Log() is not applicable)
|
||||
/**
|
||||
* \brief Write a Log message to the console (static version - to be used
|
||||
* outside of classes that derive from Object)
|
||||
*/
|
||||
#define SLog(level, fmt, ...) Thread::getThread()->getLogger()->log(level, NULL, \
|
||||
__FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef MTS_NDEBUG
|
||||
#define Assert(cond) ((void) 0)
|
||||
#define AssertEx(cond, explanation) ((void) 0)
|
||||
|
@ -42,31 +50,36 @@ MTS_NAMESPACE_BEGIN
|
|||
#define SAssertEx(cond, explanation) ((void) 0)
|
||||
#else
|
||||
|
||||
/* Assertion */
|
||||
/* Assertions */
|
||||
/*! \addtogroup libcore */
|
||||
/*! @{ */
|
||||
|
||||
#define Assert(cond) do { \
|
||||
if (!(cond)) Log(EError, "Assertion \"%s\" failed in %s:%i", \
|
||||
#cond, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
/* Static assertion (see SLog) */
|
||||
/// ``Static'' assertion (to be used outside of classes that derive from Object)
|
||||
#define SAssert(cond) do { \
|
||||
if (!(cond)) SLog(EError, "Assertion \"%s\" failed in %s:%i", \
|
||||
#cond, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
/* Assertion with a customizable error explanation */
|
||||
/// Assertion with a customizable error explanation
|
||||
#define AssertEx(cond, explanation) do { \
|
||||
if (!(cond)) Log(EError, "Assertion \"%s\" failed in %s:%i (" explanation ")", \
|
||||
#cond, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
/* Static assertion with a customizable error explanation (see SLog) */
|
||||
/// Static assertion with a customizable error explanation (see \ref SLog)
|
||||
#define SAssertEx(cond, explanation) do { \
|
||||
if (!(cond)) SLog(EError, "Assertion \"%s\" failed in %s:%i (" explanation ")", \
|
||||
#cond, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
|
||||
/**
|
||||
* \headerfile mitsuba/core/logger.h mitsuba/mitsuba.h
|
||||
* \brief Responsible for processing log messages
|
||||
|
@ -75,6 +88,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* a Formatter to convert it into a human-readable form.
|
||||
* Following that, it sends this information to every
|
||||
* registered Appender.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Logger : public Object {
|
||||
public:
|
||||
|
|
|
@ -38,8 +38,15 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Extended LRU Cache based on the bimap implementation by Tim Day
|
||||
* \brief Generic LRU cache implementation
|
||||
*
|
||||
* Based on the bimap implementation by Tim Day
|
||||
* (http://www.bottlenose.demon.co.uk/article/lru.pdf)
|
||||
*
|
||||
* \tparam K Key data type
|
||||
* \tparam KComp Key comparator
|
||||
* \tparam V Value data type
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename K, typename KComp, typename V> struct LRUCache : public Object {
|
||||
public:
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* Generic fixed-size dense matrix class using a row-major storage format
|
||||
* \brief Generic fixed-size dense matrix class using a row-major storage format
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <int M, int N, typename T> struct Matrix {
|
||||
public:
|
||||
|
@ -407,6 +409,7 @@ protected:
|
|||
|
||||
/**
|
||||
* \brief Basic 2x2 matrix data type
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Matrix2x2 : public Matrix<2, 2, Float> {
|
||||
public:
|
||||
|
@ -489,6 +492,7 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Basic 3x3 matrix data type
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Matrix3x3 : public Matrix<3, 3, Float> {
|
||||
public:
|
||||
|
@ -568,6 +572,7 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Basic 4x4 matrix data type
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Matrix4x4 : public Matrix<4, 4, Float> {
|
||||
inline Matrix4x4() { }
|
||||
|
@ -649,7 +654,8 @@ struct MTS_EXPORT_CORE Matrix4x4 : public Matrix<4, 4, Float> {
|
|||
};
|
||||
|
||||
/// Matrix multiplication (creates a temporary)
|
||||
template <typename T, int M1, int N1, int M2, int N2> inline Matrix<M1, N2, T> operator*(const Matrix<M1, N1, T> &mat1, const Matrix<M2, N2, T> &mat2) {
|
||||
template <typename T, int M1, int N1, int M2, int N2> inline Matrix<M1, N2, T>
|
||||
operator*(const Matrix<M1, N1, T> &mat1, const Matrix<M2, N2, T> &mat2) {
|
||||
BOOST_STATIC_ASSERT(N1 == M2);
|
||||
Matrix<M1, N2, T> result;
|
||||
for (int i=0; i<M1; ++i) {
|
||||
|
|
|
@ -28,6 +28,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* of objects of the same type, while attempting to keep them
|
||||
* contiguous in memory and having only minimal interaction with the
|
||||
* underlying allocator.
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class MemoryPool {
|
||||
public:
|
||||
|
@ -51,14 +52,14 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
void ensureNotContained(T *ptr) {
|
||||
if (std::find(m_free.begin(), m_free.end(), ptr) != m_free.end()) ///XXX
|
||||
SLog(EError, "Memory pool inconsistency()");
|
||||
}
|
||||
// void ensureNotContained(T *ptr) {
|
||||
// if (std::find(m_free.begin(), m_free.end(), ptr) != m_free.end())
|
||||
// SLog(EError, "Memory pool inconsistency()");
|
||||
// }
|
||||
|
||||
/// Release an entry
|
||||
inline void release(T *ptr) {
|
||||
// if (std::find(m_free.begin(), m_free.end(), ptr) != m_free.end()) ///XXX remove
|
||||
// if (std::find(m_free.begin(), m_free.end(), ptr) != m_free.end())
|
||||
// SLog(EError, "Memory pool inconsistency in release()");
|
||||
m_free.push_back(ptr);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* \brief Basic cross-platform abstraction for memory mapped files
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE MemoryMappedFile : public Object {
|
||||
public:
|
||||
|
|
|
@ -27,6 +27,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* The underlying memory storage of this implementation dynamically expands
|
||||
* as data is written to the stream.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE MemoryStream : public Stream {
|
||||
public:
|
||||
|
|
|
@ -30,6 +30,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* to the process (by a call to <tt>\ref bindUsedResources()</tt>). These will then be
|
||||
* distributed to all participating compute servers. Once unserialized on the remote side,
|
||||
* <tt>\ref wakeup()</tt> is called to let the object re-associate with the shared resources.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE NetworkedObject : public ConfigurableObject {
|
||||
public:
|
||||
|
|
|
@ -30,6 +30,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* Internally represented using floating point numbers of the chosen
|
||||
* compile-time precision. The main difference in comparison to <tt>TVector3<Float></tt>
|
||||
* is in how instances of <tt>Normal</tt> are treated by linear transformations.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct Normal : public TVector3<Float> {
|
||||
/** \brief Construct a new normal without initializing it.
|
||||
|
|
|
@ -32,6 +32,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* limited type introspection and lifetime management.
|
||||
*
|
||||
* \sa ref, Class
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Object {
|
||||
public:
|
||||
|
|
|
@ -27,7 +27,10 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
|
||||
/**
|
||||
* \brief Implements a lock-free singly linked list.
|
||||
* \brief Implements a lock-free singly linked list using
|
||||
* atomic operations.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class LockFreeList {
|
||||
public:
|
||||
|
@ -69,6 +72,8 @@ private:
|
|||
*
|
||||
* Based on the excellent implementation in PBRT. Modifications are
|
||||
* the addition of a bounding sphere query and support for multithreading.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class Octree {
|
||||
public:
|
||||
|
|
|
@ -26,6 +26,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* This class can be used to transform uniformly distributed samples
|
||||
* so that they match the stored distribution.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct DiscretePDF {
|
||||
public:
|
||||
|
|
|
@ -32,6 +32,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* Please see the <tt>\ref ConfigurableObject</tt> and
|
||||
* <tt>\ref Utility</tt> classes for details
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Plugin {
|
||||
typedef void *(*CreateInstanceFunc)(const Properties &props);
|
||||
|
@ -84,6 +86,8 @@ private:
|
|||
/**
|
||||
* \brief The plugin manager is responsible for resolving and
|
||||
* loading external plugins.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE PluginManager : public Object {
|
||||
public:
|
||||
|
|
|
@ -26,6 +26,8 @@ MTS_NAMESPACE_BEGIN
|
|||
/**
|
||||
* \headerfile mitsuba/core/point.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable two-dimensional point data structure
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TPoint2 {
|
||||
typedef T value_type;
|
||||
|
@ -218,6 +220,7 @@ template <> inline TPoint2<int> &TPoint2<int>::operator/=(int s) {
|
|||
/**
|
||||
* \headerfile mitsuba/core/point.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable three-dimensional point data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TPoint3 {
|
||||
typedef T value_type;
|
||||
|
@ -414,6 +417,7 @@ template <> inline TPoint3<int> &TPoint3<int>::operator/=(int s) {
|
|||
/**
|
||||
* \headerfile mitsuba/core/point.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable four-dimensional point data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TPoint4 {
|
||||
typedef T value_type;
|
||||
|
|
|
@ -26,6 +26,7 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/** \brief Associative map for values of various types. Used to
|
||||
* construct subclasses of <tt>ConfigurableObject</tt>.
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Properties {
|
||||
public:
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
FOR A PARTICULAR PURPOSE. See the license for more details.
|
||||
*/
|
||||
|
||||
/*! \file gausslobattointegral.hpp
|
||||
\brief integral of a one-dimensional function using the adaptive
|
||||
Gauss-Lobatto integral
|
||||
*/
|
||||
|
||||
#if !defined(__QUADRATURE_H)
|
||||
#define __QUADRATURE_H
|
||||
|
||||
|
@ -28,23 +23,24 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
//! Integral of a one-dimensional function
|
||||
/*! Given a target accuracy \f$ \epsilon \f$, the integral of
|
||||
a function \f$ f \f$ between \f$ a \f$ and \f$ b \f$ is
|
||||
calculated by means of the Gauss-Lobatto formula
|
||||
*/
|
||||
|
||||
/*! References:
|
||||
This algorithm is a C++ implementation of the algorithm outlined in
|
||||
|
||||
W. Gander and W. Gautschi, Adaptive Quadrature - Revisited.
|
||||
BIT, 40(1):84-101, March 2000. CS technical report:
|
||||
ftp.inf.ethz.ch/pub/publications/tech-reports/3xx/306.ps.gz
|
||||
|
||||
The original MATLAB version can be downloaded here
|
||||
http://www.inf.ethz.ch/personal/gander/adaptlob.m
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Computes the integral of a one-dimensional function.
|
||||
*
|
||||
* Given a target accuracy \f$ \epsilon \f$, the integral of
|
||||
* a function \f$ f \f$ between \f$ a \f$ and \f$ b \f$ is
|
||||
* calculated by means of the Gauss-Lobatto formula.
|
||||
*
|
||||
* References:
|
||||
* This algorithm is a C++ implementation of the algorithm outlined in
|
||||
*
|
||||
* W. Gander and W. Gautschi, Adaptive Quadrature - Revisited.
|
||||
* BIT, 40(1):84-101, March 2000. CS technical report:
|
||||
* ftp.inf.ethz.ch/pub/publications/tech-reports/3xx/306.ps.gz
|
||||
*
|
||||
* The original MATLAB version can be downloaded here
|
||||
* http://www.inf.ethz.ch/personal/gander/adaptlob.m
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE GaussLobattoIntegrator {
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -25,6 +25,7 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* \brief Parameterizable quaternion data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TQuaternion {
|
||||
typedef T value_type;
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
Any feedback is very welcome.
|
||||
http://www.math.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
||||
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove spaces)
|
||||
* \ingroup libcore
|
||||
*/
|
||||
|
||||
/* Period parameters */
|
||||
|
|
|
@ -23,8 +23,14 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Simple three-dimensional ray class with
|
||||
minimum / maximum extent information */
|
||||
/** \brief Simple three-dimensional ray data structure with
|
||||
* minimum / maximum extent information.
|
||||
*
|
||||
* The somewhat peculiar ordering of the attributes is due
|
||||
* to alignment purposes and should not be changed.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct Ray {
|
||||
Point o; ///< Ray origin
|
||||
Float mint; ///< Minimum range for intersection tests
|
||||
|
@ -115,7 +121,9 @@ struct Ray {
|
|||
};
|
||||
|
||||
/** \brief %Ray differential -- enhances the basic ray class with
|
||||
information about the rays of adjacent pixels on the view plane */
|
||||
information about the rays of adjacent pixels on the view plane
|
||||
\ingroup libcore
|
||||
*/
|
||||
struct RayDifferential : public Ray {
|
||||
bool hasDifferentials;
|
||||
Ray rx, ry;
|
||||
|
|
|
@ -33,6 +33,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* out of scope, the associated object will be deallocated.
|
||||
*
|
||||
* \author Wenzel Jakob
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class ref {
|
||||
public:
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
/**
|
||||
* Uncomment this to enable scheduling debug messages
|
||||
*/
|
||||
#define DEBUG_SCHED 1
|
||||
//#define DEBUG_SCHED 1
|
||||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* \brief Abstract work unit -- represents a small amount of information
|
||||
* that encodes part of a larger processing task.
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE WorkUnit : public Object {
|
||||
public:
|
||||
|
@ -58,6 +59,7 @@ protected:
|
|||
/**
|
||||
* \brief Abstract work result -- represents the result of a
|
||||
* processed <tt>\ref WorkUnit</tt> instance.
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE WorkResult : public Object {
|
||||
public:
|
||||
|
@ -86,6 +88,8 @@ protected:
|
|||
* returned in the form of <tt>WorkResult</tt>s will eventually be lost.
|
||||
* Each worker (both locally and remotely) has its own <tt>WorkProcessor</tt>,
|
||||
* and therefore no form of locking is required within instances of this class.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE WorkProcessor : public SerializableObject {
|
||||
friend class Scheduler;
|
||||
|
@ -160,6 +164,8 @@ protected:
|
|||
* is an instance of <tt>WorkProcessor</tt>, which is also specified here.
|
||||
* Finally, the this class references `resources', which denote
|
||||
* chunks of globally shared read-only data required during execution.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ParallelProcess : public Object {
|
||||
friend class Scheduler;
|
||||
|
@ -311,6 +317,8 @@ class Worker;
|
|||
* of <tt>\ref Worker</tt>s with the scheduler. These try to acquire work
|
||||
* units from the scheduler, which are then executed on the current machine
|
||||
* or sent to remote nodes over a network connection.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Scheduler : public Object {
|
||||
friend class Worker;
|
||||
|
@ -717,6 +725,8 @@ protected:
|
|||
/**
|
||||
* \brief Acquires work from the scheduler and executes
|
||||
* it locally.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE LocalWorker : public Worker {
|
||||
public:
|
||||
|
|
|
@ -38,6 +38,8 @@ class StreamBackend;
|
|||
/**
|
||||
* \brief Acquires work from the scheduler and forwards
|
||||
* it to a processing node reachable through a \ref Stream.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE RemoteWorker : public Worker {
|
||||
friend class RemoteWorkerReader;
|
||||
|
@ -116,6 +118,8 @@ private:
|
|||
/**
|
||||
* \brief Parallel process facade used to insert work units from a
|
||||
* remote scheduler into the local one.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE RemoteProcess : public ParallelProcess {
|
||||
public:
|
||||
|
@ -185,6 +189,8 @@ private:
|
|||
*
|
||||
* Attaches to the end of a stream, accepts work units and forwards
|
||||
* them to the local scheduler. Can be used to create network processing nodes.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE StreamBackend : public Thread {
|
||||
friend class RemoteProcess;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Abstract interface implemented by all serializable classes
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Serializable {
|
||||
public:
|
||||
|
@ -38,6 +39,8 @@ protected:
|
|||
*
|
||||
* To support unserialization from a stream, the implementation should use one of the
|
||||
* RTTI macros \ref MTS_IMPLEMENT_CLASS_S or \ref MTS_IMPLEMENT_CLASS_IS.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE SerializableObject : public Object, public Serializable {
|
||||
public:
|
||||
|
@ -62,6 +65,8 @@ protected:
|
|||
*
|
||||
* Similarly when unserializing a stream, it ensures that the resulting
|
||||
* object graph has the same structure.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE InstanceManager : public Object {
|
||||
friend class SerializableObject;
|
||||
|
|
|
@ -27,6 +27,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* \brief 2D version of the Hilbert space-filling curve
|
||||
*
|
||||
* Based on http://voxelizator3d.wordpress.com/
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class HilbertCurve2D {
|
||||
public:
|
||||
|
|
|
@ -34,6 +34,7 @@ struct SHVector;
|
|||
|
||||
/**
|
||||
* \brief Stores the diagonal blocks of a spherical harmonic rotation matrix
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE SHRotation {
|
||||
std::vector<ublas::matrix<Float> > blocks;
|
||||
|
@ -72,6 +73,8 @@ struct MTS_EXPORT_CORE SHRotation {
|
|||
* {Sqrt[2]*Im[SphericalHarmonicY[l, -m, \[Theta], \[Phi]]], m < 0}
|
||||
* }]
|
||||
* </pre>
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE SHVector {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* Discretization occurs in the 'wi' space. Lookups interpolate amongst
|
||||
* the 4 adjacent samples.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct SHVector4D {
|
||||
public:
|
||||
|
|
|
@ -31,6 +31,8 @@ MTS_NAMESPACE_BEGIN
|
|||
/**
|
||||
* \brief Abstract smooth spectral power distribution data type,
|
||||
* which supports evaluation at arbitrary wavelengths
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE SmoothSpectrum {
|
||||
public:
|
||||
|
@ -48,6 +50,8 @@ public:
|
|||
*
|
||||
* Computes the spectral power distribution of a black body of the
|
||||
* specified temperature.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE BlackBodySpectrum : public SmoothSpectrum {
|
||||
public:
|
||||
|
@ -71,6 +75,8 @@ private:
|
|||
|
||||
/**
|
||||
* \brief Linearly interpolated spectral power distribution
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE InterpolatedSpectrum : public SmoothSpectrum {
|
||||
public:
|
||||
|
@ -106,6 +112,8 @@ private:
|
|||
*
|
||||
* When SPECTRUM_SAMPLES is set to 3 (the default), this class
|
||||
* falls back to linear RGB as its internal representation.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Spectrum {
|
||||
public:
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Portable Stream implementation, which encapsulates a socket
|
||||
/** \brief Portable %Stream implementation, which encapsulates a socket
|
||||
* for IPv4/IPv6 network communications. Set to use network byte order
|
||||
* by default.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE SocketStream : public Stream {
|
||||
public:
|
||||
|
|
|
@ -73,6 +73,8 @@ struct CacheLineCounter {
|
|||
* quantities within Mitsuba. At various points during the execution, it is
|
||||
* possible to then call \ref Statistics::printStats() to get a human-readable
|
||||
* report of their values.
|
||||
*
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE StatsCounter {
|
||||
public:
|
||||
|
@ -194,6 +196,7 @@ private:
|
|||
};
|
||||
|
||||
/** \brief General-purpose progress reporter
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ProgressReporter {
|
||||
public:
|
||||
|
@ -240,6 +243,7 @@ private:
|
|||
|
||||
/** \brief Collects various rendering statistics. Only
|
||||
* one instance is created during a program run
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Statistics : public Object {
|
||||
public:
|
||||
|
|
|
@ -35,6 +35,7 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* \sa FileStream, MemoryStream, SocketStream,
|
||||
* ConsoleStream, SSHStream, ZStream
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Stream : public Object {
|
||||
public:
|
||||
|
@ -328,8 +329,6 @@ template <typename T> inline void Stream::writeArray(const T *array, size_t coun
|
|||
Log(EError, "Stream::writeArray<T>: not implemented!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// \cond
|
||||
template <> inline float Stream::readElement() { return readSingle(); }
|
||||
template <> inline double Stream::readElement() { return readDouble(); }
|
||||
|
|
|
@ -26,6 +26,7 @@ MTS_NAMESPACE_BEGIN
|
|||
/**
|
||||
* \headerfile mitsuba/core/thread.h mitsuba/mitsuba.h
|
||||
* \brief Cross-platform thread implementation
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Thread : public Object {
|
||||
public:
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Platform independent milli/microsecond timer
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Timer : public Object {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* This class implements a simple reference-counting thread-local
|
||||
* pointer storage.
|
||||
* \sa PrimitiveThreadLocal
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class ThreadLocal {
|
||||
public:
|
||||
|
@ -91,6 +92,7 @@ private:
|
|||
* \brief Thin wrapper around posix thread local storage.
|
||||
* Stores heap-allocated data other than Object instances.
|
||||
* \sa ThreadLocal
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> class PrimitiveThreadLocal {
|
||||
public:
|
||||
|
|
|
@ -26,6 +26,7 @@ MTS_NAMESPACE_BEGIN
|
|||
|
||||
/**
|
||||
* \brief Encapsulates a 4x4 linear transformation and its inverse
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Transform {
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* for analysis and transformation.
|
||||
*
|
||||
* Triangles are stored as indices into a vertex array
|
||||
* \ingroup libcore
|
||||
*/
|
||||
struct MTS_EXPORT_CORE Triangle {
|
||||
/// Indices into a vertex buffer
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include <boost/static_assert.hpp>
|
||||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/*! \addtogroup libcore */
|
||||
/*! @{ */
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Miscellaneous
|
||||
|
@ -45,7 +48,8 @@ extern MTS_EXPORT_CORE std::string indent(const std::string &string, int amount=
|
|||
|
||||
/**
|
||||
* Convert a time difference (in ms) to a string representation
|
||||
* \param accurate When set to true, a higher-precision string representation
|
||||
* \param time Time value in milliseconds
|
||||
* \param precise When set to true, a higher-precision string representation
|
||||
* is generated.
|
||||
*/
|
||||
extern MTS_EXPORT_CORE std::string timeToString(Float time, bool precise = false);
|
||||
|
@ -347,6 +351,8 @@ template <typename VectorType> inline Float unitAngle(const VectorType &u, const
|
|||
/// Turn a memory size into a human-readable string
|
||||
extern MTS_EXPORT_CORE std::string memString(size_t size);
|
||||
|
||||
/*! @} */
|
||||
|
||||
MTS_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_H */
|
||||
|
|
|
@ -26,6 +26,7 @@ MTS_NAMESPACE_BEGIN
|
|||
/**
|
||||
* \headerfile mitsuba/core/vector.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable two-dimensional vector data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TVector2 {
|
||||
typedef T value_type;
|
||||
|
@ -217,6 +218,7 @@ template <> inline TVector2<int> &TVector2<int>::operator/=(int s) {
|
|||
/**
|
||||
* \headerfile mitsuba/core/vector.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable three-dimensional vector data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TVector3 {
|
||||
typedef T value_type;
|
||||
|
@ -421,6 +423,7 @@ template <> inline TVector3<int> &TVector3<int>::operator/=(int s) {
|
|||
/**
|
||||
* \headerfile mitsuba/core/vector.h mitsuba/mitsuba.h
|
||||
* \brief Parameterizable four-dimensional vector data structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
template <typename T> struct TVector4 {
|
||||
typedef T value_type;
|
||||
|
|
|
@ -44,6 +44,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* Based on "Wavelets for computer graphics: A primer, part 1" by
|
||||
* Eric J. Stollnitz, Tony D. DeRose, and David H. Salesin
|
||||
* (IEEE Computer Graphics and Applications, May 1995)
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE Wavelet2D : public Object {
|
||||
public:
|
||||
|
@ -195,6 +196,7 @@ protected:
|
|||
|
||||
/**
|
||||
* \brief Sparse 2D wavelet representation using the Haar basis
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE SparseWavelet2D : public SerializableObject {
|
||||
public:
|
||||
|
@ -333,6 +335,7 @@ protected:
|
|||
/**
|
||||
* \brief Sparse 3D wavelet representation using the Haar basis and an
|
||||
* octree structure
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE SparseWaveletOctree : public Object {
|
||||
public:
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/** \brief Transparent compression/decompression stream based on ZLIB.
|
||||
* \ingroup libcore
|
||||
*/
|
||||
class MTS_EXPORT_CORE ZStream : public Stream {
|
||||
public:
|
||||
|
|
|
@ -237,10 +237,13 @@ public:
|
|||
static Device *create(Session *session);
|
||||
|
||||
/// Return the dimension of the device
|
||||
inline Vector2i getDimension() const { return m_dimension; }
|
||||
inline Vector2i getSize() const { return m_size; }
|
||||
|
||||
/// Set the dimension of the device
|
||||
void setDimension(const Vector2i &dimension);
|
||||
void setSize(const Vector2i &dimension);
|
||||
|
||||
/// Return the aspect ratio of the device
|
||||
inline Float getAspect() const { return (Float) m_size.x / (Float) m_size.y; }
|
||||
|
||||
/// Return the position of the device
|
||||
inline Point2i getPosition() const { return m_position; }
|
||||
|
@ -380,7 +383,7 @@ protected:
|
|||
protected:
|
||||
ref<Session> m_session;
|
||||
ref<Timer> m_timer;
|
||||
Vector2i m_dimension;
|
||||
Vector2i m_size;
|
||||
Point2i m_position;
|
||||
int m_fsaa;
|
||||
int m_redBits;
|
||||
|
|
|
@ -44,6 +44,9 @@ public:
|
|||
|
||||
/// Set the source code of this program
|
||||
inline void setSource(EType type, const std::string &source) { m_source[type] = source; }
|
||||
|
||||
/// Set the source code of this program by filename
|
||||
void setSourceFile(EType type, const fs::path &path);
|
||||
|
||||
/// Get the source code of this program
|
||||
inline const std::string &getSource(EType type) const { return m_source[type]; }
|
||||
|
|
|
@ -36,9 +36,13 @@ public:
|
|||
/// Construct a new viewer
|
||||
Viewer();
|
||||
|
||||
/// \brief Program entry point
|
||||
/**
|
||||
* \brief Program entry point
|
||||
*
|
||||
* The viewer is initialized by this method -- to add custom
|
||||
* initialization code, please override \ref init
|
||||
*/
|
||||
int run(int argc, char **argv);
|
||||
|
||||
protected:
|
||||
/// Draw a heads-up display
|
||||
void drawHUD(const std::string &text);
|
||||
|
@ -46,8 +50,17 @@ protected:
|
|||
/// To be overwritten by the subclass: main drawing routine
|
||||
virtual void draw() = 0;
|
||||
|
||||
/// To be overwritten (optionally): perform any necessary initializations
|
||||
virtual void init();
|
||||
/**
|
||||
* \brief To be overwritten (optionally): perform any necessary
|
||||
* initializations
|
||||
*
|
||||
* The default implementation does nothing and returns \c true.
|
||||
*
|
||||
* \param argc Number of command line arguments
|
||||
* \param argv List of command line argument strings
|
||||
* \return \c true upon success. Otherwise, the viewer will quit.
|
||||
*/
|
||||
virtual bool init(int argc, char **argv);
|
||||
|
||||
/// To be overwritten (optionally): perform any necessary cleanups
|
||||
virtual void shutdown();
|
||||
|
|
|
@ -35,10 +35,11 @@
|
|||
#include <limits>
|
||||
|
||||
/// Current release of Mitsuba
|
||||
#define MTS_VERSION "0.2.0"
|
||||
#define MTS_VERSION "0.2.1"
|
||||
#define MTS_VERSION_CODE 000201
|
||||
|
||||
/// Year of this release
|
||||
#define MTS_YEAR "2010"
|
||||
#define MTS_YEAR "2011"
|
||||
|
||||
/// Default port of <tt>mtssrv</tt>
|
||||
#define MTS_DEFAULT_PORT 7554
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
m_accumBuffer->setMipMapped(false);
|
||||
|
||||
m_session->init();
|
||||
m_device->setDimension(film->getSize());
|
||||
m_device->setSize(film->getSize());
|
||||
m_device->init();
|
||||
m_device->setVisible(false);
|
||||
m_renderer->init(m_device);
|
||||
|
|
|
@ -371,7 +371,7 @@ std::string Stream::readLine() {
|
|||
|
||||
do {
|
||||
try {
|
||||
data = readChar();
|
||||
read(&data, sizeof(char));
|
||||
} catch (std::exception &e) {
|
||||
if (getPos() == getSize()) {
|
||||
if (retval.size() != 0) {
|
||||
|
@ -391,9 +391,9 @@ std::string Stream::readLine() {
|
|||
std::string Stream::readString() {
|
||||
std::string retval;
|
||||
char data;
|
||||
|
||||
|
||||
do {
|
||||
data = readChar();
|
||||
read(&data, sizeof(char));
|
||||
if (data != 0)
|
||||
retval += data;
|
||||
} while (data != 0);
|
||||
|
|
|
@ -37,7 +37,7 @@ Device::Device(Session *name) {
|
|||
m_doubleBuffer = true;
|
||||
m_fullscreen = false;
|
||||
m_fsaa = 1;
|
||||
m_dimension = Vector2i(640, 480);
|
||||
m_size = Vector2i(640, 480);
|
||||
m_position = Point2i(0, 0);
|
||||
m_center = true;
|
||||
m_session = name;
|
||||
|
@ -69,9 +69,9 @@ void Device::setTitle(const std::string &title) {
|
|||
m_title = title;
|
||||
}
|
||||
|
||||
void Device::setDimension(const Vector2i &dimension) {
|
||||
void Device::setSize(const Vector2i &dimension) {
|
||||
Assert(!m_initialized);
|
||||
m_dimension = dimension;
|
||||
m_size = dimension;
|
||||
}
|
||||
|
||||
void Device::setRedBits(int redBits) {
|
||||
|
|
|
@ -26,6 +26,22 @@ GPUProgram::GPUProgram(const std::string &name)
|
|||
|
||||
GPUProgram::~GPUProgram() {
|
||||
}
|
||||
|
||||
void GPUProgram::setSourceFile(EType type, const fs::path &path) {
|
||||
fs::ifstream ifs(path);
|
||||
if (ifs.fail() || ifs.bad())
|
||||
Log(EError, "Unable to load GPU program \"%s\"",
|
||||
path.file_string().c_str());
|
||||
std::string code, line;
|
||||
|
||||
while (getline(ifs, line)) {
|
||||
code += line;
|
||||
code += "\n";
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
setSource(type, code);
|
||||
}
|
||||
|
||||
std::string GPUProgram::toString() const {
|
||||
std::ostringstream oss;
|
||||
|
|
|
@ -187,7 +187,7 @@ using namespace mitsuba;
|
|||
NSPoint location = [((NSWindow *) m_device->getWindow()) mouseLocationOutsideOfEventStream];
|
||||
if (deviceEvent.getType() == Device::ENoEvent)
|
||||
deviceEvent.setType(Device::EMouseButtonDownEvent);
|
||||
deviceEvent.setMousePosition(Point2i((int) location.x, m_device->getDimension().y - (int) location.y));
|
||||
deviceEvent.setMousePosition(Point2i((int) location.x, m_device->getSize().y - (int) location.y));
|
||||
deviceEvent.setMouseRelative(Vector2i(0, 0));
|
||||
uint buttonNumber = [event buttonNumber];
|
||||
uint buttonMask = 0;
|
||||
|
@ -213,7 +213,7 @@ using namespace mitsuba;
|
|||
deviceEvent.setMouseButton(Device::EWheelUpButton);
|
||||
else
|
||||
deviceEvent.setMouseButton(Device::EWheelDownButton);
|
||||
deviceEvent.setMousePosition(Point2i((int) location.x, m_device->getDimension().y - (int) location.y));
|
||||
deviceEvent.setMousePosition(Point2i((int) location.x, m_device->getSize().y - (int) location.y));
|
||||
deviceEvent.setMouseRelative(Vector2i(0, 0));
|
||||
deviceEvent.setType(Device::EMouseButtonDownEvent);
|
||||
m_device->pushEvent(deviceEvent);
|
||||
|
@ -231,7 +231,7 @@ using namespace mitsuba;
|
|||
return;
|
||||
}
|
||||
NSPoint location = [((NSWindow *) m_device->getWindow()) mouseLocationOutsideOfEventStream];
|
||||
Point2i absolute((int) location.x, m_device->getDimension().y - (int) location.y);
|
||||
Point2i absolute((int) location.x, m_device->getSize().y - (int) location.y);
|
||||
|
||||
bool cursorInWindow = m_device->isMouseInWindow();
|
||||
if (m_buttonMask == 0)
|
||||
|
@ -262,8 +262,8 @@ using namespace mitsuba;
|
|||
if (cursorInWindow)
|
||||
m_mouseInWindow = true;
|
||||
|
||||
if (absolute.x > m_device->getDimension().x || absolute.x < 0
|
||||
|| absolute.y > m_device->getDimension().y || absolute.y< 0)
|
||||
if (absolute.x > m_device->getSize().x || absolute.x < 0
|
||||
|| absolute.y > m_device->getSize().y || absolute.y< 0)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -401,7 +401,7 @@ void NSGLDevice::init(Device *other) {
|
|||
Log(EDebug, "Initializing NSGL device");
|
||||
|
||||
NSRect contentRect = NSMakeRect(m_position.x, m_position.y,
|
||||
m_dimension.x, m_dimension.y);
|
||||
m_size.x, m_size.y);
|
||||
|
||||
/* Protect the event queue */
|
||||
m_mutex = new Mutex();
|
||||
|
@ -535,7 +535,7 @@ void NSGLDevice::setGrab(bool grab) {
|
|||
Assert(m_initialized);
|
||||
|
||||
if (grab) {
|
||||
warpMouse(Point2i(getDimension().x / 2, getDimension().y/2));
|
||||
warpMouse(Point2i(getSize().x / 2, getSize().y/2));
|
||||
CGAssociateMouseAndMouseCursorPosition(false);
|
||||
} else {
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
|
|
|
@ -24,7 +24,7 @@ Viewer::Viewer() {
|
|||
m_session = Session::create();
|
||||
m_device = Device::create(m_session);
|
||||
m_renderer = Renderer::create(m_session);
|
||||
m_device->setDimension(Vector2i(768, 576));
|
||||
m_device->setSize(Vector2i(768, 576));
|
||||
}
|
||||
|
||||
int Viewer::run(int argc, char **argv) {
|
||||
|
@ -37,14 +37,15 @@ int Viewer::run(int argc, char **argv) {
|
|||
m_font->init(m_renderer);
|
||||
m_quit = false;
|
||||
|
||||
init();
|
||||
while (!m_quit) {
|
||||
m_session->processEvents();
|
||||
m_renderer->clear();
|
||||
draw();
|
||||
m_device->flip();
|
||||
if (init(argc, argv)) {
|
||||
while (!m_quit) {
|
||||
m_session->processEvents();
|
||||
m_renderer->clear();
|
||||
draw();
|
||||
m_device->flip();
|
||||
}
|
||||
shutdown();
|
||||
}
|
||||
shutdown();
|
||||
|
||||
m_font->cleanup();
|
||||
m_renderer->shutdown();
|
||||
|
@ -58,7 +59,10 @@ void Viewer::drawHUD(const std::string &text) {
|
|||
m_renderer->drawText(Point2i(10, 10), m_font, text.c_str());
|
||||
}
|
||||
|
||||
void Viewer::init() { }
|
||||
bool Viewer::init(int argc, char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Viewer::shutdown() { }
|
||||
void Viewer::keyPressed(const DeviceEvent &event) { }
|
||||
void Viewer::keyReleased(const DeviceEvent &event) { }
|
||||
|
|
|
@ -66,7 +66,7 @@ LONG WINAPI WGLDevice::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
device->initPixelFormat(hWnd);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
device->m_dimension = Vector2i(LOWORD(lParam), HIWORD(lParam));
|
||||
device->m_size = Vector2i(LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
case WM_PAINT:
|
||||
BeginPaint(hWnd, &ps);
|
||||
|
@ -280,7 +280,7 @@ void WGLDevice::init(Device *other) {
|
|||
m_fullscreen ? WS_POPUP : (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX),
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
getDimension().x, getDimension().y,
|
||||
getSize().x, getSize().y,
|
||||
NULL, NULL,
|
||||
session->m_hinstance,
|
||||
NULL);
|
||||
|
@ -299,8 +299,8 @@ void WGLDevice::init(Device *other) {
|
|||
ZeroMemory(&dm, sizeof(dm));
|
||||
dm.dmSize = sizeof(dm);
|
||||
dm.dmBitsPerPel = GetDeviceCaps(m_hdc, BITSPIXEL);
|
||||
dm.dmPelsWidth = m_dimension.x;
|
||||
dm.dmPelsHeight = m_dimension.y;
|
||||
dm.dmPelsWidth = m_size.x;
|
||||
dm.dmPelsHeight = m_size.y;
|
||||
|
||||
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
|
||||
if (!ChangeDisplaySettings(&dm, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
|
||||
|
@ -308,11 +308,11 @@ void WGLDevice::init(Device *other) {
|
|||
}
|
||||
|
||||
if (m_fullscreen || m_center) {
|
||||
m_position.x = (GetSystemMetrics(SM_CXSCREEN) - m_dimension.x) / 2;
|
||||
m_position.y = (GetSystemMetrics(SM_CYSCREEN) - m_dimension.y) / 2;
|
||||
m_position.x = (GetSystemMetrics(SM_CXSCREEN) - m_size.x) / 2;
|
||||
m_position.y = (GetSystemMetrics(SM_CYSCREEN) - m_size.y) / 2;
|
||||
}
|
||||
|
||||
SetWindowPos(m_hwnd, HWND_TOP, m_position.x, m_position.y, m_dimension.x, m_dimension.y, SWP_NOCOPYBITS);
|
||||
SetWindowPos(m_hwnd, HWND_TOP, m_position.x, m_position.y, m_size.x, m_size.y, SWP_NOCOPYBITS);
|
||||
UpdateWindow(m_hwnd);
|
||||
|
||||
m_mouse = Point2i(-1, -1);
|
||||
|
@ -434,8 +434,8 @@ bool WGLDevice::translateMouse(UINT uMsg, WPARAM wParam, DeviceEvent &event) {
|
|||
event.setType(EMouseMotionEvent);
|
||||
event.setMouseButton(ENoButton);
|
||||
if (m_grab)
|
||||
warpMouse(Point2i(getDimension().x / 2,
|
||||
getDimension().y/2));
|
||||
warpMouse(Point2i(getSize().x / 2,
|
||||
getSize().y/2));
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
event.setType(EMouseButtonDownEvent);
|
||||
|
|
|
@ -168,8 +168,8 @@ void X11Device::init(Device *other) {
|
|||
|
||||
/* Find the best matching screen resolution */
|
||||
for (int i=0; i<modeCount; ++i) {
|
||||
if (modes[i]->hdisplay == m_dimension.x &&
|
||||
modes[i]->vdisplay == m_dimension.y)
|
||||
if (modes[i]->hdisplay == m_size.x &&
|
||||
modes[i]->vdisplay == m_size.y)
|
||||
modeList.push_back(modes[i]);
|
||||
}
|
||||
/* Release the memory held by the resolution list */
|
||||
|
@ -201,7 +201,7 @@ void X11Device::init(Device *other) {
|
|||
|
||||
m_window = XCreateWindow(session->m_display, session->m_root,
|
||||
0, 0, /* x,y position*/
|
||||
m_dimension.x, m_dimension.y,
|
||||
m_size.x, m_size.y,
|
||||
0, m_visinfo->depth, /* border width, color depth */
|
||||
InputOutput, m_visinfo->visual,
|
||||
CWBackPixel | CWBorderPixel | CWColormap |
|
||||
|
@ -221,14 +221,14 @@ void X11Device::init(Device *other) {
|
|||
} else {
|
||||
/* Center the window if needed */
|
||||
if (m_center) {
|
||||
m_position.x = (DisplayWidth(session->m_display, session->m_screen) - m_dimension.x) / 2;
|
||||
m_position.y = (DisplayHeight(session->m_display, session->m_screen) - m_dimension.y) / 2;
|
||||
m_position.x = (DisplayWidth(session->m_display, session->m_screen) - m_size.x) / 2;
|
||||
m_position.y = (DisplayHeight(session->m_display, session->m_screen) - m_size.y) / 2;
|
||||
}
|
||||
|
||||
/* Create the X window */
|
||||
unsigned long mask = CWBackPixel | CWBorderPixel | CWColormap;
|
||||
m_window = XCreateWindow(session->m_display, session->m_root,
|
||||
m_position.x, m_position.y, m_dimension.x, m_dimension.y, 0, m_visinfo->depth,
|
||||
m_position.x, m_position.y, m_size.x, m_size.y, 0, m_visinfo->depth,
|
||||
InputOutput, m_visinfo->visual, mask, &x11attr);
|
||||
|
||||
if (!m_window)
|
||||
|
@ -236,8 +236,8 @@ void X11Device::init(Device *other) {
|
|||
|
||||
/* Make the window non-resizable */
|
||||
XSizeHints *hints = XAllocSizeHints();
|
||||
hints->min_width = hints->max_width = hints->width = m_dimension.x;
|
||||
hints->min_height = hints->max_height = hints->height = m_dimension.y;
|
||||
hints->min_width = hints->max_width = hints->width = m_size.x;
|
||||
hints->min_height = hints->max_height = hints->height = m_size.y;
|
||||
hints->x = m_position.x; hints->y = m_position.y;
|
||||
hints->flags = PMaxSize | PMinSize | USSize | USPosition;
|
||||
XSetNormalHints(session->m_display, m_window, hints);
|
||||
|
@ -426,10 +426,10 @@ void X11Device::processEvent(const XEvent &event) {
|
|||
translateMouse(event, deviceEvent);
|
||||
deviceEvent.setMouseButton(m_buttonState);
|
||||
if (m_grab)
|
||||
warpMouse(Point2i(getDimension().x / 2, getDimension().y/2));
|
||||
warpMouse(Point2i(getSize().x / 2, getSize().y/2));
|
||||
int xpos = deviceEvent.getMousePosition().x;
|
||||
int ypos = deviceEvent.getMousePosition().y;
|
||||
if (xpos > m_dimension.x || xpos < 0 || ypos > m_dimension.y || ypos < 0)
|
||||
if (xpos > m_size.x || xpos < 0 || ypos > m_size.y || ypos < 0)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1054,5 +1054,5 @@ void GLWidget::onUpdateView() {
|
|||
|
||||
void GLWidget::resizeGL(int width, int height) {
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
m_device->setDimension(Vector2i(width, height));
|
||||
m_device->setSize(Vector2i(width, height));
|
||||
}
|
||||
|
|
|
@ -219,8 +219,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void init() {
|
||||
bool init(int argc, char **argv) {
|
||||
m_renderer->setPointSize(4.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
|
|
Loading…
Reference in New Issue