My Project
|
it contains all the necessary dynamic information to render the terrain for the current frame. More...
#include <TerrainBuffer.h>
Public Member Functions | |
VertexBufferDevicePtr_type | GetVertexBufferDevicePtr () |
void | DeleteDeviceObjects () |
called internally by the terrain object | |
void | RebuildBuffer () |
rebuild the terrain buffer from last tessellation data of the terrain object. More... | |
bool | HasData () |
return true if the buffer contains valid data for rendering | |
void | BuildGeoMipmapBuffer () |
int | GetChunkVertexOffset (int x, int y) |
Public Attributes | |
Terrain * | m_pTerrain |
the terrain object for which this buffer is built | |
Matrix4 | matModelview |
current camera model view matrix | |
ParaVertexBuffer | m_pVertexBuffer |
the dynamic vertex buffer which hold a triangle vertex array | |
int | m_nBufferSize |
number of reserved triangles in buffer | |
int | m_nNumOfTriangles |
total number of vertices | |
TextureGroups_Type | m_textureGroups |
groups of object ordered by texture | |
it contains all the necessary dynamic information to render the terrain for the current frame.
terrain buffer is only rebuilt when the model view matrix has changed, otherwise the old terrain buffer is used for rendering the terrain. E.g. The buffer contains triangle groups sorted by textures. either low-res and high-res textures are specified.
void TerrainBuffer::RebuildBuffer | ( | ) |
rebuild the terrain buffer from last tessellation data of the terrain object.
this is the most time consuming task compared with tessellation and repair crack
these data are mainly triangle fans and strips.
add get the total number of triangles for each texture group
set the start triangle index of each texture group
recreate buffer, if the old buffer is too small.
reuse the old buffer