implemented getRoughness() for the remainder of BSDFs

metadata
Wenzel Jakob 2012-10-12 11:49:53 -04:00
parent cf5bf411e4
commit aec0c6a984
6 changed files with 33 additions and 0 deletions

View File

@ -261,6 +261,12 @@ public:
}
}
Float getRoughness(const Intersection &its, int component) const {
int bsdfIndex = m_indices[component].first;
component = m_indices[component].second;
return m_bsdfs[bsdfIndex]->getRoughness(its, component);
}
void addChild(const std::string &name, ConfigurableObject *child) {
if (child->getClass()->derivesFrom(MTS_CLASS(BSDF))) {
BSDF *bsdf = static_cast<BSDF *>(child);

View File

@ -230,6 +230,10 @@ public:
return result;
}
Float getRoughness(const Intersection &its, int component) const {
return m_nested->getRoughness(its, component);
}
std::string toString() const {
std::ostringstream oss;
oss << "BumpMap[" << endl

View File

@ -379,6 +379,11 @@ public:
return SmoothCoating::sample(bRec, pdf, sample);
}
Float getRoughness(const Intersection &its, int component) const {
return component < (int) m_components.size()
? m_nested->getRoughness(its, component) : (Float) 0;
}
std::string toString() const {
std::ostringstream oss;
oss << "SmoothCoating[" << endl

View File

@ -408,6 +408,12 @@ public:
}
}
Float getRoughness(const Intersection &its, int component) const {
/* For lack of a better value, treat this material as diffuse
in Manifold Exploration */
return std::numeric_limits<Float>::infinity();
}
std::string toString() const {
std::ostringstream oss;
oss << "HanrahanKrueger[" << endl

View File

@ -614,6 +614,12 @@ public:
return al / (4.0f * M_PI) * c1 * c2 / (c1 + c2);
}
Float getRoughness(const Intersection &its, int component) const {
/* For lack of a better value, treat this material as diffuse
in Manifold Exploration */
return std::numeric_limits<Float>::infinity();
}
std::string toString() const {
std::ostringstream oss;
oss << "IrawanClothBRDF[" << endl

View File

@ -437,6 +437,12 @@ public:
return RoughCoating::sample(bRec, pdf, sample);
}
Float getRoughness(const Intersection &its, int component) const {
return component < (int) m_components.size()
? m_nested->getRoughness(its, component)
: m_alpha->getAverage().average();
}
void addChild(const std::string &name, ConfigurableObject *child) {
if (child->getClass()->derivesFrom(MTS_CLASS(BSDF))) {
if (m_nested != NULL)