| 1 |
NAME SoSpotLightManip SoSpotLtManip "" { spotlight node with 3D interface for editing location, direction, and beam width } |
| 2 |
|
| 3 |
INCLUDE manips/SoSpotLightManip.h |
| 4 |
|
| 5 |
DESC { |
| 6 |
\cSoSpotLightManip\. |
| 7 |
is the base class for all \cSoSpotLight\. nodes that have a built-in |
| 8 |
3D user interface (this is the only such class provided with the |
| 9 |
Inventor toolkit). |
| 10 |
Since it is derived from \cSoSpotLight\., any changes to its |
| 11 |
fields result in a change of lighting for nodes that |
| 12 |
follow it in the scene graph. |
| 13 |
In this case, the interface edits the \vlocation\., \vdirection\., and |
| 14 |
\vcutOffAngle\. fields. |
| 15 |
Also, the color of the manipulator's geometry will reflect the color of the |
| 16 |
light (but you can not edit the color using this manipulator). |
| 17 |
\p |
| 18 |
Typically, you will want to replace a regular \cSoSpotLight\. with an |
| 19 |
\cSoSpotLightManip\. (as when the user selects a light to be edited), |
| 20 |
or vice versa (as when the user is done moving the light and the interface |
| 21 |
should go away). |
| 22 |
Use the |
| 23 |
\+\mreplaceNode()\. method\. |
| 24 |
\-\mSoSpotLtManipReplaceNode()\. function\. |
| 25 |
to insert a manipulator into a scene graph, and the |
| 26 |
\+\mreplaceManip()\. method\. |
| 27 |
\-\mSoSpotLtManipReplaceManip()\. function\. |
| 28 |
to remove it when done. |
| 29 |
\p |
| 30 |
The \cSoSpotLightManip\. |
| 31 |
utilizes an \cSoSpotLightDragger\. to provide a 3D interface. |
| 32 |
However, the manipulator differs from the dragger; it lights other objects |
| 33 |
in the scene because, as an \cSoSpotLight\., |
| 34 |
it alters the state. |
| 35 |
The fields values and movement of the dragger, on the other hand, affect only |
| 36 |
the dragger itself. |
| 37 |
To find out more about how the interface works and what each part will do, |
| 38 |
see the reference page for \cSoSpotLightDragger\.. The interfaces of the |
| 39 |
dragger and the manipulator are identical. |
| 40 |
\p |
| 41 |
The \cSoSpotLightManip\. utilizes its dragger by adding it |
| 42 |
as a hidden child. When an action is applied to the manipulator, |
| 43 |
such as rendering or handling events, the manipulator first traverses the |
| 44 |
dragger, and then the manipulator adds its lighting parameters to the state. |
| 45 |
When you click-drag-release over the manipulator, it passes these events down |
| 46 |
to the dragger, which moves as a result ("I can't \ehelp\. it, I'm a dragger!"). |
| 47 |
\p |
| 48 |
The manipulator maintains consistency between the fields |
| 49 |
of the dragger and its own fields. Let's say you use the mouse to widen |
| 50 |
the cone of the \edragger\.. Callbacks insure that the |
| 51 |
\vcutOffAngle\. field of the \emanipulator\. will change by the same |
| 52 |
amount, thus changing the lighting of nodes which follow |
| 53 |
in the scene graph. |
| 54 |
Similarly, if you set the \vcutOffAngle\. field of the |
| 55 |
\cSoSpotLightManip\., the manipulator will |
| 56 |
widen the beam of the dragger accordingly. |
| 57 |
\p |
| 58 |
Because the dragger is a \ehidden\. child, you can see the dragger on screen |
| 59 |
and interact with it, but the dragger |
| 60 |
does not show up when you write the manipulator to file. Also, any \cSoPath\. |
| 61 |
will end at the manipulator. (See the Actions section of this reference page |
| 62 |
for a complete description of when the dragger is traversed). |
| 63 |
\p |
| 64 |
If you want to get a pointer to the dragger |
| 65 |
you can get it from the manipulator using the |
| 66 |
\m\+getDragger()\.\-SoSpotLtManipGetDragger()\.\. method. You will need to |
| 67 |
do this if you want to change the geometry of a manipulator, since the |
| 68 |
geometry actually belongs to the dragger. |
| 69 |
} |
| 70 |
|
| 71 |
METHOD "" SoSpotLightManip() { |
| 72 |
Constructor. |
| 73 |
} |
| 74 |
|
| 75 |
METHOD getDrag SoDragger *getDragger() { |
| 76 |
Returns a pointer to the dragger being used by this manipulator. |
| 77 |
Given this pointer, you can customize the dragger just like you would |
| 78 |
any other dragger. You can change geometry using |
| 79 |
the \m\+setPart()\.\-SoDragSetPart()\.\. method, or add callbacks using |
| 80 |
the methods found in the \cSoDragger\. reference page. |
| 81 |
} |
| 82 |
|
| 83 |
METHOD "" SbBool replaceNode( SoPath *p ) { |
| 84 |
Replaces the tail of the path with this manipulator. |
| 85 |
The tail of the path must be an \cSoSpotLight\. node (or subclass thereof). |
| 86 |
If the path has a nodekit, this will try to use |
| 87 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the manipulator. |
| 88 |
Otherwise, the manipulator requires that the |
| 89 |
next to last node in the path chain be a group. |
| 90 |
\p |
| 91 |
The field values from the spotlight node will be copied to |
| 92 |
this manipulator, and the light node will be replaced. |
| 93 |
\p |
| 94 |
The manipulator will not call |
| 95 |
\m\+ref()\.\-SoSpotLtRef()\.\. on the node it is replacing. |
| 96 |
The old node will disappear if |
| 97 |
it has no references other than from the input path \ap\. and its parent, |
| 98 |
since this manipulator will be replacing it in both of those places. |
| 99 |
Nor will the manipulator make any |
| 100 |
changes to field connections of the old node. |
| 101 |
The calling process is thus responsible for keeping |
| 102 |
track of its own nodes and field connections. |
| 103 |
} |
| 104 |
|
| 105 |
METHOD "" SbBool replaceManip(SoPath *p, SoSpotLight *newOne ) const { |
| 106 |
Replaces the tail of the path, which must be this manipulator, |
| 107 |
with the given \cSoSpotLight\. node. |
| 108 |
If the path has a nodekit, this will try to use |
| 109 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the new node. |
| 110 |
Otherwise, the manipulator requires that the |
| 111 |
next to last node in the path chain be a group. |
| 112 |
\p |
| 113 |
The field values from the manipulator will be copied |
| 114 |
to the spotlight node, and the manipulator will be replaced. |
| 115 |
\p |
| 116 |
The manipulator will not call |
| 117 |
\+\mref()\. or \munref()\.\. |
| 118 |
\-\mSoSpotLtRef()\. or \mSoSpotLtUnref()\.\. |
| 119 |
on the node which is replacing it, nor will it make any |
| 120 |
changes to field connections. |
| 121 |
The calling process is thus responsible for keeping |
| 122 |
track of its own nodes and field connections. |
| 123 |
} |
| 124 |
|
| 125 |
METHOD "" static SoType getClassTypeId() { |
| 126 |
Returns type identifier for this class. |
| 127 |
} |
| 128 |
|
| 129 |
ACTION SoGLRenderAction, SoCallbackAction, |
| 130 |
SoGetBoundingBoxAction, SoGetMatrixAction, |
| 131 |
SoHandleEventAction, SoRayPickAction { |
| 132 |
First, traverses the dragger the way an \cSoGroup\. would. All draggers |
| 133 |
place themselves in space, but leave the current transformation unchanged |
| 134 |
when finished. |
| 135 |
Then the \cSoSpotLightManip\. adds a spotlight to the state, |
| 136 |
just like its base class, \cSoSpotLight\.. |
| 137 |
} |
| 138 |
|
| 139 |
ACTION SoSearchAction { |
| 140 |
Searches just like an \cSoSpotLight\.. Does not search the dragger, |
| 141 |
which is a hidden child. |
| 142 |
} |
| 143 |
|
| 144 |
ACTION SoWriteAction { |
| 145 |
Writes out just like an \cSoSpotLight\.. Does not write the dragger, |
| 146 |
which is a hidden child. If you really need to write valuable information |
| 147 |
about the dragger, such as customized geometry, you |
| 148 |
can retrieve the dragger with the |
| 149 |
\m\+getDragger()\.\-SoSpotLtManipGetDragger()\.\. method and then write |
| 150 |
it out separately. |
| 151 |
} |
| 152 |
ALSO { |
| 153 |
SoDragger, |
| 154 |
SoSpotLight, |
| 155 |
SoSpotLightDragger, |
| 156 |
SoDirectionalLightManip, |
| 157 |
SoPointLightManip |
| 158 |
} |
| 159 |
|