Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoWinDirectionalLightEditor.h
Go to the documentation of this file.
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-2014 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
30#include <Inventor/sys/port.h>
31#include <Inventor/SbBasic.h>
32#include <Inventor/SbColor.h>
35
36
37class SoBase;
38class SoCamera;
41class SoDragger;
42class SoGroup;
43class SoNodeSensor;
44class SoPath;
45class SoPathList;
47class SoSensor;
48class SoSeparator;
49class SoWinClipboard;
52class SoWinRenderArea;
53
54
55// callback function prototypes
59typedef void SoWinDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
60
62//
63// Class: SoWinDirectionalLightEditor
64//
66
95 public:
100 SoWidget parent = NULL,
101 const char *name = NULL,
102 SbBool buildInsideParent = TRUE);
107
112 void attach(SoPath *pathToLight);
116 void detach();
120 SbBool isAttached() { return (dirLight != NULL); }
121
125 void setLight(const SoDirectionalLight &newLight);
129 const SoDirectionalLight &getLight() const { return *dirLight; }
130
137 inline void addLightChangedCallback(
139 void *userData = NULL);
144 inline void removeLightChangedCallback(
146 void *userData = NULL);
147
148 // Redefined here since there are two windows to deal with -
149 // the color editor and the light manipulator
150 virtual void show();
151 virtual void hide();
152
154 private:
155
156 SoWidget mgrWidget; // topmost widget
157
158 // This constructor takes a boolean whether to build the widget now.
159 // Subclasses can pass FALSE, then call SoWinDirectionalLightEditor::buildWidget()
160 // when they are ready for it to be built.
163 SoWidget parent,
164 const char *name,
165 SbBool buildInsideParent,
166 SbBool buildNow);
167
168 // redefine these
169 virtual SbString getDefaultWidgetName() const;
170 virtual SbString getDefaultTitle() const;
171 virtual SbString getDefaultIconTitle() const;
172
173 SoDirectionalLight *dirLight; // light we are editing
174 SoSeparator *root; // root of local scene graph
175 SoSeparator *litStuff; // what's on display under thelight
176
177 SoPerspectiveCamera *myCamera;
178 SoCamera *cameraToWatch;
179
180 // components, manips, sensors
181 SoWinColorEditor *colorEditor;
182 SoWinColorSlider *intensitySlider;
183 SoWinRenderArea *renderArea;
184 SoNodeSensor *lightSensor;
185 SoNodeSensor *cameraSensor;
186 SoDirectionalLightManip *dirLightManip;
187 static char *geomBuffer;
188 SbBool ignoreCallback; // TRUE while callback should be ignored
189 SoCallbackList *callbackList;
190
191 // Copy/paste support
192 SoWinClipboard *clipboard;
193
194 // copy the src light values to the dst light values
195 void copyLight(SoDirectionalLight *dst,
196 const SoDirectionalLight *src);
197
198 void updateLocalComponents();
199
200 private:
201
202 HMENU menubar ;
203
204 static WBOOL CALLBACK mgrDlgProc( Hwnd hdlg, UINT message,
205 WPARAM wParam, LPARAM lParam );
206 static void onCommand(
207 Hwnd hdlg,
208 int id,
209 Hwnd hCtrl,
210 UINT codeNotify ) ;
211
212 void handleEdit(
213 int nSlider,
214 Hwnd hEdit,
215 UINT codeNotify) ;
216
217 void handleMenu(Hwnd hdlg,
219 int id ) ;
220
221 void initPlacement() ;
222
223 static void colorEditorCloseCB(void *userData, SoWinComponent *comp) ;
224
225 // Callback routines from components and manipulators
226 static void colorEditorCB(void *, const SbColor *);
227 static void intensitySliderCB(void *, float);
228 static void pasteDoneCB(void *, SoPathList *);
229 static void dirLightManipCB(void *, SoDragger *);
230
231 // Callback routines from Xt/Motif
232 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
233
234 // Sensor callbacks
235 static void cameraSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
236 static void lightSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
237
238 // Build routines
239 SoWidget buildWidget(SoWidget parent);
240 SoWidget buildPulldownMenu(SoWidget parent);
241
242 static void visibilityChangeCB(void *pt, SbBool visible);
243 void activate(); // connects the sensor
244 void deactivate(); // disconnects the sensor
245
246 // this is called by both constructors
247 void constructorCommon(SbBool buildNow);
248 SoNode *geom;
249
250};
251
252// Inline functions
253 void
258
259 void
264
266
267#endif // _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
268
#define SoEXTENDER
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define SoWidget
Definition SoQtDef.h:40
SoWinColorSlider(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, Type type=INTENSITY_SLIDER)
#define WBOOL
Definition SoWinDef.h:38
#define Hwnd
Definition SoWinDef.h:83
#define XmAnyCallbackStruct
Definition SoWinDef.h:127
void SoWinDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light)
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:534
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:97
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.
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
void SoCallbackListCB(void *userData, void *callbackData)
unsigned int UINT
Definition port.h:357
#define CALLBACK
Definition port.h:345