fixed SSS material

metadata
Wenzel Jakob 2010-10-21 12:02:10 +02:00
parent 00c1c6d941
commit 543c43509c
3 changed files with 30 additions and 21 deletions

View File

@ -50,16 +50,26 @@ Subsurface::Subsurface(Stream *stream, InstanceManager *manager) :
m_eta = stream->readFloat();
m_sizeMultiplier = stream->readFloat();
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;
}
Subsurface::~Subsurface() {
}
void Subsurface::setParent(ConfigurableObject *parent) {
if (parent->getClass()->derivesFrom(Shape::m_theClass)) {
Shape *shape = static_cast<Shape *>(parent);
m_shapes.push_back(shape);
m_configured = false;
if (shape->isCompound())
return;
if (std::find(m_shapes.begin(), m_shapes.end(), shape) == m_shapes.end()) {
m_shapes.push_back(shape);
m_configured = false;
}
} else {
Log(EError, "IsotropicDipole: Invalid child node!");
}
@ -77,8 +87,5 @@ void Subsurface::serialize(Stream *stream, InstanceManager *manager) const {
manager->serialize(stream, m_shapes[i]);
}
Subsurface::~Subsurface() {
}
MTS_IMPLEMENT_CLASS(Subsurface, true, NetworkedObject)
MTS_NAMESPACE_END

View File

@ -214,16 +214,6 @@ public:
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
inline AABB getAABB(Float start, Float end) const {
AABB result;
@ -238,6 +228,17 @@ public:
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 {
/* Very approximate .. */
return getAABB(0, m_length);

View File

@ -255,13 +255,14 @@ public:
Float sa = 0;
for (std::vector<Shape *>::iterator it = m_shapes.begin();
it != m_shapes.end(); ++it)
it != m_shapes.end(); ++it)
sa += (*it)->getSurfaceArea();
size_t sampleCount = (size_t) std::ceil(sa / (M_PI * m_minMFP * m_minMFP)
* m_sampleMultiplier);
Log(EInfo, "Generating " SIZE_T_FMT " irradiance samples..", sampleCount);
ref<Scheduler> sched = Scheduler::getInstance();
/* This could be a bit more elegant.. - inform the irradiance
sampler about the index of this subsurface integrator */
std::vector<Subsurface *> ssIntegrators
@ -295,7 +296,7 @@ public:
m_octreeResID = Scheduler::getInstance()->registerResource(m_octree);
m_ready = true;
return false;
return true;
}
void wakeup(std::map<std::string, SerializableObject *> &params) {