H3D API  2.4.1
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
H3D::PlanarReflector Class Reference

The PlanarReflector defines a geometry which will act as a mirror in the scene. More...

#include <H3D/PlanarReflector.h>

Inheritance diagram for H3D::PlanarReflector:
Inheritance graph

Classes

class  SFGeometryNode
 SFGeometryNode is dependent on the displayList field of its encapsulated X3DGeometryNode node, i.e. More...
 

Public Member Functions

 PlanarReflector (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< DisplayList > _displayList=0, Inst< SFGeometryNode > _geometry=0, Inst< SFFloat > _reflectivity=0, Inst< SFColor > _color=0)
 Constructor.
 
virtual void initialize ()
 Sets up the bound field using the bboxCenter and bboxSize fields. More...
 
virtual void renderPostViewpoint (X3DChildNode *n, X3DViewpointNode *vp)
 Render the mirrored scene and the mirror.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. Calls traverseSG on appeance and geometry.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the X3DGeometryNode in the field geometry. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on the node in the field geometry. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the geometry in the geometry field. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DMultiPassRenderObject
 H3DMultiPassRenderObject ()
 Constructor.
 
virtual ~H3DMultiPassRenderObject ()
 Destructor.
 
virtual void renderPreViewpoint (X3DChildNode *, X3DViewpointNode *)
 This function will be called before any viewpoint calls has been made when rendering the scene and before the scene is rendered. More...
 
virtual void renderPostScene (X3DChildNode *, X3DViewpointNode *)
 This function will be called after the scene has been rendered. More...
 
void resetCounter ()
 Reset the counter.
 

Public Attributes

H3DUniquePtr< SFGeometryNodegeometry
 Contains the X3DGeometryNode to be rendered. More...
 
H3DUniquePtr< SFFloatreflectivity
 The reflectivity of the mirror. More...
 
H3DUniquePtr< SFColorcolor
 The color of the mirror. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Static Public Member Functions inherited from H3D::H3DMultiPassRenderObject
static void renderPreViewpointAll (X3DChildNode *n, X3DViewpointNode *vp)
 Run renderPreViewpoint on all instances of H3DMultiPassRenderObject.
 
static void renderPostViewpointAll (X3DChildNode *n, X3DViewpointNode *vp)
 Run renderPostViewpoint on all instances of H3DMultiPassRenderObject.
 
static void renderPostSceneAll (X3DChildNode *n, X3DViewpointNode *vp)
 Run renderPostScene on all instances of H3DMultiPassRenderObject.
 
static void resetCounters ()
 Run resetCounter on all instances of H3DMultiPassRenderObject.
 
static void setMultiPassTransparencyAll (bool b)
 If multi pass transparency is set to true the scene should be rendered three times graphically, once for all solid objects, once for the back side of transparent objects and once for the front face of transparent objects. More...
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

The PlanarReflector defines a geometry which will act as a mirror in the scene.

Note that it is up to the user to set visibilityLimit of NavigationInfo to a value that is big enough for the PlanarReflector to function properly. If the user of the application is allowed to navigate anywhere in the scene set visibilityLimit to 0.0.

Examples:

Internal routes:

Member Function Documentation

◆ closestPoint()

void PlanarReflector::closestPoint ( const Vec3f &  p,
NodeIntersectResult result 
)
virtual

Find closest point on the node in the field geometry.

Parameters
pThe point to find the closest point to.
resultA struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::Node.

References H3D::X3DGeometryNode::closestPoint(), and geometry.

◆ initialize()

virtual void H3D::PlanarReflector::initialize ( )
inlinevirtual

Sets up the bound field using the bboxCenter and bboxSize fields.

If bboxSize is (-1, -1, -1) the bound will be the bound of the geometry field. Otherwise it will be a BoxBound with center and origin determined by the bboxCenter and bboxOrigin fields.

Reimplemented from H3DUtil::RefCountedClass.

References H3D::H3DBoundedObject::bound, H3D::BoxBound::center, H3DUtil::RefCountedClass::initialize(), and H3D::BoxBound::size.

◆ lineIntersect()

bool PlanarReflector::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult result 
)
virtual

Detect intersection between a line segment and the X3DGeometryNode in the field geometry.

Parameters
fromThe start of the line segment.
toThe end of the line segment.
resultContains info about the closest intersection for every object that intersects the line.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References geometry, and H3D::X3DGeometryNode::lineIntersect().

◆ movingSphereIntersect()

bool PlanarReflector::movingSphereIntersect ( H3DFloat  radius,
const Vec3f &  from,
const Vec3f &  to,
NodeIntersectResult result 
)
virtual

Detect collision between a moving sphere and the geometry in the geometry field.

Parameters
radiusThe radius of the sphere
fromThe start position of the sphere
toThe end position of the sphere.
resultA struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References geometry, and H3D::X3DGeometryNode::movingSphereIntersect().

Member Data Documentation

◆ color

H3DUniquePtr< SFColor > H3D::PlanarReflector::color

The color of the mirror.

Access type: inputOutput Default value: 1 1 1

Referenced by PlanarReflector(), and renderPostViewpoint().

◆ geometry

H3DUniquePtr< SFGeometryNode > H3D::PlanarReflector::geometry

Contains the X3DGeometryNode to be rendered.

Access type: inputOutput

Referenced by closestPoint(), lineIntersect(), movingSphereIntersect(), PlanarReflector(), renderPostViewpoint(), and traverseSG().

◆ reflectivity

H3DUniquePtr< SFFloat > H3D::PlanarReflector::reflectivity

The reflectivity of the mirror.

A value of 1 means total reflectivity, i.e. the mirror itself will not be visible.

Access type: inputOutput Default value: 0.9 Value range: [0-1]

Referenced by PlanarReflector(), and renderPostViewpoint().


The documentation for this class was generated from the following files: