| PathEngine home | previous: | next: |
A helper method for building ground mesh around a set of tiled obstructions.
iMesh* buildMeshAroundTiledObstructions(const char* dataBuffer, tUnsigned32 bufferSize, tSigned32 tilesInX, tSigned32 tilesInY, tSigned32 originX, tSigned32 originY, tSigned32 tileSize, const char *const* options); |
| dataBuffer | A byte buffer. This buffer is not retained after the call and can subsequently be safely deleted. | ||
| bufferSize | The size of the buffer pointed to by dataBuffer, in bytes. | ||
| tilesInX | The number of tiles across the tiled obstruction set, in the X direction. This value must be greater than or equal to 1 | ||
| tilesInY | The number of tiles across the tiled obstruction set, in the Y direction. This value must be greater than or equal to 1 | ||
| originX | The X coordinate value corresponding to the start of the tiled obstructions data. | ||
| originY | The T coordinate value corresponding to the start of the tiled obstructions data. | ||
| tileSize | The size of the tiling. This value must be greater than or equal to 1. | ||
| options |
A set of named attributes to control exactly how the mesh result is created.
|
The data buffer is interpreted as a bit sequence, with each byte in the buffer being treated as unsigned and interpreted as a 'little-endian' byte (regardless of actual platform endianness) and supplying 8 bits in the sequence.
So, for example, the following buffer data is interpreted as the bit sequence (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1):
const unsigned char buffer[2] = {0x01, 0x80};
|
The bit sequence is mapped to a 2 dimensional tiling, according to the values passed in for tilesInX and tilesInY, with X increasing from zero first, and then Y increasing from zero after every span of tilesInX. (There is no padding between spans.)
Bits that are turned on, in this sequence, mark tiles that obstruct movement.
The buffer size value passed in must be equal to the number of bytes required to represent the tiling, so this must be equal to (tilesInX * tilesInY + 7) / 8.
Vertex coordinates generated based on the origin and tile size parameters must all be within the range -1500000 to 1500000 inclusive.
The resulting mesh is generated for the unobstructed space in the tiling,
with any non-boundary detail stripped out.
Note that the resultiong mesh has all heights set to zero, and the sectionID face attribute value set to zero,
and this is basically designed for generation of 'terrain stand-in' geometry.
(See
| Documentation for PathEngine release 5.29 - Copyright © 2002-2012 PathEngine | next: |