19 #if !defined(__NORI_MESH_H)
22 #include <nori/shape.h>
23 #include <nori/dpdf.h>
44 virtual BoundingBox3f getBoundingBox(uint32_t index)
const override;
47 virtual Point3f getCentroid(uint32_t index)
const override;
74 virtual bool rayIntersect(uint32_t index,
const Ray3f &ray,
float &u,
float &v,
float &t)
const override;
92 Point3f getInterpolatedVertex(uint32_t index,
const Vector3f & bc)
const;
112 virtual std::string
toString()
const override;
MatrixXf m_UV
Vertex texture coordinates.
virtual void setHitInformation(uint32_t index, const Ray3f &ray, Intersection &its) const override
Set intersection information: hit point, shading frame, UVs.
virtual void sampleSurface(ShapeQueryRecord &sRec, const Point2f &sample) const override
Uniformly sample a position on the mesh with respect to surface area.
MatrixXf m_N
Vertex normals.
const MatrixXf & getVertexNormals() const
Return a pointer to the vertex normals (or nullptr if there are none)
uint32_t getVertexCount() const
Return the total number of vertices in this shape.
virtual std::string toString() const override
Return a human-readable summary of this instance.
const std::string & getName() const
Return the name of this mesh.
std::string m_name
Identifying name.
Mesh()
Create an empty mesh.
virtual uint32_t getPrimitiveCount() const override
Return the total number of triangles in this shape.
virtual void activate() override
Initialize internal data structures (called once by the XML parser)
const MatrixXf & getVertexPositions() const
Return a pointer to the vertex positions.
const MatrixXf & getVertexTexCoords() const
Return a pointer to the texture coordinates (or nullptr if there are none)
MatrixXf m_V
Vertex positions.
virtual bool rayIntersect(uint32_t index, const Ray3f &ray, float &u, float &v, float &t) const override
Ray-triangle intersection test.
virtual float pdfSurface(const ShapeQueryRecord &sRec) const override
Return the probability of sampling a point sRec.p by the sampleSurface() method (sRec....
const MatrixXu & getIndices() const
Return a pointer to the triangle vertex index list.
float surfaceArea(uint32_t index) const
Return the surface area of the given triangle.
Superclass of all shapes.
Discrete probability distribution.
Intersection data structure.
3-dimensional surface normal representation
Data record for conveniently querying and sampling the a point on a shape.