More consistent name handling across various shape implementations (patch by Lorenzo Tessari)
parent
23eb714038
commit
b821dc9e33
|
@ -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<BSDF> m_bsdf;
|
||||
ref<Subsurface> m_subsurface;
|
||||
ref<Emitter> m_emitter;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<BSDF *>(manager->getInstance(stream));
|
||||
m_subsurface = static_cast<Subsurface *>(manager->getInstance(stream));
|
||||
m_emitter = static_cast<Emitter *>(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<AABB> *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());
|
||||
|
|
|
@ -351,10 +351,6 @@ TriMesh::~TriMesh() {
|
|||
delete[] m_triangles;
|
||||
}
|
||||
|
||||
std::string TriMesh::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
AABB TriMesh::getAABB() const {
|
||||
return m_aabb;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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; i<m_meshes.size(); ++i)
|
||||
manager->serialize(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<TriMesh *> m_meshes;
|
||||
std::vector<std::string> m_materialAssignment;
|
||||
bool m_flipNormals, m_faceNormals;
|
||||
std::string m_name;
|
||||
AABB m_aabb;
|
||||
bool m_collapse;
|
||||
};
|
||||
|
|
|
@ -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<const Shape *> &shapes = m_kdtree->getShapes();
|
||||
size_t result = 0;
|
||||
|
|
|
@ -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<ShapeKDTree> m_kdtree;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
MTS_NAMESPACE_END
|
||||
|
|
Loading…
Reference in New Issue