19 #include <nori/shape.h>
20 #include <nori/bsdf.h>
21 #include <nori/emitter.h>
22 #include <nori/warp.h>
30 m_radius = propList.
getFloat(
"radius", 1.f);
38 virtual Point3f getCentroid(uint32_t index)
const override {
return m_position; }
40 virtual bool rayIntersect(uint32_t index,
const Ray3f &ray,
float &u,
float &v,
float &t)
const override {
53 sRec.
p = m_position + m_radius * q;
62 virtual std::string
toString()
const override {
81 NORI_REGISTER_CLASS(
Sphere,
"sphere");
virtual std::string toString() const =0
Return a brief string summary of the instance (for debugging purposes)
This is an associative container used to supply the constructors of NoriObject subclasses with parame...
float getFloat(const std::string &name) const
Get a float property, and throw an exception if it does not exist.
Point3f getPoint3(const std::string &name) const
Get a point property, and throw an exception if it does not exist.
Superclass of all shapes.
BSDF * m_bsdf
BSDF of the surface.
Emitter * m_emitter
Associated emitter, if any.
BoundingBox3f m_bbox
Bounding box of the mesh.
virtual void setHitInformation(uint32_t index, const Ray3f &ray, Intersection &its) const override
Set the intersection information: hit point, shading frame, UVs, etc.
virtual std::string toString() const override
Return a brief string summary of the instance (for debugging purposes)
virtual void sampleSurface(ShapeQueryRecord &sRec, const Point2f &sample) const override
Sample a point on the surface (potentially using the point sRec.ref to importance sample) This method...
virtual float pdfSurface(const ShapeQueryRecord &sRec) const override
Return the probability of sampling a point sRec.p by the sampleSurface() method (sRec....
static Vector3f squareToUniformSphere(const Point2f &sample)
Uniformly sample a vector on the unit sphere with respect to solid angles.
static float squareToUniformSpherePdf(const Vector3f &v)
Probability density of squareToUniformSphere()
Intersection data structure.
Data record for conveniently querying and sampling the a point on a shape.
Normal3f n
Sampled normal.
float pdf
Probability of the sample.
void expandBy(const PointType &p)
Expand the bounding box to contain another point.
std::string toString() const
Return a human-readable string summary.