Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoXtDirectionalLightEditor.h
Go to the documentation of this file.
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-2014 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
52#elif defined _WIN32
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>
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
86typedef void SoXtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
87
89//
90// Class: SoXtDirectionalLightEditor
91//
93
138 public:
143 SoWidget parent = NULL,
144 const char *name = NULL,
145 SbBool buildInsideParent = TRUE);
150
155 void attach(SoPath *pathToLight);
159 void detach();
163 SbBool isAttached() { return (dirLight != NULL); }
164
168 void setLight(const SoDirectionalLight &newLight);
172 const SoDirectionalLight &getLight() const { return *dirLight; }
173
179 inline void addLightChangedCallback(
181 void *userData = NULL);
185 inline void removeLightChangedCallback(
187 void *userData = NULL);
188
189 // Redefined here since there are two windows to deal with -
190 // the color editor and the light manipulator
191 virtual void show();
192 virtual void hide();
193
194 private:
195
196 // This constructor takes a boolean whether to build the widget now.
197 // Subclasses can pass FALSE, then call SoXtDirectionalLightEditor::buildWidget()
198 // when they are ready for it to be built.
201 SoWidget parent,
202 const char *name,
203 SbBool buildInsideParent,
204 SbBool buildNow);
205
206 // redefine these
207 virtual SbString getDefaultWidgetName() const;
208 virtual SbString getDefaultTitle() const;
209 virtual SbString getDefaultIconTitle() const;
210
211 SoDirectionalLight *dirLight; // light we are editing
212 SoSeparator *root; // root of local scene graph
213 SoSeparator *litStuff; // what's on display under thelight
214
215 SoPerspectiveCamera *myCamera;
216 SoCamera *cameraToWatch;
217
218 // components, manips, sensors
219 SoXtColorEditor *colorEditor;
220 SoXtColorSlider *intensitySlider;
221 SoXtRenderArea *renderArea;
222 SoNodeSensor *lightSensor;
223 SoNodeSensor *cameraSensor;
224 SoDirectionalLightManip *dirLightManip;
225 static char *geomBuffer;
226 SbBool ignoreCallback; // TRUE while callback should be ignored
227 SoCallbackList *callbackList;
228
229 // Copy/paste support
230 SoXtClipboard *clipboard;
231
232 // copy the src light values to the dst light values
233 void copyLight(SoDirectionalLight *dst,
234 const SoDirectionalLight *src);
235
236 void updateLocalComponents();
237
238 private:
239 // Callback routines from components and manipulators
240 static void colorEditorCB(void *, const SbColor *);
241 static void intensitySliderCB(void *, float);
242 static void pasteDoneCB(void *, SoPathList *);
243 static void dirLightManipCB(void *, SoDragger *);
244
245 // Callback routines from Xt/Motif
246 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
247
248 // Sensor callbacks
249 static void cameraSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
250 static void lightSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
251
252 // Build routines
253 SoWidget buildWidget(SoWidget parent);
254 SoWidget buildPulldownMenu(SoWidget parent);
255
256 static void visibilityChangeCB(void *pt, SbBool visible);
257 void activate(); // connects the sensor
258 void deactivate(); // disconnects the sensor
259
260 // this is called by both constructors
261 void constructorCommon(SbBool buildNow);
262
263};
264
265// Inline functions
266void
271
272void
277
278#endif // _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
279
280#endif // _WIN32
281
282
#define SoEXTENDER
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define SoWidget
Definition SoQtDef.h:40
#define XmAnyCallbackStruct
Definition SoWinDef.h:127
#define SoXtDirectionalLightEditorCB
Definition SoXt2SoQt.h:59
#define SoXtColorSlider
Definition SoXt2SoQt.h:175
#define SoXtDirectionalLightEditor
Definition SoXt2SoQt.h:58
void SoXtDirectionalLightEditorCB(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
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.
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.
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
void SoCallbackListCB(void *userData, void *callbackData)