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

The Extrusion node specifies geometric shapes based on a two dimensional cross-section extruded along a three dimensional spine in the local coordinate system. More...

#include <H3D/Extrusion.h>

Inheritance diagram for H3D::Extrusion:
Inheritance graph

Classes

class  AutoNormal
 Specialized field for automatically generating normals from coordinates. More...
 
class  SFBound
 SFBound is specialized update itself from the fields of the Extrusion. More...
 
class  VertexVector
 Specialized field vertex coordinates from the fields affecting this, the resulting vertexVector will be used both in render and in bound. More...
 

Public Types

typedef DependentSFNode< Normal, FieldRef< X3DGeometricPropertyNode, Field, &X3DNormalNode::propertyChanged > > SFNormalNode
 The SFNormalNode is dependent on the propertyChanged field of the contained Normal.
 
- 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 render ()
 Render the Extrusion with OpenGL.
 
virtual int nrTriangles ()
 An upper bound on the number of triangles.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. More...
 
 Extrusion (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< SFBool > _beginCap=0, Inst< SFBool > _ccw=0, Inst< SFBool > _convex=0, Inst< SFFloat > _creaseAngle=0, Inst< MFVec2f > _crossSection=0, Inst< SFBool > _endCap=0, Inst< MFRotation > _orientation=0, Inst< MFVec2f > _scale=0, Inst< SFBool > _solid=0, Inst< MFVec3f > _spine=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 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 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< SFBoolbeginCap
 When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve. 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< SFBoolconvex
 The convex field indicates whether all polygons in the shape are convex (TRUE). More...
 
H3DUniquePtr< SFFloatcreaseAngle
 The creaseAngle field affects how default normals are generated. More...
 
H3DUniquePtr< MFVec2fcrossSection
 A 2D crossSection piecewise linear curve (described as a series of connected vertices). More...
 
H3DUniquePtr< SFBoolendCap
 When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve. More...
 
H3DUniquePtr< MFRotationorientation
 A list of 3D orientation parameters used to orient the crossSection. More...
 
H3DUniquePtr< MFVec2fscale
 A list of 2D scale parameters used to scale the crossSection. More...
 
H3DUniquePtr< SFBoolsolid
 The solid field determines whether one or both sides of each polygon shall be displayed. More...
 
H3DUniquePtr< MFVec3fspine
 A 3D spine piecewise linear curve (also described as a series of connected vertices). More...
 
H3DUniquePtr< VertexVectorvertexVector
 The vector of vertices constructing the extrusion-shape Only accessable in C++.
 
H3DUniquePtr< AutoNormalautoNormal
 Auto-generated normals. 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

The Extrusion node specifies geometric shapes based on a two dimensional cross-section extruded along a three dimensional spine in the local coordinate system.

The cross-section can be scaled and rotated at each spine point to produce a wide variety of shapes.

Examples:

Internal routes:

Member Function Documentation

◆ traverseSG()

void Extrusion::traverseSG ( TraverseInfo ti)
virtual

Traverse the scenegraph.

A HAPIHapticShape is added for haptic rendering if haptics is enabled.

Parameters
tiThe TraverseInfo object containing information about the traversal.

Reimplemented from H3D::X3DGeometryNode.

References solid, H3D::X3DGeometryNode::traverseSG(), and H3D::X3DGeometryNode::useBackFaceCulling().

Member Data Documentation

◆ autoNormal

H3DUniquePtr< AutoNormal > H3D::Extrusion::autoNormal

Auto-generated normals.

Only accessable in C++.

Referenced by Extrusion(), and render().

◆ beginCap

H3DUniquePtr< SFBool > H3D::Extrusion::beginCap

When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.

If crossSection is not a closed curve, the caps are generated by adding a final point to crossSection that is equal to the initial point. An open surface can still have a cap, resulting (for a simple case) in a shape analogous to a soda can sliced in half vertically. These surfaces are generated even if spine is also a closed curve. If a field value is FALSE, the corresponding cap is not generated.

Access type: inputOutput
Default value: TRUE

Referenced by Extrusion(), and render().

◆ ccw

H3DUniquePtr< SFBool > H3D::Extrusion::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 Extrusion(), and render().

◆ convex

H3DUniquePtr< SFBool > H3D::Extrusion::convex

The convex field indicates whether all polygons in the shape are convex (TRUE).

A polygon is convex if it is planar, does not intersect itself, and all of the interior angles at its vertices are less than 180 degrees. Non planar and self intersecting polygons may produce undefined results even if the convex field is FALSE.

Access type: inputOutput
Default value: TRUE

Referenced by Extrusion().

◆ creaseAngle

H3DUniquePtr< SFFloat > H3D::Extrusion::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 Extrusion(), and render().

◆ crossSection

H3DUniquePtr< MFVec2f > H3D::Extrusion::crossSection

A 2D crossSection piecewise linear curve (described as a series of connected vertices).

The cross-section can be scaled and rotated at each spine point to produce a wide variety of shapes.

Access type: inputOutput
Default value: [1 1 1 -1 -1 -1 -1 1 1 1]

Referenced by Extrusion(), and render().

◆ endCap

H3DUniquePtr< SFBool > H3D::Extrusion::endCap

When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.

If crossSection is not a closed curve, the caps are generated by adding a final point to crossSection that is equal to the initial point. An open surface can still have a cap, resulting (for a simple case) in a shape analogous to a soda can sliced in half vertically. These surfaces are generated even if spine is also a closed curve. If a field value is FALSE, the corresponding cap is not generated.

Access type: inputOutput
Default value: TRUE

Referenced by Extrusion(), and render().

◆ orientation

H3DUniquePtr< MFRotation > H3D::Extrusion::orientation

A list of 3D orientation parameters used to orient the crossSection.

If the number of orientation values is greater than the number of spine points, the excess values are ignored. If it contains one value, it is applied at all spine points. The results are undefined if the number of orientation values is greater than one but less than the number of spine points. The final orientation of each cross-section is computed by first orienting it relative to the spine segments on either side of point at which the cross-section is placed. This is known as the spine-aligned cross-section plane (SCP), and is designed to provide a smooth transition from one spine segment to the next. The SCP is then rotated by the corresponding orientation value. This rotation is performed relative to the SCP. For example, to impart twist in the cross-section, a rotation about the Y-axis (0 1 0) would be used. Other orientations are valid and rotate the cross-section out of the SCP. The unmodified SCP for point is has its y-axis in the direction of the spine point i-1 to i+1. The x and z axis are perpendicular to this direction.

Access type: inputOutput
Default value: 0 0 1 0

Referenced by Extrusion().

◆ scale

H3DUniquePtr< MFVec2f > H3D::Extrusion::scale

A list of 2D scale parameters used to scale the crossSection.

If the number of scale values is greater than the number of spine points, the excess values are ignored. If it contains one value, it is applied at all spine points. The results are undefined if the number of scale values is greater than one but less than the number of spine points.

Access type: inputOutput
Default value: 1 1

Referenced by Extrusion().

◆ solid

H3DUniquePtr< SFBool > H3D::Extrusion::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 Extrusion(), and traverseSG().

◆ spine

H3DUniquePtr< MFVec3f > H3D::Extrusion::spine

A 3D spine piecewise linear curve (also described as a series of connected vertices).

Access type: inputOutput
Default value: [0 0 0 0 1 0]

Referenced by Extrusion(), and render().


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