H3D API  2.4.1
TouchSensor.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 __TOUCHSENSOR_H__
30 #define __TOUCHSENSOR_H__
31 
32 #include <H3D/X3DTouchSensorNode.h>
33 #include <H3D/SFVec2f.h>
34 
35 namespace H3D {
36 
62  class H3DAPI_API TouchSensor :
63  public X3DTouchSensorNode {
64  public:
65 
67  TouchSensor( Inst< SFString > _description = 0,
68  Inst< SFBool > _enabled = 0,
69  Inst< SFNode > _metadata = 0,
70  Inst< SFVec3f > _hitNormal_changed = 0,
71  Inst< SFVec3f > _hitPoint_changed = 0,
72  Inst< SFVec2f > _hitTexCoord_changed = 0,
73  Inst< SFBool > _isActive = 0,
74  Inst< SFBool > _isOver = 0,
75  Inst< SFTime > _touchTime = 0,
76  Inst< SFString > _hitObject_changed = 0 );
77 
78  // Fields
83  H3DUniquePtr< SFVec3f > hitNormal_changed;
84 
90  H3DUniquePtr< SFVec3f > hitPoint_changed;
91 
96  H3DUniquePtr< SFVec2f > hitTexCoord_changed;
97 
102  H3DUniquePtr< SFString > hitObject_changed;
103 
106 
107  protected:
108  // Called to generate isOver events and other events which dependens on
109  // isOver.
110  virtual void onIsOver( NodeIntersectResult *result = 0, unsigned int closest_index = 0,
111  Matrix4f *global_to_local = 0 );
112 
113  };
114 }
115 #endif
Contains the SFVec2f field class.
Header file for X3DTouchSensorNode, X3D scene-graph node.
A TouchSensor node tracks the location and state of the pointing device and detects when the user poi...
Definition: TouchSensor.h:63
H3DUniquePtr< SFVec3f > hitNormal_changed
hitNormal_changed events contain the surface normal vector at the hitPoint.
Definition: TouchSensor.h:83
H3DUniquePtr< SFVec3f > hitPoint_changed
hitPoint_changed events contain the 3D point on the surface of the underlying geometry,...
Definition: TouchSensor.h:90
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TouchSensor.h:105
H3DUniquePtr< SFString > hitObject_changed
hitObject_changed events contain the name of the object at the hitPoint.
Definition: TouchSensor.h:102
H3DUniquePtr< SFVec2f > hitTexCoord_changed
hitTexCoord_changed events contain the texture coordinates of that surface at the hitPoint.
Definition: TouchSensor.h:96
This abstract node type is the base type for all touch-style pointing device sensors.
Definition: X3DTouchSensorNode.h:46
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 intersection functions.
Definition: Node.h:114