Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Ogre::TerrainLodManager Class Reference

Terrain LOD data manager. More...

#include <OgreTerrainLodManager.h>

Inheritance diagram for Ogre::TerrainLodManager:
Inheritance graph
[legend]

Classes

struct  LoadLodRequest
 
struct  LodInfo
 

Public Types

typedef vector< float >::type LodData
 
typedef vector< LodData >::type LodsData
 

Public Member Functions

 TerrainLodManager (Terrain *t, const String &filename="")
 
 TerrainLodManager (Terrain *t, DataStreamPtr &stream)
 
virtual ~TerrainLodManager ()
 
virtual bool canHandleRequest (const WorkQueue::Request *req, const WorkQueue *srcQ)
 Return whether this handler can process a given request.
 
virtual bool canHandleResponse (const WorkQueue::Response *res, const WorkQueue *srcQ)
 Return whether this handler can process a given response.
 
void fillBufferAtLod (uint lodLevel, const float *data, uint dataSize)
 Copy geometry data from buffer to mHeightData/mDeltaData.
 
int getHighestLodLoaded ()
 
int getHighestLodPrepared ()
 
LodInfogetLodInfo (uint lodLevel)
 
int getTargetLodLevel ()
 
virtual WorkQueue::ResponsehandleRequest (const WorkQueue::Request *req, const WorkQueue *srcQ)
 The handler method every subclass must implement.
 
virtual void handleResponse (const WorkQueue::Response *res, const WorkQueue *srcQ)
 The handler method every subclass must implement.
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
voidoperator new (size_t sz, void *ptr)
 placement operator new
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
void readLodData (uint16 lowerLodBound, uint16 higherLodBound)
 Read separated geometry data from file into allocated memory.
 
void updateToLodLevel (int lodLevel, bool synchronous=false)
 
void waitForDerivedProcesses ()
 

Static Public Member Functions

static void saveLodData (StreamSerialiser &stream, Terrain *terrain)
 Save each LOD level separately compressed so seek is possible.
 

Static Public Attributes

static const uint32 TERRAINLODDATA_CHUNK_ID
 
static const uint16 TERRAINLODDATA_CHUNK_VERSION
 
static const uint16 WORKQUEUE_LOAD_LOD_DATA_REQUEST
 

Private Member Functions

void buildLodInfoTable ()
 
void init ()
 

Static Private Member Functions

static void separateData (float *data, uint16 size, uint16 numLodLevels, LodsData &lods)
 Separate geometry data by LOD level.
 

Private Attributes

DataStreamPtr mDataStream
 
int mHighestLodLoaded
 Highest LOD level stored in memory i.e. mHeightData/mDeltaData.
 
int mHighestLodPrepared
 Which LOD level is demanded.
 
bool mIncreaseLodLevelInProgress
 Highest LOD level loaded in GPU.
 
bool mLastRequestSynchronous
 Is increaseLodLevel() running?
 
LodInfomLodInfoTable
 
size_t mStreamOffset
 
int mTargetLodLevel
 
TerrainmTerrain
 
uint16 mWorkQueueChannel
 

Detailed Description

Terrain LOD data manager.

This class is used for managing terrain LOD data's loading, unloading.

Definition at line 52 of file OgreTerrainLodManager.h.

Member Typedef Documentation

◆ LodData

Definition at line 57 of file OgreTerrainLodManager.h.

◆ LodsData

Definition at line 58 of file OgreTerrainLodManager.h.

Constructor & Destructor Documentation

◆ TerrainLodManager() [1/2]

Ogre::TerrainLodManager::TerrainLodManager ( Terrain t,
DataStreamPtr stream 
)

◆ TerrainLodManager() [2/2]

Ogre::TerrainLodManager::TerrainLodManager ( Terrain t,
const String filename = "" 
)

◆ ~TerrainLodManager()

virtual Ogre::TerrainLodManager::~TerrainLodManager ( )
virtual

Member Function Documentation

◆ buildLodInfoTable()

