XdkWrl: VisibilitySensor Class Reference

Home | Hierarchy | Members | Alphabetical | Related Pages

# VisibilitySensor Class Reference
[Standard Node Types]

`#include <visibilitysensor.h>`

Inherits Node.

List of all members.

## Public Member Functions
| VisibilitySensor (const char *name="")
virtual | ~VisibilitySensor ()
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.
SFVec3f | center
SFBool | enabled
SFVec3f | size
Events In
EventIn< SFVec3f > | set_center
EventIn< SFBool > | set_enabled
EventIn< SFVec3f > | set_size
Events Out
EventOut< SFTime > | enterTime
EventOut< SFTime > | exitTime
EventOut< SFBool > | isActive
EventOut< SFVec3f > | center_changed
EventOut< SFBool > | enabled_changed
EventOut< SFVec3f > | size_changed

## Detailed Description

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

## 6.74 VisibilitySensor

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 eventOut. 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 exposed 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 a VRML 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.

## Constructor & Destructor Documentation

VisibilitySensor | ( | const char * | name = `""` | ) |

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

      center.setXYZ(0,0,0);
      enabled = true;
      size.setXYZ(0,0,0);

~VisibilitySensor | ( |  | ) | `[virtual]`

Virtual destructor, does nothing

## Member Function Documentation

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:

- center
- enabled
- size

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:

- 0 : center
- 1 : enabled
- 2 : size This function is useful, with nbFields() if you want to traverse all fields of a Node.

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:

- set_center
- set_enabled
- set_size

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:

- enterTime
- exitTime
- isActive
- center_changed
- enabled_changed
- size_changed

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:

- 0 : enterTime
- 1 : exitTime
- 2 : isActive
- 3 : center_changed
- 4 : enabled_changed
- 5 : size_changed This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

const char * typeName | ( |  | ) | const`[inline, virtual]`

Returns `"VisibilitySensor"`. 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.

virtual Node* duplicate | ( | std::map< const Node *, Node * > & |  | ) | const`[virtual]`

Implements Node.

## Member Data Documentation

SFVec3f center

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

           center.setXYZ(0,0,0);

SFBool enabled

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

           enabled = true;

SFVec3f size

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

           size.setXYZ(0,0,0);

EventIn<SFVec3f> set_center

Set event associated to exposedField center

EventIn<SFBool> set_enabled

Set event associated to exposedField enabled

EventIn<SFVec3f> set_size

Set event associated to exposedField size

EventOut<SFTime> enterTime

See Detailed Description for meaning of this event.

EventOut<SFTime> exitTime

See Detailed Description for meaning of this event.

EventOut<SFBool> isActive

See Detailed Description for meaning of this event.

EventOut<SFVec3f> center_changed

Changed event associated to exposedField center

EventOut<SFBool> enabled_changed

Changed event associated to exposedField enabled

EventOut<SFVec3f> size_changed

Changed event associated to exposedField size

Generated on 5 Jan 2007 with version 1.5.1. |