Implenting volume

This commit is contained in:
CJSatnarine
2024-07-11 14:29:54 -04:00
parent 5203ed3e17
commit f90cdb0bd2
13 changed files with 148733 additions and 348595 deletions

View File

@@ -105,4 +105,19 @@ class diffuseLight : public material {
shared_ptr<texture> tex;
};
class isotropic : public material {
public:
isotropic(const colour& albedo) : tex(make_shared<solidColour>(albedo)) {}
isotropic(shared_ptr<texture> tex) : tex(tex) {}
bool scatter(const ray& rIn, const hitRecord& rec, colour& attenuation, ray& scattered) {
scattered = ray(rec.p, randomUnitVector(), rIn.time());
attenuation = tex->value(rec.u, rec.v, rec.p);
return true;
}
private:
shared_ptr<texture> tex;
};
#endif