Texture 类
template <typename T> class Texture : public ReferenceCounted {
public:
// Texture Interface
virtual T Evaluate(const DifferentialGeometry &) const = 0;
virtual ~Texture() { }
};
作用:
(Texture 是一个 模板类,evaluation 函数返回的值得类型就可以多样化,目前 pbrt 中,evaluation 返回的类型主要是 float 和 Spectrum)
Texture is a template class parameterized by the return type of its evaluation function.
This design makes it possible to reuse almost all of the texturing code between textures
that return different types. pbrt currently uses only float and Spectrum textures.
1. virtual T Evaluate(const DifferentialGeometry &) const = 0;
作用:
(Evaluate 函数 主要的就是 利用 1个 DifferentialGeometry 作为参数,计算图片中 一个 模板类型T的值)
The key to Texture’s interface is its evaluation function; it returns a value of the template
type T. The only information it has access to in order to evaluate its value is the
DifferentialGeometry at the point being shaded. Different textures in this chapter will
use different parts of this structure to drive their evaluation.
ConstantTexture 类
template <typename T> class ConstantTexture : public Texture<T> {
public:
// ConstantTexture Public Methods
Constant