SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SoCameraPathEditKit.h
1#ifndef SMALLCHANGE_SOCAMERAPATHEDITKIT_H
2#define SMALLCHANGE_SOCAMERAPATHEDITKIT_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/nodekits/SoBaseKit.h>
37#include <Inventor/nodekits/SoShapeKit.h>
38#include <Inventor/nodes/SoEventCallback.h>
39#include <Inventor/nodes/SoCoordinate3.h>
40#include <Inventor/nodes/SoPointSet.h>
41#include <Inventor/draggers/SoDragPointDragger.h>
42#include <Inventor/nodes/SoText2.h>
43#include <Inventor/fields/SoSFInt32.h>
44#include <Inventor/fields/SoMFTime.h>
45
46#include <SmallChange/basic.h>
47
48
50{
51 typedef SoBaseKit inherited;
52
53 SO_KIT_HEADER(SoCameraPathEditKit);
54
55 SO_KIT_CATALOG_ENTRY_HEADER(rootSeparator);
56
57 SO_KIT_CATALOG_ENTRY_HEADER(eventCallback);
58 SO_KIT_CATALOG_ENTRY_HEADER(draggerSeparator);
59 SO_KIT_CATALOG_ENTRY_HEADER(feedbackSeparator);
60
61 SO_KIT_CATALOG_ENTRY_HEADER(draggerPick);
62 SO_KIT_CATALOG_ENTRY_HEADER(draggerDraw);
63 SO_KIT_CATALOG_ENTRY_HEADER(draggerTransform);
64 SO_KIT_CATALOG_ENTRY_HEADER(draggerSwitch);
65
66 SO_KIT_CATALOG_ENTRY_HEADER(timeDragger);
67 SO_KIT_CATALOG_ENTRY_HEADER(posDragger);
68 SO_KIT_CATALOG_ENTRY_HEADER(orDragger);
69
70 SO_KIT_CATALOG_ENTRY_HEADER(orLightModel);
71 SO_KIT_CATALOG_ENTRY_HEADER(headingMaterial);
72 SO_KIT_CATALOG_ENTRY_HEADER(heading);
73 SO_KIT_CATALOG_ENTRY_HEADER(pitchMaterial);
74 SO_KIT_CATALOG_ENTRY_HEADER(pitchRotate);
75 SO_KIT_CATALOG_ENTRY_HEADER(pitch);
76 SO_KIT_CATALOG_ENTRY_HEADER(bankMaterial);
77 SO_KIT_CATALOG_ENTRY_HEADER(bankRotate);
78 SO_KIT_CATALOG_ENTRY_HEADER(bank);
79
80 SO_KIT_CATALOG_ENTRY_HEADER(coordinates);
81 SO_KIT_CATALOG_ENTRY_HEADER(tagSeparator);
82 SO_KIT_CATALOG_ENTRY_HEADER(tagDrawStyle);
83 SO_KIT_CATALOG_ENTRY_HEADER(tags);
84 SO_KIT_CATALOG_ENTRY_HEADER(curveSeparator);
85 SO_KIT_CATALOG_ENTRY_HEADER(curveDrawStyle);
86 SO_KIT_CATALOG_ENTRY_HEADER(controlpoints);
87 SO_KIT_CATALOG_ENTRY_HEADER(curve);
88 SO_KIT_CATALOG_ENTRY_HEADER(objectSeparator);
89 SO_KIT_CATALOG_ENTRY_HEADER(objectTransform);
90 SO_KIT_CATALOG_ENTRY_HEADER(objectDrawStyle);
91 SO_KIT_CATALOG_ENTRY_HEADER(objectModel);
92
93 enum Editmode {
94 POSITION = 1,
95 ORIENTATION,
96 TIME
97 };
98
99
100 // Fields
101 SoSFBool timestampEnabled;
102 SoSFBool timestampVisible;
103 SoSFFloat timeScale;
104
105 SoMFVec3f position;
106 SoMFVec3f orientation;
107 SoMFTime timestamp;
108 SoSFInt32 activePoint;
109 SoSFEnum editMode;
110
111
112public:
113
115 static void initClass(void);
116
117
118 void flipEditmode(void);
119 void setEditmode(Editmode mode);
120
121 int setTimestamp(int idx, const SbTime &time);
122 int setTimestamp(int idx, float time);
123 void setPosition(int idx, const SbVec3f &pos);
124 void setOrientation(int idx, const SbVec3f &orientation);
125 int setActiveTimestamp(const SbTime &time);
126 void setActivePosition(const SbVec3f &pos);
127 void setActiveOrientation(const SbVec3f &orientation);
128
129 void insertControlpoint(int idx, const SbVec3f &pos, const SbVec3f &orientation);
130 int insertControlpoint(const SbVec3f &pos, const SbVec3f &orientation, const SbTime &time);
131 void insertPosition(int idx, const SbVec3f &pos);
132 int insertPosition(const SbVec3f &pos, const SbTime &time);
133 void insertOrientation(int idx, const SbVec3f &orientation);
134 int insertOrientation(const SbVec3f &orientation, const SbTime &time);
135 int insertControlpoint(const SbTime &time);
136
137 void deleteControlpoint(int idx);
138 void deleteActivePoint(void);
139
140
141
142private:
143 virtual ~SoCameraPathEditKit();
144
145 static void pickCallback(void *, SoEventCallback *);
146 static void posCallback(void *, SoSensor *);
147 static void timeCallback(void *, SoSensor *);
148 static void orCallback(void *, SoSensor *);
149 static void keyCallback(void *, SoEventCallback *);
150
151 static void dragtimeFinishCB(void *, SoDragger *);
152 static void dragtimeStartCB(void *, SoDragger *);
153 static void dragposFinishCB(void *, SoDragger *);
154 static void dragposStartCB(void *, SoDragger *);
155
156 void setControlpoint(int idx, const SbVec3f &pos, const SbVec3f &orient, const SbTime &time);
157
158 static void activePointCB(void *, SoSensor *);
159
160 void updateDraggers(void);
161
162 void buildTag(int tagIdx);
163 void buildTags(void);
164
165 int numControlpoints;
166
167 SbTime dragStarttime;
168};
169
170#endif // !SMALLCHANGE_SOCAMERAPATHEDITKIT_H
Definition misc/SbList.h:69
Definition SoCameraPathEditKit.h:50