19 #include <nori/bsdf.h>
20 #include <nori/frame.h>
21 #include <nori/warp.h>
22 #include <nori/texture.h>
32 if(propList.has(
"albedo")) {
46 if(obj->getIdName() ==
"albedo") {
52 throw NoriException(
"The name of this texture does not match any field!");
57 throw NoriException(
"Diffuse::addChild(<%s>) is not supported!",
81 return m_albedo->eval(bRec.
uv) * INV_PI;
119 return m_albedo->eval(bRec.
uv);
132 m_albedo ? indent(m_albedo->
toString()) : std::string(
"null")
142 NORI_REGISTER_CLASS(
Diffuse,
"diffuse");
Superclass of all bidirectional scattering distribution functions.
Diffuse / Lambertian BRDF model.
virtual EClassType getClassType() const override
Return the type of object (i.e. Mesh/BSDF/etc.) provided by this instance.
virtual Color3f eval(const BSDFQueryRecord &bRec) const override
Evaluate the BRDF model.
virtual std::string toString() const override
Return a human-readable summary.
virtual void activate() override
Perform some action associated with the object.
virtual float pdf(const BSDFQueryRecord &bRec) const override
Compute the density of sample() wrt. solid angles.
bool isDiffuse() const
Return whether or not this BRDF is diffuse. This is primarily used by photon mapping to decide whethe...
virtual Color3f sample(BSDFQueryRecord &bRec, const Point2f &sample) const override
Draw a a sample from the BRDF model.
virtual void addChild(NoriObject *obj) override
Add texture for the albedo.
Simple exception class, which stores a human-readable error description.
static NoriObject * createInstance(const std::string &name, const PropertyList &propList)
Construct an instance from the class of the given name.
Base class of all objects.
virtual void activate()
Perform some action associated with the object.
virtual std::string toString() const =0
Return a brief string summary of the instance (for debugging purposes)
static std::string classTypeName(EClassType type)
Turn a class type into a human-readable string.
virtual EClassType getClassType() const =0
Return the type of object (i.e. Mesh/BSDF/etc.) provided by this instance.
This is an associative container used to supply the constructors of NoriObject subclasses with parame...
void setColor(const std::string &name, const Color3f &value)
Set a color property.
Color3f getColor(const std::string &name) const
Get a color property, and throw an exception if it does not exist.
static Vector3f squareToCosineHemisphere(const Point2f &sample)
Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to projected so...
Convenience data structure used to pass multiple parameters to the evaluation and sampling routines i...
Vector3f wo
Outgoing direction (in the local frame)
Vector3f wi
Incident direction (in the local frame)
EMeasure measure
Measure associated with the sample.
Point2f uv
UV associated with the point.
float eta
Relative refractive index in the sampled direction.
Represents a linear RGB color value.
static float cosTheta(const Vector3f &v)
Assuming that the given direction is in the local coordinate system, return the cosine of the angle b...