H3D::X3DGeometryNode Class Reference
[Abstract nodes.]

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

#include <H3D/X3DGeometryNode.h>

Inheritance diagram for H3D::X3DGeometryNode:

Inheritance graph

List of all members.

Classes

class  BugWorkaroundDisplayList
 This is just a dummy class to get around a bug in Visual C++ 7.1 If the X3DGeometry::DisplayList inherits directly from H3DDisplayListObject::Display list the application will crash if trying to call H3DDisplayListObject::DisplayList::callList By using an intermediate class the bug dissappears. More...
class  DisplayList
 Display list is extended in order to set front sidedness of triangles outside the display list. More...
class  SFBoundTree
 The HAPIBoundTree constructs a. More...

Public Member Functions

 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)
 Constructor.
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph.
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and this geometry.
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on this geometry to point p.
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the geometry.
virtual void glRender ()
 Function overridden from HAPIGLShape.
void useCulling (bool enabled)
 This function should be used by the render() function to disable or enable face culling.
bool usingCulling ()
 Returns if face culling is in use or not.
void allowCulling (bool allow)
 Control if face culling is allowed or not.
void useBackFaceCulling (bool enabled)
 Enabling/disabling back face culling.
bool allowingCulling ()
 Returns true if back face culling is allowed, false otherwise.
void setCullFace (GLenum face)
 Set which side of a polygon to cull.
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.
virtual ~X3DGeometryNode ()
 Destructor.
HAPI::HAPIHapticShapegetOpenGLHapticShape (H3DSurfaceNode *_surface, const Matrix4f &_transform, int _nr_vertices=-1)
 Returns a either a HLFeedbackShape or a HLDepthBufferShape with the X3DGeometryNode.
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value.
virtual void getBound (HAPI::Vec3 &center, HAPI::Vec3 &size)
 Overriden from HAPIGLShape to use the bound field in he X3DGeometryNode.
virtual void initialize ()
 Changes behaviour of X3DGeometryNode to be a thread safe RefCountedClass.

Public Attributes

auto_ptr< MFBoolisTouched
 Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop.
auto_ptr< MFVec3fforce
 The last force delivered by this geometry to the haptics device.
auto_ptr< MFVec3fcontactPoint
 The last contact points of the HapticDevices on the geometry.
auto_ptr< MFVec3fcontactTexCoord
 The texture coordinate of last the contact points of the HapticDevices on the geometry.
auto_ptr< MFVec3fcontactNormal
 The normal at the last contact points of the HapticDevices on the geometry.
auto_ptr< SFBoundTreeboundTree
 Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode.
auto_ptr< MFOptionsNodeoptions
 Contains nodes with options for haptics and graphics rendering.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Static Protected Member Functions

static void cleanUpFunction (void *userdata)
 Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct time.

Protected Attributes

vector< int > haptic_shape_ids
 identifiers for the shapes geometry.


Detailed Description

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


Member Function Documentation

void H3D::X3DGeometryNode::allowCulling ( bool  allow  )  [inline]

Control if face culling is allowed or not.

Used when rendering HLFeedbackBuffer or HLDepthBuffer shapes in order not to have back face culling on when rendering shapes with OpenHaptics.

static void H3D::X3DGeometryNode::cleanUpFunction ( void *  userdata  )  [inline, static, protected]

Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct time.

The X3DGeometryNode is not automatically reference counted when sent to HAPIHapticShape.

Referenced by H3D::Sphere::traverseSG().

void X3DGeometryNode::closestPoint ( const Vec3f &  p,
NodeIntersectResult &  result 
) [virtual]

Find closest point on this geometry to point p.

Parameters:
p The point to find the closest point to.
result A struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::Node.

Reimplemented in H3D::Sphere.

References boundTree, IntersectionInfo::normal, IntersectionInfo::point, and IntersectionInfo::tex_coord.

Referenced by H3D::PlanarReflector::closestPoint(), and H3D::MagneticGeometryEffect::traverseSG().

virtual string H3D::X3DGeometryNode::defaultXMLContainerField (  )  [inline, virtual]

Returns the default xml containerField attribute value.

For this node it is "geometry".

Reimplemented from H3D::Node.

virtual void H3D::X3DGeometryNode::getBound ( HAPI::Vec3 center,
HAPI::Vec3 size 
) [inline, virtual]

Overriden from HAPIGLShape to use the bound field in he X3DGeometryNode.

An axis aligned bounding box containing all the primitives rendered by the glRender function. If no such bounding box is available, size should be set to Vec3( -1, -1, -1 )

Reimplemented from HAPI::HAPIGLShape.

References H3D::BoxBound::center, and H3D::BoxBound::size.

int X3DGeometryNode::getHapticShapeId ( unsigned int  index  ) 

Get a shape id to be used for rendering of this geometry with HLAPI for the given haptics device.

In the future it will have more uses. Since the geometry can appear in several places in the scene graph it can contain several shape ids (one for each place). Which one to get is determined by the index argument.

References HAPI::HAPIHapticShape::genShapeId(), and haptic_shape_ids.

Referenced by H3D::TraverseInfo::addHapticShape(), and H3D::TraverseInfo::addHapticShapeToAll().

