📄 ogrepaginglandscapepage.h
字号:
/***************************************************************************
OgrePagingLandScapePage.h - description
-------------------
begin : Sat Mar 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 PAGINGLANDSCAPEPAGE_H
#define PAGINGLANDSCAPEPAGE_H
#include <vector>
#include "OgrePagingLandScapePageData2D.h"
#include "OgrePagingLandScapeOptions.h"
#include "OgrePagingLandScapeTile.h"
namespace Ogre
{
class Image;
typedef std::vector < PagingLandScapeTile * > PagingLandScapeTileRow;
typedef std::vector < PagingLandScapeTileRow > PagingLandScapeTiles;
#define PAGE_INSIDE 0x00000001
#define PAGE_CHANGE 0x00000002
#define PAGE_OUTSIDE 0x00000004
class PagingLandScapePage
{
public:
PagingLandScapePage( int startx, int startz );
virtual ~PagingLandScapePage( );
/** Loads the landscape using parameters int he given in the constructor. */
void load( SceneNode &PagingLandScapeRootNode );
/** Unloads the landscape data, but doesn磘 destroy the landscape page. */
void unload( );
bool isLoaded();
/** Preloads the landscape using parameters int he given in the constructor. */
void preload( );
/** Post Unloads the landscape data, but doesn磘 destroy the landscape page. */
void postUnload( );
bool isPreLoaded( );
/** Returns if the camera is over this landscape page.
*/
int isCameraIn( const Vector3 & pos );
int _getHeight( int x, int z )
{
return mData->getHeight( x, z );
};
Real _getWorldHeight( int x, int z )
{
return mData->getHeight( ( abs(x) - abs(mIniX) ) / mOptions->scale.x, ( abs(z) - abs(mIniZ) ) / mOptions->scale.z ) * mOptions->scale.y;
};
// JEFF
/** Get the real world height at a particular position within the page
@remarks
Method is used to get the terrain height at a position based on x and z that is local to the page.
This method just figures out what tile the position is on and then asks the tile 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 position relative to page and in page scale
@param z z position relative to page and in page scale
*/
float getRealWorldHeight(float x, float z);
/// Gets all the patches within an AABB in world coords as GeometryData structs
virtual void getPagingLandScapeRenderOpsInBox(const AxisAlignedBox& box, std::list<RenderOperation>& opList);
/** The Renderable data.
Not to be used directly
*/
PagingLandScapeTiles mTiles;
PagingLandScapePage *getNeighbor( int e ) { return mNeighbors[ e ]; };
void setNeighbor( int e, PagingLandScapePage *page ){ mNeighbors[ e ] = page; };
void _notify( const Vector3 & pos, const bool needOptionsUpdate );
protected:
PagingLandScapeOptions *mOptions;
Material *mLandScapeMaterial;
SceneNode *mPageNode;
PagingLandScapePage *mNeighbors[ 4 ];
bool mIsLoaded;
bool mIsPreLoaded;
PagingLandScapePageData2D* mData;
int mX; // Position of this Terrain Page in the Terrain Page Array
int mZ;
float mIniX;//, mEndX; // Max and Min values of the terrain
float mIniZ;//, mEndZ;
// Change Zone values
AxisAlignedBox mBoundsExt;
AxisAlignedBox mBoundsInt;
};
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -