H3D::X3DPointingDeviceSensorNode Class Reference
[Abstract nodes.]

This abstract node type is the base type for all pointing device sensors. More...

#include <H3D/X3DPointingDeviceSensorNode.h>

Inheritance diagram for H3D::X3DPointingDeviceSensorNode:

Inheritance graph

List of all members.

Classes

class  SetIsActive
 The SetIsActive class is specialize field to set the isActive field. More...
class  SetIsEnabled
 The SetIsEnabled class is specialize to check if the primary pointing device button is pressed when the enabled field is set to true. More...

Public Member Functions

 X3DPointingDeviceSensorNode (Inst< SFString > _description=0, Inst< SFBool > _enabled=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isOver=0)
 Constructor.
 ~X3DPointingDeviceSensorNode ()
 Destructor.

Static Public Member Functions

static void updateX3DPointingDeviceSensors (Node *n)
 Called to detect and set properties of X3DPointingDeviceSensors.

Public Attributes

auto_ptr< SFStringdescription
 The description field in a X3DPointingDeviceSensorNode node specifies a textual description of the X3DPointingDeviceSensorNode node.
auto_ptr< SFBoolisOver
 The isOver field reflects the state of the pointing device with regard to whether it is pointing towards the X3DPointingDeviceSensorNode node's geometry or not.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Member Functions

virtual void onIsOver (IntersectionInfo *result=0, Matrix4f *global_to_local=0)
 Called to generate isOver events if they should be generated.

Static Protected Member Functions

static bool has2DPointingDeviceMoved (Vec2f &pos)
 Used to find out if the 2D pointing device ( e.g.

Protected Attributes

bool new_value
 This value is used in onIsOver.
bool lowest_enabled
 This value must be true for a sensor to become active.


Detailed Description

This abstract node type is the base type for all pointing device sensors.

Pointing-device sensors detect user pointing events such as the user clicking on a piece of geometry (i.e., TouchSensor). The following node types are pointing-device sensors:

A pointing-device sensor is activated when the user locates the pointing device over geometry that is influenced by that specific pointing-device sensor. Pointing-device sensors have influence over all geometry that is descended from the sensor's parent groups. Typically, the pointing-device sensor is a sibling to the geometry that it influences. In other cases, the sensor is a sibling to groups which contain geometry (i.e., are influenced by the pointing-device sensor).

The appearance properties of the geometry do not affect activation of the sensor. In particular, transparent materials or textures shall be treated as opaque with respect to activation of pointing-device sensors.

For a given user activation, the lowest enabled pointing-device sensor in the hierarchy is activated. All other pointing-device sensors above the lowest enabled pointing-device sensor are ignored. The hierarchy is defined by the geometry node over which the pointing-device sensor is located and the entire hierarchy upward. If there are multiple pointing-device sensors tied for lowest, each of these is activated simultaneously and independently, possibly resulting in multiple sensors activating and generating output simultaneously. This feature allows combinations of pointing-device sensors (e.g., TouchSensor and PlaneSensor). If a pointing-device sensor appears in the transformation hierarchy multiple times (DEF/USE), it shall be tested for activation in all of the coordinate systems in which it appears.

If a pointing-device sensor is not enabled when the pointing-device button is activated, it will not generate events related to the pointing device until after the pointing device is deactivated and the sensor is enabled (i.e., enabling a sensor in the middle of dragging does not result in the sensor activating immediately).

The pointing device controls a pointer in the virtual world. While activated by the pointing device, a sensor will generate events as the pointer moves. Typically the pointing device may be categorized as either 2D (e.g., conventional mouse) or 3D (e.g., wand). It is suggested that the pointer controlled by a 2D device is mapped onto a plane a fixed distance from the viewer and perpendicular to the line of sight. The mapping of a 3D device may describe a 1:1 relationship between movement of the pointing device and movement of the pointer.

The position of the pointer defines a bearing which is used to determine which geometry is being indicated. When implementing a 2D pointing device it is suggested that the bearing is defined by the vector from the viewer position through the location of the pointer. When implementing a 3D pointing device it is suggested that the bearing is defined by extending a vector from the current position of the pointer in the direction indicated by the pointer.

In all cases the pointer is considered to be indicating a specific geometry when that geometry is intersected by the bearing. If the bearing intersects multiple sensors' geometries, only the sensor nearest to the pointer will be eligible for activation.

Internal routes:
X3DPointingDeviceSensorNode.dot

Member Function Documentation

bool X3DPointingDeviceSensorNode::has2DPointingDeviceMoved ( Vec2f &  pos  )  [static, protected]

Used to find out if the 2D pointing device ( e.g.

the mouse ) has moved. In that case collision with all geometries need to be done.

References H3D::MouseSensor::position.

Referenced by updateX3DPointingDeviceSensors().

virtual void H3D::X3DPointingDeviceSensorNode::onIsOver ( IntersectionInfo result = 0,
Matrix4f *  global_to_local = 0 
) [inline, protected, virtual]

Called to generate isOver events if they should be generated.

Reimplemented in H3D::CylinderSensor, H3D::PlaneSensor, H3D::SphereSensor, and H3D::TouchSensor.

void X3DPointingDeviceSensorNode::updateX3DPointingDeviceSensors ( Node n  )  [static]

Called to detect and set properties of X3DPointingDeviceSensors.

This is not done in traverseSG since that would give prolems with DEF/USE feature and X3DPointingDevice hierarchy. It would also mean more calls to lineIntersect.

Parameters:
n The node to do intersection tests with, e.g. the sceneRoot.

References has2DPointingDeviceMoved(), H3D::Node::lineIntersect(), and new_value.

Referenced by H3D::H3DWindowNode::render().


Member Data Documentation

The description field in a X3DPointingDeviceSensorNode node specifies a textual description of the X3DPointingDeviceSensorNode node.

This may be used by browser-specific user interfaces that wish to present users with more detailed information about the X3DPointingDeviceSensorNode.

Access type: inputOutput

X3DPointingDeviceSensorNode_description.dot

Referenced by X3DPointingDeviceSensorNode().

The isOver field reflects the state of the pointing device with regard to whether it is pointing towards the X3DPointingDeviceSensorNode node's geometry or not.

When the pointing device changes state from a position such that its bearing does not intersect any of the X3DPointingDeviceSensorNode 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 X3DPointingDeviceSensorNode 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.

Access type: outputOnly

X3DPointingDeviceSensorNode_isOver.dot

Referenced by X3DPointingDeviceSensorNode().

This value is used in onIsOver.

Set here instead of sending as argument cause it is more effective to go through all instances of X3DPointingDeviceSensorNodes twice than it is to compare pointers for all devices to know if it should be true or not.

Referenced by H3D::TouchSensor::onIsOver(), H3D::SphereSensor::onIsOver(), H3D::PlaneSensor::onIsOver(), H3D::CylinderSensor::onIsOver(), and updateX3DPointingDeviceSensors().


The documentation for this class was generated from the following files:

Generated on Fri Nov 7 10:31:30 2008 for H3D API by  doxygen 1.5.7