diff --git a/include/mitsuba/render/shape.h b/include/mitsuba/render/shape.h index be414480..b4f429e0 100644 --- a/include/mitsuba/render/shape.h +++ b/include/mitsuba/render/shape.h @@ -184,7 +184,6 @@ public: /// Return the name of this shape (e.g. the filename) virtual std::string getName() const; - /// Is this a compound shape consisting of several sub-objects? virtual bool isCompound() const; @@ -519,6 +518,7 @@ protected: /// Virtual destructor virtual ~Shape(); protected: + std::string m_name; ref m_bsdf; ref m_subsurface; ref m_emitter; diff --git a/include/mitsuba/render/trimesh.h b/include/mitsuba/render/trimesh.h index d6200c0e..71ca6dcd 100644 --- a/include/mitsuba/render/trimesh.h +++ b/include/mitsuba/render/trimesh.h @@ -94,9 +94,6 @@ public: //! @{ \name General query functions // ============================================================= - /// Return the name of this shape (e.g. the filename) - std::string getName() const; - /// Return the total surface area Float getSurfaceArea() const; @@ -356,7 +353,6 @@ protected: /// Prepare internal tables for sampling uniformly wrt. area void prepareSamplingTable(); protected: - std::string m_name; AABB m_aabb; Triangle *m_triangles; Point *m_positions; diff --git a/src/libbidir/mut_manifold.cpp b/src/libbidir/mut_manifold.cpp index 31beff0c..8c42c908 100644 --- a/src/libbidir/mut_manifold.cpp +++ b/src/libbidir/mut_manifold.cpp @@ -191,7 +191,7 @@ bool ManifoldPerturbation::sampleMutationRecord( Float sample = m_sampler->next1D(); a = -1; - if (source.vertex(k-1)->isConnectable()) { + if (source.vertex(k-1)->isConnectable() && false) { /* Extra optimization: slightly prefer perturbations from the sensor */ #define SENSOR_PROB (Float) 0.25f @@ -203,6 +203,9 @@ bool ManifoldPerturbation::sampleMutationRecord( } } + a = 1; + step = 1; + if (a < 0) { step = sample < 0.5f ? 1 : -1; @@ -515,7 +518,7 @@ bool ManifoldPerturbation::sampleMutation( Point p1 = m_manifold->getPosition(1); Float relerr = (p0-p1).length() / std::max(std::max(std::abs(p0.x), std::abs(p0.y)), std::abs(p0.z)); - if (relerr > Epsilon) { + if (relerr > ShadowEpsilon) { ++statsNonReversible; goto fail; } diff --git a/src/librender/shape.cpp b/src/librender/shape.cpp index e55c49ae..2630495b 100644 --- a/src/librender/shape.cpp +++ b/src/librender/shape.cpp @@ -28,10 +28,13 @@ MTS_NAMESPACE_BEGIN Shape::Shape(const Properties &props) - : ConfigurableObject(props) { } + : ConfigurableObject(props) { + m_name = props.getID(); +} Shape::Shape(Stream *stream, InstanceManager *manager) : ConfigurableObject(stream, manager) { + m_name = stream->readString(); m_bsdf = static_cast(manager->getInstance(stream)); m_subsurface = static_cast(manager->getInstance(stream)); m_emitter = static_cast(manager->getInstance(stream)); @@ -83,7 +86,7 @@ bool Shape::isCompound() const { } std::string Shape::getName() const { - return "Unnamed"; + return m_name; } Shape *Shape::getElement(int i) { @@ -183,6 +186,7 @@ const KDTreeBase *Shape::getKDTree() const { void Shape::serialize(Stream *stream, InstanceManager *manager) const { ConfigurableObject::serialize(stream, manager); + stream->writeString(m_name); manager->serialize(stream, m_bsdf.get()); manager->serialize(stream, m_subsurface.get()); manager->serialize(stream, m_emitter.get()); diff --git a/src/librender/trimesh.cpp b/src/librender/trimesh.cpp index 921ca9f6..994df18b 100644 --- a/src/librender/trimesh.cpp +++ b/src/librender/trimesh.cpp @@ -351,10 +351,6 @@ TriMesh::~TriMesh() { delete[] m_triangles; } -std::string TriMesh::getName() const { - return m_name; -} - AABB TriMesh::getAABB() const { return m_aabb; } diff --git a/src/shapes/cube.cpp b/src/shapes/cube.cpp index bec36a27..7509da62 100644 --- a/src/shapes/cube.cpp +++ b/src/shapes/cube.cpp @@ -73,7 +73,6 @@ static uint32_t CubeData_triangles[][3] = {{0, 1, 2}, {3, 0, 2}, {4, 5, 6}, {7, class Cube : public TriMesh { public: Cube(const Properties &props) : TriMesh(props) { - m_name = props.getID(); m_triangleCount = 12; m_vertexCount = 24; m_positions = new Point[m_vertexCount]; diff --git a/src/shapes/obj.cpp b/src/shapes/obj.cpp index 1bcce7ab..65b2a550 100644 --- a/src/shapes/obj.cpp +++ b/src/shapes/obj.cpp @@ -350,7 +350,6 @@ public: WavefrontOBJ(Stream *stream, InstanceManager *manager) : Shape(stream, manager) { m_aabb = AABB(stream); - m_name = stream->readString(); uint32_t meshCount = stream->readUInt(); m_meshes.resize(meshCount); @@ -364,7 +363,6 @@ public: Shape::serialize(stream, manager); m_aabb.serialize(stream); - stream->writeString(m_name); stream->writeUInt((uint32_t) m_meshes.size()); for (size_t i=0; iserialize(stream, m_meshes[i]); @@ -806,10 +804,6 @@ public: return shape; } - std::string getName() const { - return m_name; - } - AABB getAABB() const { return m_aabb; } @@ -840,7 +834,6 @@ private: std::vector m_meshes; std::vector m_materialAssignment; bool m_flipNormals, m_faceNormals; - std::string m_name; AABB m_aabb; bool m_collapse; }; diff --git a/src/shapes/shapegroup.cpp b/src/shapes/shapegroup.cpp index 62097b9d..5f3de8a5 100644 --- a/src/shapes/shapegroup.cpp +++ b/src/shapes/shapegroup.cpp @@ -72,7 +72,6 @@ MTS_NAMESPACE_BEGIN ShapeGroup::ShapeGroup(const Properties &props) : Shape(props) { m_kdtree = new ShapeKDTree(); - m_name = props.getID(); } ShapeGroup::ShapeGroup(Stream *stream, InstanceManager *manager) @@ -143,10 +142,6 @@ bool ShapeGroup::isCompound() const { return true; } -std::string ShapeGroup::getName() const { - return m_name; -} - size_t ShapeGroup::getPrimitiveCount() const { const std::vector &shapes = m_kdtree->getShapes(); size_t result = 0; diff --git a/src/shapes/shapegroup.h b/src/shapes/shapegroup.h index 29fb338d..01f7dca5 100644 --- a/src/shapes/shapegroup.h +++ b/src/shapes/shapegroup.h @@ -68,16 +68,12 @@ public: /// Return the effective primitive count of this shape (always zero) size_t getEffectivePrimitiveCount() const; - /// Return the name of the geometry group - std::string getName() const; - /// Return a string representation std::string toString() const; MTS_DECLARE_CLASS() private: ref m_kdtree; - std::string m_name; }; MTS_NAMESPACE_END