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

This is the base node type for all composed 3D geometry in X3D. More...

#include <H3D/X3DComposedGeometryNode.h>

Inheritance diagram for H3D::X3DComposedGeometryNode:
Inheritance graph

Classes

class  DisplayList
 Display list is extended in order to set front sidedness of triangles outside the display list. More...
 
class  MFVertexAttributeNode
 The MFVertexAttributeNode is dependent on the propertyChanged field of the contained X3DVertexAttributeNode. More...
 

Public Types

typedef DependentSFNode< X3DColorNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DColorNode::propertyChanged > > SFColorNode
 The SFColorNode is dependent on the propertyChanged field of the contained X3DColorNode.
 
typedef DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
 The SFCoordinateNode is dependent on the propertyChanged field of the contained X3DCoordinateNode.
 
typedef DependentSFNode< X3DNormalNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DNormalNode::propertyChanged > > SFNormalNode
 The SFNormalNode is dependent on the propertyChanged field of the contained X3DNormalNode.
 
typedef DependentSFNode< X3DTextureCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DTextureCoordinateNode::propertyChanged > > SFTextureCoordinateNode
 The SFTextureCoordinteNode is dependent on the propertyChanged field of the contained X3DTextureCoordinateNode.
 
typedef DependentSFNode< FogCoordinate, FieldRef< X3DGeometricPropertyNode, Field, &FogCoordinate::propertyChanged > > SFFogCoordinate
 The SFFogCoordinate is dependent on the propertyChanged. More...
 
- 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.
 

Public Member Functions

virtual void startTexGen (X3DTextureCoordinateNode *tex_coord)
 Start texture coordinate generation. More...
 
virtual void stopTexGen (X3DTextureCoordinateNode *tex_coord)
 Stop texture coordinate generation.
 
virtual void renderTexCoord (int index, X3DTextureCoordinateNode *tc)
 Render the texure coordinate with the given index from the tc argument. More...
 
virtual void renderTexCoordArray (X3DTextureCoordinateNode *tc)
 Render the X3DTextureCoordinate as an array. More...
 
virtual void disableTexCoordArray (X3DTextureCoordinateNode *tc)
 Disable the arrays that were enabled in renderTexCoordArray().
 
virtual void renderTexCoordVertexBufferObject (X3DTextureCoordinateNode *tc)
 Render the X3DTextureCoordinate as a vertex buffer object. More...
 
virtual void disableTexCoordVertexBufferObject (X3DTextureCoordinateNode *tc)
 Disable the vertex buffer objects that were enabled in renderTexCoordArray().
 
