Open Inventor Reference
SoDirectionalLightDragger Class Reference

Directional icon you rotate and translate by dragging with the mouse. More...

#include <Inventor/draggers/SoDirectionalLightDragger.h>

Inheritance diagram for SoDirectionalLightDragger:
SoDragger SoInteractionKit SoBaseKit SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoDirectionalLightDragger ()
 Constructor.

Static Public Member Functions

static void initClass ()
 initialize the class

Public Attributes

SoSFRotation rotation
SoSFVec3f translation

Protected Member Functions

virtual SbBool setUpConnections (SbBool onOff, SbBool doItAlways=FALSE)
 detach/attach any sensors, callbacks, and/or field connections.
virtual void setDefaultOnNonWritingFields ()
 Called by the SoBaseKit::write() method.
 ~SoDirectionalLightDragger ()

Static Protected Member Functions

static void fieldSensorCB (void *, SoSensor *)
static void valueChangedCB (void *, SoDragger *)

Protected Attributes

SoFieldSensortranslFieldSensor
SoFieldSensorrotFieldSensor

Detailed Description

SoDirectionalLightDragger is a composite dragger. It looks like a sun with a large arrow coming out of it. The arrow can be rotated about the sun by dragging with the mouse; its orientation is given by the rotation field. You can also drag the sun (and the arrow with it) through 3-space. The location is stored in the translation field.

The dragger uses an SoRotateSphericalDragger for changing the rotation. Instead of using the default spherical geometry, this dragger uses an arrow shape.

The sun is an SoDragPointDragger. Dragging it edits the translation field; conversely, if you change the translation field the sun will move to that new location, bringing the arrow with it. The sun looks and behaves just like the sun in an SoPointLightDragger, as does the material part. See the SoPointLightDragger man page for details.

Remember: This is not a light source! It just looks like one. If you want to move a light with this dragger, you can either:

[a] Use an SoDirectionalLightManip, which is subclassed from SoLight. It creates an SoDirectionalLightDragger and uses it as the interface to change the direction of its light source (see the SoDirectionalLightManip man page). The manipulator also edits the material part of this dragger to match the color of light the manipulator is producing. However, the directional light manipulator will ignore the translation field, because a directional light has no location or translation field. So in this case the translation dragger merely allows you to move the physical arrow to wherever you'd like it to be.

[b] Put an SoTransform under an SoTransformSeparator. Add the SoDirectionalLight as the next child. Use a field-to-field connection between the rotation fields of this dragger and the transform node to synchronize the light with this dragger.

[c] Use engines to connect the rotation field of this dragger to the direction field of an SoDirectionalLight. Use the rotation as input to an SoComposeMatrix engine. Then, use an SoTransformVec3f engine to apply that matrix to (0,0,-1), the default light direction.

You can change the parts in any instance of this dragger using setPart(). The default part geometries are defined as resources for this SoDirectionalLightDragger class. They are detailed in the Dragger Resources section of the online reference page for this class. You can make your program use different default resources for the parts by copying the file /usr/share/data/draggerDefaults/directionalLightDragger.iv into your own directory, editing the file, and then setting the environment variable SO_DRAGGER_DIR to be a path to that directory.

File Format/Default
See Also
SoInteractionKit, SoDragger, SoCenterballDragger, SoDragPointDragger, SoHandleBoxDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTabPlaneDragger, SoTrackballDragger, SoTransformBoxDragger, SoTransformerDragger, SoTranslate1Dragger, SoTranslate2Dragger

Definition at line 204 of file SoDirectionalLightDragger.h.


Constructor & Destructor Documentation

SoDirectionalLightDragger::SoDirectionalLightDragger ( )
SoDirectionalLightDragger::~SoDirectionalLightDragger ( ) [protected]

Member Function Documentation

static void SoDirectionalLightDragger::fieldSensorCB ( void *  ,
SoSensor  
) [static, protected]

Reimplemented from SoInteractionKit.

static void SoDirectionalLightDragger::initClass ( ) [static]

Reimplemented from SoDragger.

virtual void SoDirectionalLightDragger::setDefaultOnNonWritingFields ( ) [protected, virtual]

Draggers don't want to write out fields if they have default vals.

sets isActive to default if default and not connected.

Looks for fields named: 'rotation' with value SbRotation::identity() 'translation' with value (0,0,0) 'center' with value (0,0,0) 'scaleFactor' with value (1,1,1) and sets them to default if they are not connected from a field. (most draggers are missing at least some of these, but thats okay)

Then calls the method for SoInteractionKit.

NOTE: Parts which are set to default may still wind up writing to file if, for example, they lie on a path.

Reimplemented from SoDragger.

virtual SbBool SoDirectionalLightDragger::setUpConnections ( SbBool  onOff,
SbBool  doItAlways = FALSE 
) [protected, virtual]

Also set geometry of childDraggers to be our default instead of their regular default, using our resources. Called by: start/end of SoBaseKit::readInstance and on new copy by: start/end of SoBaseKit::copy. Classes that redefine must call setUpConnections(TRUE,TRUE) at end of constructor. Returns the state of the node when this was called.

Reimplemented from SoInteractionKit.

static void SoDirectionalLightDragger::valueChangedCB ( void *  ,
SoDragger  
) [static, protected]

Member Data Documentation


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