void Ogre::TerrainLodManager::buildLodInfoTable ( )
private

◆ canHandleRequest()

virtual bool Ogre::TerrainLodManager::canHandleRequest ( const WorkQueue::Request req,
const WorkQueue srcQ 
)
virtual

Return whether this handler can process a given request.

Remarks
Defaults to true, but if you wish to add several handlers each of which deal with different types of request, you can override this method.

Reimplemented from Ogre::WorkQueue::RequestHandler.

◆ canHandleResponse()

virtual bool Ogre::TerrainLodManager::canHandleResponse ( const WorkQueue::Response res,
const WorkQueue srcQ 
)
virtual

Return whether this handler can process a given response.

Remarks
Defaults to true, but if you wish to add several handlers each of which deal with different types of response, you can override this method.

Reimplemented from Ogre::WorkQueue::ResponseHandler.

◆ fillBufferAtLod()

void Ogre::TerrainLodManager::fillBufferAtLod ( uint  lodLevel,
const float data,
uint  dataSize 
)

Copy geometry data from buffer to mHeightData/mDeltaData.

Parameters
lodLevelA LOD level to work with
dataBuffer which holds geometry data if separated form
Remarks
Data in buffer has to be both height and delta data. First half is height data. Seconds half is delta data.

◆ getHighestLodLoaded()

int Ogre::TerrainLodManager::getHighestLodLoaded ( )

Definition at line 117 of file OgreTerrainLodManager.h.

Referenced by Ogre::Terrain::getHighestLodLoaded().

◆ getHighestLodPrepared()

int Ogre::TerrainLodManager::getHighestLodPrepared ( )

Definition at line 116 of file OgreTerrainLodManager.h.

Referenced by Ogre::Terrain::getHighestLodPrepared().

◆ getLodInfo()

LodInfo & Ogre::TerrainLodManager::getLodInfo ( uint  lodLevel)

Definition at line 120 of file OgreTerrainLodManager.h.

◆ getTargetLodLevel()

int Ogre::TerrainLodManager::getTargetLodLevel ( )

Definition at line 118 of file OgreTerrainLodManager.h.

Referenced by Ogre::Terrain::getTargetLodLevel().

◆ handleRequest()

virtual WorkQueue::Response * Ogre::TerrainLodManager::handleRequest ( const WorkQueue::Request req,
const WorkQueue srcQ 
)
virtual

The handler method every subclass must implement.

If a failure is encountered, return a Response with a failure result rather than raise an exception.

Parameters
reqThe Request structure, which is effectively owned by the handler during this call. It must be attached to the returned Response regardless of success or failure.
srcQThe work queue that this request originated from
Returns
Pointer to a Response object - the caller is responsible for deleting the object.

Implements Ogre::WorkQueue::RequestHandler.

◆ handleResponse()

virtual void Ogre::TerrainLodManager::handleResponse ( const WorkQueue::Response res,
const WorkQueue srcQ 
)
virtual

The handler method every subclass must implement.

Parameters
resThe Response structure. The caller is responsible for deleting this after the call is made, none of the data contained (except pointers to structures in user Any data) will persist after this call is returned.
srcQThe work queue that this request originated from

Implements Ogre::WorkQueue::ResponseHandler.

◆ init()

void Ogre::TerrainLodManager::init ( )
private

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr)
inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
const char ,
int  ,
const char  
)
inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
void  
)
inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr)
inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr,
const char ,
int  ,
const char  
)
inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

