19 #if !defined(__NORI_SHAPE_H)
20 #define __NORI_SHAPE_H
22 #include <nori/object.h>
23 #include <nori/frame.h>
24 #include <nori/bbox.h>
127 virtual BoundingBox3f getBoundingBox(uint32_t index)
const = 0;
130 virtual Point3f getCentroid(uint32_t index)
const = 0;
133 virtual bool rayIntersect(uint32_t index,
const Ray3f &ray,
float &u,
float &v,
float &t)
const = 0;
Superclass of all bidirectional scattering distribution functions.
Superclass of all emitters.
Base class of all objects.
Superclass of all shapes.
bool isEmitter() const
Is this mesh an area emitter?
virtual void addChild(NoriObject *child) override
Add a child object to the current instance.
const Emitter * getEmitter() const
Return a pointer to an attached area emitter instance (const version)
virtual void sampleSurface(ShapeQueryRecord &sRec, const Point2f &sample) const =0
Sample a point on the surface (potentially using the point sRec.ref to importance sample) This method...
const BSDF * getBSDF() const
Return a pointer to the BSDF associated with this mesh.
virtual float pdfSurface(const ShapeQueryRecord &sRec) const =0
Return the probability of sampling a point sRec.p by the sampleSurface() method (sRec....
virtual void setHitInformation(uint32_t index, const Ray3f &ray, Intersection &its) const =0
Set the intersection information: hit point, shading frame, UVs, etc.
virtual EClassType getClassType() const override
Return the type of object (i.e. Mesh/BSDF/etc.) provided by this instance.
virtual void activate() override
Initialize internal data structures (called once by the XML parser)
BSDF * m_bsdf
BSDF of the surface.
Emitter * getEmitter()
Return a pointer to an attached area emitter instance.
Emitter * m_emitter
Associated emitter, if any.
BoundingBox3f m_bbox
Bounding box of the mesh.
virtual uint32_t getPrimitiveCount() const
Return the total number of primitives in this shape.
virtual ~Shape()
Release all memory.
Stores a three-dimensional orthonormal coordinate frame.
Vector3f toWorld(const Vector3f &v) const
Convert from local coordinates to world coordinates.
Vector3f toLocal(const Vector3f &v) const
Convert from world coordinates to local coordinates.
Intersection data structure.
const Shape * mesh
Pointer to the associated shape.
Vector3f toWorld(const Vector3f &d) const
Transform a direction vector from local to world coordinates.
std::string toString() const
Return a human-readable summary of the intersection record.
Frame shFrame
Shading frame (based on the shading normal)
float t
Unoccluded distance along the ray.
Frame geoFrame
Geometric frame (based on the true geometry)
Point3f p
Position of the surface intersection.
Intersection()
Create an uninitialized intersection record.
Vector3f toLocal(const Vector3f &d) const
Transform a direction vector into the local shading frame.
Point2f uv
UV coordinates, if any.
3-dimensional surface normal representation
Data record for conveniently querying and sampling the a point on a shape.
ShapeQueryRecord(const Point3f &ref_)
Data structure with ref to call sampleSurface()
Normal3f n
Sampled normal.
Point3f ref
Reference point.
ShapeQueryRecord()
Empty constructor.
float pdf
Probability of the sample.
ShapeQueryRecord(const Point3f &ref_, const Point3f &p_)
Data structure with ref and p to call pdfSurface()