29 #ifndef __X3DGEOMETRYNODE_H__
30 #define __X3DGEOMETRYNODE_H__
44 #include <HAPI/HAPIGLShape.h>
45 #include <HAPI/HapticTriangleSet.h>
52 class H3DShadowObjectNode;
61 public HAPI::HAPIGLShape {
79 virtual void callList(
bool build_list =
true );
82 virtual unsigned int cachingDelay();
84 virtual bool usingCaching();
92 virtual void update();
97 Inst< SFBound > _bound = 0,
98 Inst< DisplayList > _displayList = 0,
99 Inst< MFBool > _isTouched = 0,
100 Inst< MFVec3f > _force = 0,
101 Inst< MFVec3f > _contactPoint = 0,
102 Inst< MFVec3f > _contactNormal = 0,
103 Inst< MFVec3f > _contactTexCoord = 0,
104 Inst< SFBoundTree > _boundTree = 0,
105 Inst< SFVec3f > _centerOfMass = 0);
147 bool previous_allow = allowingCulling();
148 bool prev_draw = draw_debug_options;
149 allowCulling(
false );
150 draw_debug_options =
false;
151 displayList->callList(
false );
152 draw_debug_options = prev_draw;
153 allowCulling( previous_allow );
165 use_culling = enabled;
177 allow_culling = allow;
183 useCulling( enabled );
184 setCullFace( GL_BACK );
189 return allow_culling;
207 template<
class OptionNodeType >
209 for( MFOptionsNode::const_iterator i = options->begin();
210 i != options->end(); ++i ) {
211 OptionNodeType *_options =
dynamic_cast< OptionNodeType *
>( *i );
230 #ifdef HAVE_OPENHAPTICS
237 const Matrix4f &_transform,
238 int _nr_vertices = -1 );
258 virtual void getBound( HAPI::Vec3 ¢er, HAPI::Vec3& size ) {
261 center = b->
center->getValue();
262 size = b->
size->getValue();
264 HAPIGLShape::getBound( center, size );
347 inline void renderTexCoordForActiveTexture(
const Vec3f &tc ) {
351 void createAndAddHapticShapes( TraverseInfo &ti,
352 H3DHapticsDevice *hd,
354 OpenHapticsOptions *openhaptics_options );
356 void addDynamicInfoToShape( TraverseInfo &ti,
357 const string &dynamic_mode,
358 HAPI::HAPIHapticShape *shape );
363 bool use_culling, allow_culling;
364 bool draw_debug_options;
369 bool print_negative_scaling_warning;
Header file for H3DBoundedObject.
Header file for H3DDisplayListObject.
Header file for H3DOptionNode.
Contains the MFBool field class.
Contains the MFNode class.
Contains the MFVec3f field class.
Header file for OpenHapticsOptions.
Header file for X3DChildNode, X3D scene-graph node.
Header file for X3DTextureCoordinateNode, X3D scene-graph node.
The BoxBound is a Bound class that specifies the bound using an axis-aligned bounding box.
Definition: Bound.h:144
H3DUniquePtr< SFVec3f > center
The center point of the bounding box.
Definition: Bound.h:285
H3DUniquePtr< SFVec3f > size
The size of the bounding box.
Definition: Bound.h:287
This abstract interface is the base class for all node types that include a bounding box.
Definition: H3DBoundedObject.h:42
We use the Field's lazy evaluation mechanisms to manage the GL display lists for rendering,...
Definition: H3DDisplayListObject.h:60
This abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
Base class for all haptic devices.
Definition: H3DHapticsDevice.h:68
The H3DShadowObjectNode is the base class for all shadow objects for use in the ShadowCaster node.
Definition: H3DShadowObjectNode.h:49
Base class for all surfaces.
Definition: H3DSurfaceNode.h:44
RefCountSField is almost like any SField but it encapsulates a pointer to a RefCountedClass.
Definition: RefCountSField.h:42
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
This abstract node type indicates that the concrete nodes which are instantiated based on it may be u...
Definition: X3DChildNode.h:42
This is just a dummy class to get around a bug in Visual C++ 7.1 If the X3DGeometry::DisplayList inhe...
Definition: X3DGeometryNode.h:71
Display list is extended in order to set front sidedness of triangles outside the display list.
Definition: X3DGeometryNode.h:76
virtual void callList(bool build_list=true)
Perform front face code outside the display list.
The SFBoundTree constructs a BinaryBoundTree that can be used for collision detection as well as fast...
Definition: X3DGeometryNode.h:91
This is the base node type for all geometry in X3D.
Definition: X3DGeometryNode.h:61
H3DUniquePtr< MFVec3f > contactTexCoord
The texture coordinate of last the contact points of the HapticDevices on the geometry.
Definition: X3DGeometryNode.h:304
H3DUniquePtr< SFVec3f > centerOfMass
The field contains center of mass for the object, based on its bounding box.
Definition: X3DGeometryNode.h:319
virtual bool supportsTangentAttributes()
Returns true if this geometry supports the automatic generation of tangents and binormals as FloatVer...
Definition: X3DGeometryNode.h:250
virtual ~X3DGeometryNode()
Destructor.
virtual void glRender()
Function overridden from HAPIGLShape.
Definition: X3DGeometryNode.h:146
H3DUniquePtr< MFVec3f > contactPoint
The last contact points of the HapticDevices on the geometry.
Definition: X3DGeometryNode.h:294
void allowCulling(bool allow)
Control if face culling is allowed or not.
Definition: X3DGeometryNode.h:176
static void cleanUpFunction(void *userdata)
Function sent to HAPIHapticsShape created to allow for deletion of X3DGeometryNode at the correct tim...
Definition: X3DGeometryNode.h:343
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: X3DGeometryNode.h:243
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: X3DGeometryNode.h:331
AutoRef< Node > shadow_volume
The shadow volume used for this geometry when shadows enabled.
Definition: X3DGeometryNode.h:338
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 void getBound(HAPI::Vec3 ¢er, HAPI::Vec3 &size)
Overriden from HAPIGLShape to use the bound field in he X3DGeometryNode.
Definition: X3DGeometryNode.h:258
H3DUniquePtr< MFVec3f > force
The last force delivered by this geometry to the haptics device.
Definition: X3DGeometryNode.h:285
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.
virtual void initialize()
Changes behaviour of X3DGeometryNode to be a thread safe RefCountedClass.
GLenum getCullFace()
Get which face will be culled if culling is enabled.
Definition: X3DGeometryNode.h:199
bool usingCulling()
Returns if face culling is in use or not.
Definition: X3DGeometryNode.h:169
void setCullFace(GLenum face)
Set which side of a polygon to cull.
Definition: X3DGeometryNode.h:194
void getOptionNode(OptionNodeType *&option)
Get the first option node of the type of the pointer given as argument from the renderOptions fieeld ...
Definition: X3DGeometryNode.h:208
virtual bool movingSphereIntersect(H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
Detect collision between a moving sphere and the geometry.
virtual void closestPoint(const Vec3f &p, NodeIntersectResult &result)
Find closest point on this geometry to point p.
H3DUniquePtr< MFVec3f > contactNormal
The normal at the last contact points of the HapticDevices on the geometry.
Definition: X3DGeometryNode.h:313
virtual H3DShadowObjectNode * getShadowObject()
Get the H3DShadowObjectNode used to create a shadow volume for this geometry.
vector< pair< int, pair< Matrix4f, H3DTime > > > haptic_shape_ids
identifiers for the shapes geometry.
Definition: X3DGeometryNode.h:361
void useBackFaceCulling(bool enabled)
Enabling/disabling back face culling.
Definition: X3DGeometryNode.h:182
H3DUniquePtr< MFBool > isTouched
Tells if a HapticsDevice has been in contact with the geometry in the last scenegraph loop.
Definition: X3DGeometryNode.h:279
virtual bool lineIntersect(const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
Detect intersection between a line segment and this geometry.
bool allowingCulling()
Returns true if back face culling is allowed, false otherwise.
Definition: X3DGeometryNode.h:188
H3DUniquePtr< MFOptionsNode > options
Contains nodes with options for haptics and graphics rendering.
Definition: X3DGeometryNode.h:328
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.
void useCulling(bool enabled)
This function should be used by the render() function to disable or enable face culling.
Definition: X3DGeometryNode.h:164
H3DUniquePtr< SFBoundTree > boundTree
Contains a tree of the HAPI::GeometryPrimitives that build up the X3DGeometryNode.
Definition: X3DGeometryNode.h:323
virtual void traverseSG(TraverseInfo &ti)
Traverse the scenegraph.
static void renderTexCoordForActiveTexture(const Vec3f &tc)
Render the texture coordinate for all texture units used by the texture in X3DTextureNode::getActiveT...
Definition: X3DTextureCoordinateNode.cpp:75
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
Used as input to lineIntersect functions.
Definition: Node.h:224
Used as input to intersection functions.
Definition: Node.h:114