1
/***************************************************************************
2
OgrePagingLandScapePage.h - description
4
begin : Sat Mar 08 2003
5
copyright : (C) 2003-2006 by Jose A. Milan and Tuan Kuranes
6
email : spoke2@supercable.es && tuan.kuranes@free.fr
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU Lesser General Public License as *
13
* published by the Free Software Foundation; either version 2 of the *
14
* License, or (at your option) any later version. *
16
***************************************************************************/
18
#ifndef PAGINGLandScapePAGE_H
19
#define PAGINGLandScapePAGE_H
21
#include "OgrePagingLandScapePrerequisites.h"
27
class _OgrePagingLandScapeExport PagingLandScapePage
30
/** Sets the appropriate neighbor for this TerrainRenderable. Neighbors are necessary
31
to know when to bridge between LODs.
33
void _setNeighbor(const Neighbor& n, PagingLandScapePage* p);
35
/** Returns the page's scene node
37
SceneNode* getPageNode() const { return mPageNode; }
39
/** Returns the neighbor TerrainRenderable.
41
PagingLandScapePage* _getNeighbor(const Neighbor& n) const
43
return mNeighbors[ n ];
46
PagingLandScapeTile* getTile(const unsigned int i , const unsigned int j) const;
48
PagingLandScapeTile* getTile(const Vector3& pos);
49
PagingLandScapePage(PagingLandScapePageManager *pageMgr);
51
virtual ~PagingLandScapePage(void);
53
/** Whole Map changes */
54
void init(const unsigned int tableX, const unsigned int tableZ);
56
/** Release the page, but keep it reusable if Whole Map changes */
59
/** Pre-loads the LandScape data using parameters int he given in the constructor. */
62
/** Loads the LandScape tiles using parameters int he given in the constructor. */
65
/** Unloads the LandScape data, then reloads it */
68
/** Loads the LandScape texture using parameters int he given in the constructor. */
69
void loadTexture(void);
71
/** Unloads the LandScape texture, but doesn't destroy the LandScape data. */
72
void unloadTexture(void);
74
/** Unloads the LandScape data, but doesn't destroy the LandScape page. */
77
/** Post Unloads the LandScape data, but doesn't destroy the LandScape page. */
78
void postUnload(void);
80
void unsetLoading(void)
85
void unsetPreLoading(void)
87
mIsPreLoading = false;
90
void unsetTextureLoading(void)
92
mIsTextureLoading = false;
95
void unsetUnloading(void)
100
void unsetPostUnloading(void)
102
mIsPostUnloading = false;
105
void unsetTextureunloading(void)
107
mIsTextureunloading = false;
110
const bool isLoaded(void) const
115
const bool isPreLoaded(void) const
120
const bool isTextureLoaded(void) const
122
return mIsTextureLoaded;
125
const bool isLoadable(void) const
130
const bool unloadUntouched(void);
133
bool isVisible(void) const
138
/** Returns if the camera is over this LandScape page.
140
int isCameraIn(const Vector3& pos) const;
142
bool _Notify(const Vector3 &pos, const PagingLandScapeCamera * const Cam);
143
void _Show(const bool do_show);
145
void getCoordinates(unsigned int& X, unsigned int& Z) const
154
bool mIsTextureLoading;
158
bool mIsPostUnloading;
159
bool mIsTextureunloading;
161
/** Sets the render queue group which the tiles should be rendered in. */
162
void setRenderQueue(uint8 qid);
164
void _updateLod(void);
166
void setMapMaterial(void);
168
inline bool isCoord(const unsigned int x, const unsigned int z){return (mTableZ == z && mTableX == x);};
170
SceneNode *getSceneNode(){return mPageNode;};
171
const AxisAlignedBox &getWorldBbox() const {return mBounds;};
172
const Vector3 &getCenter(void) const {return mWorldPosition;};
174
void updateTerrain();
177
SceneNode* mPageNode;
179
PagingLandScapeTiles mTiles;
183
bool mIsTextureLoaded;
185
// if data needed for this page doesn't exists
189
// ensure page is not flickering due to shadow passes
190
// as it unload instantly
191
// but loading is queued
192
// if not page not showed until mVisibletouch==0 it becomes invisible
193
//size_t mVisibletouch;
195
// Position of this Terrain Page in the Terrain Page Array
196
unsigned int mTableX;
197
unsigned int mTableZ;
199
unsigned int mNumTiles;
201
Real mIniX; //, mEndX; // Max and Min values of the terrain
202
Real mIniZ; //, mEndZ;
204
PagingLandScapePage* mNeighbors[4];
206
// Change Zone values
207
AxisAlignedBox mBounds;
208
AxisAlignedBox mBoundsInt;
209
AxisAlignedBox mBoundsExt;
210
Vector3 mWorldPosition;
212
PagingLandScapePageRenderable* mRenderable;
214
unsigned int mTimeUntouched;
217
PageQueuingState pageQueingState;
218
PagingLandScapePageManager *mParent;