VR-Forces 4.6 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
osgdb_vrftxp
trpage_scene.h
Go to the documentation of this file.
1
/* ************************
2
Copyright Terrain Experts Inc.
3
Terrain Experts Inc (TERREX) reserves all rights to this source code
4
unless otherwise specified in writing by the President of TERREX.
5
This copyright may be updated in the future, in which case that version
6
supercedes this one.
7
-------------------
8
Terrex Experts Inc.
9
4400 East Broadway #314
10
Tucson, AZ 85711
11
info@terrex.com
12
Tel: (520) 323-7990
13
************************
14
*/
15
16
#ifndef _txpage_scene_h_
17
18
#define _txpage_scene_h_
19
20
/* trpage_scene.h
21
Scene Graph definition.
22
This is a small scene graph we use for testing.
23
It's not intended to replace the scene graph you may already be using.
24
You do not need to translate from this scene graph structure to your own,
25
at run-time. Instead, use this file and trpage_scene.cpp as a guideline
26
for how to read TerraPage format into your own scene graph.
27
*/
28
29
#include <
osgdb_vrftxp/trpage_geom.h
>
30
31
/*
32
{group:Demonstration Scene Graph}
33
*/
34
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgMBR
{
35
public
:
36
trpgMBR
(
void
);
37
~trpgMBR
(
void
) { };
38
bool
isValid(
void
)
const
;
39
void
Reset(
void
);
40
void
AddPoint(
const
trpg3dPoint
&);
41
void
AddPoint(
double
,
double
,
double
);
42
void
GetMBR(
trpg3dPoint
&ll,
trpg3dPoint
&ur)
const
;
43
trpg3dPoint
GetLL(
void
)
const
;
44
trpg3dPoint
GetUR(
void
)
const
;
45
void
Union(
const
trpgMBR
&);
47
bool
Overlap(
const
trpg2dPoint
&ll,
const
trpg2dPoint
&ur)
const
;
49
bool
Within(
const
trpg2dPoint
&)
const
;
50
protected
:
51
inline
bool
inRange
(
double
minv,
double
maxv,
double
val)
const
{
return
(val >= minv && val <= maxv); }
52
bool
valid
;
53
trpg3dPoint
ll,
ur
;
54
};
55
59
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadNode
{
60
public
:
61
virtual
~trpgReadNode
(
void
) { };
62
virtual
bool
isGroupType(
void
) = 0;
63
virtual
int
GetType
(
void
) {
return
type; }
64
virtual
trpgMBR
GetMBR
(
void
)
const
{
return
trpgMBR
(); }
65
protected
:
66
int
type
;
67
};
68
72
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadGroupBase
:
public
trpgReadNode
{
73
public
:
74
virtual
~
trpgReadGroupBase
(
void
);
75
void
AddChild(
trpgReadNode
*);
76
bool
isGroupType
(
void
) {
return
true
; }
77
int
GetNumChildren
(
void
) {
return
int
(children.size()); }
78
trpgReadNode
*
GetChild
(
int
i) {
return
children[i]; }
79
trpgMBR
GetMBR
(
void
)
const
;
80
void
unRefChild(
int
i);
81
void
unRefChildren(
void
);
82
protected
:
83
trpgMBR
mbr
;
84
void
DeleteChildren(
void
);
85
std::vector<trpgReadNode *>
children
;
86
};
87
91
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadGeometry
:
public
trpgReadNode
{
92
public
:
93
trpgReadGeometry
(
void
) { type =
TRPG_GEOMETRY
; }
94
~trpgReadGeometry
(
void
) { };
95
bool
isGroupType
(
void
) {
return
false
; }
96
trpgGeometry
*
GetData
(
void
) {
return
&data; }
97
trpgMBR
GetMBR
(
void
)
const
;
98
protected
:
99
trpgMBR
mbr
;
100
trpgGeometry
data
;
101
};
102
106
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadTileHeader
:
public
trpgReadNode
{
107
public
:
108
trpgReadTileHeader
(
void
) { type =
TRPGTILEHEADER
; }
109
~trpgReadTileHeader
(
void
) { };
110
bool
isGroupType
(
void
) {
return
false
; }
111
trpgTileHeader
*
GetData
(
void
) {
return
&data; }
112
trpgMBR
GetMBR
(
void
)
const
{
trpgMBR
mbr;
return
mbr; };
113
protected
:
114
trpgTileHeader
data;
115
};
116
120
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadGroup
:
public
trpgReadGroupBase
{
121
public
:
122
trpgReadGroup
(
void
) { type =
TRPG_GROUP
; }
123
~trpgReadGroup
(
void
) { };
124
trpgGroup
*
GetData
(
void
) {
return
&data; }
125
protected
:
126
trpgGroup
data
;
127
};
128
132
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadAttach
:
public
trpgReadGroupBase
{
133
public
:
134
trpgReadAttach
(
void
) { type =
TRPG_ATTACH
; }
135
~trpgReadAttach
(
void
) { };
136
trpgAttach
*
GetData
(
void
) {
return
&data; }
137
protected
:
138
trpgAttach
data
;
139
};
140
144
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadChildRef
:
public
trpgReadGroupBase
{
145
public
:
146
trpgReadChildRef
(
void
) { type =
TRPG_CHILDREF
; }
147
~trpgReadChildRef
(
void
) { };
148
bool
isGroupType
(
void
) {
return
false
;}
149
trpgChildRef
*
GetData
(
void
) {
return
&data; }
150
protected
:
151
trpgChildRef
data
;
152
};
153
156
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadBillboard
:
public
trpgReadGroupBase
{
157
public
:
158
trpgReadBillboard
(
void
) { type =
TRPG_BILLBOARD
; }
159
~trpgReadBillboard
(
void
) { };
160
trpgBillboard
*
GetData
(
void
) {
return
&data; }
161
protected
:
162
trpgBillboard
data
;
163
};
164
167
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadLod
:
public
trpgReadGroupBase
{
168
public
:
169
trpgReadLod
(
void
) { type =
TRPG_LOD
; }
170
~trpgReadLod
(
void
) { };
171
trpgLod
*
GetData
(
void
) {
return
&data; }
172
protected
:
173
trpgLod
data
;
174
};
175
178
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadLayer
:
public
trpgReadGroupBase
{
179
public
:
180
trpgReadLayer
(
void
) { type =
TRPG_LAYER
; }
181
~trpgReadLayer
(
void
) { };
182
trpgLayer
*
GetData
(
void
) {
return
&data; }
183
protected
:
184
trpgLayer
data
;
185
};
186
189
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadTransform
:
public
trpgReadGroupBase
{
190
public
:
191
trpgReadTransform
(
void
) { type =
TRPG_TRANSFORM
; }
192
~trpgReadTransform
(
void
) { };
193
trpgTransform
*
GetData
(
void
) {
return
&data; }
194
protected
:
195
trpgTransform
data
;
196
};
197
200
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgReadModelRef
:
public
trpgReadGroupBase
{
201
public
:
202
trpgReadModelRef
(
void
) { type =
TRPG_MODELREF
; }
203
~trpgReadModelRef
(
void
) { };
204
trpgModelRef
*
GetData
(
void
) {
return
&data; }
205
protected
:
206
trpgModelRef
data
;
207
};
208
209
/* Scene Graph Parser
210
Parses a read buffer and returns a full scenegraph.
211
You don't want to use this if you're reading into your own scenegraph.
212
Instead, you'll want to sublcass trpgSceneParser, which is a helper
213
class to keep track of pushes and pops and implement the same functionality
214
that trpgSceneGraphParser has for your own scene graph.
215
*/
217
TX_EXDECL
class
DT_DLL_osgdb_vrftxp
trpgSceneGraphParser
:
public
trpgSceneParser
{
218
public
:
219
#if defined(_WIN32)
220
typedef
std::map<int,trpgReadGroupBase *>
GroupMap
;
221
#else
222
typedef
std::map< int,trpgReadGroupBase *,std::less<int> >
GroupMap
;
223
#endif
224
trpgSceneGraphParser
(
void
);
225
virtual
~trpgSceneGraphParser
(
void
) { };
228
trpgReadNode
*ParseScene(
trpgReadBuffer
&,GroupMap &);
229
trpgReadGroupBase
*GetCurrTop(
void
);
230
trpgReadTileHeader
*GetTileHeaderRef(
void
);
231
233
GroupMap *GetGroupMap(
void
);
234
protected
:
235
bool
StartChildren
(
void
*);
236
bool
EndChildren
(
void
*);
237
trpgReadNode
*
currTop
;
238
trpgReadNode
*
top
;
239
GroupMap
*
gmap
;
240
trpgReadTileHeader
tileHead
;
241
};
242
243
/* Test Archive
244
Utility function that loads and tests all tiles.
245
The only reason you'd want to call this is to test a TerraPage archive
246
you'd written.
247
*/
249
TX_CPPDECL
bool
trpgTestArchive
(
trpgr_Archive
&);
250
251
#endif
Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)