virtual Matrix4f getDefaultTexGenMatrix ()
 Gets the matrix that transforms from object space to texture coordinate space in the default case when no texCoord node is specified. More...
 
 X3DComposedGeometryNode (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< SFColorNode > _color=0, Inst< SFCoordinateNode > _coord=0, Inst< SFNormalNode > _normal=0, Inst< SFTextureCoordinateNode > _texCoord=0, Inst< SFBool > _ccw=0, Inst< SFBool > _colorPerVertex=0, Inst< SFBool > _normalPerVertex=0, Inst< SFBool > _solid=0, Inst< MFVertexAttributeNode > _attrib=0, Inst< SFFogCoordinate > _fogCoord=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DGeometryNode
 X3DGeometryNode (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< MFBool > _isTouched=0, Inst< MFVec3f > _force=0, Inst< MFVec3f > _contactPoint=0, Inst< MFVec3f > _contactNormal=0, Inst< MFVec3f > _contactTexCoord=0, Inst< SFBoundTree > _boundTree=0, Inst< SFVec3f > _centerOfMass=0)
 Constructor.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and this geometry. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on this geometry to point p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the geometry. More...
 
virtual void glRender ()
 Function overridden from HAPIGLShape. More...
 
virtual H3DShadowObjectNodegetShadowObject ()
 Get the H3DShadowObjectNode used to create a shadow volume for this geometry. More...
 
void useCulling (bool enabled)
 This function should be used by the render() function to disable or enable face culling. More...
 
bool usingCulling ()
 Returns if face culling is in use or not.
 
void allowCulling (bool allow)
 Control if face culling is allowed or not. More...
 
void useBackFaceCulling (bool enabled)
 Enabling/disabling back face culling. More...
 
bool allowingCulling ()
 Returns true if back face culling is allowed, false otherwise.
 
void setCullFace (GLenum face)
 Set which side of a polygon to cull. More...
 
GLenum getCullFace ()
 Get which face will be culled if culling is enabled.
 
template<class OptionNodeType >
void getOptionNode (OptionNodeType *&option)
 Get the first option node of the type of the pointer given as argument from the renderOptions fieeld The option argument will contain the node afterwards, or NULL if no option of that type exists.
 
int getHapticShapeId (unsigned int index)
 Get a shape id to be used for rendering of this geometry with HLAPI for the given haptics device. More...
 
virtual ~X3DGeometryNode ()
 Destructor.
 
HAPI::HAPIHapticShape * getOpenGLHapticShape (unsigned int hd_index, H3DSurfaceNode *_surface, const Matrix4f &_transform, int _nr_vertices=-1)
 Returns a either a HLFeedbackShape or a HLDepthBufferShape with the X3DGeometryNode. More...
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual bool supportsTangentAttributes ()
 Returns true if this geometry supports the automatic generation of tangents and binormals as FloatVertexAttribues(needed by e.g. More...
 
virtual void getBound (HAPI::Vec3 &center, HAPI::Vec3 &size)
 Overriden from HAPIGLShape to use the bound field in he X3DGeometryNode. More...
 
virtual void initialize ()
 Changes behaviour of X3DGeometryNode to be a thread safe RefCountedClass.
 
- 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 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 Attributes

H3DUniquePtr< SFColorNodecolor
 Contains an X3DColorNode whose colors are applied to the X3DComposedGeometryNode. More...
 
H3DUniquePtr< SFCoordinateNodecoord
 An X3DCoordinate node with the coordinates to use. More...
 
H3DUniquePtr< SFNormalNodenormal
 Contains an X3DNormalNode which normals are applied to the X3DComposedGeometryNode. More...
 
H3DUniquePtr< SFTextureCoordinateNodetexCoord
 Contains an X3DTextureCoordinateNode which texture coordinates are applied to the X3DComposedGeometryNode. More...
 
H3DUniquePtr< SFBoolccw
 The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors used in the lighting model equations. More...
 
H3DUniquePtr< SFBoolcolorPerVertex
 If TRUE the colors in the color field is applied per vertex, otherwise it is applied per face. More...
 
H3DUniquePtr< SFBoolnormalPerVertex
 If TRUE the normals in the normal field is applied per vertex, otherwise it is applied per face. More...
 
H3DUniquePtr< SFBoolsolid
 The solid field determines whether one or both sides of each polygon shall be displayed. More...
 
H3DUniquePtr< MFVertexAttributeNodeattrib
 If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per-vertex attribute information for programmable shaders. More...
 
H3DUniquePtr< SFFogCoordinatefogCoord
 If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculating fog depth. More...
 
- Public Attributes inherited from H3D::X3DGeometryNode
H3DUniquePtr< MFBoolisTouched
 Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop. More...
 
H3DUniquePtr< MFVec3fforce
 The last force delivered by this geometry to the haptics device. More...
 
H3DUniquePtr< MFVec3fcontactPoint
 The last contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< MFVec3fcontactTexCoord
 The texture coordinate of last the contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< MFVec3fcontactNormal
 The normal at the last contact points of the HapticDevices on the geometry. More...
 
H3DUniquePtr< SFVec3fcenterOfMass
 The field contains center of mass for the object, based on its bounding box. More...
 
H3DUniquePtr< SFBoundTreeboundTree
 Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode. More...
 
H3DUniquePtr< MFOptionsNodeoptions
 Contains nodes with options for haptics and graphics rendering. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about 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::X3DGeometryNode
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

- 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.
 
- 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::X3DGeometryNode
static void cleanUpFunction (void *userdata)
 Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct time. 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...
 
- Protected Attributes inherited from H3D::X3DGeometryNode
AutoRef< Nodeshadow_volume
 The shadow volume used for this geometry when shadows enabled. More...
 
vector< pair< int, pair< Matrix4f, H3DTime > > > haptic_shape_ids
 identifiers for the shapes geometry.
 

Detailed Description

This is the base node type for all composed 3D geometry in X3D.

A composed geometry node type defines an abstract type that composes geometry from a set of nodes that define individual components. Composed geometry may have color, coordinates, normal and texture coordinates supplied. The rendered output of the combination of these is dependent on the concrete node definition. However, in general, the following rules shall be applied for all nodes:

If the texCoord field is not NULL, it shall contain a TextureCoordinate node.

If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per-vertex attribute information for programmable shaders.

If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculating fog depth.

Internal routes:

Member Typedef Documentation

◆ SFFogCoordinate

The SFFogCoordinate is dependent on the propertyChanged.

field of the contained FogCoordinate.

Member Function Documentation

◆ getDefaultTexGenMatrix()

Matrix4f X3DComposedGeometryNode::getDefaultTexGenMatrix ( )
virtual

Gets the matrix that transforms from object space to texture coordinate space in the default case when no texCoord node is specified.


References H3D::H3DBoundedObject::bound, H3D::BoxBound::center, H3DAbs(), and H3D::BoxBound::size.

Referenced by H3D::IndexedFaceSet::AutoTangent::getTexCoord(), and startTexGen().

◆ renderTexCoord()

void X3DComposedGeometryNode::renderTexCoord ( int  index,
X3DTextureCoordinateNode tc 
)
virtual

Render the texure coordinate with the given index from the tc argument.

If the currently active texture is a MultiTexture the texture coordinate will be rendered for the texture units of all textures in MultiTexture. tc must not be NULL.

References H3D::X3DTextureCoordinateNode::renderForActiveTexture().

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), and H3D::TriangleStripSet::render().

◆ renderTexCoordArray()

void X3DComposedGeometryNode::renderTexCoordArray ( X3DTextureCoordinateNode tc)
virtual

Render the X3DTextureCoordinate as an array.

If the currently active texture is a MultiTexture it will be rendered for the texture units of all textures in MultiTexture. tc must not be NULL.

References H3D::X3DTextureCoordinateNode::renderArrayForActiveTexture().

Referenced by H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), and H3D::TriangleStripSet::render().

