20 #if !defined(__MITSUBA_RENDER_SHAPE_H_)
21 #define __MITSUBA_RENDER_SHAPE_H_
39 shape(NULL), t(std::numeric_limits<
Float>::infinity()) { }
43 return shFrame.toWorld(v);
48 return shFrame.toLocal(v);
53 return t != std::numeric_limits<Float>::infinity();
57 inline bool isEmitter()
const;
60 inline bool isSensor()
const;
63 inline bool hasSubsurface()
const;
66 inline bool isMediumTransition()
const;
74 inline const Medium *getTargetMedium(
const Vector &d)
const;
83 inline const Medium *getTargetMedium(
Float cosTheta)
const;
98 inline const BSDF *getBSDF()
const;
116 const Vector &d,
int depth=0)
const;
122 inline void adjustTime(
Float time);
125 inline void getNormalDerivative(
Vector &dndu,
Vector &dndv,
126 bool shadingFrame =
true)
const;
129 std::string toString()
const;
165 bool hasUVPartials : 1;
185 virtual std::string getName()
const;
188 virtual bool isCompound()
const;
197 virtual Shape *getElement(
int i);
207 virtual Float getSurfaceArea()
const;
210 virtual AABB getAABB()
const = 0;
220 virtual AABB getClippedAABB(
const AABB &box)
const;
253 virtual bool rayIntersect(
const Ray &ray,
Float mint,
268 virtual bool rayIntersect(
const Ray &ray,
Float mint,
Float maxt)
const;
277 virtual void fillIntersectionRecord(
const Ray &ray,
302 virtual void getNormalDerivative(
const Intersection &its,
303 Vector &dndu,
Vector &dndv,
bool shadingFrame =
true)
const;
323 bool shadingFrame =
true)
const;
362 const Point2 &sample)
const;
402 const Point2 &sample)
const;
445 inline bool isEmitter()
const {
return m_emitter.get() != NULL; }
454 inline bool isSensor()
const {
return m_sensor.get() != NULL; }
461 inline bool hasBSDF()
const {
return m_bsdf.get() != NULL; }
475 virtual size_t getPrimitiveCount()
const = 0;
483 virtual size_t getEffectivePrimitiveCount()
const = 0;
486 void copyAttachments(
Shape *shape);
const Shape * shape
Pointer to the associated shape.
Definition: shape.h:132
Record for solid-angle based area sampling techniques.
Definition: common.h:238
Abstract participating medium.
Definition: medium.h:103
Subsurface * getSubsurface()
Return the associated sub-surface integrator.
Definition: shape.h:440
Stores a three-dimensional orthonormal coordinate frame.
Definition: frame.h:37
Abstract radiance emitter interface.
Definition: emitter.h:443
Generic serializable object, which supports construction from a Properties instance.
Definition: cobject.h:40
Medium * getInteriorMedium()
Return the medium that lies on the interior of this shape (NULL == vacuum)
Definition: shape.h:429
const Emitter * getEmitter() const
Return the associated emitter (if any)
Definition: shape.h:449
Generic sampling record for positions.
Definition: common.h:82
bool isMediumTransition() const
Does the surface of this shape mark a medium transition?
Definition: shape.h:427
void addChild(ConfigurableObject *child)
Add an unnamed child.
Definition: shape.h:505
const Medium * getInteriorMedium() const
Return the medium that lies on the interior of this shape (NULL == vacuum, const version) ...
Definition: shape.h:431
Principal scene data structure.
Definition: scene.h:49
Vector dpdv
Definition: shape.h:150
Abstract sensor interface.
Definition: sensor.h:66
Point2 uv
UV surface coordinates.
Definition: shape.h:147
Base class of all sample generators.
Definition: sampler.h:66
void setEmitter(Emitter *emitter)
Set the emitter of this shape.
Definition: shape.h:451
BSDF * getBSDF()
Return the shape's BSDF.
Definition: shape.h:465
bool isValid() const
Is the current intersection valid?
Definition: shape.h:52
const Subsurface * getSubsurface() const
Return the associated sub-surface integrator.
Definition: shape.h:442
const Medium * getExteriorMedium() const
Return the medium that lies on the exterior of this shape (NULL == vacuum, const version) ...
Definition: shape.h:435
Abstract base class of all shapes.
Definition: shape.h:178
virtual void serialize(Stream *stream, InstanceManager *manager) const
Serialize this object to a binary data stream.
Ray differential – enhances the basic ray class with information about the rays of adjacent pixels on...
Definition: ray.h:140
bool isSensor() const
Is this shape also an area sensor?
Definition: shape.h:454
const Shape * instance
Stores a pointer to the parent instance, if applicable.
Definition: shape.h:171
Vector toLocal(const Vector &v) const
Convert a world-space vector into local shading coordinates.
Definition: shape.h:47
Vector toWorld(const Vector &v) const
Convert a local shading-space vector into world space.
Definition: shape.h:42
Axis-aligned bounding box data structure in three dimensions.
Definition: aabb.h:437
Vector wi
Incident direction in the local shading frame.
Definition: shape.h:162
virtual void addChild(const std::string &name, ConfigurableObject *child)
Add a child (default implementation throws an error)
bool isEmitter() const
Is this shape also an area emitter?
Definition: shape.h:445
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
const BSDF * getBSDF() const
Return the shape's BSDF.
Definition: shape.h:463
virtual void configure()
Configure the object (called once after construction and addition of all child ConfigurableObject ins...
Reference counting helper.
Definition: ref.h:40
const Sensor * getSensor() const
Return the associated sensor (if any)
Definition: shape.h:458
Abstract BSDF base-class.
Definition: bsdf.h:215
Medium * getExteriorMedium()
Return the medium that lies on the exterior of this shape (NULL == vacuum)
Definition: shape.h:433
Frame shFrame
Shading frame.
Definition: shape.h:144
Float time
Time value associated with the intersection.
Definition: shape.h:156
bool hasBSDF() const
Does the shape have a BSDF?
Definition: shape.h:461
Sensor * getSensor()
Return the associated sensor (if any)
Definition: shape.h:456
Spectrum color
Interpolated vertex color.
Definition: shape.h:159
Float t
Distance traveled along the ray.
Definition: shape.h:135
Associative parameter map for constructing subclasses of ConfigurableObject.
Definition: properties.h:46
Container for all information related to a surface intersection.
Definition: shape.h:36
Intersection()
Definition: shape.h:38
Coordinates the serialization and unserialization of object graphs.
Definition: serialization.h:65
Frame geoFrame
Geometry frame.
Definition: shape.h:141
Discrete spectral power distribution based on a number of wavelength bins over the 360-830 nm range...
Definition: spectrum.h:663
void setBSDF(BSDF *bsdf)
Set the BSDF of this shape.
Definition: shape.h:467
Point p
Definition: shape.h:138
bool hasSubsurface() const
Does this shape have a sub-surface integrator?
Definition: shape.h:438
Float dvdy
Definition: shape.h:153
Emitter * getEmitter()
Return the associated emitter (if any)
Definition: shape.h:447
Abstract subsurface scattering models.
Definition: subsurface.h:38