HAPI::HAPIHapticShape* H3D::X3DGeometryNode::getOpenGLHapticShape ( H3DSurfaceNode _surface,
const Matrix4f &  _transform,
int  _nr_vertices = -1 
)

Returns a either a HLFeedbackShape or a HLDepthBufferShape with the X3DGeometryNode.

Which type depents on possible OpenHapticsOptions nodes in the options field and the default settings in OpenHapticsSettings bindable node.

Referenced by traverseSG().

template<class OptionNodeType >
void H3D::X3DGeometryNode::getOptionNode ( OptionNodeType *&  option  )  [inline]

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.

Referenced by H3D::H3DDisplayListObject::DisplayList::cachingDelay(), H3D::X3DGeometryNode::DisplayList::callList(), traverseSG(), H3D::Sphere::traverseSG(), H3D::MagneticGeometryEffect::traverseSG(), and H3D::H3DDisplayListObject::DisplayList::usingCaching().

virtual void H3D::X3DGeometryNode::glRender (  )  [inline, virtual]

Function overridden from HAPIGLShape.

Just call the displayList->callList per default

Reimplemented from HAPI::HAPIGLShape.

void X3DGeometryNode::initialize (  )  [virtual]

Changes behaviour of X3DGeometryNode to be a thread safe RefCountedClass.

Reimplemented from H3DUtil::RefCountedClass.

References H3DUtil::RefCountedClass::ref_count_lock_pointer.

bool X3DGeometryNode::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult &  result 
) [virtual]

Detect intersection between a line segment and this geometry.

Parameters:
from The start of the line segment.
to The end of the line segment.
result Contains info about the closest intersection for every object that intersects the line.
Returns:
true if intersected, false otherwise.

Reimplemented from H3D::Node.

Reimplemented in H3D::Sphere, and H3D::Text.

References H3D::H3DBoundedObject::bound, boundTree, and H3D::Bound::lineSegmentIntersect().

Referenced by H3D::PlanarReflector::lineIntersect().

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

Detect collision between a moving sphere and the geometry.

Parameters:
radius The radius of the sphere
from The start position of the sphere
to The end position of the sphere.
result A struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns:
true if intersected, false otherwise.

Reimplemented from H3D::Node.

Reimplemented in H3D::IndexedLineSet, H3D::PointSet, and H3D::Sphere.

References H3D::H3DBoundedObject::bound, boundTree, and H3D::Bound::movingSphereIntersect().

Referenced by H3D::X3DShapeNode::movingSphereIntersect(), and H3D::PlanarReflector::movingSphereIntersect().

void H3D::X3DGeometryNode::setCullFace ( GLenum  face  )  [inline]

Set which side of a polygon to cull.

Valid values are GL_FRONT or GL_BACK

Referenced by H3D::X3DShapeNode::render().

void X3DGeometryNode::traverseSG ( TraverseInfo ti  )  [virtual]

void H3D::X3DGeometryNode::useBackFaceCulling ( bool  enabled  )  [inline]

void H3D::X3DGeometryNode::useCulling ( bool  enabled  )  [inline]

This function should be used by the render() function to disable or enable face culling.

DO NOT USE glEnable/glDisable to do this, since it will cause problems with OpenHaptics.

Referenced by H3D::X3DShapeNode::render().


Member Data Documentation

Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode.

C++-only field.

Referenced by H3D::X3DGeometryNode::DisplayList::callList(), closestPoint(), lineIntersect(), movingSphereIntersect(), H3D::MagneticGeometryEffect::traverseSG(), and X3DGeometryNode().

The normal at the last contact points of the HapticDevices on the geometry.

The field contains a normal for each of the points in contactPoint. The value will be an empty vector before the first contact.

Access type: outputOnly

Referenced by H3D::DeformableShape::traverseSG(), and H3D::H3DHapticsDevice::updateDeviceValues().

The last contact points of the HapticDevices on the geometry.

The field contains a contact point for each HapticsDevice with the index as specified in the DeviceInfo node. The value will be an empty vector before the first contact.

Access type: outputOnly

Referenced by H3D::DeformableShape::traverseSG(), and H3D::H3DHapticsDevice::updateDeviceValues().

The texture coordinate of last the contact points of the HapticDevices on the geometry.

The field contains a contact point for each HapticsDevice with the index as specified in the DeviceInfo node. The value will be an empty vector before the first contact. NOTE: Will not return correct texture coordinate when using OpenHapticsRenderer.

Access type: outputOnly

Referenced by H3D::H3DHapticsDevice::updateDeviceValues().

The last force delivered by this geometry to the haptics device.

The field contains a force vector for each HapticsDevice with the index as specified in the DeviceInfo node. The value will be an empty vector before the first contact.

Referenced by H3D::DeformableShape::traverseSG(), and H3D::H3DHapticsDevice::updateDeviceValues().

Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop.

The field contains a boolean for each HapticsDevice with the index as specified in the DeviceInfo node. You can get the contact point from the contactPoint field. The value will be an empty vector before the first contact.

Access type: outputOnly

Referenced by H3D::DeformableShape::traverseSG(), and H3D::H3DHapticsDevice::updateDeviceValues().

Contains nodes with options for haptics and graphics rendering.

Access type: inputOnly


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

Generated on Fri Nov 7 10:31:26 2008 for H3D API by  doxygen 1.5.7