VolumeRegion 类
class VolumeRegion {
public:
// VolumeRegion Interface
virtual ~VolumeRegion();
virtual BBox WorldBound() const = 0;
virtual bool IntersectP(const Ray &ray, float *t0, float *t1) const = 0;
virtual Spectrum sigma_a(const Point &, const Vector &,
float time) const = 0;
virtual Spectrum sigma_s(const Point &, const Vector &,
float time) const = 0;
virtual Spectrum Lve(const Point &, const Vector &,
float time) const = 0;
virtual float p(const Point &, const Vector &,
const Vector &, float time) const = 0;
virtual Spectrum sigma_t(const Point &p, const Vector &wo, float time) const;
virtual Spectrum tau(const Ray &ray, float step = 1.f,
float offset = 0.5) const = 0;
};
类的作用:
(这个类 简单理解就是 一块体积散射区域)
The key abstraction for describing volume scattering in pbrt is the abstract VolumeRegion
class—the interface to describe volume scattering in a region of the scene. Multiple
VolumeRegions of different types can be used to describe different kinds of scattering in
different parts of the scene. In this section, we will describe the basic interface.
1. virtual BBox WorldBound() const = 0;
作用:
(世界空间的包围盒)
All VolumeRegions must be able to compute their axis-aligned world space bounding
box, which is returned by the VolumeRegion::WorldBound() method. As with Shapes and
Primitives, this bound can be used to place VolumeRegions into acceleration structures.
2. virtual bool IntersectP(const Ray &ray, float *t0, float *t1) const = 0;
作用:
(假如 与 Ray 相交,计算返回 Ray 穿过这个 volume 的交点 t0 和 t1)
Because VolumeIntegrators need to know the parametric range of a world space ray that
passes through a volume regi