H3D API
2.4.1
|
The VisibilitySensor node detects visibility changes of a rectangular box as the user navigates the world. More...
#include <H3D/VisibilitySensor.h>
Classes | |
class | SetTime |
The SetTime class is specialize to set the value of either the inputTrue or inputFalse field in the BooleanFilter node it resides in, depending on the value that is is given. More... | |
Public Member Functions | |
VisibilitySensor (Inst< SFNode > _metadata=0, Inst< SFVec3f > _center=0, Inst< SFVec3f > _size=0, Inst< SFTime > _enterTime=0, Inst< SFTime > _exitTime=0, Inst< SFBool > _enabled=0, Inst< SFBool > _isActive=0, Inst< SFBool > _viewFrustumMode=0) | |
Constructor. | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
![]() | |
X3DEnvironmentalSensorNode (Inst< SFNode > _metadata=0, Inst< SFVec3f > _center=0, Inst< SFBool > _enabled=0, Inst< SFVec3f > _size=0, Inst< SFTime > _enterTime=0, Inst< SFTime > _exitTime=0, Inst< SFBool > _isActive=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 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... | |
Public Attributes | |
H3DUniquePtr< SetTime > | set_time |
Sets enterTime if the set_boolean value is set to TRUE. More... | |
H3DUniquePtr< SFBool > | viewFrustumMode |
If true, isActive field will be true as long as the sensor stays within the view frustum without being affected by the depth test. More... | |
TraverseInfo * | prev_travinfoadr |
Adress of traverseInfo only interested in adress, what it points to will be invalid. | |
![]() | |
H3DUniquePtr< SFVec3f > | center |
Center gives the space location of the box. More... | |
H3DUniquePtr< SFVec3f > | size |
Size gives the size of the box (width=x, height=y, depth=z) More... | |
H3DUniquePtr< SFTime > | enterTime |
enterTime More... | |
H3DUniquePtr< SFTime > | exitTime |
exitTime 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. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
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 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. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
The VisibilitySensor node detects visibility changes of a rectangular box as the user navigates the world.
VisibilitySensor is typically used to detect when the user can see a specific object or region in the scene in order to activate or deactivate some behaviour or animation. The purpose is often to attract the attention of the user or to improve performance.
The enabled field enables and disables the VisibilitySensor node. If enabled is set to FALSE, the VisibilitySensor node does not send events. If enabled is TRUE, the VisibilitySensor node detects changes to the visibility status of the box specified and sends events through the isActive field. A TRUE event is output to isActive when any portion of the box impacts the rendered view. A FALSE event is sent when the box has no effect on the view. Browsers shall guarantee that, if isActive is FALSE, the box has absolutely no effect on the rendered view. Browsers may err liberally when isActive is TRUE. For example, the box may affect the rendering.
The fields center and size specify the object space location of the box centre and the extents of the box (i.e., width, height, and depth). The VisibilitySensor node's box is affected by hierarchical transformations of its parents. The components of the size field shall be greater than or equal to zero.
The enterTime event is generated whenever the isActive TRUE event is generated, and exitTime events are generated whenever isActive FALSE events are generated. A VisibilitySensor read from an X3D file shall generate isActive TRUE and enterTime events if the sensor is enabled and the visibility box is visible. A VisibilitySensor inserted into the transformation hierarchy shall generate isActive TRUE and enterTime events if the sensor is enabled and the visibility box is visible. A VisibilitySensor removed from the transformation hierarchy shall generate isActive FALSE and exitTime events if the sensor is enabled and the visibility box is visible.
Each VisibilitySensor node behaves independently of all other VisibilitySensor nodes. Every enabled VisibilitySensor node that is affected by the user's movement receives and sends events, possibly resulting in multiple VisibilitySensor nodes receiving and sending events simultaneously. Unlike TouchSensor nodes, there is no notion of a VisibilitySensor node lower in the scene graph "grabbing" events. Multiply instanced VisibilitySensor nodes (i.e., DEF/USE) use the union of all the boxes defined by their instances. An instanced VisibilitySensor node shall detect visibility changes for all instances of the box and send events appropriately.
Examples:
|
virtual |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph.
During this traversal things can be updated in the node and HapticObject instances to be rendered should be added to the TraverseInfo object.
ti | The TraverseInfo object containing information about the traversal. |
Reimplemented from H3D::Node.
References H3D::X3DEnvironmentalSensorNode::center, H3D::X3DSensorNode::enabled, H3D::TraverseInfo::getAccForwardMatrix(), H3D::X3DSensorNode::isActive, prev_travinfoadr, H3D::X3DEnvironmentalSensorNode::size, and viewFrustumMode.
H3DUniquePtr< SetTime > H3D::VisibilitySensor::set_time |
Sets enterTime if the set_boolean value is set to TRUE.
Else sets exitTime
Access type: inputOnly
Referenced by VisibilitySensor().
H3DUniquePtr< SFBool > H3D::VisibilitySensor::viewFrustumMode |
If true, isActive field will be true as long as the sensor stays within the view frustum without being affected by the depth test.
Otherwise depth test will affect the result.
Default Value False Access type: inputOutput
Referenced by traverseSG(), and VisibilitySensor().