had forgotten about the phong model, other minor tweaks

metadata
Wenzel Jakob 2012-10-12 13:07:14 -04:00
parent eb423bf9f9
commit 6aa7534d67
3 changed files with 11 additions and 2 deletions

View File

@ -263,6 +263,15 @@ public:
manager->serialize(stream, m_exponent.get());
}
Float getRoughness(const Intersection &its, int component) const {
Assert(component == 0 || component == 1);
/* Find the Beckmann-equivalent roughness */
if (component == 0)
return std::sqrt(2 / (2+m_exponent->eval(its).average()));
else
return std::numeric_limits<Float>::infinity();
}
std::string toString() const {
std::ostringstream oss;
oss << "Phong[" << endl

View File

@ -440,7 +440,7 @@ public:
Float getRoughness(const Intersection &its, int component) const {
return component < (int) m_components.size()
? m_nested->getRoughness(its, component)
: m_alpha->getAverage().average();
: m_alpha->eval(its).average();
}
void addChild(const std::string &name, ConfigurableObject *child) {

View File

@ -505,7 +505,7 @@ public:
Assert(component == 0 || component == 1);
if (component == 0)
return m_alpha->getAverage().average();
return m_alpha->eval(its).average();
else
return std::numeric_limits<Float>::infinity();
}