◆ renderTexCoordVertexBufferObject()

void X3DComposedGeometryNode::renderTexCoordVertexBufferObject ( X3DTextureCoordinateNode tc)
virtual

Render the X3DTextureCoordinate as a vertex buffer object.

If the currently active texture is a MultiTexture it will be rendered for the texture units of all textures in MultiTexture. tc must not be NULL.

References H3D::X3DTextureCoordinateNode::renderVertexBufferObjectForActiveTexture().

Referenced by H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleSet::render(), and H3D::TriangleStripSet::render().

◆ startTexGen()

void X3DComposedGeometryNode::startTexGen ( X3DTextureCoordinateNode tex_coord)
virtual

Start texture coordinate generation.

Texture coordinates will be generated for all texture units used by the currently active texture. If tex_coord is NULL then texture coordinates will be generated from the bounding box of the geometry as defined in the X3D specification. If tex_coord is not NULL then we use the TextureCoordinateGenerator to define the texture coordinate generation.

References H3D::X3DTextureNode::getActiveTexture(), getDefaultTexGenMatrix(), H3D::X3DTextureCoordinateNode::startTexGenForActiveTexture(), and H3D::MultiTexture::texture.

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), and H3D::TriangleStripSet::render().

Member Data Documentation

◆ attrib

H3DUniquePtr< MFVertexAttributeNode > H3D::X3DComposedGeometryNode::attrib

If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per-vertex attribute information for programmable shaders.

Access type: inputOutput

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), H3D::TriangleStripSet::render(), and X3DComposedGeometryNode().

◆ ccw

H3DUniquePtr< SFBool > H3D::X3DComposedGeometryNode::ccw

