VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
4.4 - Observers

An observer is a special kind of distributed object that is not part of the scene.

It controls the camera associated with one or more channels. The input driver is responsible for instantiating observers, because they provide the link between mouse and keyboard input and the cameras that determine how a scene is viewed. For details about how distributed objects are managed, please see 5.1 - The Input Driver.

Observers that control OSG cameras are implemented by the DtOsgObserverAgent and DtOsgObserverObjects, which are derived from the DtObserverAgent and DtObserverObject classes respectively. The DtObserver class provides a renderer-independent interface for creating and controlling observer objects. The renderer creates and maintains an Observer Object Manager (DtObserverObjectManager).

Note
The DtObserverAgent and DtOsgObserverAgent classes are generated. They do not have header files and are not in the API documentation.

When the input driver creates an observer object (through the DtObserver class), the observer is registered with the renderer's Observer Object Manager. Channels can then use the Observer Object Manager to look up the observers that have been designated as their controllers. The linkage between channels and observers is made by observer name. Each channel is given the name of the observer that it should use to position its camera. The observer name is specified in the channel configuration (default "Observer 1"). For details about creating observers, please see 5.1 - The Input Driver.

There are several Boost signals associated with observers. Signals that indicate the creation and destruction of observers are available using the DtInputDriverSignaler (since the input driver creates and owns all observers). You can also connect to the signals raised by individual observers. The following table describes these signals.

Observer Signals
Signal Description
signal_objectAttached Called when the observer attaches to an object. Includes the observer name and the unique ID of the object attached to.
signal_objectsDetached Called when the observer detaches from all. Includes the observer name.
signal_linearScaledSpeedGainChanged Called when the scaled linear speed gain is changed. Includes a pointer to the observer and the new gain.
signal_linearUnscaledSpeedGainChanged Called when the unscaled linear speed gain is changed. Includes a pointer to the observer and the new gain.
signal_rotationSpeedGainChanged Called when the rotation speed gain is changed. Includes a pointer to the observer and the new gain.
signal_orbitSpeedGainChanged Called when the orbit speed gain is changed. Includes a pointer to the observer and the new gain.
signal_gainPrecisionChanged Called when the gain precision is changed. Includes a pointer to the observer and the new gain.
signal_terrainConstraintChanged Called when terrain constraint is turned on or off. Includes a pointer to the observer and a boolean indicating whether terrain constraint is on or off.
signal_speedScalingChanged Called when speed scaling is turned on or off. Includes a pointer to the observer and a boolean indicating whether speed scaling is on or off.

[<< Generating Code for Agents] [Home] [Top of Page] [The Observer API >>]


Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)