📄 ogrepaginglandscapetile.h
字号:
/***************************************************************************
OgrePagingLandScapeTile.h - description
-------------------
begin : Sun Jun 08 2003
copyright : (C) 2003 by Jose A. Milan
email : spoke2@supercable.es
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
#ifndef PAGINGLANDSCAPETILE_H
#define PAGINGLANDSCAPETILE_H
#include <OgreMovableObject.h>
#include <OgreSceneNode.h>
#include "OgrePagingLandScapePageData2D.h"
#include "OgrePagingLandScapeRenderable.h"
namespace Ogre
{
class PagingLandScapeTile /*: public MovableObject*/
{
public:
enum eNeighbor
{
EAST = 0,
WEST = 1,
NORTH = 2,
SOUTH = 3
};
PagingLandScapeTile( void );
~PagingLandScapeTile( void );
void init( SceneNode &PageNode, PagingLandScapePageData2D *Data, Material *material, float PosX, float PosZ, float offSetX, float offSetZ, int Nivel );
void release( void );
void updateCache( void );
// JEFF - just a trial: does Tile have to derive from MoveableObject since it doesn't really use it?
//movable object methods
/** Returns the name of the PagingLandScapeRenderable
*/
//virtual const String& getName( void ) const { return mName; };
/** Returns the type of the movable.
*/
//virtual const String& getMovableType( void ) const { return mType; };
/** Returns the bounding box of this LandScapeRenderable
*/
const AxisAlignedBox& getBoundingBox( void ) const { return mBounds; };
/** Updates the level of detail to be used for rendering this PagingLandScapeRenderable based on the passed in Camera
*/
//virtual void _notifyCurrentCamera( Camera* cam );
//virtual void _notifyAttached(Node* parent);
//virtual void _updateRenderQueue( RenderQueue* queue );
/** Overridden from MovableObject */
//Real getBoundingRadius(void) const { return 0; /* not needed */ };
//void getWorldTransforms( Matrix4* xform ) const;
//const Quaternion& getWorldOrientation(void) const;
//const Vector3& getWorldPosition(void) const;
void Split( void );
void Merge( void );
PagingLandScapeTile *getNeighbor( eNeighbor e );
void setNeighbor( eNeighbor e, PagingLandScapeTile *tile );
void _update( void );
bool isDivided( void );
bool canUnload( void );
void startDemorph( void );
/// Gets all the patches within an AABB in world coords as GeometryData structs
virtual void getPagingLandScapeRenderOpsInBox(const AxisAlignedBox& box, std::list<RenderOperation>& opList);
PagingLandScapeTile *mTile[ 4 ];
PagingLandScapeRenderable *mRenderable;
void _notify( const Vector3 & pos, const bool needOptionsUpdate );
// JEFF
/** Get the real world height at a particular position within the Tile
@remarks
Method is used to get the terrain height at a position based on x and z that is local to the Tile.
This method figures out what subtile the position is on if the tile is split and then asks the subtile node
to do the dirty work of getting the height. Again passing the buck.
@par
the float returned is the real world height based on the scale of the world. If the height could
not be determined then -1 is returned and this would only occur if the page was not preloaded or loaded
@param x x world position
@param z z world position
*/
float getRealWorldHeight(const float x, const float z);
// bool needForce( void );
protected:
//movable object variables
String mName;
//static String mType;
AxisAlignedBox mBounds;
int mNivel;
bool mIsDivided;
bool mInit;
bool mIsQueued;
PagingLandScapeTile *mNeighbors[ 4 ];
PagingLandScapePageData2D *mData;
Material *mMaterial;
SceneNode *mTileSceneNode;
Vector3 mCenter;
float mSize;
float mError;
// bool mNeedForce;
Vector3 mDiff;
float mX; // Position of this Terrain Tile in the Terrain Page Array
float mZ;
float mPosX; // Offset of this Terrain Tile in this Terrain Page
float mPosZ;
float endx;
float endz;
inline float _Max( float a, float b )
{
return ( ( a > b ) ? a : b );
};
};
} //namespace
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -