fixed SSS material
parent
00c1c6d941
commit
543c43509c
|
@ -50,16 +50,26 @@ Subsurface::Subsurface(Stream *stream, InstanceManager *manager) :
|
||||||
m_eta = stream->readFloat();
|
m_eta = stream->readFloat();
|
||||||
m_sizeMultiplier = stream->readFloat();
|
m_sizeMultiplier = stream->readFloat();
|
||||||
unsigned int shapeCount = stream->readUInt();
|
unsigned int shapeCount = stream->readUInt();
|
||||||
for (unsigned int i=0; i<shapeCount; ++i)
|
|
||||||
m_shapes.push_back(static_cast<Shape *>(manager->getInstance(stream)));
|
for (unsigned int i=0; i<shapeCount; ++i) {
|
||||||
|
Shape *shape = static_cast<Shape *>(manager->getInstance(stream));
|
||||||
|
m_shapes.push_back(shape);
|
||||||
|
}
|
||||||
m_sigmaT = m_sigmaS + m_sigmaA;
|
m_sigmaT = m_sigmaS + m_sigmaA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Subsurface::~Subsurface() {
|
||||||
|
}
|
||||||
|
|
||||||
void Subsurface::setParent(ConfigurableObject *parent) {
|
void Subsurface::setParent(ConfigurableObject *parent) {
|
||||||
if (parent->getClass()->derivesFrom(Shape::m_theClass)) {
|
if (parent->getClass()->derivesFrom(Shape::m_theClass)) {
|
||||||
Shape *shape = static_cast<Shape *>(parent);
|
Shape *shape = static_cast<Shape *>(parent);
|
||||||
m_shapes.push_back(shape);
|
if (shape->isCompound())
|
||||||
m_configured = false;
|
return;
|
||||||
|
if (std::find(m_shapes.begin(), m_shapes.end(), shape) == m_shapes.end()) {
|
||||||
|
m_shapes.push_back(shape);
|
||||||
|
m_configured = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log(EError, "IsotropicDipole: Invalid child node!");
|
Log(EError, "IsotropicDipole: Invalid child node!");
|
||||||
}
|
}
|
||||||
|
@ -77,8 +87,5 @@ void Subsurface::serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
manager->serialize(stream, m_shapes[i]);
|
manager->serialize(stream, m_shapes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Subsurface::~Subsurface() {
|
|
||||||
}
|
|
||||||
|
|
||||||
MTS_IMPLEMENT_CLASS(Subsurface, true, NetworkedObject)
|
MTS_IMPLEMENT_CLASS(Subsurface, true, NetworkedObject)
|
||||||
MTS_NAMESPACE_END
|
MTS_NAMESPACE_END
|
||||||
|
|
|
@ -214,16 +214,6 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB getClippedAABB(const AABB &box) const {
|
|
||||||
/* Compute a base bounding box */
|
|
||||||
AABB base(getAABB());
|
|
||||||
base.clip(box);
|
|
||||||
|
|
||||||
/* Now forget about the cylinder ends and
|
|
||||||
intersect an infinite cylinder with each AABB face */
|
|
||||||
return box;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
inline AABB getAABB(Float start, Float end) const {
|
inline AABB getAABB(Float start, Float end) const {
|
||||||
AABB result;
|
AABB result;
|
||||||
|
@ -238,6 +228,17 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AABB getClippedAABB(const AABB &box) const {
|
||||||
|
/* Compute a base bounding box */
|
||||||
|
AABB base(getAABB());
|
||||||
|
base.clip(box);
|
||||||
|
|
||||||
|
/* Now forget about the cylinder ends and
|
||||||
|
intersect an infinite cylinder with each AABB face */
|
||||||
|
return box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
AABB getAABB() const {
|
AABB getAABB() const {
|
||||||
/* Very approximate .. */
|
/* Very approximate .. */
|
||||||
return getAABB(0, m_length);
|
return getAABB(0, m_length);
|
||||||
|
|
|
@ -255,13 +255,14 @@ public:
|
||||||
|
|
||||||
Float sa = 0;
|
Float sa = 0;
|
||||||
for (std::vector<Shape *>::iterator it = m_shapes.begin();
|
for (std::vector<Shape *>::iterator it = m_shapes.begin();
|
||||||
it != m_shapes.end(); ++it)
|
it != m_shapes.end(); ++it)
|
||||||
sa += (*it)->getSurfaceArea();
|
sa += (*it)->getSurfaceArea();
|
||||||
size_t sampleCount = (size_t) std::ceil(sa / (M_PI * m_minMFP * m_minMFP)
|
size_t sampleCount = (size_t) std::ceil(sa / (M_PI * m_minMFP * m_minMFP)
|
||||||
* m_sampleMultiplier);
|
* m_sampleMultiplier);
|
||||||
|
Log(EInfo, "Generating " SIZE_T_FMT " irradiance samples..", sampleCount);
|
||||||
|
|
||||||
ref<Scheduler> sched = Scheduler::getInstance();
|
ref<Scheduler> sched = Scheduler::getInstance();
|
||||||
|
|
||||||
/* This could be a bit more elegant.. - inform the irradiance
|
/* This could be a bit more elegant.. - inform the irradiance
|
||||||
sampler about the index of this subsurface integrator */
|
sampler about the index of this subsurface integrator */
|
||||||
std::vector<Subsurface *> ssIntegrators
|
std::vector<Subsurface *> ssIntegrators
|
||||||
|
@ -295,7 +296,7 @@ public:
|
||||||
m_octreeResID = Scheduler::getInstance()->registerResource(m_octree);
|
m_octreeResID = Scheduler::getInstance()->registerResource(m_octree);
|
||||||
|
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wakeup(std::map<std::string, SerializableObject *> ¶ms) {
|
void wakeup(std::map<std::string, SerializableObject *> ¶ms) {
|
||||||
|
|
Loading…
Reference in New Issue