| 1 |
NAME SoSpotLightDragger SoSpotLtDrag "" {spotlight shaped dragger that allows you to change position, direction, and width of the beam } |
| 2 |
|
| 3 |
INCLUDE draggers/SoSpotLightDragger.h |
| 4 |
|
| 5 |
DESC { \cSoSpotLightDragger\. |
| 6 |
is a composite dragger. It is shaped like a beam of light emanating from a |
| 7 |
sun-like ball. An arrow runs along the axis of the |
| 8 |
beam and extends past the end of the beam. |
| 9 |
\p |
| 10 |
When you click and drag the beam, it opens and closes with |
| 11 |
an umbrella-like motion. The angle |
| 12 |
between the center and edge of the beam is stored in |
| 13 |
the \vangle\. field of this dragger; setting the \vangle\. field causes the |
| 14 |
beam to widen or narrow in response. The spotlight dragger does not |
| 15 |
use a standard dragger class to execute this motion. More details are |
| 16 |
given later in this section. |
| 17 |
\p |
| 18 |
Dragging the arrow rotates it arount the sun, and the beam moves with it. |
| 19 |
The arrow is an \cSoRotateSphericalDragger\. that controls the \vrotation\. |
| 20 |
field. See the reference page for \cSoDirectionalLightDragger\., which |
| 21 |
works the same way, for details. |
| 22 |
\p |
| 23 |
The sun-shape can be dragged to translate all three pieces together |
| 24 |
through 3-space. Its movement controls the \vtranslation\. field and |
| 25 |
works exactly as described in the reference pages for |
| 26 |
\cSoDirectionalLightDragger\. and \cSoPointLightDragger\. (which goes |
| 27 |
into more detail). |
| 28 |
\p |
| 29 |
\eRemember:\. This is \enot\. a light source! It just looks like one. |
| 30 |
If you want to move a light with this dragger, you can do the following: |
| 31 |
\p |
| 32 |
[a] Use an \cSoSpotLightManip\., which is subclassed from \cSoLight\.. |
| 33 |
It creates an \cSoSpotLightDragger\. |
| 34 |
and uses it as the interface to change the \vlocation\., \vdirection\., |
| 35 |
and \vcutOffAngle\. of its light source |
| 36 |
(see the \cSoSpotLightManip\. man page). |
| 37 |
The manip also edits the \vmaterial\. part of this dragger to match the |
| 38 |
color of light the manip is producing. |
| 39 |
\p |
| 40 |
[b] Connect the \vangle\. field of this dragger to the \vcutOffAngle\. |
| 41 |
field of an \cSoSpotLight\. with a field-to-field connection. |
| 42 |
\p |
| 43 |
See the \cSoPointLightDragger\. and \cSoDirectionalLightDragger\. |
| 44 |
man pages for other ways to control light parameters with the |
| 45 |
\vrotation\. and \vtranslation\. fields. |
| 46 |
\p |
| 47 |
This class creates its own projector and |
| 48 |
handles mouse events to do it's own dragging of the beam angle. |
| 49 |
When the mouse picks a point on the beam, that point is dragged in a |
| 50 |
circle just like in an \cSoRotateDiscDragger\., but the |
| 51 |
plane of the disc is re-defined every time a drag is initiated. |
| 52 |
Imagine placing the metal tip of a compass at the apex of the cone and the |
| 53 |
pencil tip at the picked point. |
| 54 |
If you swing an arc through the central axis of the cone, |
| 55 |
you will be drawing the arc |
| 56 |
used to drag the beam open and closed. |
| 57 |
\p |
| 58 |
The beam is opened and closed not by rotating, but by scaling. |
| 59 |
The dragger scales the beam-cone so that the height and |
| 60 |
radius change to move the picked point along the circle. Then the |
| 61 |
\vangle\. field is calculated from the height and radius. |
| 62 |
\p |
| 63 |
You can change the geometry of parts in any instance of this dragger using |
| 64 |
\m\+setPart()\.\-SoDraggerSetPart()\.\.. |
| 65 |
The default part geometries are defined as resources for this |
| 66 |
\cSoSpotLightDragger\. class. They are detailed below in the |
| 67 |
\kDRAGGER RESOURCE\. section. |
| 68 |
You can make your program use different default resources for the parts |
| 69 |
by copying the file |
| 70 |
\v/usr/share/data/draggerDefaults/spotLightDragger.iv\. |
| 71 |
into your own directory, editing the file, and then |
| 72 |
setting the environment variable \vSO_DRAGGER_DIR\. to be a path to that directory. |
| 73 |
} |
| 74 |
|
| 75 |
METHOD "" SoSpotLightDragger() { |
| 76 |
Constructor. |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
METHOD getClassNkitCat static |
| 81 |
const SoNodekitCatalog *getClassNodekitCatalog() const |
| 82 |
{ Returns an \cSoNodekitCatalog\. for this class } |
| 83 |
|
| 84 |
METHOD "" static SoType getClassTypeId() { |
| 85 |
Returns type identifier for this class. |
| 86 |
} |
| 87 |
|
| 88 |
FIELD rotation { Orientation of the rotating part (an arrow by default). } |
| 89 |
FIELD translation { Position of the dragger. } |
| 90 |
FIELD angle { Angle between center and edge of beam. } |
| 91 |
|
| 92 |
DRAGGER_RESOURCE { |
| 93 |
spotLightBeam, |
| 94 |
beam, |
| 95 |
"wire-frame cone with no \cSoMaterial\. node", |
| 96 |
"picking this initiates dragging of the beam angle. The beam |
| 97 |
inherits colors from the \vmaterial\. part, just like the stationary |
| 98 |
version of the sun shape." |
| 99 |
} |
| 100 |
|
| 101 |
DRAGGER_RESOURCE { |
| 102 |
spotLightBeamActive, |
| 103 |
beamActive, |
| 104 |
"yellow wire-frame cone", |
| 105 |
"displayed during dragging of the beam angle." |
| 106 |
} |
| 107 |
|
| 108 |
DRAGGER_RESOURCE { |
| 109 |
spotLightBeamPlacement, |
| 110 |
beamPlacement, |
| 111 |
"translation of (0,0,-1)", |
| 112 |
"This translation node moves the beam parts relative to the rest |
| 113 |
of the dragger. In this case, moving by (0,0,-1) slides the cone outward |
| 114 |
along rotator part toward its arrow-head. The distance |
| 115 |
chosen places the apex of the cone on the surface of the sun shape." |
| 116 |
} |
| 117 |
|
| 118 |
DRAGGER_RESOURCE { |
| 119 |
spotLightRotatorRotator, |
| 120 |
rotator.rotator, |
| 121 |
"white arrow that goes through the sun", |
| 122 |
"picking this begins rotation of the arrow about the sun-shape" |
| 123 |
} |
| 124 |
|
| 125 |
DRAGGER_RESOURCE { |
| 126 |
spotLightRotatorRotatorActive, |
| 127 |
rotator.rotatorActive, |
| 128 |
"yellow arrow that goes through the sun", |
| 129 |
"displayed while the arrow is being rotated" |
| 130 |
} |
| 131 |
|
| 132 |
DRAGGER_RESOURCE { |
| 133 |
spotLightRotatorFeedback, |
| 134 |
rotator.feedback, |
| 135 |
"empty Separator", |
| 136 |
"this disables display of the axes that a rotateSpherical dragger uses |
| 137 |
by default" |
| 138 |
} |
| 139 |
|
| 140 |
DRAGGER_RESOURCE { |
| 141 |
spotLightRotatorFeedbackActive, |
| 142 |
rotator.feedbackActive, |
| 143 |
"empty Separator", |
| 144 |
"this disables display of the axes that a rotateSpherical dragger uses |
| 145 |
by default" |
| 146 |
} |
| 147 |
|
| 148 |
DRAGGER_RESOURCE { |
| 149 |
spotLightOverallMaterial, |
| 150 |
material, |
| 151 |
"white. half strength emissive, half strength diffuse", |
| 152 |
"sets material for the sun shape when stationary. |
| 153 |
Resource for the moving sun, |
| 154 |
spotLightTranslatorPlaneTranslatorActive, |
| 155 |
contains a yellow material for highlighting." |
| 156 |
} |
| 157 |
DRAGGER_RESOURCE { |
| 158 |
spotLightTranslatorPlaneTranslator, |
| 159 |
translator.yzTranslator.translator |
| 160 |
translator.xzTranslator.translator |
| 161 |
translator.xyTranslator.translator, |
| 162 |
"sun shape with no material", |
| 163 |
"picking these parts initiates dragging |
| 164 |
by the yz, xz, and xy planar draggers |
| 165 |
respectively." |
| 166 |
} |
| 167 |
|
| 168 |
DRAGGER_RESOURCE { |
| 169 |
spotLightTranslatorPlaneTranslatorActive, |
| 170 |
translator.yzTranslator.translatorActive |
| 171 |
translator.xzTranslator.translatorActive |
| 172 |
translator.xyTranslator.translatorActive, |
| 173 |
"yellow sun shape", |
| 174 |
"shown during planar dragging in the yz, xz, |
| 175 |
and xy planes respectively." |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
DRAGGER_RESOURCE { |
| 180 |
spotLightTranslatorLineTranslator, |
| 181 |
translator.xTranslator.translator |
| 182 |
translator.yTranslator.translator |
| 183 |
translator.zTranslator.translator, |
| 184 |
"white cylinder", |
| 185 |
"picking these parts initiates dragging |
| 186 |
in the x, y, and z linear draggers respectively." |
| 187 |
} |
| 188 |
|
| 189 |
DRAGGER_RESOURCE { |
| 190 |
spotLightTranslatorLineTranslatorActive, |
| 191 |
translator.xTranslator.translatorActive |
| 192 |
translator.yTranslator.translatorActive |
| 193 |
translator.zTranslator.translatorActive, |
| 194 |
"yellow cylinder", |
| 195 |
"shown during linear dragging in the x, y, |
| 196 |
and z directions respectively." |
| 197 |
} |
| 198 |
|
| 199 |
ALSO { |
| 200 |
SoInteractionKit, |
| 201 |
SoDragger, |
| 202 |
SoCenterballDragger, |
| 203 |
SoDirectionalLightDragger, |
| 204 |
SoDragPointDragger, |
| 205 |
SoHandleBoxDragger, |
| 206 |
SoJackDragger, |
| 207 |
SoPointLightDragger, |
| 208 |
SoRotateCylindricalDragger, |
| 209 |
SoRotateDiscDragger, |
| 210 |
SoRotateSphericalDragger, |
| 211 |
SoScale1Dragger, |
| 212 |
SoScale2Dragger, |
| 213 |
SoScale2UniformDragger, |
| 214 |
SoScaleUniformDragger, |
| 215 |
SoTabBoxDragger, |
| 216 |
SoTabPlaneDragger, |
| 217 |
SoTrackballDragger, |
| 218 |
SoTransformBoxDragger, |
| 219 |
SoTransformerDragger, |
| 220 |
SoTranslate1Dragger, |
| 221 |
SoTranslate2Dragger |
| 222 |
} |
| 223 |
|