H3D API  2.4.1
HapticTexturesSurface.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __HAPTICTEXTURESSURFACE_H__
30 #define __HAPTICTEXTURESSURFACE_H__
31 
33 #include <H3D/H3DImageObject.h>
35 
36 #include <HAPI/HapticTexturesSurface.h>
37 
38 namespace H3D {
39 
56  public:
57 
60  class H3DAPI_API SFImageObjectNode : public DependentSFNodeObject< H3DImageObject,
61  FieldRef< H3DImageObject,
62  H3DImageObject::SFImage,
63  &H3DImageObject::image >,
64  true > {
69  true > SFImageObjectNodeBase;
70  protected:
73  virtual void onAdd( Node *n );
74 
76  virtual void onRemove( Node *n );
77 
78  public:
79  HAPI::HapticTexturesSurface::ParameterType parameter_type;
80  };
81 
87  class SetImagePtr : public AutoUpdate<
88  TypedField< SFBool, H3DImageObject::SFImage,
89  AnyNumber< H3DImageObject::SFImage > > > {
90  public:
91  HAPI::HapticTexturesSurface::ParameterType parameter_type;
92  protected:
93  virtual void update();
94  };
95 
99  public AutoUpdate< OnValueChangeSField< SFFloat > > {
100  public:
101  HAPI::HapticTexturesSurface::ParameterType parameter_type;
102  bool max_value;
103  protected:
104  virtual void onValueChange( const H3DFloat &v );
105  };
106 
109  Inst< UpdateStiffness > _stiffness = 0,
110  Inst< UpdateDamping > _damping = 0,
111  Inst< UpdateStaticFriction > _staticFriction = 0,
112  Inst< UpdateDynamicFriction > _dynamicFriction = 0,
113  Inst< SFBool > _useRelativeValues = 0,
114  Inst< SFImageObjectNode > _stiffnessMap = 0,
115  Inst< UpdateMinMaxParamValue > _maxStiffness = 0,
116  Inst< UpdateMinMaxParamValue > _minStiffness = 0,
117  Inst< SFImageObjectNode > _dampingMap = 0,
118  Inst< UpdateMinMaxParamValue > _maxDamping = 0,
119  Inst< UpdateMinMaxParamValue > _minDamping = 0,
120  Inst< SFImageObjectNode > _staticFrictionMap = 0,
121  Inst< UpdateMinMaxParamValue > _maxStaticFriction = 0,
122  Inst< UpdateMinMaxParamValue > _minStaticFriction = 0,
123  Inst< SFImageObjectNode > _dynamicFrictionMap = 0,
124  Inst< UpdateMinMaxParamValue > _maxDynamicFriction = 0,
125  Inst< UpdateMinMaxParamValue > _minDynamicFriction = 0 );
126 
129  void initialize();
130 
136  H3DUniquePtr< SFImageObjectNode > stiffnessMap;
137 
143  H3DUniquePtr< SFImageObjectNode > dampingMap;
144 
150  H3DUniquePtr< SFImageObjectNode > staticFrictionMap;
151 
157  H3DUniquePtr< SFImageObjectNode > dynamicFrictionMap;
158 
167  H3DUniquePtr< UpdateMinMaxParamValue > maxStiffness;
168 
177  H3DUniquePtr< UpdateMinMaxParamValue > maxDamping;
178 
187  H3DUniquePtr< UpdateMinMaxParamValue > maxStaticFriction;
188 
197  H3DUniquePtr< UpdateMinMaxParamValue > maxDynamicFriction;
198 
207  H3DUniquePtr< UpdateMinMaxParamValue > minStiffness;
208 
217  H3DUniquePtr< UpdateMinMaxParamValue > minDamping;
218 
227  H3DUniquePtr< UpdateMinMaxParamValue > minStaticFriction;
228 
237  H3DUniquePtr< UpdateMinMaxParamValue > minDynamicFriction;
238 
241 
242  protected:
243  // Used to update the image used for the stiffness parameter
244  // in HAPI::HapticTexturesSurface.
245  H3DUniquePtr< SetImagePtr > setStiffnessPtr;
246 
247  // Used to update the image used for the damping parameter
248  // in HAPI::HapticTexturesSurface.
249  H3DUniquePtr< SetImagePtr > setDampingPtr;
250 
251  // Used to update the image used for the static_friction parameter
252  // in HAPI::HapticTexturesSurface.
253  H3DUniquePtr< SetImagePtr > setStaticFrictionPtr;
254 
255  // Used to update the image used for the dynamic_friction parameter
256  // in HAPI::HapticTexturesSurface.
257  H3DUniquePtr< SetImagePtr > setDynamicFrictionPtr;
258  };
259 }
260 
261 #endif
Contains the DependentSFNode and DependentMFNode template classes.
Header file for H3DFrictionalSurfaceNode.
Header file for H3DImageObject, X3D abstract texture scene-graph node.
DependentSFNodeObject is similar to DependentSFNode but uses TypedSFNodeObject instead of TypedSFNode...
Definition: DependentNodeFields.h:377
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
Base class for surfaces with friction.
Definition: H3DFrictionalSurfaceNode.h:40
The SFImage field is a field containing an Image pointer.
Definition: H3DImageObject.h:50
This abstract interface is inherited by all nodes that contains an SFImage object with an Image conta...
Definition: H3DImageObject.h:45
H3DUniquePtr< SFImage > image
Field containing the Image to use as a texture.
Definition: H3DImageObject.h:191
An SFNode where we make sure the type of the nodes contained is a subclass of H3DImageObject.
Definition: HapticTexturesSurface.h:64
Field class used to transfer the routed image to the HAPISurfaceObject.
Definition: HapticTexturesSurface.h:89
Field class used to set the min and max values of the different parameters in the HAPISurfaceObject.
Definition: HapticTexturesSurface.h:99
Surface in which textures can be used to control the values of the parameters stiffness,...
Definition: HapticTexturesSurface.h:55
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HapticTexturesSurface.h:240
H3DUniquePtr< UpdateMinMaxParamValue > maxStiffness
The maximum allowed value of the stiffness.
Definition: HapticTexturesSurface.h:167
H3DUniquePtr< UpdateMinMaxParamValue > maxDynamicFriction
The maximum allowed value of the dynamic friction.
Definition: HapticTexturesSurface.h:197
H3DUniquePtr< UpdateMinMaxParamValue > minDynamicFriction
The minimum allowed value of the dynamic friction.
Definition: HapticTexturesSurface.h:237
H3DUniquePtr< UpdateMinMaxParamValue > minStiffness
The minimum allowed value of the stiffness.
Definition: HapticTexturesSurface.h:207
H3DUniquePtr< SFImageObjectNode > stiffnessMap
The texture used to map stiffness values.
Definition: HapticTexturesSurface.h:136
H3DUniquePtr< UpdateMinMaxParamValue > minDamping
The minimum allowed value of the damping.
Definition: HapticTexturesSurface.h:217
H3DUniquePtr< SFImageObjectNode > staticFrictionMap
The texture used to map static friction values.
Definition: HapticTexturesSurface.h:150
H3DUniquePtr< SFImageObjectNode > dynamicFrictionMap
The texture used to map dynamic friction values.
Definition: HapticTexturesSurface.h:157
H3DUniquePtr< UpdateMinMaxParamValue > minStaticFriction
The minimum allowed value of the static friction.
Definition: HapticTexturesSurface.h:227
H3DUniquePtr< UpdateMinMaxParamValue > maxStaticFriction
The maximum allowed value of the static friction.
Definition: HapticTexturesSurface.h:187
H3DUniquePtr< UpdateMinMaxParamValue > maxDamping
The maximum allowed value of the damping.
Definition: HapticTexturesSurface.h:177
H3DUniquePtr< SFImageObjectNode > dampingMap
The texture used to map damping values.
Definition: HapticTexturesSurface.h:143
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
float H3DFloat
H3D API namespace.
Definition: Anchor.h:38
The AutoUpdate field is a template to force the BaseField to update itself as soon as an event is rec...
Definition: FieldTemplates.h:130
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194