diff --git a/include/mitsuba/core/octree.h b/include/mitsuba/core/octree.h index 3cfad1e2..94c2142a 100644 --- a/include/mitsuba/core/octree.h +++ b/include/mitsuba/core/octree.h @@ -231,7 +231,7 @@ protected: return result; } - inline StaticOctree() { } + inline StaticOctree() : m_root(NULL) { } protected: AABB m_aabb; std::vector m_items; diff --git a/src/subsurface/dipole.cpp b/src/subsurface/dipole.cpp index 04768763..b43b3e47 100644 --- a/src/subsurface/dipole.cpp +++ b/src/subsurface/dipole.cpp @@ -437,7 +437,7 @@ public: std::vector &samples = proc->getIrradianceSampleVector()->get(); sa /= samples.size(); - + for (size_t i=0; ireadFloat(); } /** @@ -127,6 +128,7 @@ public: inline void serialize(Stream *stream) const { p.serialize(stream); E.serialize(stream); + stream->writeFloat(area); } /// Return the position (used by the octree code) diff --git a/src/subsurface/irrtree.cpp b/src/subsurface/irrtree.cpp index e43303b9..21ac133e 100644 --- a/src/subsurface/irrtree.cpp +++ b/src/subsurface/irrtree.cpp @@ -35,6 +35,8 @@ IrradianceOctree::IrradianceOctree(const AABB &bounds, Float solidAngleThreshold IrradianceOctree::IrradianceOctree(Stream *stream, InstanceManager *manager) { m_aabb = AABB(stream); + m_maxDepth = stream->readUInt(); + m_maxItems = stream->readUInt(); m_solidAngleThreshold = stream->readFloat(); size_t items = stream->readSize(); @@ -49,6 +51,8 @@ IrradianceOctree::IrradianceOctree(Stream *stream, InstanceManager *manager) { void IrradianceOctree::serialize(Stream *stream, InstanceManager *manager) const { m_aabb.serialize(stream); + stream->writeUInt(m_maxDepth); + stream->writeUInt(m_maxItems); stream->writeFloat(m_solidAngleThreshold); stream->writeSize(m_items.size()); @@ -98,5 +102,5 @@ void IrradianceOctree::propagate(OctreeNode *node) { ++statsNumNodes; } - +MTS_IMPLEMENT_CLASS_S(IrradianceOctree, false, SerializableObject) MTS_NAMESPACE_END diff --git a/src/subsurface/irrtree.h b/src/subsurface/irrtree.h index a6014296..92b18dc3 100644 --- a/src/subsurface/irrtree.h +++ b/src/subsurface/irrtree.h @@ -42,6 +42,7 @@ public: performQuery(m_aabb, m_root, query); } + MTS_DECLARE_CLASS() protected: /// Propagate irradiance approximations througout the tree void propagate(OctreeNode *node);