root/OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ControlRecords.cpp @ 10283

Revision 10283, 4.4 kB (checked in by robert, 6 years ago)

From Gregory Jaegy and Robert Osfield, added support for static linking of OpenFlight? plugin

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[7748]1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under 
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
[5038]14//
15// OpenFlight® loader for OpenSceneGraph
16//
[7748]17//  Copyright (C) 2005-2007  Brede Johansen
[5038]18//
19
[5375]20#include <assert.h>
[5038]21#include <osg/Geode>
22#include <osg/Geometry>
23#include "Registry.h"
24#include "Document.h"
25#include "RecordInputStream.h"
26
27namespace flt {
28
29
30
31/** PushLevel
32*/
33class PushLevel : public Record
34{
35    public:
36
37        PushLevel() {}
38
39        META_Record(PushLevel)
40
[7756]41        virtual void readRecord(RecordInputStream& /*in*/, Document& document)
[5038]42        {
43            document.pushLevel();
44        }
45
46    protected:
47
48        virtual ~PushLevel() {}
49};
50
[10283]51REGISTER_FLTRECORD(PushLevel, PUSH_LEVEL_OP)
[5038]52
53
[10283]54
[5038]55/** PophLevel
56*/
57class PopLevel : public Record
58{
59    public:
60
61        PopLevel() {}
62
63        META_Record(PopLevel)
64
[5229]65        virtual void read(RecordInputStream& /*in*/, Document& document)
[5038]66        {
[7859]67            PrimaryRecord* parentPrimary = document.getTopOfLevelStack();
68            PrimaryRecord* currentPrimary = document.getCurrentPrimaryRecord();
69
70            // Call dispose() for primary without push, pop level pair.
71            if (currentPrimary && currentPrimary!=parentPrimary)
[7756]72            {
[7859]73                currentPrimary->dispose(document);
[7756]74            }
75
[7859]76            // Call dispose() for primary with push, pop level pair.
77            if (parentPrimary)
78            {
79                parentPrimary->dispose(document);
80            }
81
[5038]82            document.popLevel();
83        }
84
85    protected:
86
87        virtual ~PopLevel() {}
88};
89
[10283]90REGISTER_FLTRECORD(PopLevel, POP_LEVEL_OP)
[5038]91
92
[10283]93
[5038]94/** PushSubface
95*/
96class PushSubface : public Record
97{
98    public:
99
100        PushSubface() {}
101
102        META_Record(PushSubface)
103
[5229]104        virtual void read(RecordInputStream& /*in*/, Document& document)
[5038]105        {
106            document.pushSubface();
107        }
108
109    protected:
110
111        virtual ~PushSubface() {}
112};
113
[10283]114REGISTER_FLTRECORD(PushSubface, PUSH_SUBFACE_OP)
[5038]115
116
[10283]117
[5038]118/** PopSubface
119*/
120class PopSubface : public Record
121{
122    public:
123
124        PopSubface() {}
125
126        META_Record(PopSubface)
127
[5229]128        virtual void read(RecordInputStream& /*in*/, Document& document)
[5038]129        {
130            document.popSubface();
131        }
132
133    protected:
134
135        virtual ~PopSubface() {}
136};
137
[10283]138REGISTER_FLTRECORD(PopSubface, POP_SUBFACE_OP)
[5038]139
140
[10283]141
[5038]142/** PushExtension
143*/
144class PushExtension : public Record
145{
146    public:
147
148        PushExtension() {}
149
150        META_Record(PushExtension)
151
152        virtual void read(RecordInputStream& in, Document& document)
153        {
154            readRecord(in,document);
155            document.pushExtension();
156        }
157
158    protected:
159
160        virtual ~PushExtension() {}
161};
162
[10283]163REGISTER_FLTRECORD(PushExtension, PUSH_EXTENSION_OP)
[5038]164
165
[10283]166
[5038]167/** PopExtension
168*/
169class PopExtension : public Record
170{
171    public:
172
173        PopExtension() {}
174
175        META_Record(PopExtension)
176
177        virtual void read(RecordInputStream& in, Document& document)
178        {
179            readRecord(in,document);
180            document.popExtension();
181        }
182
183    protected:
184
185        virtual ~PopExtension() {}
186};
187
[10283]188REGISTER_FLTRECORD(PopExtension, POP_EXTENSION_OP)
[5038]189
190
[10283]191
[5038]192/** PushAttribute - Reserved subtree
193*/
194class PushAttribute : public Record
195{
196    public:
197
198        PushAttribute() {}
199
200        META_Record(PushAttribute)
201
202        virtual void read(RecordInputStream& in, Document& document)
203        {
204            readRecord(in,document);
205        }
206
207    protected:
208
209        virtual ~PushAttribute() {}
210};
211
[10283]212REGISTER_FLTRECORD(PushAttribute, PUSH_ATTRIBUTE_OP)
[5038]213
214
[10283]215
[5038]216/** PopAttribute
217*/
218class PopAttribute : public Record
219{
220    public:
221
222        PopAttribute() {}
223
224        META_Record(PopAttribute)
225
226        virtual void read(RecordInputStream& in, Document& document)
227        {
228            readRecord(in,document);
229        }
230
231    protected:
232
233        virtual ~PopAttribute() {}
234};
235
[10283]236REGISTER_FLTRECORD(PopAttribute, POP_ATTRIBUTE_OP)
[5038]237
238
[10283]239
[5038]240} // end namespace
241
242
Note: See TracBrowser for help on using the browser.