Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoWinDirectionalLightEditor.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
27#define _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30#include <Inventor/sys/port.h>
31#include <Inventor/SbBasic.h>
32#include <Inventor/SbColor.h>
33#include <Inventor/misc/SoCallbackList.h>
34#include <Inventor/Win/SoWinComponent.h>
35
36
37class SoBase;
38class SoCamera;
41class SoDragger;
42class SoGroup;
43class SoNodeSensor;
44class SoPath;
45class SoPathList;
47class SoSensor;
48class SoSeparator;
49class SoWinClipboard;
51class SoWinColorSlider;
52class SoWinRenderArea;
53
54
55// callback function prototypes
61typedef void SoWinDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
62
64//
65// Class: SoWinDirectionalLightEditor
66//
68
97 public:
102 SoWidget parent = NULL,
103 const char *name = NULL,
104 SbBool buildInsideParent = TRUE);
109
114 void attach(SoPath *pathToLight);
118 void detach();
122 SbBool isAttached() { return (dirLight != NULL); }
123
127 void setLight(const SoDirectionalLight &newLight);
131 const SoDirectionalLight &getLight() const { return *dirLight; }
132
139 inline void addLightChangedCallback(
141 void *userData = NULL);
146 inline void removeLightChangedCallback(
148 void *userData = NULL);
149
150 // Redefined here since there are two windows to deal with -
151 // the color editor and the light manipulator
152 virtual void show();
153 virtual void hide();
154
156 private:
157
158 SoWidget mgrWidget; // topmost widget
159
160 // This constructor takes a boolean whether to build the widget now.
161 // Subclasses can pass FALSE, then call SoWinDirectionalLightEditor::buildWidget()
162 // when they are ready for it to be built.
163 SoEXTENDER
165 SoWidget parent,
166 const char *name,
167 SbBool buildInsideParent,
168 SbBool buildNow);
169
170 // redefine these
171 virtual SbString getDefaultWidgetName() const;
172 virtual SbString getDefaultTitle() const;
173 virtual SbString getDefaultIconTitle() const;
174
175 SoDirectionalLight *dirLight; // light we are editing
176 SoSeparator *root; // root of local scene graph
177 SoSeparator *litStuff; // what's on display under thelight
178
179 SoPerspectiveCamera *myCamera;
180 SoCamera *cameraToWatch;
181
182 // components, manips, sensors
183 SoWinColorEditor *colorEditor;
184 SoWinColorSlider *intensitySlider;
185 SoWinRenderArea *renderArea;
186 SoNodeSensor *lightSensor;
187 SoNodeSensor *cameraSensor;
188 SoDirectionalLightManip *dirLightManip;
189 static char *geomBuffer;
190 SbBool ignoreCallback; // TRUE while callback should be ignored
191 SoCallbackList *callbackList;
192
193 // Copy/paste support
194 SoWinClipboard *clipboard;
195
196 // copy the src light values to the dst light values
197 void copyLight(SoDirectionalLight *dst,
198 const SoDirectionalLight *src);
199
200 void updateLocalComponents();
201
202 private:
203
204 HMENU menubar ;
205
206 static WBOOL CALLBACK mgrDlgProc( Hwnd hdlg, UINT message,
207 WPARAM wParam, LPARAM lParam );
208 static void onCommand(
209 Hwnd hdlg,
210 int id,
211 Hwnd hCtrl,
212 UINT codeNotify ) ;
213
214 void handleEdit(
215 int nSlider,
216 Hwnd hEdit,
217 UINT codeNotify) ;
218
219 void handleMenu(Hwnd hdlg,
221 int id ) ;
222
223 void initPlacement() ;
224
225 static void colorEditorCloseCB(void *userData, SoWinComponent *comp) ;
226
227 // Callback routines from components and manipulators
228 static void colorEditorCB(void *, const SbColor *);
229 static void intensitySliderCB(void *, float);
230 static void pasteDoneCB(void *, SoPathList *);
231 static void dirLightManipCB(void *, SoDragger *);
232
233 // Callback routines from Xt/Motif
234 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
235
236 // Sensor callbacks
237 static void cameraSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
238 static void lightSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
239
240 // Build routines
241 SoWidget buildWidget(SoWidget parent);
242 SoWidget buildPulldownMenu(SoWidget parent);
243
244 static void visibilityChangeCB(void *pt, SbBool visible);
245 void activate(); // connects the sensor
246 void deactivate(); // disconnects the sensor
247
248 // this is called by both constructors
249 void constructorCommon(SbBool buildNow);
250 SoNode *geom;
251
252};
253
254// Inline functions
255 void
257 SoWinDirectionalLightEditorCB *f,
258 void *userData)
259{ callbackList->addCallback((SoCallbackListCB *) f, userData); }
260
261 void
263 SoWinDirectionalLightEditorCB *f,
264 void *userData)
265{ callbackList->removeCallback((SoCallbackListCB *) f, userData); }
266
267#include <Inventor/Win/SoWinEndStrict.h>
268
269#endif // _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
270
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
Abstract base class for all database nodes.
Definition SoNode.h:145
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.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Supports copy/pa...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component that l...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component for ed...
void attach(SoPath *pathToLight)
Attaches the editor to a directional light.
void removeLightChangedCallback(SoWinDirectionalLightEditorCB *f, void *userData=NULL)
Removes the lightChanged callback.
void addLightChangedCallback(SoWinDirectionalLightEditorCB *f, void *userData=NULL)
Adds lightChanged callback.
void SoWinDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light)
SoWinDirectionalLightEditor(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.
virtual void show()
This shows the component.
const SoDirectionalLight & getLight() const
Gets the current light values.
void setLight(const SoDirectionalLight &newLight)
Sets new light values.
SbBool isAttached()
Returns TRUE if the editor is attached.
~SoWinDirectionalLightEditor()
Destructor.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component for re...
int SbBool
Boolean type.
Definition SbBase.h:87