bool HomogeneousVolumeDensity::SampleDirection(const Point &p, const Vector& wi, Vector& wo, float* pdf, RNG &rng) const { const Point Pobj = WorldToVolume(p); if(extent.Inside(Pobj)) { wo = SampleHG(wi, g, rng.RandomFloat(), rng.RandomFloat()); *pdf = PhaseHG(wi, wo, g); return true; } else { return false; } }
bool IntersectP(const Ray &r, float *t0, float *t1) const { Ray ray = WorldToVolume(r); return extent.IntersectP(ray, t0, t1); }
float p(const Point &p, const Vector &wi, const Vector &wo) const { if (!extent.Inside(WorldToVolume(p))) return 0.; return PhaseHG(wi, wo, g); }
Spectrum Lve(const Point &p, const Vector &) const { return extent.Inside(WorldToVolume(p)) ? le : 0.; }
Spectrum sigma_t(const Point &p, const Vector &) const { return extent.Inside(WorldToVolume(p)) ? (sig_a + sig_s) : 0.; }
Spectrum sigma_s(const Point &p, const Vector &) const { return extent.Inside(WorldToVolume(p)) ? sig_s : 0.; }