Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoXtDirectionalLightEditor.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : David Mott (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef SOQT
51# include <Inventor/Qt/SoQtDirectionalLightEditor.h>
52#elif defined _WIN32
53# include <Inventor/Win/SoWinDirectionalLightEditor.h>
54#else // _WIN32
55
56#ifndef _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
57#define _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
58
59#include <X11/Intrinsic.h>
60#include <Xm/Xm.h>
61#include <Inventor/SbBasic.h>
62#include <Inventor/SbColor.h>
63#include <Inventor/misc/SoCallbackList.h>
64#include <Inventor/Xt/SoXtComponent.h>
65
66
67class SoBase;
68class SoCamera;
71class SoDragger;
72class SoGroup;
73class SoNodeSensor;
74class SoPath;
75class SoPathList;
77class SoSensor;
78class SoSeparator;
79class SoXtClipboard;
80class SoXtColorEditor;
81class SoXtColorSlider;
82class SoXtRenderArea;
83
84
85// callback function prototypes
87typedef void SoXtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
88
90//
91// Class: SoXtDirectionalLightEditor
92//
94
139 public:
144 SoWidget parent = NULL,
145 const char *name = NULL,
146 SbBool buildInsideParent = TRUE);
151
156 void attach(SoPath *pathToLight);
160 void detach();
164 SbBool isAttached() { return (dirLight != NULL); }
165
169 void setLight(const SoDirectionalLight &newLight);
173 const SoDirectionalLight &getLight() const { return *dirLight; }
174
180 inline void addLightChangedCallback(
181 SoXtDirectionalLightEditorCB *f,
182 void *userData = NULL);
186 inline void removeLightChangedCallback(
187 SoXtDirectionalLightEditorCB *f,
188 void *userData = NULL);
189
190 // Redefined here since there are two windows to deal with -
191 // the color editor and the light manipulator
192 virtual void show();
193 virtual void hide();
194
195 private:
196
197 // This constructor takes a boolean whether to build the widget now.
198 // Subclasses can pass FALSE, then call SoXtDirectionalLightEditor::buildWidget()
199 // when they are ready for it to be built.
200 SoEXTENDER
202 SoWidget parent,
203 const char *name,
204 SbBool buildInsideParent,
205 SbBool buildNow);
206
207 // redefine these
208 virtual SbString getDefaultWidgetName() const;
209 virtual SbString getDefaultTitle() const;
210 virtual SbString getDefaultIconTitle() const;
211
212 SoDirectionalLight *dirLight; // light we are editing
213 SoSeparator *root; // root of local scene graph
214 SoSeparator *litStuff; // what's on display under thelight
215
216 SoPerspectiveCamera *myCamera;
217 SoCamera *cameraToWatch;
218
219 // components, manips, sensors
220 SoXtColorEditor *colorEditor;
221 SoXtColorSlider *intensitySlider;
222 SoXtRenderArea *renderArea;
223 SoNodeSensor *lightSensor;
224 SoNodeSensor *cameraSensor;
225 SoDirectionalLightManip *dirLightManip;
226 static char *geomBuffer;
227 SbBool ignoreCallback; // TRUE while callback should be ignored
228 SoCallbackList *callbackList;
229
230 // Copy/paste support
231 SoXtClipboard *clipboard;
232
233 // copy the src light values to the dst light values
234 void copyLight(SoDirectionalLight *dst,
235 const SoDirectionalLight *src);
236
237 void updateLocalComponents();
238
239 private:
240 // Callback routines from components and manipulators
241 static void colorEditorCB(void *, const SbColor *);
242 static void intensitySliderCB(void *, float);
243 static void pasteDoneCB(void *, SoPathList *);
244 static void dirLightManipCB(void *, SoDragger *);
245
246 // Callback routines from Xt/Motif
247 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
248
249 // Sensor callbacks
250 static void cameraSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
251 static void lightSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
252
253 // Build routines
254 SoWidget buildWidget(SoWidget parent);
255 SoWidget buildPulldownMenu(SoWidget parent);
256
257 static void visibilityChangeCB(void *pt, SbBool visible);
258 void activate(); // connects the sensor
259 void deactivate(); // disconnects the sensor
260
261 // this is called by both constructors
262 void constructorCommon(SbBool buildNow);
263
264};
265
266// Inline functions
267void
269 SoXtDirectionalLightEditorCB *f,
270 void *userData)
271{ callbackList->addCallback((SoCallbackListCB *) f, userData); }
272
273void
275 SoXtDirectionalLightEditorCB *f,
276 void *userData)
277{ callbackList->removeCallback((SoCallbackListCB *) f, userData); }
278
279#endif // _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
280
281#endif // _WIN32
282
283
Color vector class.
Definition SbColor.h:82
Class for smart character strings.
Definition SbString.h:202
Base class for all nodes, paths, and engines.
Definition SoBase.h:111
Manages a list of callbacks and associated data.
void addCallback(SoCallbackListCB *f, void *userData=NULL)
Adds a function to the list of callback functions.
void removeCallback(SoCallbackListCB *f, void *userData=NULL)
Removes a function from the list of callback functions.
Abstract base class for camera nodes.
Definition SoCamera.h:188
Node representing a directional light source.
Directional light node with 3D interface for editing direction.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Base class for all group nodes.
Definition SoGroup.h:122
Sensor class that can be attached to Open Inventor nodes.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Maintains a list of pointers to paths.
Definition SoPathList.h:81
Perspective camera node.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Group node that saves and restores traversal state.
Supports copy/paste for Open Inventor using the Xt clipboard.
Component that lets you edit a color interactively.
Abstract base class for all Open Inventor components.
Component for editing directional lights.
void removeLightChangedCallback(SoXtDirectionalLightEditorCB *f, void *userData=NULL)
Removes the lightChanged callback.
~SoXtDirectionalLightEditor()
Destructor.
void attach(SoPath *pathToLight)
Attaches the editor to a directional light.
const SoDirectionalLight & getLight() const
Gets the current light values.
void SoXtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light)
virtual void show()
This shows the component.
SbBool isAttached()
Returns TRUE if the editor is attached.
SoXtDirectionalLightEditor(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE)
Constructor.
virtual void hide()
This hides the component.
void detach()
Detaches the editor from a directional light.
void addLightChangedCallback(SoXtDirectionalLightEditorCB *f, void *userData=NULL)
Adds lightChanged callback.
void setLight(const SoDirectionalLight &newLight)
Sets new light values.
Component for rendering Open Inventor scene graphs.
int SbBool
Boolean type.
Definition SbBase.h:87