29 #ifndef __HAPTICSRENDERERS_H__
30 #define __HAPTICSRENDERERS_H__
42 #include <HAPI/RuspiniRenderer.h>
43 #include <HAPI/GodObjectRenderer.h>
58 virtual void onValueChange(
const string &v );
65 virtual void onValueChange(
const bool &v );
73 virtual void onValueChange(
const bool &v );
78 Inst< AdaptiveViewport > _defaultAdaptiveViewport = 0,
79 Inst< CameraView > _defaultHapticCameraView = 0 ) :
80 defaultShapeType( _defaultShapeType ),
81 defaultAdaptiveViewport( _defaultAdaptiveViewport ),
82 defaultHapticCameraView( _defaultHapticCameraView ) {
83 type_name =
"OpenHapticsRenderer";
84 database.initFields(
this );
86 #ifndef HAVE_OPENHAPTICS
87 Console(LogLevel::Error) <<
"Cannot use OpenHapticsRenderer. HAPI compiled without"
88 <<
" OpenHaptics support. Recompile HAPI with "
89 <<
"HAVE_OPENHAPTICS defined"
90 <<
" in order to use it." << endl;
93 defaultShapeType->addValidValue(
"FEEDBACK_BUFFER" );
94 defaultShapeType->addValidValue(
"DEPTH_BUFFER" );
95 defaultShapeType->setValue(
"FEEDBACK_BUFFER" );
96 defaultAdaptiveViewport->setValue(
true );
97 defaultHapticCameraView->setValue(
true );
126 virtual HAPI::HAPIHapticsRenderer *getNewHapticsRenderer();
142 virtual void onValueChange(
const H3DDouble &v);
148 virtual void onValueChange(
const bool &v);
153 Inst< EnableSecondaryCollisions > _enableSecondaryCollisions = 0);
178 return new HAPI::GodObjectRenderer( minDistance->getValue(), enableSecondaryCollisions->getValue());
194 virtual void onValueChange(
const H3DFloat &v );
198 virtual void onValueChange(
const bool &b );
203 Inst< AlwaysFollowSurface > _alwaysFollowSurface = 0 );
241 return new HAPI::RuspiniRenderer( proxyRadius->getValue(), alwaysFollowSurface->getValue() );
257 type_name =
"Chai3DRenderer";
258 database.initFields(
this );
266 virtual HAPI::HAPIHapticsRenderer *getNewHapticsRenderer();
290 virtual void onAdd(
Node *n );
292 virtual void onRemove(
Node *n );
299 virtual HAPI::HAPIHapticsRenderer *
300 getHapticsRenderer(
unsigned int layer );
309 hapticsRendererRemovedInternal( layer );
310 if( layer < hapticsRenderer->size() )
311 hapticsRenderer->getValueByIndex( layer )->
312 hapticsRendererRemoved( 0 );
328 return new HAPI::GodObjectRenderer;
331 void hapticsRendererRemovedInternal(
unsigned int layer,
bool erase =
false ) {
333 if( layer < renderers.size() ) {
334 vector< HAPI::HAPIHapticsRenderer * >::iterator i = renderers.begin();
336 renderers.erase( i );
Contains different templates to modify field behaviour.
Header file for H3DHapticsRendererNode.
Contains the MFNode class.
Contains the SFBool field class.
Contains the SFDouble field class.
Contains the SFFloat field class.
Contains the SFString field class.
Haptics renderer using Chai3D(www.chai3d.org) Uses the HAPI::Chai3DRenderer class.
Definition: HapticsRenderers.h:252
Chai3DRenderer()
Constructor.
Definition: HapticsRenderers.h:256
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticsRenderers.h:262
EnableSecondaryCollisions specializes SFBool to set the value determining whether to enable secondary...
Definition: HapticsRenderers.h:147
minDistance specializes SFDouble to set the minimum distance between the surface and the proxy in God...
Definition: HapticsRenderers.h:141
Haptics renderer using the god object algorithm to render objects.
Definition: HapticsRenderers.h:136
H3DUniquePtr< SFBool > enableSecondaryCollisions
Performs additional collision detection when calculating a new proxy position Attempts to avoid placi...
Definition: HapticsRenderers.h:171
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticsRenderers.h:174
virtual HAPI::HAPIHapticsRenderer * getNewHapticsRenderer()
Returns a new instance of HAPI::GodObjectRenderer.
Definition: HapticsRenderers.h:177
H3DUniquePtr< SFDouble > minDistance
The minimum distance the proxy will be from the surface.
Definition: HapticsRenderers.h:161
Base class for all haptic renderers, i.e.
Definition: H3DHapticsRendererNode.h:44
virtual void hapticsRendererRemoved(unsigned int layer)
This function should only be called if the HAPI::HAPIHapticsRenderer obtained for the given layer is ...
Definition: H3DHapticsRendererNode.h:69
MFHapticsRendererNode extends TypedMFNode< H3DHapticsRendererNode > in order to change the haptics re...
Definition: HapticsRenderers.h:287
Haptics renderer which may contain other haptics renderer nodes.
Definition: HapticsRenderers.h:280
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticsRenderers.h:324
virtual void hapticsRendererRemoved(unsigned int layer)
This function should only be called if the HAPI::HAPIHapticsRenderer obtained for the given layer is ...
Definition: HapticsRenderers.h:308
H3DUniquePtr< MFHapticsRendererNode > hapticsRenderer
The hapticsRenderer field contains a HapticsRendererNode for each layer.
Definition: HapticsRenderers.h:321
virtual HAPI::HAPIHapticsRenderer * getNewHapticsRenderer()
Returns a new instance of HAPI::RuspiniRenderer.
Definition: HapticsRenderers.h:327
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
Template for adding the virtual function onValueChange that can be overridden in subclasses in order ...
Definition: FieldTemplates.h:49
AdaptiveViewport specializes SFBool to set the appropriate default values in the HAPI::OpenHapticsRen...
Definition: HapticsRenderers.h:63
CameraView specializes SFBool to set the appropriate default values in the HAPI::OpenHapticsRenderer ...
Definition: HapticsRenderers.h:71
ShapeType specializes SFString to set the appropriate default OpenHaptics shape in the HAPI::OpenHapt...
Definition: HapticsRenderers.h:56
Haptics renderer using OpenHaptics to render objects.
Definition: HapticsRenderers.h:52
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticsRenderers.h:123
H3DUniquePtr< SFBool > defaultAdaptiveViewport
The default value for use of adaptive viewport to use if it has not been specified with the OpenHapti...
Definition: HapticsRenderers.h:113
H3DUniquePtr< SFString > defaultShapeType
The default shape type to use if it has not been specified with the OpenHapticsOptions node.
Definition: HapticsRenderers.h:106
OpenHapticsRenderer(Inst< ShapeType > _defaultShapeType=0, Inst< AdaptiveViewport > _defaultAdaptiveViewport=0, Inst< CameraView > _defaultHapticCameraView=0)
Constructor.
Definition: HapticsRenderers.h:77
H3DUniquePtr< SFBool > defaultHapticCameraView
The default value for use of haptic camera view to use if it has not been specified with the OpenHapt...
Definition: HapticsRenderers.h:120
ProxyRadius specializes SFFloat to set the proxy radius in the HAPI::RuspiniRenderer used.
Definition: HapticsRenderers.h:193
Haptics renderer using a variant of the Ruspini algorithm allowing you to specify a radius on the pro...
Definition: HapticsRenderers.h:189
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticsRenderers.h:237
H3DUniquePtr< SFFloat > proxyRadius
The radius of the proxy in metres.
Definition: HapticsRenderers.h:209
virtual HAPI::HAPIHapticsRenderer * getNewHapticsRenderer()
Returns a new instance of HAPI::RuspiniRenderer.
Definition: HapticsRenderers.h:240
H3DUniquePtr< SFBool > alwaysFollowSurface
Always move the proxy when the object that it is in contact with moves.
Definition: HapticsRenderers.h:234
Template to make sure that the Nodes that are added to a MFNode are of a specified Node type.
Definition: MFNode.h:221
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