PathEngine home previous: iPathEngine::buildMeshAroundObstructionBoundaries()next: iPathEngine::buildMeshByCopyingConnectedGround()
Contents, API Reference, Interfaces, iPathEngine, buildMeshAroundTiledObstructions

iPathEngine::buildMeshAroundTiledObstructions()

Description

A helper method for building ground mesh around a set of tiled obstructions.

Syntax

std::unique_ptr<iMesh> buildMeshAroundTiledObstructions(char const * data_Buffer, uint32_t data_BufferEntries, int32_t tilesInX, int32_t tilesInY, int32_t originX, int32_t originY, int32_t tileSize, const char *const* options)

Parameters

data_Buffer, data_BufferEntries (See Passing Arrays.) The data buffer to build from.
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.
An 'addDiagonals' attribute may be supplied as 'true' to turn on a diagonal adding filter for the reduction of jaggies resulting from the terrain obstructions grid.
Otherwise, refer to this page for information about the set of attributes relating to mesh construction in general.

Return Value

If there are unobstructed tiles in the tiling passed in, a new iMesh object constructed based on this tiling.
If there are no unobstructed tiles, and the resulting ground mesh would be empty, a null pointer is returned.

Remarks

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 Working with Terrain.)

C# Mapping

Mesh buildMeshAroundTiledObstructions(byte[] data, int tilesInX, int tilesInY, int originX, int originY, int tileSize, string[] options);

Java Mapping

Mesh buildMeshAroundTiledObstructions(byte[] data, int tilesInX, int tilesInY, int originX, int originY, int tileSize, String[] options);

Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: iPathEngine::buildMeshByCopyingConnectedGround()