1 /*
2  * Scene.h
3  *
4  * Copyright (C) 1999 Stephen F. White
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #ifndef _SCENE_H
23 #define _SCENE_H
24 
25 #ifndef _STDIO_H
26 #include <stdio.h>
27 #endif
28 
29 #ifndef _ARRAY_H
30 #include "Array.h"
31 #endif
32 
33 #ifndef _MAP_H
34 #include "Map.h"
35 #endif
36 
37 #ifndef _STACK_H
38 #include "Stack.h"
39 #endif
40 
41 #ifndef _COMMAND_LIST_H
42 #include "CommandList.h"
43 #endif
44 
45 #ifndef _NODE_LIST_H
46 #include "NodeList.h"
47 #endif
48 
49 #ifndef _DUNE_STRING_H
50 #include "MyString.h"
51 #endif
52 
53 #ifndef _URL_H
54 #include "URL.h"
55 #endif
56 
57 #ifndef _PROTO_H
58 #include "Proto.h"
59 #endif
60 
61 #ifndef _DUNE_APP_H
62 #include "DuneApp.h"
63 #endif
64 
65 #ifndef _QUATERNION_H
66 #include "Quaternion.h"
67 #endif
68 
69 #include "x3dFlags.h"
70 
71 #include "TransformMode.h"
72 #include "RenderState.h"
73 #include "NodeFlags.h"
74 
75 #include "ProtoMap.h"
76 
77 #define MAX_PATH_LEN 1024
78 
79 class FieldValue;
80 class Node;
81 class Path;
82 class FontInfo;
83 class NodeViewpoint;
84 class NodeNavigationInfo;
85 class NodeViewport;
86 class NodeFog;
87 class NodeBackground;
88 class SFVec3f;
89 class MFVec3f;
90 class SceneView;
91 class Hint;
92 class NodeInline;
93 class Element;
94 class VertexModifier;
95 
96 class DownloadPathData;
97 
98 typedef MyStack<Command *> CommandStack;
99 
100 typedef Map<MyString, Node *> NodeMap;
101 typedef Map<MyString, int> StringMap;
102 
103 class Interpolator;
104 
105 enum {
106      HIGHEST_SELECTION_LEVEL = 0,
107      DEEPEST_SELECTION_LEVEL = -1
108 };
109 
110 enum {
111      SELECTION_MODE_FACES = 0,
112      SELECTION_MODE_VERTICES = 1,
113      SELECTION_MODE_LINES = 2,
114      SELECTION_HANIM_JOINT_WEIGHT = 3,
115      SELECTION_VERTICES_OF_HANIM_JOINT = 4
116 };
117 
118 enum {
119      SCAN_FOR_BOTH,
120      SCAN_FOR_EXTERN_PROTO,
121      SCAN_FOR_INLINE
122 };
123 
124 struct WriteCDynamicNodeData {
125     int filedes;
126     int languageFlag;
127     int result;
128 };
129 
130 class CGlNameData {
131 public:
132     int glName;
133     Node *node;
134     MyString nodeName;
135 };
136 
137 class Scene {
138 public:
139                         Scene();
140                        ~Scene();
141     void                def(const char *nodeName, Node *value);
def(Node * value)142     void                def(Node *value) { m_defNode = value; }
143     Node               *use(const char *nodeName);
144     bool                use(Node *parentNode, int parentField);
145     void                unuse(const char *nodeName);
146     void                removeUse(Node *node);
147     bool                canUse(Node *parentNode, int parentField);
148     void                undef(MyString nodeName);
hasAlreadyName(const char * name)149     bool                hasAlreadyName(const char *name) { return use(name); }
150 
151     int                 addSymbol(MyString s);
152     const MyString     &getSymbol(int id) const;
153 
setRoot(Node * root)154     void                setRoot(Node *root) { m_root = root; }
getRoot()155     Node               *getRoot() const { return m_root; }
getRootField()156     int                 getRootField() const { return m_rootField; }
157 
158     void                setNodes(NodeList *nodes);
getNodes()159     const NodeList     *getNodes() const { return &m_nodes; }
160     void                addNodes(Node *target, int targetField,
161                                  NodeList *nodes, int scanFor);
162 
163     void                addMeta(const char *metaKey, const char* metaValue);
164     void                addUnit(const char *category, const char *name,
165                                 double conversionFactor);
166 
getUnitLength(void)167     double              getUnitLength(void)
168                            {
169                            if (m_unitLength == 0)
170                                 return 1;
171                            return m_unitLength;
172                            }
173     void                setUnitLengthInit(void);
174     void                setUnitLength(double f);
getUnitAngle(void)175     double              getUnitAngle(void)
176                             {
177                             if (m_unitAngle == 0)
178                                 return 1;
179                             return m_unitAngle;
180                             }
181     void                setUnitAngleInit(void);
182     void                setUnitAngle(double f);
183 
184     void                pushUnitLength(void);
185     void                popUnitLength(void);
186     void                pushUnitAngle(void);
187     void                popUnitAngle(void);
188 
189     void                scanForInlines(NodeList *nodes);
190     void                readInline(NodeInline *node);
191 
192     void                scanForExternProtos(NodeList *nodes);
193     bool                readExternProto(Proto *proto);
194 
195     void                scanForMultimedia(NodeList *nodes);
196 
197     NodeList           *searchNodeType(int nodeType);
198     void                addToNodeList(Node *node);
199 
200 
201     const char         *parse(FILE *f, Node *target,
202                               int targetField, int scanFor);
203 
204     Node               *createNode(const char *nodeType,
205                                    int flags = NODE_FLAG_COLLAPSED);
206     Node               *createNode(int nodeType);
207 
208     DynamicFieldsNode  *createDynamicFieldsNode(const char *nodeType,
209                             int flags = NODE_FLAG_COLLAPSED);
210 
211     int                 write(int filedes, const char *url, int writeFlags = 0,
212                               char *wrlFile = NULL);
213     int                 writeHead(int f, int writeFlags);
214     int                 writeExtensionProtos(void);
215 
getWriteKanimNow(void)216     bool                getWriteKanimNow(void) { return m_writeKanimNow; }
217     int                 writeKanim(int filedes, const char* url);
218 
219     int                 writeC(int filedes, int languageFlag);
220     int                 writeCDeclaration(int filedes, int languageFlag);
221     int                 writeCTreeCallback(int filedes,
222                                            const char *functionName,
223                                            bool callTreeCallback = true);
224     int                 writeCDataFunctionsCalls(int filedes, int languageFlag);
225     int                 writeCRoutes(int filedes, int languageFlag);
226 
zeroNumDataFunctions(void)227     void                zeroNumDataFunctions(void) { m_numDataFunctions = 0; }
getNumDataFunctions(void)228     int                 getNumDataFunctions(void)
229                            { return m_numDataFunctions; }
increaseNumDataFunctions(void)230     int                 increaseNumDataFunctions(void)
231                            { return m_numDataFunctions++; }
232 
zeroNumDataClasses(void)233     void                zeroNumDataClasses(void) { m_numDataClasses = 0; }
getNumDataClasses(void)234     int                 getNumDataClasses(void)
235                            { return m_numDataClasses; }
increaseNumDataClasses(void)236     int                 increaseNumDataClasses(void)
237                            { return m_numDataClasses++; }
238 
getStartNumDataFunctions(void)239     int                 getStartNumDataFunctions(void)
240                            { return m_startNumDataFunctions; }
setStartNumDataFunctions(int i)241     void                setStartNumDataFunctions(int i)
242                            { m_startNumDataFunctions = i; }
243 
getNumDataFunctionsPerClass(void)244     int                 getNumDataFunctionsPerClass(void)
245                            { return m_numDataFunctionsPerClass; }
setNumDataFunctionsPerClass(int i)246     void                setNumDataFunctionsPerClass(int i)
247                            { m_numDataFunctionsPerClass = i; }
248 
249     int                 writeAc3d(int filedes, bool raven = false);
250     void                collectAc3dMaterialInfo(char *name, Node *node);
251     bool                hasEmptyMaterial(void);
getAc3dEmptyMaterial(void)252     int                 getAc3dEmptyMaterial(void)
253                            { return m_ac3dEmptyMaterial; }
254 
255     int                 writeRib(int f, const char *url);
256     int                 writeRibNextFrame(int f, const char *url, int frame);
257 
258     int                 writePovray(int f, const char *url);
259     int                 writePovrayNextFrame(int f, const char *url,
260                                              int frame);
261 
262     int                 writeCattGeo(void);
getCattGeoFileCounter(void)263     int                 getCattGeoFileCounter(void)
264                            { return m_cattGeoFileCounter; }
getAndIncCattGeoFileCounter(void)265     int                 getAndIncCattGeoFileCounter(void)
266                            { return m_cattGeoFileCounter++; }
getCattGeoCornerCounter(void)267     int                 getCattGeoCornerCounter(void)
268                            { return m_cattGeoCornerCounter; }
getAndIncCattGeoCornerCounter(void)269     int                 getAndIncCattGeoCornerCounter(void)
270                            { return m_cattGeoCornerCounter++; }
getAndIncCattGeoPlaneCounter(void)271     int                 getAndIncCattGeoPlaneCounter(void)
272                            { return m_cattGeoPlaneCounter++; }
273 
getCattRecIsWritten(void)274     bool                getCattRecIsWritten(void)
275                            { return m_cattRecIsWritten; }
setCattRecIsWritten(void)276     void                setCattRecIsWritten(void)
277                            { m_cattRecIsWritten = true; }
278 
getCattSrcIsWritten(void)279     bool                getCattSrcIsWritten(void)
280                            { return m_cattSrcIsWritten; }
setCattSrcIsWritten(void)281     void                setCattSrcIsWritten(void)
282                            { m_cattSrcIsWritten = true; }
283 
284     bool                validateLdrawExport();
285     int                 writeLdrawDat(int filedes, const char *path);
getCurrentLdrawColor(void)286     int                 getCurrentLdrawColor(void)
287                            { return m_currentLdrawColor; }
setCurrentLdrawColor(int c)288     void                setCurrentLdrawColor(int c)
289                            { m_currentLdrawColor = c; }
290 
291     int                 writeOff(int filedes);
292 
293     void                deleteExtensionProtos(void);
294     Proto              *getExtensionProto(Proto *proto);
295 
296     void                addProto(MyString name, Proto *value);
297     Proto              *getProto(MyString name);
getProto(const char * name)298     Proto              *getProto(const char *name)
299                            {
300                            MyString mname = name;
301                            return getProto(mname);
302                            }
hasProtoName(MyString name)303     bool                hasProtoName(MyString name)
304                            {
305                            if (getProto(name) == NULL)
306                                return false;
307                            return true;
308                            }
309     void                deleteProto(MyString name);
310     Proto              *getExtensionProto(MyString name);
311 
312     static bool         validRoute(Node *src, int eventOut, Node *dst,
313                                    int eventIn);
314     bool                addRoute(Node *src, int eventOut, Node *dest,
315                                  int eventIn, SceneView *sender = NULL);
316     void                deleteRoute(Node *src, int eventOut, Node *dest,
317                                     int eventIn);
318 
319     void                execute(Command *cmd, SceneView *sender = NULL);
320 
321     void                add(Command *change);
322     void                addNextCommand(void);
323     void                deleteLastNextCommand(void);
324 
325     void                undo();
326     void                redo();
327 
328     int                 canUndo() const;
329     int                 canRedo() const;
330 
getUndoStackTop()331     int                 getUndoStackTop() { return m_undoStack.getTop(); }
332 
333     void                errorf(const char *fmt, ...);
334 
335     void                invalidNode(const char *nodeName);
336     void                invalidField(const char *node, const char *field);
337 
338     void                backupField(Node *node, int field);
339     void                backupFieldsStart(void);
340     void                backupFieldsAppend(Node *node, int field);
341     void                backupFieldsDone(void);
342     void                setField(Node *node, int field, FieldValue *value);
343     Interpolator       *findUpstreamInterpolator(const Node *node,
344                                                  int field) const;
345 
346     void                drawScene(bool pick = false, int x = 0, int y = 0,
347                                   double width = 0, double height = 0,
348                                   Node *root = NULL, bool update = false,
349                                   float scaleX = 1, float scaleY = 1);
350 
getNumDraw(void)351     int                 getNumDraw(void) { return m_numDraw; }
352 
353     Path               *pick(int x, int y, float width = 0, float height = 0);
354     Path               *searchTransform(void);
355     Path               *searchTransform(Path *transform);
356     void                drawHandles(Node *root,
357                                     bool drawRigidBodyHandles = false);
358     void                finishDrawHandles(void);
359     void                drawHandlesRec(Node *node, bool drawOnlyJoints = false)
360                            const;
361 
setSelectedHandle(int handle)362     void                setSelectedHandle(int handle)
363                            {
364                            if (handle == NO_HANDLE)  {
365                                m_firstSelectionRangeHandle = -1;
366                                setSelectionMode(SELECTION_MODE_VERTICES);
367                                return;
368                            }
369                            m_isNewSelectedHandle = !isInSelectedHandles(handle);
370                            m_lastSelectedHandle = handle;
371                            addSelectedHandle(handle);
372                            if ((m_firstSelectionRangeHandle > 0) &&
373                                (m_firstSelectionRangeHandle != handle))
374                                addSelectionRange(m_firstSelectionRangeHandle,
375                                                  handle);
376                            }
addSelectedHandle(int handle)377     bool                addSelectedHandle(int handle)
378                            {
379                            if (m_selectedHandles.find(handle) != -1)
380                                return false;
381                            m_selectedHandles.append(handle);
382                            return true;
383                            }
removeSelectedHandle(int handle)384     void                removeSelectedHandle(int handle)
385                            {
386                            if (m_lastSelectedHandle == handle)
387                                m_lastSelectedHandle = -1;
388                            int index = m_selectedHandles.find(handle);
389                            if (index > -1)
390                                m_selectedHandles.remove(index);
391                            }
removeSelectedHandles(void)392     void                removeSelectedHandles(void)
393                            {
394                            if (m_selectedHandles.size() == 0)
395                                return;
396                            m_oldSelectedHandles.resize(0);
397                            for (long i = 0; i < m_selectedHandles.size();
398                                 i++)
399                                m_oldSelectedHandles.append(
400                                      m_selectedHandles[i]);
401                            m_selectedHandles.resize(0);
402                            m_oldLastSelectedHandle = m_lastSelectedHandle;
403                            m_lastSelectedHandle = -1;
404                            m_singleSelectedHandle = true;
405                            m_isNewSelectedHandle = true;
406                            }
407     void                restoreSelectedHandles(void);
getSelectedHandlesSize()408     int                 getSelectedHandlesSize() const
409                            { return m_selectedHandles.size(); }
getSelectedHandle(int i)410     int                 getSelectedHandle(int i) const
411                            { return m_selectedHandles[i]; }
isInSelectedHandles(int handle)412     bool                isInSelectedHandles(int handle)
413                            {
414                            if (m_selectedHandles.find(handle) != -1)
415                                return true;
416                            return false;
417                            }
isNewSelectedHandle(void)418     bool                isNewSelectedHandle(void)
419                           { return m_isNewSelectedHandle; }
getLastSelectedHandle(void)420     int                 getLastSelectedHandle(void)
421                            { return m_lastSelectedHandle; }
422     bool                checkXSymetricOrSameHandle(int handle, MFVec3f *points);
423 
isSingleSelectedHandle(void)424     bool                isSingleSelectedHandle(void)
425                            { return m_singleSelectedHandle; }
setSingleSelectedHandle(void)426     void                setSingleSelectedHandle(void)
427                            { m_singleSelectedHandle = true; }
setMultipleSelectedHandles(void)428     void                setMultipleSelectedHandles(void)
429                            { m_singleSelectedHandle = false; }
430 
getfirstSelectionRangeHandle(void)431     int                 getfirstSelectionRangeHandle(void)
432                            { return m_firstSelectionRangeHandle; }
setfirstSelectionRangeHandle(void)433     void                setfirstSelectionRangeHandle(void)
434                            { m_firstSelectionRangeHandle =
435                                  getLastSelectedHandle(); }
removeFirstSelectionRangeHandle(void)436     void                removeFirstSelectionRangeHandle(void)
437                            { m_firstSelectionRangeHandle = -1; }
438     void                addSelectionRange(int firstRangeHandle,
439                                           int secondRangeHandle);
440 
441     void                showOnlySelectedVertices(void);
442 
443     void                hideSelectedVertices(void);
unHideVertices(void)444     void                unHideVertices(void) { m_hiddenVertices.resize(0); }
445 
getNumHiddenVertices(void)446     int                 getNumHiddenVertices(void)
447                             { return m_hiddenVertices.size(); }
448 
getHiddenVertex(int i)449     int                 getHiddenVertex(int i)
450                             { return m_hiddenVertices[i]; }
451 
getSelectionMode(void)452     int                 getSelectionMode(void)
453                            { return m_selectionMode; }
454     void                setSelectionMode(int mode);
455 
setTransformMode(TMode tm)456     void                setTransformMode(TMode tm)
457                            { m_transformMode->tmode = tm; }
setTransformMode(TDimension td)458     void                setTransformMode(TDimension td)
459                            { m_transformMode->tdimension = td; }
setTransformMode(T2axes t2)460     void                setTransformMode(T2axes t2)
461                            { m_transformMode->t2axes = t2; }
getTransformMode()462     TransformMode      *getTransformMode()
463                            { return m_transformMode; }
isTranslation(void)464     bool                isTranslation(void)
465                            {
466                            TransformMode *tm = getTransformMode();
467                            return tm->hasTranslation();
468                            }
469 
470     void                transform(const Path *path);
471     void                projectPoint(float x, float y, float z,
472                                      float *wx, float *wy, float *wz);
473     void                unProjectPoint(float wx, float wy, float wz,
474                                        float *x, float *y, float *z);
475     int                 allocateLight();
476     int                 freeLight();
getNumLights()477     int                 getNumLights() { return m_numLights; }
478 
479     int                 allocateClipPlane();
480     int                 freeClipPlane();
getNumClipPlanes()481     int                 getNumClipPlanes() { return m_numClipPlanes; }
482 
483     void                enableHeadlight();
484     Path               *processHits(GLint hits, GLuint *pickBuffer,
485                                     bool selectMultipleHandles);
486 
487     void                addViewpoint(Node *viewpoint);
488     void                addFog(Node *fog);
489     void                setFog(Node *fog);
490     void                addBackground(Node *background);
491     void                setBackground(Node *background);
492     void                addNavigationInfo(Node *navigationInfo);
493 
494     void                setFirstNavigationInfo(void);
495 
496     void                addTimeSensor(Node *timeSensor);
497 
498     void                setHeadlight(int headlight);
499 
500     void                changeTurnPointDistance(float factor);
501 
502     void                moveCamera(float dx, float dy, float dz);
503     void                walkCamera(Vec3f walk, bool forward);
504     void                turnCamera(float x, float y, float z, float ang);
505     void                orbitCamera(float dtheta, float dphi);
506     void                rollCamera(float dtheta);
507     void                standUpCamera(void);
508 
509     void                startWalking();
510 
511     Node               *getCamera() const;
512     void                setCamera(Node *camera);
513     void                applyCamera(void);
514 
515     NodeNavigationInfo *getNavigationInfoNode() const;
516     void                applyNavigationInfo(void);
517 
518     void                findBindableNodes(void);
519 
520     void                addNode(Node *node);
521     Node               *replaceNode(Node *oldNode, Node* newNode);
522     void                removeNode(Node *node);
523 
524     MyString            getUniqueNodeName(const char *name);
525     MyString            getUniqueNodeName(Node *node);
526     MyString            generateUniqueNodeName(Node *node,
527                                                const char *name);
528     MyString            generateUniqueNodeName(Node *node);
529 
530     MyString            generateVariableName(Node *node);
531 
getSelection(void)532     Path               *getSelection(void) const { return m_selection; }
533     void                setSelection(Path *selection);
534     void                setSelection(Node *node);
535     void                setSelection(Proto *proto);
536 
537     Path               *newPath(Node *node);
538 
setURL(const char * url)539     void                setURL(const char *url) { m_URL = ""; m_URL += url; }
getURL(void)540     const char         *getURL(void) const { return m_URL; }
getNewURL(void)541     const char         *getNewURL(void) const { return m_newURL; }
542 
543     void                resetWriteFlags(int flags);
isTempSave(void)544     bool                isTempSave(void) const
545                            { return m_writeFlags & TEMP_SAVE; }
isPureVRML97(void)546     bool                isPureVRML97(void) const
547                            { return m_writeFlags & PURE_VRML97; }
isPureX3dv(void)548     bool                isPureX3dv(void) const
549                            { return m_writeFlags & PURE_X3DV; }
isX3dv(void)550     bool                isX3dv(void) const
551                            { return ::isX3dv(m_writeFlags); }
isX3dXml(void)552     bool                isX3dXml(void) const
553                            { return ::isX3dXml(m_writeFlags); }
isX3d(void)554     bool                isX3d(void) const
555                            { return ::isX3d(m_writeFlags); }
isPureVRML(void)556     bool                isPureVRML(void) const
557                            { return isPureVRML97() || isPureX3dv(); }
converts2X3d(void)558     bool                converts2X3d(void) const
559                            { return m_writeFlags & CONVERT2X3D; }
converts2VRML(void)560     bool                converts2VRML(void) const
561                            { return m_writeFlags & CONVERT2VRML; }
isX3dom(void)562     bool                isX3dom(void) const
563                            { return m_writeFlags & X3DOM; }
getWriteFlags(void)564     int                 getWriteFlags(void) { return m_writeFlags; }
setWriteFlags(int flags)565     void                setWriteFlags(int flags) { m_writeFlags = flags; }
566     void                setX3d(void);
567     void                setX3dv(void);
568     void                setX3dXml(void);
569     void                setVrml(void);
570     bool                isInvalidElement(Element *element);
571     bool                isValidElement(Element *element, bool x3d);
572 
setPath(const char * path)573     void                setPath(const char *path)
574                             {
575                             m_path = "";
576                             m_path += path;
577                             }
getPath()578     const char         *getPath() const { return m_path; }
579 
setPathIntern(const char * path)580     void                setPathIntern(const char *path)
581                             {
582                             m_pathIntern = "";
583                             m_pathIntern += path;
584                             }
getPathIntern()585     const char         *getPathIntern() const
586                            {
587                            if (m_pathIntern.length() == 0)
588                                return m_path;
589                            return m_pathIntern;
590                            }
591 
592     void                getProtoList(MyArray<int> *protoList, const Node *node);
593     void                setPathAllURL(const char *path);
594 
595     bool                isModified() const;
isRunning()596     bool                isRunning() const { return m_running; }
isRecording()597     bool                isRecording() const { return m_recording; }
setRecording(bool recording)598     void                setRecording(bool recording) { m_recording = recording; }
599 
600     void                start();
601     void                stop();
602     void                updateTime();
603     void                updateTimeAt(double t);
604     double              timeSinceStart(void);
605 
606     void                updateNodePROTOs(Proto *protoToUpdate);
607 
608     void                OnFieldChange(Node *node, int field, int index = -1);
609     void                OnAddNode(Node *node, Node *dest, int field);
610     void                OnRemoveNode(Node *node, Node *src, int field);
611 
612     void                OnAddNodeSceneGraph(Node *node, Node *dest, int field);
613 
614     void                AddView(SceneView *view);
615     void                RemoveView(SceneView *view);
616     void                UpdateViews(SceneView *sender, int type,
617                                     Hint *hint = NULL);
618     void                UpdateViewsNow(SceneView *sender, int type,
619                                        Hint *hint = NULL);
setUpdateViewsSelection(bool flag)620     void                setUpdateViewsSelection(bool flag)
621                            { m_canUpdateViewsSelection = flag; }
622 
623     void                deleteSelected();
624     void                deleteSelectedAppend(CommandList* list);
625     void                deleteAll();
626     void                selectNext();
627     int                 OnDragOver(Node *src, Node *srcParent, int srcField,
628                                    Node *dest, int destField, int modifiers);
629     int                 OnDrop(Node *src, Node *srcParent, int srcField,
630                                Node *dest, int destField, int effect);
631 
632     bool                Download(const URL &url, MyString *path);
633     MyString            downloadPath(const URL &url);
634     FontInfo           *LoadGLFont(const char *fontName, const char *style);
getNumProtoNames(void)635     int                 getNumProtoNames(void) { return m_numProtoNames; }
636     bool                addProtoName(MyString name);
637     void                deleteProtoName(MyString name);
getProtoName(int i)638     MyString            getProtoName(int i) { return m_protoNames[i]; }
639     void                addProtoDefinition(void);
640     void                addToProtoDefinition(const char* string);
641 
642     bool                isNestedProto(const char *protoName);
643     void                setNestedProto(void);
644 
645     int                 writeExternProto(int f, const char* protoName);
646 
647     void                updateSceneMap(void);
648 
649     MyString            createRouteString(const char *fromNodeName,
650                                           const char *fromFieldName,
651                                           const char *toNodeName,
652                                           const char *toFieldName);
653     void                addRouteString(MyString string);
654     void                addEndRouteString(MyString string);
655     int                 writeRouteStrings(int filedes, int indent,
656                                           bool end = false);
657     void                copyRoutes(Node *toNode, Node *fromNode);
658     void                copyRoutesToScene(Node *node);
659     void                changeRoutes(Node *toNode, int toField,
660                                      Node *fromNode, int fromField);
661     void                changeRoutes(Node *toNode, int toField,
662                                      int toOffset,
663                                      Node *fromNode, int fromField,
664                                      int fromOffset);
665     int                 writeComponents(int filedes);
666 
setHasFocus(void)667     void                setHasFocus(void)    {m_hasFocus=true;}
deleteHasFocus(void)668     void                deleteHasFocus(void) {m_hasFocus=false;}
getHasFocus(void)669     bool                getHasFocus(void)
670                            {
671                            if (TheApp->dontCareFocus())
672                                return true;
673                            else
674                                return m_hasFocus;
675                            }
setMouseNavigationMode(bool flag)676     void                setMouseNavigationMode(bool flag)
677                            {m_navigationMouseMode=flag;}
getMouseNavigationMode()678     bool                getMouseNavigationMode()
679                            {return m_navigationMouseMode;}
setInputDeviceNavigationMode(bool flag)680     void                setInputDeviceNavigationMode(bool flag)
681                            {m_navigationInputDeviceMode=flag;}
getInputDeviceNavigationMode()682     bool                getInputDeviceNavigationMode()
683                            {return m_navigationInputDeviceMode;}
684 
685     void                setViewOfLastSelection(SceneView* view);
686     SceneView          *getViewOfLastSelection(void);
687 
688     void                copyLastSelection(void);
689     void                pasteLastSelection(void);
690     void                pasteSymetricLastSelection(int direction);
691     void                deleteLastSelection(void);
692 
disableMakeSimilarName()693     void                disableMakeSimilarName() { m_similarNameFlag = false; }
694     void                makeSimilarName(Node *node, const char *name);
enableMakeSimilarName()695     void                enableMakeSimilarName() { m_similarNameFlag = true; }
696 
697     void                saveProtoStatus(void);
698     void                restoreProtoStatus(void);
699 
setErrorLineNumber(int lineno)700     void                setErrorLineNumber(int lineno)
701                            { m_errorLineNumber = lineno ;}
getErrorLineNumber(void)702     int                 getErrorLineNumber(void) { return m_errorLineNumber; }
703 
getErrors(void)704     const char         *getErrors(void) { return m_errors; }
705 
706     /*
707      * a extra modifiedflag is needed to signal possible changes
708      * (e.g. from the file -> Textedit menupoint)
709      */
setExtraModifiedFlag(void)710     void                setExtraModifiedFlag(void)
711                            { m_extraModifiedFlag = true; }
712     StringArray        *getAllNodeNames(void);
713     void                draw3dCursor(int x, int y);
use3dCursor(bool flag)714     void                use3dCursor(bool flag) { m_use3dCursor = flag; }
715     bool                use3dCursor(void);
716     bool                isVerticesOrNurbs(void);
717     void                draw3dBoundingBox(int xfrom, int yfrom,
718                                           int xto, int yto);
719     bool                setPrefix(char* prefix);
720     MyString            getNodeWithPrefix(const MyString &nodeType);
hasExternProtoWarning(void)721     bool                hasExternProtoWarning(void)
722                            { return m_externProtoWarning; }
setExternProtoWarning(bool flag)723     void                setExternProtoWarning(bool flag)
724                            { m_externProtoWarning = flag; }
725     bool                belongsToNodeWithExternProto(const char *protoName);
726     int                 writeIndexedFaceSet(int f, Node* node);
727     int                 writeIndexedTriangleSet(int f, Node* node);
728     int                 writeTriangleSet(int f, Node* node);
729     int                 writeTriangles(int f, Node* node);
730     int                 writeIndexedLineSet(int f, Node* node);
getXSymetricMode()731     bool                getXSymetricMode()
732                            { return TheApp->GetXSymetricMode(); }
isParsing(void)733     bool                isParsing(void) { return m_isParsing; }
getNumberBuildinProtos(void)734     int                 getNumberBuildinProtos(void)
735                            { return m_numberBuildinProtos; }
addDelayedWriteNode(Node * node)736     void                addDelayedWriteNode(Node *node)
737                            { m_delayedWriteNodes.append(node); }
738     void                recalibrate(void);
hasJoints(void)739     bool                hasJoints(void) { return m_hasJoints; }
setHasJoints(void)740     void                setHasJoints(void) { m_hasJoints = true; }
showJoints(void)741     bool                showJoints(void) { return m_showJoints; }
setShowJoints(bool flag)742     void                setShowJoints(bool flag)
743                            { if (m_hasJoints) m_showJoints = flag; }
getNumInteractiveProtos(int type)744     int                 getNumInteractiveProtos(int type)
745                            { return getInteractiveProtos(type)->size(); }
getInteractiveProto(int type,int i)746     Proto              *getInteractiveProto(int type, int i)
747                            { return (*getInteractiveProtos(type))[i]; }
setXrayRendering(bool flag)748     void                setXrayRendering(bool flag)
749                            { m_xrayRendering = flag; }
750     int                 getDestField(Node* src, Node *dest, int destField);
751 
setXonly(bool flag)752     void                setXonly(bool flag) { m_xOnly = flag; }
setYonly(bool flag)753     void                setYonly(bool flag) { m_yOnly = flag; }
setZonly(bool flag)754     void                setZonly(bool flag) { m_zOnly = flag; }
getXonly(void)755     bool                getXonly(void) { return m_xOnly; }
getYonly(void)756     bool                getYonly(void) { return m_yOnly; }
getZonly(void)757     bool                getZonly(void) { return m_zOnly; }
758     int                 getConstrain(void);
759     Vec3f               constrainVec(Vec3f vec);
760 
761     void                setTurnPoint(void);
762 
getTimeSensors(void)763     NodeList            getTimeSensors(void) { return m_timeSensors; }
764 
setImportIntoVrmlScene(bool f)765     void                setImportIntoVrmlScene(bool f) { m_importIntoVrmlScene = f; }
getImportIntoVrmlScene(void)766     bool                getImportIntoVrmlScene(void) { return m_importIntoVrmlScene; }
767 
768     void                convertProtos2X3d(void);
769     void                convertProtos2Vrml(void);
770 
setRigidBodyHandleNode(Node * node)771     void                setRigidBodyHandleNode(Node *node)
772                            { m_rigidBodyHandleNode = node; }
773 
774     Node               *convertToIndexedFaceSet(Node* node);
775     Node               *convertToTriangleSet(Node* node);
776     Node               *convertToIndexedTriangleSet(Node* node);
777     Node               *convertToIndexedLineSet(Node* node);
778 
779     void                branchConvertToTriangleSet(Node *node);
780     void                branchConvertToIndexedTriangleSet(Node *node);
781     void                branchConvertToIndexedFaceSet(Node *node);
782     void                branchConvertToTriangles(Node *node, bool targetHasCcw);
783     void                branchCreateNormals(Node *node);
784     void                createNormal(Node *node);
785     void                branchCreateTextureCoordinates(Node *node);
786     void                createTextureCoordinate(Node *node);
787 
788     void                branchSetBbox(void);
789 
isCurrentViewpoint(Node * node)790     bool                isCurrentViewpoint(Node *node)
791                             { return node == (Node *)m_currentViewpoint; }
isDefaultViewpoint(Node * node)792     bool                isDefaultViewpoint(Node *node)
793                             { return node == (Node *)m_currentViewpoint; }
794 
795     void                addToSensorNodes(Node *node);
removeSensorNodes(void)796     void                removeSensorNodes(void) { m_sensorNodes.resize(0); }
797 
setParsedX3dVersion(int version)798     void                setParsedX3dVersion(int version)
799                            { m_x3dVersion = version; }
getParsedX3dVersion(void)800     int                 getParsedX3dVersion(void) { return m_x3dVersion; }
801     int                 getX3dVersion(void);
802 
803     void                warning(const char* string);
804     void                warning(int id);
805     void                warning(int id, const char *string);
806 
getProto(long i)807     Proto              *getProto(long i)
808                             {
809                             if (i >= m_protoNames.size())
810                                 return NULL;
811                             return m_protos[m_protoNames[i]];
812                             }
getNumProtos(void)813     int                 getNumProtos(void) { return m_protoNames.size(); }
toggleDeselect(void)814     void                toggleDeselect(void) { m_deselect = !m_deselect; }
getDeselect(void)815     bool                getDeselect(void) { return m_deselect; }
816     Node               *searchProtoNodeId(long id);
817     Node               *searchProtoNodeIdInNode(Node *node, long id);
818     int                 getProtoType(Proto *proto);
setLastSelectedHAnimJoint(Node * n)819     void                setLastSelectedHAnimJoint(Node *n)
820                            { m_lastSelectedHAnimJoint = n; }
getLastSelectedHAnimJoint(void)821     Node               *getLastSelectedHAnimJoint(void)
822                            { return m_lastSelectedHAnimJoint; }
setLastSelectedHAnimJointOrHumanoid(Node * n)823     void                setLastSelectedHAnimJointOrHumanoid(Node *n)
824                            { m_lastSelectedHAnimJointOrHumanoid = n; }
getLastSelectedHAnimJointOrHumanoid(void)825     Node               *getLastSelectedHAnimJointOrHumanoid(void)
826                            { return m_lastSelectedHAnimJointOrHumanoid; }
getCurrentTime(void)827     double              getCurrentTime(void) { return m_currentTime; }
828 
getRibTexureFile(MyString file)829     MyString            getRibTexureFile(MyString file)
830                             { return m_ribTexureFiles[file]; }
addRibTexureFile(MyString file,MyString txFile)831     void                addRibTexureFile(MyString file, MyString txFile)
832                             {
833                             if (m_ribTexureFiles.hasKey(file))
834                                 m_ribTexureFiles.replace(file, txFile);
835                             else
836                                 m_ribTexureFiles.add(file, txFile);
837                             }
getTexureFile(MyString file)838     MyString            getTexureFile(MyString file)
839                             { return file; }
getSavedVrml(void)840     bool               getSavedVrml(void) { return m_saved_vrml; }
getSavedX3dv(void)841     bool               getSavedX3dv(void) { return m_saved_x3dv; }
getSavedX3dXml(void)842     bool               getSavedX3dXml(void) { return m_saved_x3dxml; }
setSaved(void)843     void               setSaved(void) {
844                            m_saved_vrml = true;
845                            m_saved_x3dv = true;
846                            m_saved_x3dxml = true;
847                        }
setNotSaved(void)848     void               setNotSaved(void) {
849                             m_saved_vrml = false;
850                             m_saved_x3dv = false;
851                             m_saved_x3dxml = false;
852                         }
853      MyArray<Node *>   *getViewPorts();
854      void               setViewPorts(void);
addViewPort(Node * node)855      void               addViewPort(Node *node) {
856                            m_viewports.append(node);
857                         }
858 
getViewpointUpdated(void)859      bool               getViewpointUpdated(void) { return m_viewpointUpdated; }
860 
getDrawViewports()861      bool               getDrawViewports() { return m_drawViewPorts; }
862 
863     void                resetPerspective(void);
864 
getWidth(void)865     int                 getWidth(void)  { return m_width; }
getHeight(void)866     int                 getHeight(void) { return m_height; }
867 
hasParticleSystem(void)868     bool                hasParticleSystem(void)
869                             { return m_hasParticleSystem; }
setParticleSystem(bool flag)870     void                setParticleSystem(bool flag)
871                             { m_hasParticleSystem = flag; }
872 
hasMovieTexture(void)873     bool                hasMovieTexture(void)
874                             { return m_hasMovieTexture; }
setMovieTexture(bool flag)875     void                setMovieTexture(bool flag)
876                             { m_hasMovieTexture = flag; }
877 
setInfoHandles(bool flag)878     void                setInfoHandles(bool flag)
879                             { m_infoHandles = flag; }
getInfoHandles(void)880     bool                getInfoHandles(void) { return m_infoHandles; }
881 
getGlName(void)882     int                 getGlName(void) { return m_glName; }
increaseGlName(void)883     void                increaseGlName(void) { m_glName++; }
884 
getScriptTypeWritten(void)885     bool                getScriptTypeWritten(void)
886                             { return m_scriptTypeWritten; }
setScriptTypeWritten(void)887     void                setScriptTypeWritten(void)
888                             { m_scriptTypeWritten = true; }
889 
dynamicNodeCallbackWritten(const char * name)890     bool                dynamicNodeCallbackWritten(const char *name)
891                             {
892                             return m_writeCDynamicNodeCallback.find(name) > -1;
893                             }
dynamicNodeCallbackAppend(const char * name)894     void                dynamicNodeCallbackAppend(const char *name)
895                             { m_writeCDynamicNodeCallback.append(name); }
dynamicNodeCallbackRemove(void)896     void                dynamicNodeCallbackRemove(void)
897                             { m_writeCDynamicNodeCallback.resize(0); }
898 
899     void                addToStore4ConvexHull(void);
getStore4ConvexHull(void)900     MyArray<Vec3f>     *getStore4ConvexHull(void)
901                             { return &m_store4ConvexHull; }
getStore4ExtrusionConvexHull(int num)902     MyArray<Vec3f>     *getStore4ExtrusionConvexHull(int num)
903                             {
904                             if (num % 2 == 1)
905                                 return &m_store4Extrusion1ConvexHull;
906                             return &m_store4Extrusion2ConvexHull;
907                             }
removeStore4ConvexHull(void)908     void                removeStore4ConvexHull(void)
909                             {
910                             m_convexHullCounter = 0;
911                             m_store4ConvexHull.resize(0);
912                             m_store4Extrusion1ConvexHull.resize(0);
913                             m_store4Extrusion2ConvexHull.resize(0);
914                             }
915 
getVertexModifier(void)916     VertexModifier     *getVertexModifier(void) { return m_vertexModifier; }
setVertexModifier(VertexModifier * mod)917     void                setVertexModifier(VertexModifier *mod)
918                             { m_vertexModifier = mod; }
919 
920     void                storeHtmlData(const char *data);
921     void                storeHtmlElementAndAttributes(const char *element,
922                                                       const char **attribures,
923                                                       int numAttributes,
924                                                       bool htmlFirstPart);
925 
storeAsHtml(void)926     void                storeAsHtml(void) { m_storeAsHtml = true; }
getStoreAsHtml(void)927     bool                getStoreAsHtml(void) { return m_htmlData.size() > 2; }
928 
929     bool                hasPROTONodes(void);
930 
931     MyArray<Node *>    *searchTimeSensors(void);
932     MyArray<Node *>    *searchInterpolators(void);
933     NodeList            searchTimeSensorInInterpolator(Node *interpolator);
934     void                makeEmpty();
935 
936 protected:
937     int                 writeExtensionProtos(int f, int flag);
938     ProtoArray         *getInteractiveProtos(int type);
939     void                buildInteractiveProtos(void);
940     void                updateViewpoint(void);
941     DownloadPathData    downloadPathIntern(const URL &url);
942 protected:
943     NodeMap             m_nodeMap;
944     Node               *m_root;
945     int                 m_rootField;
946     StringMap           m_symbols;
947     StringArray         m_symbolList;
948     StringArray         m_protoNames;
949     int                 m_numProtoNames;
950     int                 m_statusNumProtoNames;
951     StringArray         m_protoDefinitions;
952     MyArray<bool>       m_isNestedProto;
953     int                 m_numProtoDefinitions;
954     int                 m_statusNumProtoDefinitions;
955     ProtoMap            m_protos;
956 
957     MyArray<MyString>   m_htmlBegin;
958     MyArray<MyString>   m_htmlData;
959     MyArray<MyString>   m_htmlEnd;
960     MyArray<bool>       m_htmlFirstPart;
961 
962     int                 m_numDraw;
963 
964     CommandStack        m_undoStack;
965     CommandStack        m_redoStack;
966 
967     CommandList        *m_backupCommandList;
968     int                 m_numLights;
969     int                 m_numClipPlanes;
970     NodeList            m_viewpoints;
971     NodeList            m_navigationinfos;
972     NodeList            m_backgrounds;
973     NodeList            m_fogs;
974     MyStack<Node *>     m_fogStack;
975 
976     NodeList            m_timeSensors;
977 
978     int                 m_headlight;
979     bool                m_headlightIsSet;
980 
981     NodeList            m_nodes;
982 
983     Path               *m_selection;
984     IntArray            m_selectedHandles;
985     int                 m_lastSelectedHandle;
986     int                 m_oldLastSelectedHandle;
987     bool                m_isNewSelectedHandle;
988 
989     Node               *m_oldSelection;
990     IntArray            m_oldSelectedHandles;
991 
992     bool                m_singleSelectedHandle;
993 
994     int                 m_selectionMode;
995 
996     TransformMode      *m_transformMode;
997 
998     MyString            m_URL;
999     const char         *m_newURL;
1000     int                 m_writeFlags;
1001     int                 m_x3dVersion;
1002 
1003     int                 m_numSymbols;
1004 
1005     bool                m_running;
1006     double              m_timeStart;
1007     bool                m_recording;
1008 
1009     Command            *m_unmodified;
1010     bool                m_extraModifiedFlag;
1011 
1012     bool                m_setViewpoint;
1013     Node               *m_defaultViewpoint;
1014     Node               *m_currentViewpoint;
1015 
1016     bool                m_setNavigationInfo;
1017     NodeNavigationInfo *m_defaultNavigationInfo;
1018     NodeNavigationInfo *m_currentNavigationInfo;
1019 
1020     NodeFog            *m_currentFog;
1021     NodeBackground     *m_currentBackground;
1022 
1023     MyArray<Node *>     m_viewports;
1024 
1025     bool                m_canUpdateViewsSelection;
1026     List<SceneView *>   m_views;
1027 
1028     MyString            m_errors;
1029     MyArray<FontInfo *> m_fonts;
1030 
1031     MyString            m_path;
1032     MyString            m_pathIntern;
1033 
1034     List<MyString>      m_routeList;
1035     List<MyString>      m_endRouteList;
1036 
1037     /* when picking several objects which one click, which one is selected ? */
1038     int                 m_selectlevel;
1039 
1040     /* current scene is in mouse focus ? */
1041     bool                m_hasFocus;
1042 
1043     bool                m_xOnly;
1044     bool                m_yOnly;
1045     bool                m_zOnly;
1046 
1047     bool                m_navigationMouseMode;
1048     bool                m_navigationInputDeviceMode;
1049 
1050     SceneView          *m_viewOfLastSelection;
1051     bool                m_selection_is_in_scene;
1052 
1053     GLUquadricObj      *m_obj3dCursor;
1054     bool                m_use3dCursor;
1055     int                 m_errorLineNumber;
1056 
1057     MyArray<const char *> m_nodesWithExternProto;
1058     MyArray<const char *> m_nodesForceExternProtoWrite;
1059     bool                m_externProtoWarning;
1060     int                 m_numberBuildinProtos;
1061 
1062     bool                m_isParsing;
1063 
1064     // temporary nodes to write (e.g. Interpolators for PureVRML Export)
1065     MyArray<Node *>     m_delayedWriteNodes;
1066 
1067     bool                m_hasJoints;
1068     bool                m_showJoints;
1069 
1070     ProtoArray          m_interactiveSFBoolProtos;
1071     ProtoArray          m_interactiveSFRotationProtos;
1072     ProtoArray          m_interactiveSFTimeProtos;
1073     ProtoArray          m_interactiveSFVec3fProtos;
1074     ProtoArray          m_emptyProtoArray;
1075 
1076     bool                m_xrayRendering;
1077 
1078     Vec3d               m_turnPointPos;
1079     Quaternion          m_turnPointRot;
1080 
1081     double              m_oldWalkTime;
1082 
1083     Node               *m_defNode;
1084     MyArray<Proto *>    m_writtenExtensionProtos;
1085     bool                m_importIntoVrmlScene;
1086 
1087     int                 m_numDataClasses;
1088     int                 m_numDataFunctions;
1089     int                 m_startNumDataFunctions;
1090     int                 m_numDataFunctionsPerClass;
1091     bool                m_writeKanimNow;
1092 
1093     StringMap           m_ac3dMaterialIndexMap;
1094     NodeArray           m_ac3dMaterialNodeArray;
1095     StringArray         m_ac3dMaterialNameArray;
1096     int                 m_ac3dEmptyMaterial;
1097 
1098     int                 m_cattGeoFileCounter;
1099     int                 m_cattGeoCornerCounter;
1100     int                 m_cattGeoPlaneCounter;
1101 
1102     bool                m_cattRecIsWritten;
1103     bool                m_cattSrcIsWritten;
1104 
1105     int                 m_currentLdrawColor;
1106 
1107     int                 m_variableCounter;
1108 
1109     NodeList            m_nodeList;
1110 
1111     Node               *m_rigidBodyHandleNode;
1112 
1113     MyArray<const char*>  m_metaKeys;
1114     MyArray<const char*>  m_metaValues;
1115 
1116     MyArray<const char*>  m_unitCategory;
1117     MyArray<const char*>  m_unitName;
1118     MyArray<double>       m_unitConversionFactor;
1119 
1120     double              m_unitLength;
1121     double              m_unitAngle;
1122 
1123     MyStack<double>     m_unitLengthStack;
1124     MyStack<double>     m_unitAngleStack;
1125 
1126     NodeArray           m_sensorNodes;
1127 
1128     StringArray         m_warnings;
1129 
1130     double              m_currentTime;
1131     double              m_oldTime;
1132 
1133     bool                m_deselect;
1134 
1135     int                 m_firstSelectionRangeHandle;
1136 
1137     IntArray            m_hiddenVertices;
1138 
1139     Node               *m_lastSelectedHAnimJoint;
1140     Node               *m_lastSelectedHAnimJointOrHumanoid;
1141 
1142     bool                m_downloaded;
1143 
1144     Map<MyString, MyString> m_ribTexureFiles;
1145     Map<MyString, MyString> m_povrayTexureFiles;
1146 
1147     bool                m_saved_vrml;
1148     bool                m_saved_x3dv;
1149     bool                m_saved_x3dxml;
1150 
1151     bool                m_viewpointUpdated;
1152 
1153     bool                m_drawViewPorts;
1154 
1155     int                 m_width;
1156     int                 m_height;
1157 
1158     bool                m_hasParticleSystem;
1159     bool                m_hasMovieTexture;
1160 
1161     Node               *m_orthoViewpoint;
1162 
1163     bool                m_infoHandles;
1164 
1165     int                 m_glName;
1166 
1167     bool                m_scriptTypeWritten;
1168 
1169     MyArray<const char *> m_writeCDynamicNodeCallback;
1170 
1171     MyArray<Vec3f>      m_store4ConvexHull;
1172     MyArray<Vec3f>      m_store4Extrusion1ConvexHull;
1173     MyArray<Vec3f>      m_store4Extrusion2ConvexHull;
1174 
1175     int                 m_convexHullCounter;
1176 
1177     VertexModifier     *m_vertexModifier;
1178 
1179     bool                m_storeAsHtml;
1180 
1181     bool                m_similarNameFlag;
1182 
1183     bool                m_alreadyPredrawed;
1184 
1185 public:
1186     MyArray<CGlNameData> m_glNameData;
1187 };
1188 
1189 bool writeCNodeData(Node *node, void *data);
1190 
1191 enum {
1192     UPDATE_ALL = 0,
1193     UPDATE_SELECTION,
1194     UPDATE_FIELD,
1195     UPDATE_ADD_NODE,
1196     UPDATE_REMOVE_NODE,
1197     UPDATE_CHANGE_INTERFACE_NODE,
1198     UPDATE_ADD_ROUTE,
1199     UPDATE_DELETE_ROUTE,
1200     UPDATE_MODE,
1201     UPDATE_PROTO,
1202     UPDATE_TIME,
1203     UPDATE_START_FIELD_EDIT,
1204     UPDATE_STOP_FIELD_EDIT,
1205     UPDATE_ENABLE_COLOR_CIRCLE,
1206     UPDATE_DISABLE_COLOR_CIRCLE,
1207     UPDATE_CLOSE_COLOR_CIRCLE,
1208     UPDATE_CLOSE_VERTEX_MODIFIER,
1209     UPDATE_SELECTED_FIELD,
1210     UPDATE_SELECTION_NAME,
1211     UPDATE_NODE_NAME,
1212     UPDATE_ADD_NODE_SCENE_GRAPH_VIEW,
1213     UPDATE_REDRAW,
1214     UPDATE_REDRAW_3D,
1215     UPDATE_PREVIEW,
1216     UPDATE_SOLID_CHANGED,
1217     UPDATE_TOOLBAR,
1218     UPDATE_TOOLBARS,
1219     UPDATE_SELF
1220 };
1221 
1222 enum {
1223     RENDER_PASS_GEOMETRY,
1224     RENDER_PASS_NON_TRANSPARENT,
1225     RENDER_PASS_TRANSPARENT
1226 };
1227 
1228 class Hint {
1229 };
1230 
1231 class FieldUpdate : public Hint {
1232 public:
1233                     FieldUpdate(Node *n = NULL, int f = -1, int i = -1);
1234 
1235 
1236     Node           *node;
1237     int             field;
1238     int             index;
1239 };
1240 
1241 class NodeUpdate : public Hint {
1242 public:
NodeUpdate(Node * n,Node * p,int f)1243                     NodeUpdate(Node *n, Node *p, int f)
1244                     { node = n; parent = p, field = f; }
1245 
1246     Node           *node;
1247     Node           *parent;
1248     int             field;
1249 };
1250 
1251 class RouteUpdate : public Hint {
1252 public:
RouteUpdate(Node * s,int out,Node * d,int in)1253                     RouteUpdate(Node *s, int out, Node *d, int in)
1254                     { src = s; eventOut = out; dest = d; eventIn = in; }
1255 
1256     Node           *src;
1257     Node           *dest;
1258     int             eventOut;
1259     int             eventIn;
1260 };
1261 
1262 class ProtoUpdate : public Hint {
1263 public:
ProtoUpdate(Proto * p)1264                     ProtoUpdate(Proto *p) { proto = p; }
1265 
1266     Proto          *proto;
1267 };
1268 
1269 void BackupRoutesRec(Node *node, CommandList *list);
1270 
1271 SDC CreateDC(SWND canvas);
1272 
1273 #endif // _SCENE_H
1274 
1275