Abstract base class of all shapes. More...
#include <mitsuba/render/shape.h>
Public Member Functions | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Query functions to be implemented in subclasses | |
virtual std::string | getName () const |
Return the name of this shape (e.g. the filename) More... | |
virtual bool | isCompound () const |
Is this a compound shape consisting of several sub-objects? More... | |
virtual Shape * | getElement (int i) |
Return a sub-element of a compound shape. More... | |
virtual Float | getSurfaceArea () const |
Return the shape's surface area. More... | |
virtual AABB | getAABB () const =0 |
Return a bounding box containing the shape. More... | |
virtual AABB | getClippedAABB (const AABB &box) const |
Returns the minimal axis-aligned bounding box of this shape when clipped to another bounding box. More... | |
virtual ref< TriMesh > | createTriMesh () |
Create a triangle mesh approximation of this shape. More... | |
Ray tracing routines | |
virtual bool | rayIntersect (const Ray &ray, Float mint, Float maxt, Float &t, void *temp) const |
Fast ray intersection test. More... | |
virtual bool | rayIntersect (const Ray &ray, Float mint, Float maxt) const |
Fast ray intersection test for visibility queries. More... | |
virtual void | fillIntersectionRecord (const Ray &ray, const void *temp, Intersection &its) const |
Given that an intersection has been found, create a detailed intersection record. More... | |
virtual void | getNormalDerivative (const Intersection &its, Vector &dndu, Vector &dndv, bool shadingFrame=true) const |
Return the derivative of the normal vector with respect to the UV parameterization. More... | |
void | getCurvature (const Intersection &its, Float &H, Float &K, bool shadingFrame=true) const |
Compute the Gaussian and mean curvature at the given surface intersection. More... | |
virtual void | adjustTime (Intersection &its, Float time) const |
virtual const KDTreeBase< AABB > * | getKDTree () const |
Return the internal kd-tree of this shape (if any) More... | |
Sampling routines | |
virtual void | samplePosition (PositionSamplingRecord &pRec, const Point2 &sample) const |
Sample a point on the surface of this shape instance (with respect to the area measure) More... | |
virtual Float | pdfPosition (const PositionSamplingRecord &pRec) const |
Query the probability density of samplePosition() for a particular point on the surface. More... | |
virtual void | sampleDirect (DirectSamplingRecord &dRec, const Point2 &sample) const |
Sample a point on the surface of this shape instance (with respect to the solid angle measure) More... | |
virtual Float | pdfDirect (const DirectSamplingRecord &dRec) const |
Query the probability density of sampleDirect() for a particular point on the surface. More... | |
Miscellaneous | |
bool | isMediumTransition () const |
Does the surface of this shape mark a medium transition? More... | |
Medium * | getInteriorMedium () |
Return the medium that lies on the interior of this shape (NULL == vacuum) More... | |
const Medium * | getInteriorMedium () const |
Return the medium that lies on the interior of this shape (NULL == vacuum, const version) More... | |
Medium * | getExteriorMedium () |
Return the medium that lies on the exterior of this shape (NULL == vacuum) More... | |
const Medium * | getExteriorMedium () const |
Return the medium that lies on the exterior of this shape (NULL == vacuum, const version) More... | |
bool | hasSubsurface () const |
Does this shape have a sub-surface integrator? More... | |
Subsurface * | getSubsurface () |
Return the associated sub-surface integrator. More... | |
const Subsurface * | getSubsurface () const |
Return the associated sub-surface integrator. More... | |
bool | isEmitter () const |
Is this shape also an area emitter? More... | |
Emitter * | getEmitter () |
Return the associated emitter (if any) More... | |
const Emitter * | getEmitter () const |
Return the associated emitter (if any) More... | |
void | setEmitter (Emitter *emitter) |
Set the emitter of this shape. More... | |
bool | isSensor () const |
Is this shape also an area sensor? More... | |
Sensor * | getSensor () |
Return the associated sensor (if any) More... | |
const Sensor * | getSensor () const |
Return the associated sensor (if any) More... | |
bool | hasBSDF () const |
Does the shape have a BSDF? More... | |
const BSDF * | getBSDF () const |
Return the shape's BSDF. More... | |
BSDF * | getBSDF () |
Return the shape's BSDF. More... | |
void | setBSDF (BSDF *bsdf) |
Set the BSDF of this shape. More... | |
virtual size_t | getPrimitiveCount () const =0 |
Return the number of primitives (triangles, hairs, ..) contributed to the scene by this shape. More... | |
virtual size_t | getEffectivePrimitiveCount () const =0 |
Return the number of primitives (triangles, hairs, ..) contributed to the scene by this shape. More... | |
void | copyAttachments (Shape *shape) |
Copy attachments (BSDF, Emitter, ..) from another shape. More... | |
ConfigurableObject interface | |
virtual void | configure () |
Called once after constructing the object. More... | |
virtual void | serialize (Stream *stream, InstanceManager *manager) const |
Serialize this shape to a stream. More... | |
void | addChild (const std::string &name, ConfigurableObject *child) |
Add a child (e.g. a emitter/sub surface integrator) to this shape. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
Public Member Functions inherited from mitsuba::ConfigurableObject | |
virtual void | setParent (ConfigurableObject *parent) |
Notify the ConfigurableObject instance about its parent object. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
const std::string & | getID () const |
Return the identifier associated with this instance (or "unnamed") More... | |
void | setID (const std::string &name) |
Set the identifier associated with this instance. More... | |
const Properties & | getProperties () const |
Return the properties object that was originally used to create this instance. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a serializable object. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::ConfigurableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
Shape (const Properties &props) | |
Create a new shape. More... | |
Shape (Stream *stream, InstanceManager *manager) | |
Unserialize a shape. More... | |
virtual | ~Shape () |
Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::ConfigurableObject | |
virtual | ~ConfigurableObject () |
Virtual destructor. More... | |
ConfigurableObject (const Properties &props) | |
Construct a configurable object. More... | |
ConfigurableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a configurable object. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject () | |
Construct a serializable object. More... | |
virtual | ~SerializableObject () |
Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
std::string | m_name |
ref< BSDF > | m_bsdf |
ref< Subsurface > | m_subsurface |
ref< Emitter > | m_emitter |
ref< Sensor > | m_sensor |
ref< Medium > | m_interiorMedium |
ref< Medium > | m_exteriorMedium |
Protected Attributes inherited from mitsuba::ConfigurableObject | |
Properties | m_properties |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Abstract base class of all shapes.
|
protected |
Create a new shape.
|
protected |
Unserialize a shape.
|
protectedvirtual |
Virtual destructor.
|
virtual |
Add a child (e.g. a emitter/sub surface integrator) to this shape.
Reimplemented from mitsuba::ConfigurableObject.
|
inline |
Add an unnamed child.
|
virtual |
Adjust an intersection record to a different time value
|
virtual |
Called once after constructing the object.
Reimplemented from mitsuba::ConfigurableObject.
Reimplemented in mitsuba::TriMesh.
void mitsuba::Shape::copyAttachments | ( | Shape * | shape | ) |
Create a triangle mesh approximation of this shape.
This function is used by the realtime preview and certain integrators, which rely on hardware rasterization.
The default implementation simply returns NULL.
Reimplemented in mitsuba::TriMesh.
|
virtual |
Given that an intersection has been found, create a detailed intersection record.
rayIntersect
.
|
pure virtual |
Return a bounding box containing the shape.
Implemented in mitsuba::TriMesh.
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::ConfigurableObject.
Reimplemented in mitsuba::TriMesh.
Returns the minimal axis-aligned bounding box of this shape when clipped to another bounding box.
This is extremely important to construct decent kd-trees. The default implementation just takes the bounding box returned by getAABB() and clips it to box.
void mitsuba::Shape::getCurvature | ( | const Intersection & | its, |
Float & | H, | ||
Float & | K, | ||
bool | shadingFrame = true |
||
) | const |
Compute the Gaussian and mean curvature at the given surface intersection.
its | Intersection record associated with the query |
H | Parameter used to store the mean curvature |
K | Parameter used to store the Gaussian curvature |
shadingFrame | Specifies whether to compute the curvature based on the geometric normal or the shading normal of the surface |
H, K = shape.getCurvature(its, shadingFrame)
|
pure virtual |
Return the number of primitives (triangles, hairs, ..) contributed to the scene by this shape.
Includes instanced geometry
Implemented in mitsuba::TriMesh.
|
virtual |
Return a sub-element of a compound shape.
When expanding shapes, the scene will repeatedly call this function with increasing indices. Returning NULL indicates that no more elements are available.
|
inline |
Return the associated emitter (if any)
|
inline |
Return the associated emitter (if any)
|
inline |
Return the medium that lies on the exterior of this shape (NULL
== vacuum)
|
inline |
Return the medium that lies on the exterior of this shape (NULL
== vacuum, const version)
|
inline |
Return the medium that lies on the interior of this shape (NULL
== vacuum)
|
inline |
Return the medium that lies on the interior of this shape (NULL
== vacuum, const version)
|
virtual |
Return the internal kd-tree of this shape (if any)
This function is used by the kd-tree visualization in the interactive walkthrough. The default implementation simply returns NULL.
|
virtual |
Return the name of this shape (e.g. the filename)
|
virtual |
Return the derivative of the normal vector with respect to the UV parameterization.
This can be used to compute Gaussian and principal curvatures, amongst other things.
its | Intersection record associated with the query |
dndu | Parameter used to store the partial derivative of the normal vector with respect to u |
dndv | Parameter used to store the partial derivative of the normal vector with respect to v |
shadingFrame | Specifies whether to compute the derivative of the geometric normal or the shading normal of the surface |
dndu, dndv = shape.getNormalDerivative(its, shadingFrame)
Reimplemented in mitsuba::TriMesh.
|
pure virtual |
Return the number of primitives (triangles, hairs, ..) contributed to the scene by this shape.
Does not include instanced geometry
Implemented in mitsuba::TriMesh.
|
inline |
Return the associated sensor (if any)
|
inline |
Return the associated sensor (if any)
|
inline |
Return the associated sub-surface integrator.
|
inline |
Return the associated sub-surface integrator.
|
virtual |
Return the shape's surface area.
Assumes that the object is not undergoing some kind of time-dependent scaling.
The default implementation throws an exception
Reimplemented in mitsuba::TriMesh.
|
inline |
Does this shape have a sub-surface integrator?
|
virtual |
Is this a compound shape consisting of several sub-objects?
|
inline |
Is this shape also an area emitter?
|
inline |
Does the surface of this shape mark a medium transition?
|
inline |
Is this shape also an area sensor?
|
virtual |
Query the probability density of sampleDirect() for a particular point on the surface.
dRec | A direct sampling record, which specifies the query location. Note that this record need not be completely filled out. The important fields are p , n , ref , dist , d , measure , and uv . |
p | An arbitrary point used to define the solid angle measure |
|
virtual |
Query the probability density of samplePosition() for a particular point on the surface.
This method will generally return the inverse of the surface area.
pRec | A position record, which will be used to return the sampled position, as well as auxilary information about the sample. |
Reimplemented in mitsuba::TriMesh.
|
virtual |
Fast ray intersection test.
Check whether the shape is intersected by the given ray. Some temporary space (MTS_KD_INTERSECTION_TEMP-4 bytes) is, supplied which can be used to cache information about the intersection. The function fillIntersectionRecord() can later use this information to fill in a detailed intersection record.
fillIntersectionRecord
and has the signature intersection = shape.rayIntersect(ray, mint, maxt)
Fast ray intersection test for visibility queries.
Check whether the shape is intersected by the given ray. No details about the intersection are returned, hence the function is only useful for visibility queries. For most shapes, this will simply call forward the call to rayIntersect. When the shape actually contains a nested kd-tree, some optimizations are possible.
|
virtual |
Sample a point on the surface of this shape instance (with respect to the solid angle measure)
The sample density should ideally be uniform in direction as seen from the reference point dRec.p
.
This general approach for sampling positions is named "direct" sampling throughout Mitsuba motivated by direct illumination rendering techniques, which represent the most important application.
When no implementation of this function is supplied, the Shape class will revert to the default approach, which piggybacks on sampleArea(). This usually results in a a suboptimal sample placement, which can manifest itself in the form of high variance
dRec | A direct sampling record that specifies the reference point and a time value. After the function terminates, it will be populated with the position sample and related information |
sample | A uniformly distributed 2D vector |
|
virtual |
Sample a point on the surface of this shape instance (with respect to the area measure)
The returned sample density will be uniform over the surface.
pRec | A position record, which will be used to return the sampled position, as well as auxilary information about the sample. |
sample | A uniformly distributed 2D vector |
Reimplemented in mitsuba::TriMesh.
|
virtual |
Serialize this shape to a stream.
Reimplemented from mitsuba::ConfigurableObject.
Reimplemented in mitsuba::TriMesh.
|
inline |
Set the emitter of this shape.
|
protected |
|
protected |
|
static |