VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #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 
30 
31 /*
32  {group:Demonstration Scene Graph}
33  */
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;
54 };
55 
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 
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:
84  void DeleteChildren(void);
85  std::vector<trpgReadNode *> children;
86 };
87 
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:
101 };
102 
107 public:
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 
121 public:
122  trpgReadGroup(void) { type = TRPG_GROUP; }
123  ~trpgReadGroup(void) { };
124  trpgGroup *GetData(void) { return &data; }
125 protected:
127 };
128 
133 public:
134  trpgReadAttach(void) { type = TRPG_ATTACH; }
135  ~trpgReadAttach(void) { };
136  trpgAttach *GetData(void) { return &data; }
137 protected:
139 };
140 
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:
152 };
153 
157 public:
160  trpgBillboard *GetData(void) { return &data; }
161 protected:
163 };
164 
168 public:
169  trpgReadLod(void) { type = TRPG_LOD; }
170  ~trpgReadLod(void) { };
171  trpgLod *GetData(void) { return &data; }
172 protected:
174 };
175 
179 public:
180  trpgReadLayer(void) { type = TRPG_LAYER; }
181  ~trpgReadLayer(void) { };
182  trpgLayer *GetData(void) { return &data; }
183 protected:
185 };
186 
190 public:
193  trpgTransform *GetData(void) { return &data; }
194 protected:
196 };
197 
201 public:
202  trpgReadModelRef(void) { type = TRPG_MODELREF; }
203  ~trpgReadModelRef(void) { };
204  trpgModelRef *GetData(void) { return &data; }
205 protected:
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  */
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 *);
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  */
250 
251 #endif
Read Attach Should be the top of a higher LOD tile {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:132
Definition: trpage_geom.h:2076
#define TRPG_MODELREF
{secret}
Definition: trpage_io.h:221
trpgReadBillboard(void)
Definition: trpage_scene.h:158
trpgReadTileHeader(void)
Definition: trpage_scene.h:108
#define TRPG_GROUP
{secret}
Definition: trpage_io.h:213
virtual int GetType(void)
Definition: trpage_scene.h:63
Definition: trpage_read.h:256
~trpgReadGroup(void)
Definition: trpage_scene.h:123
trpgBillboard * GetData(void)
Definition: trpage_scene.h:160
GroupMap * gmap
Top of everything.
Definition: trpage_scene.h:239
trpgGroup * GetData(void)
Definition: trpage_scene.h:124
#define DT_DLL_osgdb_vrftxp
Contains DLL export macros.
Definition: osgdb_vrftxpDefines.h:25
trpgAttach * GetData(void)
Definition: trpage_scene.h:136
Definition: trpage_geom.h:2766
Read Tile Header One per tile.
Definition: trpage_scene.h:106
bool isGroupType(void)
Definition: trpage_scene.h:95
bool isGroupType(void)
Definition: trpage_scene.h:76
trpgTransform data
Definition: trpage_scene.h:195
Read Node Simple Scenegraph node used for read testing {group:Demonstration Scene Graph}...
Definition: trpage_scene.h:59
bool inRange(double minv, double maxv, double val) const
Definition: trpage_scene.h:51
trpgGeometry * GetData(void)
Definition: trpage_scene.h:96
#define TRPG_LOD
{secret}
Definition: trpage_io.h:217
trpgModelRef data
Definition: trpage_scene.h:206
trpgMBR mbr
Definition: trpage_scene.h:83
#define TRPG_GEOMETRY
{secret}
Definition: trpage_io.h:226
trpgReadTileHeader tileHead
Definition: trpage_scene.h:240
bool valid
Definition: trpage_scene.h:52
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
Read ChildRef Should point to a block tile {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:144
trpgReadTransform(void)
Definition: trpage_scene.h:191
virtual ~trpgSceneGraphParser(void)
Definition: trpage_scene.h:225
~trpgReadTransform(void)
Definition: trpage_scene.h:192
trpgMBR GetMBR(void) const
Definition: trpage_scene.h:112
trpgLayer data
Definition: trpage_scene.h:184
trpgReadModelRef(void)
Definition: trpage_scene.h:202
TX_CPPDECL bool trpgTestArchive(trpgr_Archive &)
{group:Demonstration Scene Graph}
trpgReadNode * GetChild(int i)
Definition: trpage_scene.h:78
Read Group Base Base class for all group nodes {group:Demonstration Scene Graph}. ...
Definition: trpage_scene.h:72
trpgReadNode * currTop
Definition: trpage_scene.h:237
Read Geometry The leaf for this scene graph {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:91
#define TRPG_LAYER
{secret}
Definition: trpage_io.h:223
trpgLod * GetData(void)
Definition: trpage_scene.h:171
trpgTileHeader * GetData(void)
Definition: trpage_scene.h:111
{group:Demonstration Scene Graph}
Definition: trpage_scene.h:217
Definition: trpage_geom.h:2476
trpgReadAttach(void)
Definition: trpage_scene.h:134
trpgReadGeometry(void)
Definition: trpage_scene.h:93
trpgGeometry data
Definition: trpage_scene.h:100
std::map< int, trpgReadGroupBase *, std::less< int > > GroupMap
Definition: trpage_scene.h:222
trpgReadNode * top
Current parent group.
Definition: trpage_scene.h:238
Definition: trpage_geom.h:2340
Definition: trpage_io.h:265
#define TX_CPPDECL
Exports a C++ function properly in a windows DLL.
Definition: trdll.h:71
Definition: trpage_read.h:185
virtual trpgMBR GetMBR(void) const
Definition: trpage_scene.h:64
Definition: trpage_geom.h:2533
Definition: trpage_geom.h:2626
trpgReadGroup(void)
Definition: trpage_scene.h:122
~trpgReadTileHeader(void)
Definition: trpage_scene.h:109
Definition: trpage_geom.h:2441
trpgAttach data
Definition: trpage_scene.h:138
trpgMBR mbr
Definition: trpage_scene.h:99
~trpgMBR(void)
Definition: trpage_scene.h:37
virtual ~trpgReadNode(void)
Definition: trpage_scene.h:61
#define TRPG_CHILDREF
{secret}
Definition: trpage_io.h:252
#define TRPG_TRANSFORM
{secret}
Definition: trpage_io.h:219
Read LOD {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:167
Definition: trpage_geom.h:2722
trpgTransform * GetData(void)
Definition: trpage_scene.h:193
trpgModelRef * GetData(void)
Definition: trpage_scene.h:204
~trpgReadLayer(void)
Definition: trpage_scene.h:181
trpgReadLod(void)
Definition: trpage_scene.h:169
~trpgReadChildRef(void)
Definition: trpage_scene.h:147
~trpgReadAttach(void)
Definition: trpage_scene.h:135
trpgLod data
Definition: trpage_scene.h:173
Read Transform {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:189
trpgBillboard data
Definition: trpage_scene.h:162
trpgGroup data
Definition: trpage_scene.h:126
trpgLayer * GetData(void)
Definition: trpage_scene.h:182
Definition: trpage_geom.h:1898
virtual bool EndChildren(void *)
Definition: trpage_read.h:267
Read Model Reference {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:200
~trpgReadBillboard(void)
Definition: trpage_scene.h:159
bool isGroupType(void)
Definition: trpage_scene.h:110
trpgChildRef data
Definition: trpage_scene.h:151
#define TX_EXDECL
Goes before &quot;class&quot; to handle DLL export in windows.
Definition: trdll.h:69
Read billboard {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:156
#define TRPGTILEHEADER
{secret}
Definition: trpage_io.h:143
trpg3dPoint ur
Definition: trpage_scene.h:53
#define TRPG_BILLBOARD
{secret}
Definition: trpage_io.h:215
Definition: trpage_io.h:452
Read Layer {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:178
~trpgReadGeometry(void)
Definition: trpage_scene.h:94
trpgReadChildRef(void)
Definition: trpage_scene.h:146
virtual bool StartChildren(void *)
Start defining children for the given object.
Definition: trpage_read.h:266
~trpgReadModelRef(void)
Definition: trpage_scene.h:203
std::vector< trpgReadNode * > children
Definition: trpage_scene.h:85
trpgChildRef * GetData(void)
Definition: trpage_scene.h:149
Read Group Simple group structure {group:Demonstration Scene Graph}.
Definition: trpage_scene.h:120
#define TRPG_ATTACH
{secret}
Definition: trpage_io.h:249
{secret}
Definition: trpage_scene.h:34
Definition: trpage_io.h:285
int type
Definition: trpage_scene.h:66
~trpgReadLod(void)
Definition: trpage_scene.h:170
bool isGroupType(void)
Definition: trpage_scene.h:148
trpgReadLayer(void)
Definition: trpage_scene.h:180
Definition: trpage_geom.h:2700
int GetNumChildren(void)
Definition: trpage_scene.h:77

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)