OGRE  1.9.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Ogre::Terrain::DefaultGpuBufferAllocator Class Reference

Standard implementation of a buffer allocator which re-uses buffers. More...

#include <OgreTerrain.h>

Inheritance diagram for Ogre::Terrain::DefaultGpuBufferAllocator:
Inheritance graph
[legend]

Public Member Functions

 DefaultGpuBufferAllocator ()
 
virtual ~DefaultGpuBufferAllocator ()
 
void allocateVertexBuffers (Terrain *forTerrain, size_t numVertices, HardwareVertexBufferSharedPtr &destPos, HardwareVertexBufferSharedPtr &destDelta)
 Allocate (or reuse) vertex buffers for a terrain LOD.
 
void freeAllBuffers ()
 Free any buffers we're holding.
 
void freeVertexBuffers (const HardwareVertexBufferSharedPtr &posbuf, const HardwareVertexBufferSharedPtr &deltabuf)
 Free (or return to the pool) vertex buffers for terrain.
 
HardwareIndexBufferSharedPtr getSharedIndexBuffer (uint16 batchSize, uint16 vdatasize, size_t vertexIncrement, uint16 xoffset, uint16 yoffset, uint16 numSkirtRowsCols, uint16 skirtRowColSkip)
 Get a shared index buffer for a given number of settings.
 
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 warmStart (size_t numInstances, uint16 terrainSize, uint16 maxBatchSize, uint16 minBatchSize)
 'Warm start' the allocator based on needing x instances of terrain with the given configuration.
 

Protected Types

typedef map< uint32, HardwareIndexBufferSharedPtr >::type IBufMap
 
typedef list< HardwareVertexBufferSharedPtr >::type VBufList
 

Protected Member Functions

HardwareVertexBufferSharedPtr getVertexBuffer (VBufList &list, size_t vertexSize, size_t numVertices)
 
uint32 hashIndexBuffer (uint16 batchSize, uint16 vdatasize, size_t vertexIncrement, uint16 xoffset, uint16 yoffset, uint16 numSkirtRowsCols, uint16 skirtRowColSkip)
 

Protected Attributes

VBufList mFreeDeltaBufList
 
VBufList mFreePosBufList
 
IBufMap mSharedIBufMap
 

Detailed Description

Standard implementation of a buffer allocator which re-uses buffers.

Definition at line 572 of file OgreTerrain.h.

Member Typedef Documentation

◆ IBufMap

Definition at line 594 of file OgreTerrain.h.

◆ VBufList

Definition at line 591 of file OgreTerrain.h.

Constructor & Destructor Documentation

◆ DefaultGpuBufferAllocator()

Ogre::Terrain::DefaultGpuBufferAllocator::DefaultGpuBufferAllocator ( )

◆ ~DefaultGpuBufferAllocator()

virtual Ogre::Terrain::DefaultGpuBufferAllocator::~DefaultGpuBufferAllocator ( )
virtual

Member Function Documentation

◆ allocateVertexBuffers()

void Ogre::Terrain::DefaultGpuBufferAllocator::allocateVertexBuffers ( Terrain forTerrain,
size_t  numVertices,
HardwareVertexBufferSharedPtr destPos,
HardwareVertexBufferSharedPtr destDelta 
)
virtual

Allocate (or reuse) vertex buffers for a terrain LOD.

Parameters
numVerticesThe total number of vertices
destPosPointer to a vertex buffer for positions, to be bound
destDeltaPointer to a vertex buffer for deltas, to be bound

Implements Ogre::Terrain::GpuBufferAllocator.

◆ freeAllBuffers()

void Ogre::Terrain::DefaultGpuBufferAllocator::freeAllBuffers ( )
virtual

Free any buffers we're holding.

Implements Ogre::Terrain::GpuBufferAllocator.

◆ freeVertexBuffers()

void Ogre::Terrain::DefaultGpuBufferAllocator::freeVertexBuffers ( const HardwareVertexBufferSharedPtr posbuf,
const HardwareVertexBufferSharedPtr deltabuf 
)
virtual

Free (or return to the pool) vertex buffers for terrain.

Implements Ogre::Terrain::GpuBufferAllocator.

◆ getSharedIndexBuffer()

HardwareIndexBufferSharedPtr Ogre::Terrain::DefaultGpuBufferAllocator::getSharedIndexBuffer ( uint16  batchSize,
uint16  vdatasize,
size_t  vertexIncrement,
uint16  xoffset,
uint16  yoffset,
uint16  numSkirtRowsCols,
uint16  skirtRowColSkip 
)
virtual

Get a shared index buffer for a given number of settings.

Remarks
Since all index structures are the same at the same LOD level and relative position, we can share index buffers. Therefore the buffer returned from this method does not need to be 'freed' like the vertex buffers since it is never owned.
Parameters
batchSizeThe batch size along one edge
vdatasizeThe size of the referenced vertex data along one edge
vertexIncrementThe number of vertices to increment for each new indexed row / column
xoffsetThe x offset from the start of vdatasize, at that resolution
yoffsetThe y offset from the start of vdatasize, at that resolution
numSkirtRowsColsNumber of rows and columns of skirts
skirtRowColSkipThe number of rows / cols to skip in between skirts

Implements Ogre::Terrain::GpuBufferAllocator.

◆ getVertexBuffer()

HardwareVertexBufferSharedPtr Ogre::Terrain::DefaultGpuBufferAllocator::getVertexBuffer ( VBufList list,
size_t  vertexSize,
size_t  numVertices 
)
protected

◆ hashIndexBuffer()

uint32 Ogre::Terrain::DefaultGpuBufferAllocator::hashIndexBuffer ( uint16  batchSize,
uint16  vdatasize,
size_t  vertexIncrement,
uint16  xoffset,
uint16  yoffset,
uint16  numSkirtRowsCols,
uint16  skirtRowColSkip 
)
protected

◆ 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.

◆ warmStart()

void Ogre::Terrain::DefaultGpuBufferAllocator::warmStart ( size_t  numInstances,
uint16  terrainSize,
uint16  maxBatchSize,
uint16  minBatchSize 
)

'Warm start' the allocator based on needing x instances of terrain with the given configuration.

Member Data Documentation

◆ mFreeDeltaBufList

VBufList Ogre::Terrain::DefaultGpuBufferAllocator::mFreeDeltaBufList
protected

Definition at line 593 of file OgreTerrain.h.

◆ mFreePosBufList

VBufList Ogre::Terrain::DefaultGpuBufferAllocator::mFreePosBufList
protected

Definition at line 592 of file OgreTerrain.h.

◆ mSharedIBufMap

IBufMap Ogre::Terrain::DefaultGpuBufferAllocator::mSharedIBufMap
protected

Definition at line 595 of file OgreTerrain.h.


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