1SoSpotLightManip(3IV)() SoSpotLightManip(3IV)()
2
3
4
6 SoSpotLightManip — spotlight node with 3D interface for editing loca‐
7 tion, direction, and beam width
8
10 SoBase > SoFieldContainer > SoNode > SoLight > SoSpotLight > SoSpot‐
11 LightManip
12
14 #include <Inventor/manips/SoSpotLightManip.h>
15
16 Fields from class SoSpotLight:
17
18 SoSFVec3f location
19 SoSFVec3f direction
20 SoSFFloat dropOffRate
21 SoSFFloat cutOffAngle
22
23 Fields from class SoLight:
24
25 SoSFBool on
26 SoSFFloat intensity
27 SoSFColor color
28
29 Methods from class SoSpotLightManip:
30
31 SoSpotLightManip()
32 SoDragger * getDragger()
33 SbBool replaceNode(SoPath *p )
34 SbBool replaceManip(SoPath *p, SoSpotLight *newOne ) const
35 static SoType getClassTypeId()
36
37 Methods from class SoNode:
38
39 void setOverride(SbBool state)
40 SbBool isOverride() const
41 SoNode * copy(SbBool copyConnections = FALSE) const
42 virtual SbBool affectsState() const
43 static SoNode * getByName(const SbName &name)
44 static int getByName(const SbName &name, SoNodeList &list)
45
46 Methods from class SoFieldContainer:
47
48 void setToDefaults()
49 SbBool hasDefaultValues() const
50 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
51 void copyFieldValues(const SoFieldContainer *fc, SbBool
52 copyConnections = FALSE)
53 SbBool set(const char *fieldDataString)
54 void get(SbString &fieldDataString)
55 virtual int getFields(SoFieldList &resultList) const
56 virtual SoField * getField(const SbName &fieldName) const
57 SbBool getFieldName(const SoField *field, SbName &fieldName)
58 const
59 SbBool isNotifyEnabled() const
60 SbBool enableNotify(SbBool flag)
61
62 Methods from class SoBase:
63
64 void ref()
65 void unref() const
66 void unrefNoDelete() const
67 void touch()
68 virtual SoType getTypeId() const
69 SbBool isOfType(SoType type) const
70 virtual void setName(const SbName &name)
71 virtual SbName getName() const
72
73
75 SoSpotLightManip is the base class for all SoSpotLight nodes that have
76 a built-in 3D user interface (this is the only such class provided with
77 the Inventor toolkit). Since it is derived from SoSpotLight, any
78 changes to its fields result in a change of lighting for nodes that
79 follow it in the scene graph. In this case, the interface edits the
80 location, direction, and cutOffAngle fields. Also, the color of the
81 manipulator's geometry will reflect the color of the light (but you can
82 not edit the color using this manipulator).
83
84 Typically, you will want to replace a regular SoSpotLight with an
85 SoSpotLightManip (as when the user selects a light to be edited), or
86 vice versa (as when the user is done moving the light and the interface
87 should go away). Use the replaceNode() method to insert a manipulator
88 into a scene graph, and the replaceManip() method to remove it when
89 done.
90
91 The SoSpotLightManip utilizes an SoSpotLightDragger to provide a 3D
92 interface. However, the manipulator differs from the dragger; it lights
93 other objects in the scene because, as an SoSpotLight, it alters the
94 state. The fields values and movement of the dragger, on the other
95 hand, affect only the dragger itself. To find out more about how the
96 interface works and what each part will do, see the reference page for
97 SoSpotLightDragger. The interfaces of the dragger and the manipulator
98 are identical.
99
100 The SoSpotLightManip utilizes its dragger by adding it as a hidden
101 child. When an action is applied to the manipulator, such as rendering
102 or handling events, the manipulator first traverses the dragger, and
103 then the manipulator adds its lighting parameters to the state. When
104 you click-drag-release over the manipulator, it passes these events
105 down to the dragger, which moves as a result ("I can't help it, I'm a
106 dragger!").
107
108 The manipulator maintains consistency between the fields of the dragger
109 and its own fields. Let's say you use the mouse to widen the cone of
110 the dragger. Callbacks insure that the cutOffAngle field of the manipu‐
111 lator will change by the same amount, thus changing the lighting of
112 nodes which follow in the scene graph. Similarly, if you set the cutOf‐
113 fAngle field of the SoSpotLightManip, the manipulator will widen the
114 beam of the dragger accordingly.
115
116 Because the dragger is a hidden child, you can see the dragger on
117 screen and interact with it, but the dragger does not show up when you
118 write the manipulator to file. Also, any SoPath will end at the manipu‐
119 lator. (See the Actions section of this reference page for a complete
120 description of when the dragger is traversed).
121
122 If you want to get a pointer to the dragger you can get it from the
123 manipulator using the getDragger() method. You will need to do this if
124 you want to change the geometry of a manipulator, since the geometry
125 actually belongs to the dragger.
126
128 SoSpotLightManip()
129 Constructor.
130
131 SoDragger * getDragger()
132 Returns a pointer to the dragger being used by this manipulator.
133 Given this pointer, you can customize the dragger just like you
134 would any other dragger. You can change geometry using the setPart()
135 method, or add callbacks using the methods found in the SoDragger
136 reference page.
137
138 SbBool replaceNode(SoPath *p )
139 Replaces the tail of the path with this manipulator. The tail of the
140 path must be an SoSpotLight node (or subclass thereof). If the path
141 has a nodekit, this will try to use setPart() to insert the manipu‐
142 lator. Otherwise, the manipulator requires that the next to last
143 node in the path chain be a group.
144
145 The field values from the spotlight node will be copied to this
146 manipulator, and the light node will be replaced.
147
148 The manipulator will not call ref() on the node it is replacing. The
149 old node will disappear if it has no references other than from the
150 input path p and its parent, since this manipulator will be replac‐
151 ing it in both of those places. Nor will the manipulator make any
152 changes to field connections of the old node. The calling process is
153 thus responsible for keeping track of its own nodes and field con‐
154 nections.
155
156 SbBool replaceManip(SoPath *p, SoSpotLight *newOne ) const
157 Replaces the tail of the path, which must be this manipulator, with
158 the given SoSpotLight node. If the path has a nodekit, this will try
159 to use setPart() to insert the new node. Otherwise, the manipulator
160 requires that the next to last node in the path chain be a group.
161
162 The field values from the manipulator will be copied to the spot‐
163 light node, and the manipulator will be replaced.
164
165 The manipulator will not call ref() or unref() on the node which is
166 replacing it, nor will it make any changes to field connections. The
167 calling process is thus responsible for keeping track of its own
168 nodes and field connections.
169
170 static SoType getClassTypeId()
171 Returns type identifier for this class.
172
173
175 SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoGetMa‐
176 trixAction, SoHandleEventAction, SoRayPickAction
177 First, traverses the dragger the way an SoGroup would. All draggers
178 place themselves in space, but leave the current transformation
179 unchanged when finished. Then the SoSpotLightManip adds a spotlight
180 to the state, just like its base class, SoSpotLight.
181
182 SoSearchAction
183 Searches just like an SoSpotLight. Does not search the dragger,
184 which is a hidden child.
185
186 SoWriteAction
187 Writes out just like an SoSpotLight. Does not write the dragger,
188 which is a hidden child. If you really need to write valuable infor‐
189 mation about the dragger, such as customized geometry, you can
190 retrieve the dragger with the getDragger() method and then write it
191 out separately.
192
193
195 SpotLightManip {
196 on TRUE
197 intensity 1
198 color 1 1 1
199 location 0 0 1
200 direction 0 0 -1
201 dropOffRate 0
202 cutOffAngle 0.785398
203 }
204
206 SoDragger, SoSpotLight, SoSpotLightDragger, SoDirectionalLightManip,
207 SoPointLightManip
208
209
210
211
212 SoSpotLightManip(3IV)()