H3D API
2.4.1
|
The IndexedTriangleSet node represents a 3D shape composed of a collection of individual triangles. More...
#include <H3D/IndexedTriangleSet.h>
Classes | |
class | AutoNormal |
Specialized field for automatically generating normals from coordinates. More... | |
class | AutoTangent |
Specialized field for automatically generating two FloatVertexAttribute nodes representing the tangent and binormal of each vertex(or face if normalPerVertex is false). More... | |
class | NotEnoughColors |
Thrown if the number of colors in the color field is less than the number coordinates in the coord field. More... | |
class | NotEnoughTextureCoordinates |
Thrown if the number of texture coordinates in the color field is less than the number coordinates in the coord field. More... | |
Public Member Functions | |
IndexedTriangleSet (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< AutoNormal > _autoNormal=0, Inst< MFInt32 > _set_index=0, Inst< MFInt32 > _index=0, Inst< SFFogCoordinate > _fogCoord=0, Inst< SFInt32InstanceCount > _instanceCount=0) | |
Constructor. | |
virtual | ~IndexedTriangleSet () |
Destructor. | |
virtual void | traverseSG (TraverseInfo &ti) |
Traverse the scenegraph. More... | |
virtual void | render () |
Renders the IndexedTriangleSet with OpenGL. | |
virtual int | nrTriangles () |
The number of triangles renderered in this geometry. | |
virtual bool | supportsTangentAttributes () |
Returns true if this geometry supports the automatic generation of tangents and binormals as FloatVertexAttribues(needed by e.g. More... | |
void | setRenderPatches (bool _renderPatches) |
Explicitly enable or disable the rendering of patches for tessellation. | |
bool | getRenderPatches () |
Returns true if rendering using patches for tessellation is enabled. | |
virtual void | glRender () |
Function overridden from HAPIGLShape. More... | |
![]() | |
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. | |
![]() | |
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 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 H3DShadowObjectNode * | getShadowObject () |
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 void | getBound (HAPI::Vec3 ¢er, 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. | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (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. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
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 Field * | getField (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... | |
![]() | |
H3DBoundedObject (Inst< SFBound > _bound=0) | |
Constructor. | |
![]() | |
H3DDisplayListObject (Inst< DisplayList > _displayList=0) | |
Constructor. | |
Public Attributes | |
H3DUniquePtr< AutoNormal > | autoNormal |
Auto-generated normals that are used if the normal field is NULL. More... | |
H3DUniquePtr< AutoTangent > | autoTangent |
Auto-generated vertex attributes for tangents and binormals. More... | |
H3DUniquePtr< MFInt32 > | set_index |
Field for setting the value of the index field. More... | |
H3DUniquePtr< MFInt32 > | index |
The index field is used to specify the vertices of each triangle from the coord field. More... | |
H3DUniquePtr< SFInt32InstanceCount > | instanceCount |
If 0 or greater, then instanced rendering is used to render instanceCount instances of the mesh. More... | |
![]() | |
H3DUniquePtr< SFColorNode > | color |
Contains an X3DColorNode whose colors are applied to the X3DComposedGeometryNode. More... | |
H3DUniquePtr< SFCoordinateNode > | coord |
An X3DCoordinate node with the coordinates to use. More... | |
H3DUniquePtr< SFNormalNode > | normal |
Contains an X3DNormalNode which normals are applied to the X3DComposedGeometryNode. More... | |
H3DUniquePtr< SFTextureCoordinateNode > | texCoord |
Contains an X3DTextureCoordinateNode which texture coordinates are applied to the X3DComposedGeometryNode. More... | |
H3DUniquePtr< SFBool > | 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. More... | |
H3DUniquePtr< SFBool > | colorPerVertex |
If TRUE the colors in the color field is applied per vertex, otherwise it is applied per face. More... | |
H3DUniquePtr< SFBool > | normalPerVertex |
If TRUE the normals in the normal field is applied per vertex, otherwise it is applied per face. More... | |
H3DUniquePtr< SFBool > | solid |
The solid field determines whether one or both sides of each polygon shall be displayed. More... | |
H3DUniquePtr< MFVertexAttributeNode > | attrib |
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< SFFogCoordinate > | fogCoord |
If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculating fog depth. More... | |
![]() | |
H3DUniquePtr< MFBool > | isTouched |
Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop. More... | |
H3DUniquePtr< MFVec3f > | force |
The last force delivered by this geometry to the haptics device. More... | |
H3DUniquePtr< MFVec3f > | contactPoint |
The last contact points of the HapticDevices on the geometry. More... | |
H3DUniquePtr< MFVec3f > | contactTexCoord |
The texture coordinate of last the contact points of the HapticDevices on the geometry. More... | |
H3DUniquePtr< MFVec3f > | contactNormal |
The normal at the last contact points of the HapticDevices on the geometry. More... | |
H3DUniquePtr< SFVec3f > | centerOfMass |
The field contains center of mass for the object, based on its bounding box. More... | |
H3DUniquePtr< SFBoundTree > | boundTree |
Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode. More... | |
H3DUniquePtr< MFOptionsNode > | options |
Contains nodes with options for haptics and graphics rendering. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
![]() | |
H3DUniquePtr< SFBound > | bound |
The field containing the bound object. More... | |
![]() | |
H3DUniquePtr< DisplayList > | displayList |
The DisplayList instance handling the OpenGL caching of this object. | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Protected Attributes | |
bool | render_tangents |
This will be set to true in traverseSG if the render function is supposed to render tangent vertex attributes. | |
bool | render_patches |
This will be set to true in traverseSG if the render function is supposed to render GL_PATCHES instead of GL_TRIANGLES. More... | |
H3DUniquePtr< Field > | vboFieldsUpToDate |
Internal field used to know if vertex buffer object can be created. More... | |
![]() | |
AutoRef< Node > | shadow_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. | |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static void | cleanUpFunction (void *userdata) |
Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct time. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
The IndexedTriangleSet node represents a 3D shape composed of a collection of individual triangles.
IndexedTriangleSet uses the indices in its index field to specify the vertices of each triangle from the coord field. Each triangle is formed from a set of three vertices of the Coordinate node identified by three consecutive indices from the index field. If the index field does not contain a multiple of three coordinate values, the remaining vertices shall be ignored.
The IndexedTriangleSet node is specified in the local coordinate system and is affected by the transformations of its ancestors. If values are provided for the color, normal and texCoord fields, the values are applied in the same manner as the values from the coord field and there shall be at least as many values as are present in the coord field. The value of the colorPerVertex field is ignored and always treated as TRUE. If the normal field is not supplied, normals shall be generated as follows:
Examples:
|
inlinevirtual |
Function overridden from HAPIGLShape.
Just call the displayList->callList per default
Reimplemented from H3D::X3DGeometryNode.
|
inlinevirtual |
Returns true if this geometry supports the automatic generation of tangents and binormals as FloatVertexAttribues(needed by e.g.
PhongShader. IndexedTriangleSet does support this.
Reimplemented from H3D::X3DGeometryNode.
|
virtual |
Traverse the scenegraph.
A HAPIHapticShape is added for haptic rendering if haptics is enabled.
ti | The TraverseInfo object containing information about the traversal. |
Reimplemented from H3D::X3DGeometryNode.
References H3D::H3DDisplayListObject::displayList, H3DUtil::RefCountedClass::getName(), H3D::TraverseInfo::getUserData(), render_patches, render_tangents, H3D::X3DComposedGeometryNode::solid, H3D::X3DGeometryNode::traverseSG(), and H3D::X3DGeometryNode::useBackFaceCulling().
H3DUniquePtr< AutoNormal > H3D::IndexedTriangleSet::autoNormal |
Auto-generated normals that are used if the normal field is NULL.
Only accessable in C++.
Referenced by IndexedTriangleSet(), and render().
H3DUniquePtr< AutoTangent > H3D::IndexedTriangleSet::autoTangent |
Auto-generated vertex attributes for tangents and binormals.
Only accessable in C++.
Referenced by IndexedTriangleSet(), and render().
H3DUniquePtr< MFInt32 > H3D::IndexedTriangleSet::index |
The index field is used to specify the vertices of each triangle from the coord field.
Each triangle is formed from a set of three vertices of the Coordinate node identified by three consecutive indices from the index field. If the index field does not contain a multiple of three coordinate values, the remaining vertices shall be ignored. NOTE: The access type differs from the X3D standard.
Access type: inputOutput
Referenced by IndexedTriangleSet(), and render().
H3DUniquePtr< SFInt32InstanceCount > H3D::IndexedTriangleSet::instanceCount |
If 0 or greater, then instanced rendering is used to render instanceCount instances of the mesh.
NOTE: Instanced rendering is not supported if normalPerVertex is false. NOTE: Enabling instanced rendering will disable displaylists for this geometry (since instance rendering is not supported for displaylists). Disabling it again will set the cachemode to OPTIONS. It is up to subclasses of IndexedTriangleSet to implement any other kind of behaviour cache mode of displayList.
Access type: inputOutput
Default value: -1
Referenced by IndexedTriangleSet(), and render().
|
protected |
This will be set to true in traverseSG if the render function is supposed to render GL_PATCHES instead of GL_TRIANGLES.
If multiple uses of the IndexedTriangleSet then whether patches are rendered or not is decided by the last usage to be traversed.
Referenced by render(), and traverseSG().
H3DUniquePtr< MFInt32 > H3D::IndexedTriangleSet::set_index |
Field for setting the value of the index field.
Access type: inputOnly
Referenced by IndexedTriangleSet().
|
protected |
Internal field used to know if vertex buffer object can be created.
C++ only field
Referenced by IndexedTriangleSet(), and render().