L3DT documentation
Large 3D terrain generator



Retrieve the raw memory pointer to the data block of a mosaic tile.


Declaration Zeolite.h
Implementation Zeolite.cpp

Function prototype

void* zmap_tile_GetDataPtr(void* hTile);


Name Type Comment
hTile void* A handle to a mosaic tile, as retrieved by the zmap_GetMosaicTile function.

Return value

A null pointer if:

  • The tile handle is invalid.
  • The tile has not been locked for use via zmap_tile_SetLock (this is automatic when loading/saving tiles).

A valid non-null pointer otherwise.


Pixel ordering

Pixels are ordered in rows going east-to-west, with rows ordered south to north. To convert from x/y coordinate to memory offset, use the following formula:

long offset = (x + TileSize * y) * PixelMemSize;

…where PixelMemSize is the size in memory of one pixel (see zmap_GetPixelSize).

To convert from memory offsets to pixel coordinates, use the following formulae:

long x = (offset/PixelMemSize)%TileSize;
long y = (offset/PixelMemSize)/TileSize;

Use zmap_tile_GetPixel / zmap_tile_SetPixel where possible

It is recommended that, wherever possible, the zmap_tile_GetPixel /zmap_tile_SetPixel functions are used for accessing tile data, instead of direct memory access with zmap_tile_GetDataPtr. Those functions include coordinate checking and memory protection, as well has handling mip-mapping and mosaic tile cache loading/saving automatically.

zeolite/functions/zmap_tile_getdataptr.txt · Last modified: 2017/08/31 07:11 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki