field.cpp: added ability to extract albedo values

metadata
Wenzel Jakob 2014-02-23 16:12:01 +01:00
parent 209a19967b
commit b27a81f71b
1 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,7 @@ MTS_NAMESPACE_BEGIN
* \item \code{geoNormal}: Geometric surface normal
* \item \code{shNormal}: Shading surface normal
* \item \code{uv}: UV coordinate value
* \item \code{albedo}: Albedo value of the BSDF
* \item \code{shapeIndex}: Integer index of the high-level shape
* \item \code{primIndex}: Integer shape primitive index
* \end{itemize}
@ -60,6 +61,7 @@ public:
EGeometricNormal,
EShadingNormal,
EUV,
EAlbedo,
EShapeIndex,
EPrimIndex
};
@ -79,6 +81,8 @@ public:
m_field = EShadingNormal;
} else if (field == "uv") {
m_field = EUV;
} else if (field == "albedo") {
m_field = EAlbedo;
} else if (field == "shapeIndex") {
m_field = EShapeIndex;
} else if (field == "primIndex") {
@ -146,6 +150,9 @@ public:
case EUV:
result.fromLinearRGB(its.uv.x, its.uv.y, 0);
break;
case EAlbedo:
result = its.shape->getBSDF()->getDiffuseReflectance(its);
break;
case EShapeIndex: {
const ref_vector<Shape> &shapes = rRec.scene->getShapes();
result = Spectrum((Float) -1);