H3D API
2.4.1
|
The ElevationGrid node specifies a uniform rectangular grid of varying height in the Y=0 plane of the local coordinate system. More...
#include <H3D/ElevationGrid.h>
Classes | |
class | AutoNormal |
Specialized field for automatically generating normals from coordinates. More... | |
class | DisplayList |
Display list is extended in order to set front sidedness of triangles outside the display list. More... | |
class | SFBound |
SFBound is specialized update itself from the fields of the ElevationGrid. More... | |
Public Member Functions | |
virtual void | startTexGen (TextureCoordinateGenerator *tex_coord_gen) |
Start texture coordinate generation. More... | |
virtual void | stopTexGen (TextureCoordinateGenerator *tex_coord_gen) |
Stop texture coordinate generation. | |
virtual void | render () |
Render the ElevationGrid with OpenGL. | |
virtual int | nrTriangles () |
The number of triangles renderered in this geometry. | |
virtual void | traverseSG (TraverseInfo &ti) |
Traverse the scenegraph. More... | |
ElevationGrid (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< SFColorNode > _color=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< SFFloat > _creaseAngle=0, Inst< SFInt32 > _xDimension=0, Inst< SFInt32 > _zDimension=0, Inst< SFFloat > _xSpacing=0, Inst< SFFloat > _zSpacing=0, Inst< MFFloat > _height=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 void | glRender () |
Function overridden from HAPIGLShape. 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 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 ¢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< SFColorNode > | color |
Contains an X3DColorNode whose colors are applied to the ElevationGrid. More... | |
H3DUniquePtr< SFNormalNode > | normal |
Contains an X3DNormalNode which colors are applied to the ElevationGrid. More... | |
H3DUniquePtr< SFTextureCoordinateNode > | texCoord |
Contains an X3DTextureCoordinateNode which colors are applied to the ElevationGrid. 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< SFFloat > | creaseAngle |
The creaseAngle field affects how default normals are generated. More... | |
H3DUniquePtr< SFInt32 > | xDimension |
The number of elements in the grid height array in the x direction. More... | |
H3DUniquePtr< SFInt32 > | zDimension |
The number of elements in the grid height array in the z direction. More... | |
H3DUniquePtr< SFFloat > | xSpacing |
The distance between vertices in the x direction. More... | |
H3DUniquePtr< SFFloat > | zSpacing |
The distance between vertices in the z direction. More... | |
H3DUniquePtr< MFFloat > | height |
The height field is an xDimension by zDimension array of scalar values representing the height above the grid for each vertex. More... | |
H3DUniquePtr< AutoNormal > | autoNormal |
Auto-generated normals that are used if the normal field is NULL. 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. | |
Protected Attributes | |
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 ElevationGrid node specifies a uniform rectangular grid of varying height in the Y=0 plane of the local coordinate system.
The geometry is described by a scalar array of height values that specify the height of a surface above each point of the grid.
The xDimension and zDimension fields indicate the number of elements of the grid height array in the X and Z directions. Both xDimension and zDimension shall be greater than or equal to zero. If either the xDimension or the zDimension is less than two, the ElevationGrid contains no quadrilaterals. The vertex locations for the rectangles are defined by the height field and the xSpacing and zSpacing fields:
The color field specifies per-vertex or per-quadrilateral colours for the ElevationGrid node depending on the value of colorPerVertex. If the color field is NULL, the ElevationGrid node is rendered with the overall attributes of the Shape node enclosing the ElevationGrid node).
The colorPerVertex field determines whether colours specified in the color field are applied to each vertex or each quadrilateral of the ElevationGrid node. If colorPerVertex is FALSE and the color field is not NULL, the color field shall specify a Color node containing at least (xDimension-1)×(zDimension-1) colours; one for each quadrilateral.
If colorPerVertex is TRUE and the color field is not NULL, the color field shall specify a Color node containing at least xDimension × zDimension colours, one for each vertex.
The normal field specifies per-vertex or per-quadrilateral normals for the ElevationGrid node. If the normal field is NULL, normals are automatically generated, using the creaseAngle field to determine if and how normals are smoothed across the surface(see Section 11.2.3 in the X3D specification).
The normalPerVertex field determines whether normals are applied to each vertex or each quadrilateral of the ElevationGrid node depending on the value of normalPerVertex. If normalPerVertex is FALSE and the normal node is not NULL, the normal field shall specify a Normal node containing at least (xDimension-1)×(zDimension-1) normals; one for each quadrilateral
If normalPerVertex is TRUE and the normal field is not NULL, the normal field shall specify a Normal node containing at least xDimension × zDimension normals; one for each vertex.
The texCoord field specifies per-vertex texture coordinates for the ElevationGrid node. If texCoord is NULL, default texture coordinates are applied to the geometry. The default texture coordinates range from (0,0) at the first vertex to (1,1) at the last vertex. The S texture coordinate is aligned with the positive X-axis, and the T texture coordinate with positive Z-axis. If texCoord is not NULL, it shall specify a TextureCoordinate node containing at least (xDimension)×(zDimension) texture coordinates; one for each vertex.
By default, the quadrilaterals are defined with a counterclockwise ordering. Hence, the Y-component of the normal is positive. Setting the ccw field to FALSE reverses the normal direction. Backface culling is enabled when the solid field is TRUE.
Examples:
|
virtual |
Start texture coordinate generation.
Texture coordinates will be generated for all texture units used by the currently active texture. If tex_coord_gen is NULL then texture coordinates will be generated from the bounding box of the geometry as defined in the X3D specification. If tex_coord_gen is not NULL then we use the TextureCoordinateGenerator to define the texture coordinate generation.
References H3D::H3DBoundedObject::bound, H3D::BoxBound::center, H3D::X3DTextureNode::getActiveTexture(), H3D_FULL_LOCATION, H3DAbs(), H3D::BoxBound::size, H3D::TextureCoordinateGenerator::startTexGen(), and H3D::MultiTexture::texture.
Referenced by render().
|
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 solid, H3D::X3DGeometryNode::traverseSG(), and H3D::X3DGeometryNode::useBackFaceCulling().
H3DUniquePtr< MFVertexAttributeNode > H3D::ElevationGrid::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 ElevationGrid(), and render().
H3DUniquePtr< AutoNormal > H3D::ElevationGrid::autoNormal |
Auto-generated normals that are used if the normal field is NULL.
Only accessable in C++.
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFBool > H3D::ElevationGrid::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::ElevationGrid::DisplayList::callList(), and ElevationGrid().
H3DUniquePtr< SFColorNode > H3D::ElevationGrid::color |
Contains an X3DColorNode whose colors are applied to the ElevationGrid.
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 ElevationGrid(), and render().
H3DUniquePtr< SFBool > H3D::ElevationGrid::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 ElevationGrid(), and render().
H3DUniquePtr< SFFloat > H3D::ElevationGrid::creaseAngle |
The creaseAngle field affects how default normals are generated.
If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced.
Access type: inputOutput
Default value: 0
Valid range: [0-inf]
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFFogCoordinate > H3D::ElevationGrid::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 ElevationGrid(), and render().
H3DUniquePtr< MFFloat > H3D::ElevationGrid::height |
The height field is an xDimension by zDimension array of scalar values representing the height above the grid for each vertex.
Access type: inputOutput
Default value: []
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFNormalNode > H3D::ElevationGrid::normal |
Contains an X3DNormalNode which colors are applied to the ElevationGrid.
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 ElevationGrid(), and render().
H3DUniquePtr< SFBool > H3D::ElevationGrid::normalPerVertex |
If TRUE the normals in the normal field is applied per vertex, otherwise it is applied per face.
Access type: inputOutput
Default value: TRUE
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFBool > H3D::ElevationGrid::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 ElevationGrid(), and traverseSG().
H3DUniquePtr< SFTextureCoordinateNode > H3D::ElevationGrid::texCoord |
Contains an X3DTextureCoordinateNode which colors are applied to the ElevationGrid.
Access type: inputOutput
Referenced by ElevationGrid(), and render().
|
protected |
Internal field used to know if vertex buffer object can be created.
C++ only field
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFInt32 > H3D::ElevationGrid::xDimension |
The number of elements in the grid height array in the x direction.
Access type: inputOutput
Default value: 0
Valid range: [0-inf]
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFFloat > H3D::ElevationGrid::xSpacing |
The distance between vertices in the x direction.
Access type: inputOutput
Default value: 1.0
Valid range: (0-inf]
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFInt32 > H3D::ElevationGrid::zDimension |
The number of elements in the grid height array in the z direction.
Access type: inputOutput
Default value: 0
Valid range: [0-inf]
Referenced by ElevationGrid(), and render().
H3DUniquePtr< SFFloat > H3D::ElevationGrid::zSpacing |
The distance between vertices in the z direction.
Access type: inputOutput
Default value: 1.0
Valid range: (0-inf]
Referenced by ElevationGrid(), and render().