ChunkTriangleBufferGenerator Class Reference [Old Atlas Editor Code]

#include <atlasOldMesher.h>

List of all members.


Detailed Description

This is a utility class to generate an optimized triangle buffer for the Atlas terrain collision engine.

It is fed the size of the grid, then the list of triangles for each bin.

Then it performs a processing step. This step consists of sorting the binlists from longest to shortest, performing an insert on each one. The insert first does a search in the buffer to see if the list already exists (each list is sorted to maximize matches), then adds to the end of the buffer if not, storing the resulting offset in either case.

Ends of binlists are marked by 0xFFFF.

Finally, it writes the results to disk (the offsets and the buffer).


Public Member Functions

 ChunkTriangleBufferGenerator (U32 gridSize)
void clear ()
 Reset the generator.
void insertBinList (Point2I bin, Vector< U16 > &binList)
 Add a list to the buffer.
bool write (Stream *s)

Private Attributes

U32 mGridSize
Vector< U16mTriangles
 The triangle buffer.
Vector< U16mBinOffsets
 Stores the start of each bin's data.


Constructor & Destructor Documentation

ChunkTriangleBufferGenerator::ChunkTriangleBufferGenerator ( U32  gridSize  )  [inline]


Member Function Documentation

void ChunkTriangleBufferGenerator::clear (  )  [inline]

Reset the generator.

void ChunkTriangleBufferGenerator::insertBinList ( Point2I  bin,
Vector< U16 > &  binList 
) [inline]

Add a list to the buffer.

bool ChunkTriangleBufferGenerator::write ( Stream s  )  [inline]


Member Data Documentation

The triangle buffer.

This encodes lists of triangles contained in each bin.

Stores the start of each bin's data.