The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors used in the lighting model equations.

If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the local coordinate system of the Shape) from the opposite direction as the normal. If ccw is FALSE, the normals shall be oriented in the opposite direction. If normals are not generated but are supplied using a Normal node, and the orientation of the normals does not match the setting of the ccw field, results are undefined.

Access type: inputOutput
Default value: TRUE

Referenced by H3D::X3DComposedGeometryNode::DisplayList::callList(), H3D::IndexedFaceSet::IndexedFaceSet(), H3D::IndexedTriangleFanSet::IndexedTriangleFanSet(), H3D::IndexedTriangleSet::IndexedTriangleSet(), H3D::IndexedTriangleStripSet::IndexedTriangleStripSet(), H3D::TriangleFanSet::TriangleFanSet(), H3D::TriangleSet::TriangleSet(), H3D::TriangleStripSet::TriangleStripSet(), and X3DComposedGeometryNode().

◆ color

H3DUniquePtr< SFColorNode > H3D::X3DComposedGeometryNode::color

Contains an X3DColorNode whose colors are applied to the X3DComposedGeometryNode.

If the color field is NULL, the geometry shall be rendered normally using the Material and texture defined in the Appearance node

Access type: inputOutput

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), H3D::TriangleStripSet::render(), and X3DComposedGeometryNode().

◆ colorPerVertex

H3DUniquePtr< SFBool > H3D::X3DComposedGeometryNode::colorPerVertex

If TRUE the colors in the color field is applied per vertex, otherwise it is applied per face.

Access type: inputOutput
Default value: TRUE

Referenced by H3D::IndexedFaceSet::IndexedFaceSet(), H3D::IndexedFaceSet::render(), and X3DComposedGeometryNode().

◆ coord

H3DUniquePtr< SFCoordinateNode > H3D::X3DComposedGeometryNode::coord

◆ fogCoord

H3DUniquePtr< SFFogCoordinate > H3D::X3DComposedGeometryNode::fogCoord

If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculating fog depth.

Access type: inputOutput

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), H3D::TriangleStripSet::render(), and X3DComposedGeometryNode().

◆ normal

H3DUniquePtr< SFNormalNode > H3D::X3DComposedGeometryNode::normal

Contains an X3DNormalNode which normals are applied to the X3DComposedGeometryNode.

If the normal field is NULL, the normals are automatically generated in accordance with the node's definition. If the node does not define a behaviour, the default is to generate an averaged normal for all faces that share that vertex.

Access type: inputOutput

Referenced by H3D::IndexedFaceSet::render(), H3D::IndexedTriangleFanSet::render(), H3D::IndexedTriangleSet::render(), H3D::IndexedTriangleStripSet::render(), H3D::TriangleFanSet::render(), H3D::TriangleSet::render(), H3D::TriangleStripSet::render(), and X3DComposedGeometryNode().

◆ normalPerVertex

H3DUniquePtr< SFBool > H3D::X3DComposedGeometryNode::normalPerVertex

◆ solid

H3DUniquePtr< SFBool > H3D::X3DComposedGeometryNode::solid

The solid field determines whether one or both sides of each polygon shall be displayed.

If solid is FALSE, each polygon shall be visible regardless of the viewing direction (i.e., no backface culling shall be done, and two sided lighting shall be performed to illuminate both sides of lit surfaces). If solid is TRUE, back face culling will be performed.

Access type: inputOutput
Default value: TRUE

Referenced by H3D::IndexedFaceSet::IndexedFaceSet(), H3D::IndexedFaceSet::traverseSG(), H3D::IndexedTriangleFanSet::traverseSG(), H3D::IndexedTriangleSet::traverseSG(), H3D::IndexedTriangleStripSet::traverseSG(), H3D::TriangleFanSet::traverseSG(), H3D::TriangleSet::traverseSG(), H3D::TriangleStripSet::traverseSG(), and X3DComposedGeometryNode().

◆ texCoord

H3DUniquePtr< SFTextureCoordinateNode > H3D::X3DComposedGeometryNode::texCoord

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