Home Hierarchy Members Alphabetical Related Pages

TouchSensor Class Reference
[Standard Node Types]

#include <touchsensor.h>

Inherits Node.

Inheritance diagram for TouchSensor:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TouchSensor (const char *name="")
virtual ~TouchSensor ()
virtual unsigned int nbFields () const
virtual FieldHandle field (const std::string &n)
virtual FieldHandle field (const unsigned int i)
virtual bool isSetToDefaultValue (const unsigned int i) const
virtual unsigned int nbEventsIn () const
virtual EventInHandle eventIn (const std::string &n)
virtual EventInHandle eventIn (const unsigned int i)
virtual unsigned int nbEventsOut () const
virtual EventOutHandle eventOut (const std::string &n)
virtual EventOutHandle eventOut (const unsigned int i)
const char * typeName () const
virtual Nodeduplicate () const
virtual Nodeduplicate (std::map< const Node *, Node * > &) const

Public Attributes

Exposed Fields
A field that is capable of receiving events via an eventIn to change its value(s), and generating events via an eventOut when its value(s) change.

SFBool enabled
Events In
EventIn< SFBoolset_enabled
Events Out
EventOut< SFVec3fhitNormal_changed
EventOut< SFVec3fhitPoint_changed
EventOut< SFVec2fhitTexCoord_changed
EventOut< SFBoolisActive
EventOut< SFBoolisOver
EventOut< SFTimetouchTime
EventOut< SFBoolenabled_changed

Detailed Description

Here is the documentation for this node type, from the ISO standard.

+6.70 TouchSensor

A TouchSensor node tracks the location and state of the pointing device and detects when the user points at geometry contained by the TouchSensor node's parent group. A TouchSensor node can be enabled or disabled by sending it an enabled event with a value of TRUE or FALSE. If the TouchSensor node is disabled, it does not track user input or send events.

The TouchSensor generates events when the pointing device points toward any geometry nodes that are descendants of the TouchSensor's parent group. See 4.6.7.5, Activating and manipulating sensors, for more details on using the pointing device to activate the TouchSensor.

The isOver eventOut reflects the state of the pointing device with regard to whether it is pointing towards the TouchSensor node's geometry or not. When the pointing device changes state from a position such that its bearing does not intersect any of the TouchSensor node's geometry to one in which it does intersect geometry, an isOver TRUE event is generated. When the pointing device moves from a position such that its bearing intersects geometry to one in which it no longer intersects the geometry, or some other geometry is obstructing the TouchSensor node's geometry, an isOver FALSE event is generated. These events are generated only when the pointing device has moved and changed `over' state. Events are not generated if the geometry itself is animating and moving underneath the pointing device.

As the user moves the bearing over the TouchSensor node's geometry, the point of intersection (if any) between the bearing and the geometry is determined. Each movement of the pointing device, while isOver is TRUE, generates hitPoint_changed, hitNormal_changed and hitTexCoord_changed events. hitPoint_changed events contain the 3D point on the surface of the underlying geometry, given in the TouchSensor node's coordinate system. hitNormal_changed events contain the surface normal vector at the hitPoint. hitTexCoord_changed events contain the texture coordinates of that surface at the hitPoint. The values of hitTexCoord_changed and hitNormal_changed events are computed as appropriate for the associated shape.

If isOver is TRUE, the user may activate the pointing device to cause the TouchSensor node to generate isActive events (e.g., by pressing the primary mouse button). When the TouchSensor node generates an isActive TRUE event, it grabs all further motion events from the pointing device until it is released and generates an isActive FALSE event (other pointing-device sensors will not generate events during this time). Motion of the pointing device while isActive is TRUE is termed a "drag." If a 2D pointing device is in use, isActive events reflect the state of the primary button associated with the device (i.e., isActive is TRUE when the primary button is pressed and FALSE when it is released). If a 3D pointing device is in use, isActive events will typically reflect whether the pointing device is within (or in contact with) the TouchSensor node's geometry.

The eventOut field touchTime is generated when all three of the following conditions are true:

  1. The pointing device was pointing towards the geometry when it was initially activated (isActive is TRUE).
  2. The pointing device is currently pointing towards the geometry (isOver is TRUE).
  3. The pointing device is deactivated (isActive FALSE event is also generated).

More information about this behaviour is described in 4.6.7.3, Pointing-device sensors, 4.6.7.4, Drag sensors, and 4.6.7.5, Activating and manipulating sensors.

--- VRML separator bar ---


Constructor & Destructor Documentation

TouchSensor const char *  name = ""  ) 
 

Construct a node with all its fields set to default value, which is equivalent to the code below:

  enabled = true;

~TouchSensor  )  [virtual]
 

Virtual destructor, does nothing


Member Function Documentation

wrl::Node * duplicate std::map< const Node *, Node * > &   )  const [virtual]
 

Implements Node.

wrl::Node * duplicate  )  const [virtual]
 

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

wrl::Node::EventInHandle eventIn const unsigned int  n  )  [virtual]
 

Return a handle on the i th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventInHandle eventIn const std::string &  n  )  [virtual]
 

Return a handle on the event in named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

  • set_enabled

Implements Node.

wrl::Node::EventOutHandle eventOut const unsigned int  n  )  [virtual]
 

Return a handle on the i th event out of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

  • 0 : hitNormal_changed
  • 1 : hitPoint_changed
  • 2 : hitTexCoord_changed
  • 3 : isActive
  • 4 : isOver
  • 5 : touchTime
  • 6 : enabled_changed This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventOutHandle eventOut const std::string &  n  )  [virtual]
 

Return a handle on the event out named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

  • hitNormal_changed
  • hitPoint_changed
  • hitTexCoord_changed
  • isActive
  • isOver
  • touchTime
  • enabled_changed

Implements Node.

wrl::Node::FieldHandle field const unsigned int  n  )  [virtual]
 

Return a handle on the i th field of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

  • 0 : enabled This function is useful, with nbFields() if you want to traverse all fields of a Node.

Implements Node.

wrl::Node::FieldHandle field const std::string &  n  )  [virtual]
 

Return a handle on the field named n of the node or a "unknown" typed handle if there is no such field. Valid names are:

  • enabled

Implements Node.

bool isSetToDefaultValue const unsigned int  i  )  const [virtual]
 

Implements Node.

unsigned int nbEventsIn  )  const [inline, virtual]
 

Returns the number of events in for this node type.

Implements Node.

unsigned int nbEventsOut  )  const [inline, virtual]
 

Returns the number of events out for this node type.

Implements Node.

unsigned int nbFields  )  const [inline, virtual]
 

Returns the number of fields (exposed or not) for this node type.

Implements Node.

const char * typeName  )  const [inline, virtual]
 

Returns "TouchSensor". Useful for printing.

Implements Node.


Member Data Documentation

SFBool enabled
 

See Detailed Description for meaning of this field. Default value is set to

       enabled = true;

EventOut<SFBool> enabled_changed
 

Changed event associated to exposedField enabled

EventOut<SFVec3f> hitNormal_changed
 

See Detailed Description for meaning of this event.

EventOut<SFVec3f> hitPoint_changed
 

See Detailed Description for meaning of this event.

EventOut<SFVec2f> hitTexCoord_changed
 

See Detailed Description for meaning of this event.

EventOut<SFBool> isActive
 

See Detailed Description for meaning of this event.

EventOut<SFBool> isOver
 

See Detailed Description for meaning of this event.

EventIn<SFBool> set_enabled
 

Set event associated to exposedField enabled

EventOut<SFTime> touchTime
 

See Detailed Description for meaning of this event.


Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!