H3D API
2.4.1
|
This abstract node type is the base type for all pointing device sensors. More...
#include <H3D/X3DPointingDeviceSensorNode.h>
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. | |
![]() | |
X3DSensorNode (Inst< SFBool > _enabled=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isActive=0) | |
Constructor. | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Static Public Member Functions | |
static void | updateX3DPointingDeviceSensors (Node *n, const Vec3f &from, const Vec3f &to) |
Called to detect and set properties of X3DPointingDeviceSensors. More... | |
static void | updateButtonDependentFields (bool primary_button) |
Update fields that depends on the status of the primary pointing device button. More... | |
static bool | anyIsOver () |
Called to query, whether any X3DPointingDeviceSensors is in isOver state. | |
static bool | anyIsActive () |
Called to query, whether any X3DPointingDeviceSensors is in isActive state. | |
static bool | instancesExists () |
Returns true if there are any X3DPointingDeviceSensors in the scene. | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
Public Attributes | |
H3DUniquePtr< SFString > | description |
The description field in a X3DPointingDeviceSensorNode node specifies a textual description of the X3DPointingDeviceSensorNode node. More... | |
H3DUniquePtr< SFBool > | isOver |
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. More... | |
![]() | |
H3DUniquePtr< SFBool > | enabled |
If enabled is true the sensor node is enabled otherwise it is disabled and will not generate any output. More... | |
H3DUniquePtr< SFBool > | isActive |
A sensor is active when some special conditions are fulfilled and it will then generate extra output. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Protected Member Functions | |
void | setIsEnabled (bool primary_button) |
Handles the enabled logic. | |
void | setIsActive (bool primary_button) |
Handles the isActive logic. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
Protected Attributes | |
H3DUniquePtr< SetIsEnabled > | setIsEnabledField |
Used to call setIsEnabled function when the enabled field is changed. | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
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.
|
static |
Update fields that depends on the status of the primary pointing device button.
So far only implemented for mouse.
Referenced by H3D::H3DWindowNode::render().
|
static |
Called to detect and set properties of X3DPointingDeviceSensors.
The call to this function is done in H3DWindowNode::render
n | The node to do intersection tests with, e.g. the sceneRoot. |
from | The start of the line segment for which to intersect with. |
to | The end of the line segment for which to intersect with.. |
References H3D::X3DSensorNode::enabled, H3D::Node::LineIntersectResult::geom_ptd_map, H3D::GlobalSettings::getActive(), H3D::GlobalSettings::getOptionNode(), H3D::Node::lineIntersect(), H3D::Node::NodeIntersectResult::result, H3D::CollisionOptions::sensorCollideCollisionFalse, H3D::CollisionOptions::sensorCollideToggleGraphicsOff, H3D::Node::NodeIntersectResult::theNodes, and H3D::Node::NodeIntersectResult::transformResult().
Referenced by H3D::H3DWindowNode::render().
H3DUniquePtr< SFString > H3D::X3DPointingDeviceSensorNode::description |
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
Referenced by X3DPointingDeviceSensorNode().
H3DUniquePtr< SFBool > H3D::X3DPointingDeviceSensorNode::isOver |
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
Referenced by anyIsOver(), setIsActive(), setIsEnabled(), and X3DPointingDeviceSensorNode().