Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoSpotLightDragger.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 : SGI (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-2019 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
49//
50// Description:
51// This is the include file for the SoSpotLightDragger.
52// This is a composite dragger which allows independent rotation,
53// translation, and beam spread editting of a spot light.
54//
55// It is composed of an SoRotateSphericalDragger (for rotation),
56// an SoDragPointDragger (for translation), and it creates its own projector
57// handles mouse events for doing it's own dragging of the beam angle.
58//
59// The beam is editted by behaving like an SoRotateDiscDragger, but the
60// plane of the disc is re-defined every time a drag is initiated.
61// The plane always passes through the z axis and the selected point.
62// When the rotation angle is determined, however, the beam is not rotated,
63// but scaled so it looks like an opening or closing umbrella. This is done
64// by scaling evenly in x and y, and a different amount in z, so the distance
65// between the selected point and the origin remains constant.
66//
67// NOTE TO DEVELOPERS:
68// For info about the structure of SoSpotLightDragger:
69// [1] compile: /usr/share/src/Inventor/samples/ivNodeKitStructure
70// [2] type: ivNodeKitStructure SoSpotLightDragger.
71// [3] The program prints a diagram of the scene graph and a table with
72// information about each part.
73//
74//
75// The following parts in this dragger are created at construction time.
76// 'ResourceName' corresponds to the name of the default geometry for the
77// part. The dragger's constructor gets the scene graph for 'ResourceName'
78// by querying the global dictionary ( SoDB::getByName("ResourceName"); ).
79//
80// Resource Name: Part Name:
81//
82// spotLightOverallMaterial - material
83//
84// spotLightTranslatorLineTranslator -
85// - translator.xTranslator.translator
86// - translator.yTranslator.translator
87// - translator.zTranslator.translator
88// spotLightTranslatorLineTranslatorActive -
89// - translator.xTranslator.translatorActive
90// - translator.yTranslator.translatorActive
91// - translator.zTranslator.translatorActive
92//
93// spotLightTranslatorPlaneTranslator-
94// - translator.yzTranslator.translator
95// - translator.xzTranslator.translator
96// - translator.xyTranslator.translator
97// spotLightTranslatorPlaneTranslatorActive -
98// - translator.yzTranslator.translatorActive
99// - translator.xzTranslator.translatorActive
100// - translator.xyTranslator.translatorActive
101//
102// spotLightRotatorRotator - rotator.rotator
103// spotLightRotatorRotatorActive - rotator.rotatorActive
104// spotLightRotatorFeedback - rotator.feedback
105// spotLightRotatorFeedbackActive - rotator.feedbackActive
106//
107// spotLightBeam - beam
108// spotLightBeamActive - beamActive
109//
110// NOTE: This is a translation node that
111// moves the beam origin relative
112// to the rest of the dragger.
113// spotLightBeamPlacement - beamPlacement
114//
116
117
118#ifndef _SO_SPOT_LIGHT_DRAGGER_
119#define _SO_SPOT_LIGHT_DRAGGER_
120
121#include <Inventor/SbLinear.h>
122#include <Inventor/draggers/SoDragger.h>
123#include <Inventor/fields/SoSFVec3f.h>
124#include <Inventor/fields/SoSFFloat.h>
125#include <Inventor/fields/SoSFRotation.h>
126#include <Inventor/sensors/SoSensor.h>
127
128class SoFieldSensor;
129class SbPlaneProjector;
130
365{
366 SO_KIT_HEADER(SoSpotLightDragger);
367
368 // This gives the dragger an overall material. It is edited by lightManips
369 // to make its dragger match the color of the light. Any materials within
370 // other parts will override this one.
371 SO_KIT_CATALOG_ENTRY_HEADER(material);
372
373 // The translator is kept under a separator along with a
374 // rotation that is maintained as the inverse to the rotation of the
375 // light. This means that using the rotator does not rotate the
376 // coordinate system that we translate the base of the dragger in.
377 SO_KIT_CATALOG_ENTRY_HEADER(translatorSep);
378 SO_KIT_CATALOG_ENTRY_HEADER(translatorRotInv);
379 SO_KIT_CATALOG_ENTRY_HEADER(translator);
380 SO_KIT_CATALOG_ENTRY_HEADER(rotator);
381 // Beneath a separator, the beamPlacement part places the beam's local
382 // space relative to the other parts.
383 // The beamSwitch is flipped when the beam is dragged.
384 SO_KIT_CATALOG_ENTRY_HEADER(beamSep);
385 SO_KIT_CATALOG_ENTRY_HEADER(beamPlacement);
386 SO_KIT_CATALOG_ENTRY_HEADER(beamScale);
387 SO_KIT_CATALOG_ENTRY_HEADER(beamSwitch);
388 SO_KIT_CATALOG_ENTRY_HEADER(beam);
389 SO_KIT_CATALOG_ENTRY_HEADER(beamActive);
390
391 public:
396
412
413 private:
414 static void initClass(); // Initialize the class.
415 static void exitClass();
416
417 private:
418
419 SbPlaneProjector *planeProj; // used during interaciton with beam
420
421 static void startCB( void *, SoDragger * );
422 static void motionCB( void *, SoDragger * );
423 static void doneCB( void *, SoDragger * );
424
425 void dragStart();
426 void drag();
427 void dragFinish();
428
429 SoFieldSensor *rotFieldSensor;
430 SoFieldSensor *translFieldSensor;
431 SoFieldSensor *angleFieldSensor;
432 static void fieldSensorCB( void *, SoSensor * );
433 static void valueChangedCB( void *, SoDragger * );
434
435 // Returns scaleFactor for beamScale part to display beamAngle.
436 void setBeamScaleFromAngle(float beamAngle);
437
438 // detach/attach any sensors, callbacks, and/or field connections.
439 // Also set geometry of childDraggers to be our default instead of their
440 // regular default, using our resources.
441 // Called by: start/end of SoBaseKit::readInstance
442 // and on new copy by: start/end of SoBaseKit::copy.
443 // Classes that redefine must call setUpConnections(TRUE,TRUE)
444 // at end of constructor.
445 // Returns the state of the node when this was called.
446 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE );
447
448 virtual void setDefaultOnNonWritingFields();
449
450 virtual ~SoSpotLightDragger();
451
452 private:
453 static const char geomBuffer[];
454};
455
456#endif /* _SO_SPOT_LIGHT_DRAGGER_ */
457
Plane projector.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Sensor class that can be attached to Open Inventor fields.
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a rotation.
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Spotlight shaped dragger that allows you to change position, direction, and width of the beam.
SoSFRotation rotation
Orientation of the rotating part (an arrow by default).
SoSpotLightDragger()
Constructor.
SoSFFloat angle
Angle between center and edge of beam.
SoSFVec3f translation
Position of the dragger.
int SbBool
Boolean type.
Definition SbBase.h:87