Home | Hierarchy | Members | Alphabetical | Related Pages |
#include <touchsensor.h>
Inherits Node.
Public Member Functions | |
TouchSensor (const char *name="") | |
virtual | ~TouchSensor () |
virtual unsigned int | nbFields () const |
virtual FieldHandle | field (const std::string &n) |
virtual FieldHandle | field (unsigned int i) |
virtual bool | isSetToDefaultValue (unsigned int i) const |
virtual unsigned int | nbEventsIn () const |
virtual EventInHandle | eventIn (const std::string &n) |
virtual EventInHandle | eventIn (unsigned int i) |
virtual unsigned int | nbEventsOut () const |
virtual EventOutHandle | eventOut (const std::string &n) |
virtual EventOutHandle | eventOut (unsigned int i) |
const char * | typeName () const |
virtual Node * | duplicate () const |
virtual Node * | duplicate (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< SFBool > | set_enabled |
Events Out | |
EventOut< SFVec3f > | hitNormal_changed |
EventOut< SFVec3f > | hitPoint_changed |
EventOut< SFVec2f > | hitTexCoord_changed |
EventOut< SFBool > | isActive |
EventOut< SFBool > | isOver |
EventOut< SFTime > | touchTime |
EventOut< SFBool > | enabled_changed |
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:
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.
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
unsigned int nbFields | ( | ) | const [inline, virtual] |
Returns the number of fields (exposed or not) for this node type.
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:
Implements Node.
wrl::Node::FieldHandle field | ( | 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:
Implements Node.
bool isSetToDefaultValue | ( | 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.
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:
Implements Node.
wrl::Node::EventInHandle eventIn | ( | 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.
unsigned int nbEventsOut | ( | ) | const [inline, virtual] |
Returns the number of events out for this node type.
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:
Implements Node.
wrl::Node::EventOutHandle eventOut | ( | 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:
Implements Node.
const char * typeName | ( | ) | const [inline, virtual] |
Returns "TouchSensor"
. Useful for printing.
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.
See Detailed Description for meaning of this field. Default value is set to
enabled = true;
Set event associated to exposedField enabled
See Detailed Description for meaning of this event.
See Detailed Description for meaning of this event.
See Detailed Description for meaning of this event.
See Detailed Description for meaning of this event.
See Detailed Description for meaning of this event.
See Detailed Description for meaning of this event.
Changed event associated to exposedField enabled
Generated on 5 Jan 2007 with
![]() |
|