Debian Codegraph @

lib/interaction/src/SoInteraction.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990-93 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Description:
46 | Definition of the SoInteraction class
47 |
48 | Author(s): Thad Beier, David Mott, Alain Dumesny
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54
55 #include <Inventor/SoDB.h>
56 #include <Inventor/nodekits/SoNodeKit.h>
57 #include <Inventor/SoInteraction.h>
58 #include <Inventor/nodes/SoShape.h>
59 #include <Inventor/nodes/SoLight.h>
60 #include <Inventor/nodes/SoCamera.h>
61
62 #include <Inventor/manips/SoTransformManip.h>
63 #include <Inventor/manips/SoHandleBoxManip.h>
64
65 #include <Inventor/manips/SoCenterballManip.h>
66 #include <Inventor/manips/SoDirectionalLightManip.h>
67 #include <Inventor/manips/SoJackManip.h>
68 #include <Inventor/manips/SoPointLightManip.h>
69 #include <Inventor/manips/SoSpotLightManip.h>
70 #include <Inventor/manips/SoTabBoxManip.h>
71 #include <Inventor/manips/SoTrackballManip.h>
72 #include <Inventor/manips/SoTransformBoxManip.h>
73 #include <Inventor/manips/SoTransformerManip.h>
74
75 #include <Inventor/nodes/SoAntiSquish.h>
76 #include <Inventor/nodes/SoSurroundScale.h>
77
78 #include <Inventor/nodekits/SoInteractionKit.h>
79 #include <Inventor/draggers/SoDragger.h>
80
81 #include <Inventor/nodes/SoSelection.h>
82 #include <Inventor/actions/SoBoxHighlightRenderAction.h>
83 #include <Inventor/actions/SoLineHighlightRenderAction.h>
84
85 SbBool SoInteraction::initialized = FALSE;
86
87 ////////////////////////////////////////////////////////////////////////
88 //
89 // Description:
90 // Initialize all interaction class.
91 //
92 // Use: public
93
94 void
95 SoInteraction::init()
96 //
97 ////////////////////////////////////////////////////////////////////////
98 {
99 // Only initialize once
100 if (! initialized) {
101
102 SoDB::init(); // no problem if called multiple times
103 SoNodeKit::init(); // no problem if called multiple times
104
105 // Nodes used in interaction kits to help with transforms.
106 SoAntiSquish::initClass();
107 SoSurroundScale::initClass();
108
109 // draggers
110 SoInteractionKit::initClass();
111 SoDragger::initClasses();
112
113 // transform manips
114 SoTransformManip::initClass();
115 SoCenterballManip::initClass();
116 SoHandleBoxManip::initClass();
117 SoJackManip::initClass();
118 SoTabBoxManip::initClass();
119 SoTrackballManip::initClass();
120 SoTransformBoxManip::initClass();
121 SoTransformerManip::initClass();
122 // lightManips
123 SoPointLightManip::initClass();
124 SoDirectionalLightManip::initClass();
125 SoSpotLightManip::initClass();
126
127
128 // nodes
129 SoSelection::initClass();
130
131 // actions
132 SoBoxHighlightRenderAction::initClass();
133 SoLineHighlightRenderAction::initClass();
134
135 initialized = TRUE;
136 }
137 }
138
139 ////////////////////////////////////////////////////////////////////////
140 //
141 // Description:
142 // Initializes the type ID for this manipulator node. This
143 // should be called once after SoInteraction::init().
144 //
145 // Use: public
146 //
147 void
148 SoCenterballManip::initClass()
149 //
150 ////////////////////////////////////////////////////////////////////////
151 {
152 SO__NODE_INIT_CLASS(SoCenterballManip, "CenterballManip", SoTransformManip);
153 }
154
155 ////////////////////////////////////////////////////////////////////////
156 //
157 // Description:
158 // Initializes the type ID for this manipulator node. This
159 // should be called once after SoInteraction::init().
160 //
161 // Use: public, internal
162 //
163 void
164 SoDirectionalLightManip::initClass()
165 //
166 ////////////////////////////////////////////////////////////////////////
167 {
168 SO__NODE_INIT_CLASS(SoDirectionalLightManip, "DirectionalLightManip",
169 SoDirectionalLight);
170 }
171
172 ////////////////////////////////////////////////////////////////////////
173 //
174 // Description:
175 // Initialize the node
176 //
177 // Use: public, internal
178 //
179
180 void
181 SoHandleBoxManip::initClass()
182 //
183 ////////////////////////////////////////////////////////////////////////
184 {
185 SO__NODE_INIT_CLASS(SoHandleBoxManip, "HandleBoxManip", SoTransformManip);
186 }
187
188 ////////////////////////////////////////////////////////////////////////
189 //
190 // Description:
191 // Initializes the type ID for this manipulator node. This
192 // should be called once after SoInteraction::init().
193 //
194 // Use: public
195 //
196 void
197 SoJackManip::initClass()
198 //
199 ////////////////////////////////////////////////////////////////////////
200 {
201 SO__NODE_INIT_CLASS( SoJackManip, "JackManip", SoTransformManip );
202 }
203
204 ////////////////////////////////////////////////////////////////////////
205 //
206 // Description:
207 // Initialize the node
208 //
209 // Use: public, internal
210 //
211 void
212 SoPointLightManip::initClass()
213 //
214 ////////////////////////////////////////////////////////////////////////
215 {
216 SO__NODE_INIT_CLASS(SoPointLightManip, "PointLightManip", SoPointLight);
217 }
218
219 ////////////////////////////////////////////////////////////////////////
220 //
221 // Description:
222 // Initializes the type ID for this manipulator node. This
223 // should be called once after SoInteraction::init().
224 //
225 // Use: public
226 //
227 void
228 SoSpotLightManip::initClass()
229 //
230 ////////////////////////////////////////////////////////////////////////
231 {
232 SO__NODE_INIT_CLASS( SoSpotLightManip, "SpotLightManip", SoSpotLight);
233 }
234
235 ////////////////////////////////////////////////////////////////////////
236 //
237 // Description:
238 // Initializes the type ID for this manipulator node. This
239 // should be called once after SoInteraction::init().
240 //
241 // Use: public
242 //
243 void
244 SoTabBoxManip::initClass()
245 //
246 ////////////////////////////////////////////////////////////////////////
247 {
248 SO__NODE_INIT_CLASS(SoTabBoxManip, "TabBoxManip", SoTransformManip);
249 }
250
251 ////////////////////////////////////////////////////////////////////////
252 //
253 // Description:
254 // initialize the class
255 //
256 // Use: public, internal
257
258 void
259 SoTrackballManip::initClass()
260 //
261 ////////////////////////////////////////////////////////////////////////
262 {
263 SO__NODE_INIT_CLASS(SoTrackballManip, "TrackballManip", SoTransformManip);
264 }
265
266 ////////////////////////////////////////////////////////////////////////
267 //
268 // Description:
269 // Initializes the type ID for this manipulator node. This
270 // should be called once after SoInteraction::init().
271 //
272 // Use: public
273 //
274 void
275 SoTransformManip::initClass()
276 //
277 ////////////////////////////////////////////////////////////////////////
278 {
279 SO__NODE_INIT_CLASS(SoTransformManip, "TransformManip", SoTransform);
280 }
281
282 ////////////////////////////////////////////////////////////////////////
283 //
284 // Description:
285 // Initializes the type ID for this manipulator node. This
286 // should be called once after SoInteraction::init().
287 //
288 // Use: public
289 //
290 void
291 SoTransformBoxManip::initClass()
292 //
293 ////////////////////////////////////////////////////////////////////////
294 {
295 SO__NODE_INIT_CLASS(SoTransformBoxManip, "TransformBoxManip", SoTransformManip);
296 }
297
298 ////////////////////////////////////////////////////////////////////////
299 //
300 // Description:
301 // Initializes the type ID for this manipulator node. This
302 // should be called once after SoInteraction::init().
303 //
304 // Use: public
305 //
306 void
307 SoTransformerManip::initClass()
308 //
309 ////////////////////////////////////////////////////////////////////////
310 {
311 SO__NODE_INIT_CLASS(SoTransformerManip, "TransformerManip", SoTransformManip);
312 }
313
314 ////////////////////////////////////////////////////////////////////////
315 //
316 // Description:
317 // Initialize the class
318 //
319 // Use: static, internal
320 //
321
322 void
323 SoInteractionKit::initClass()
324 //
325 ////////////////////////////////////////////////////////////////////////
326 {
327 SO__KIT_INIT_CLASS(SoInteractionKit, "InteractionKit", SoBaseKit);
328 }
329
330 ////////////////////////////////////////////////////////////////////////
331 //
332 // Description:
333 // This initializes the SoAntiSquish class.
334 //
335 // Use: internal
336
337 void
338 SoAntiSquish::initClass()
339 //
340 ////////////////////////////////////////////////////////////////////////
341 {
342 SO__NODE_INIT_CLASS(SoAntiSquish, "AntiSquish", SoTransformation);
343 }
344
345 ////////////////////////////////////////////////////////////////////////
346 //
347 // Description:
348 // This initializes the SoSurroundScale class.
349 //
350 // Use: internal
351
352 void
353 SoSurroundScale::initClass()
354 //
355 ////////////////////////////////////////////////////////////////////////
356 {
357 SO__NODE_INIT_CLASS(SoSurroundScale, "SurroundScale", SoTransformation);
358 }
359
360 ////////////////////////////////////////////////////////////////////////
361 //
362 // Description:
363 // Initializes the SoBoxHighlightRenderAction class.
364 //
365 void
366 SoBoxHighlightRenderAction::initClass()
367 //
368 ////////////////////////////////////////////////////////////////////////
369 {
370 SO_ACTION_INIT_CLASS(SoBoxHighlightRenderAction, SoGLRenderAction);
371 }
372
373 ////////////////////////////////////////////////////////////////////////
374 //
375 // Description:
376 // Initializes the SoGLRenderAction class.
377 //
378 void
379 SoLineHighlightRenderAction::initClass()
380 //
381 ////////////////////////////////////////////////////////////////////////
382 {
383 SO_ACTION_INIT_CLASS(SoLineHighlightRenderAction, SoGLRenderAction);
384 }
385
386 ////////////////////////////////////////////////////////////////////////
387 //
388 // Description:
389 // This initializes the SoSelection class.
390 //
391 // Use: private
392
393 void
394 SoSelection::initClass()
395 //
396 ////////////////////////////////////////////////////////////////////////
397 {
398 SO__NODE_INIT_CLASS(SoSelection, "Selection", SoSeparator);
399 }
400