◆ operator new() [1/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

◆ operator new() [2/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char file,
int  line,
const char func 
)
inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

◆ operator new() [3/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void ptr 
)
inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [1/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

◆ operator new[]() [2/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char file,
int  line,
const char func 
)
inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

◆ readLodData()

void Ogre::TerrainLodManager::readLodData ( uint16  lowerLodBound,
uint16  higherLodBound 
)

Read separated geometry data from file into allocated memory.

Parameters
lowerLodBoundLower bound of LOD levels to load
higherLodBoundUpper bound of LOD levels to load
Remarks
Geometry data are uncompressed using inflate() and stored into allocated buffer

◆ saveLodData()

static void Ogre::TerrainLodManager::saveLodData ( StreamSerialiser stream,
Terrain terrain 
)
static

Save each LOD level separately compressed so seek is possible.

◆ separateData()

static void Ogre::TerrainLodManager::separateData ( float data,
uint16  size,
uint16  numLodLevels,
LodsData lods 
)
staticprivate

Separate geometry data by LOD level.

Parameters
dataA geometry data to separate i.e. mHeightData/mDeltaData
sizeDimension of the input data
numLodLevelsNumber of LOD levels in the input data
lodsThe separated LOD data
Remarks
Allocates new array and fills it with geometry data coupled by LOD level from lowest LOD level to highest. Example: before separation: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 after separation: 2: 00 04 20 24 1: 02 10 12 14 22 0: 01 03 05 06 07 08 09 11 13 15 16 17 18 19 21 23

◆ updateToLodLevel()

void Ogre::TerrainLodManager::updateToLodLevel ( int  lodLevel,
bool  synchronous = false 
)

◆ waitForDerivedProcesses()

void Ogre::TerrainLodManager::waitForDerivedProcesses ( )

Member Data Documentation

◆ mDataStream

DataStreamPtr Ogre::TerrainLodManager::mDataStream
private

Definition at line 150 of file OgreTerrainLodManager.h.

◆ mHighestLodLoaded

int Ogre::TerrainLodManager::mHighestLodLoaded
private

Highest LOD level stored in memory i.e. mHeightData/mDeltaData.

Definition at line 157 of file OgreTerrainLodManager.h.

◆ mHighestLodPrepared

int Ogre::TerrainLodManager::mHighestLodPrepared
private

Which LOD level is demanded.

Definition at line 156 of file OgreTerrainLodManager.h.

◆ mIncreaseLodLevelInProgress

bool Ogre::TerrainLodManager::mIncreaseLodLevelInProgress
private

Highest LOD level loaded in GPU.

Definition at line 159 of file OgreTerrainLodManager.h.

◆ mLastRequestSynchronous

bool Ogre::TerrainLodManager::mLastRequestSynchronous
private

Is increaseLodLevel() running?

Definition at line 160 of file OgreTerrainLodManager.h.

◆ mLodInfoTable

LodInfo* Ogre::TerrainLodManager::mLodInfoTable
private

Definition at line 154 of file OgreTerrainLodManager.h.

◆ mStreamOffset

size_t Ogre::TerrainLodManager::mStreamOffset
private

Definition at line 151 of file OgreTerrainLodManager.h.

◆ mTargetLodLevel

int Ogre::TerrainLodManager::mTargetLodLevel
private

Definition at line 155 of file OgreTerrainLodManager.h.

◆ mTerrain

Terrain* Ogre::TerrainLodManager::mTerrain
private

Definition at line 149 of file OgreTerrainLodManager.h.

◆ mWorkQueueChannel

uint16 Ogre::TerrainLodManager::mWorkQueueChannel
private

Definition at line 152 of file OgreTerrainLodManager.h.

◆ TERRAINLODDATA_CHUNK_ID

const uint32 Ogre::TerrainLodManager::TERRAINLODDATA_CHUNK_ID
static

Definition at line 55 of file OgreTerrainLodManager.h.

◆ TERRAINLODDATA_CHUNK_VERSION

const uint16 Ogre::TerrainLodManager::TERRAINLODDATA_CHUNK_VERSION
static

Definition at line 56 of file OgreTerrainLodManager.h.

◆ WORKQUEUE_LOAD_LOD_DATA_REQUEST

const uint16 Ogre::TerrainLodManager::WORKQUEUE_LOAD_LOD_DATA_REQUEST
static

Definition at line 90 of file OgreTerrainLodManager.h.


The documentation for this class was generated from the following file:

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.