11 int nz,
void *block,
int type)
14 int tileX0, tileY0, tileZ0, tileOffsX0, tileOffsY0, tileOffsZ0;
15 int tileX1, tileY1, tileZ1, tileOffsX1, tileOffsY1, tileOffsZ1;
16 int tx, ty, tz, dx, dy, dz, x,
y, z, rows,
cols, depths;
25 &tileOffsX0, &tileOffsY0, &tileOffsZ0);
27 &tileX1, &tileY1, &tileZ1,
28 &tileOffsX1, &tileOffsY1, &tileOffsZ1);
30 for (tz = tileZ0; tz <= tileZ1; tz++) {
31 dz = (tz - tileZ0) * map->tileZ - tileOffsZ0;
32 for (ty = tileY0; ty <= tileY1; ty++) {
33 dy = (ty - tileY0) * map->tileY - tileOffsY0;
34 for (tx = tileX0; tx <= tileX1; tx++) {
35 dx = (tx - tileX0) * map->tileX - tileOffsX0;
44 (
"G3d_getBlockNocache: error in G3d_getTilePtr");
48 (map, tileIndex, tile, map->typeIntern))
50 (
"G3d_getBlockNocache: error in G3d_readTile");
56 cols = (tx == tileX1 ? tileOffsX1 : map->tileX - 1);
57 rows = (ty == tileY1 ? tileOffsY1 : map->tileY - 1);
58 depths = (tz == tileZ1 ? tileOffsZ1 : map->tileZ - 1);
60 x = (tx == tileX0 ? tileOffsX0 : 0);
62 for (z = (tz == tileZ0 ? tileOffsZ0 : 0); z <= depths; z++)
63 for (y = (ty == tileY0 ? tileOffsY0 : 0); y <= rows; y++) {
65 z * map->tileXY + y * map->tileX + x,
68 (z + dz) * nx * ny + (y + dy) * nx +
69 (x + dx), type, cols - x + 1);
103 G3d_getBlock(G3D_Map * map,
int x0,
int y0,
int z0,
int nx,
int ny,
int nz,
104 void *block,
int type)
106 int x,
y, z, nNull, x1, y1, z1, length;
108 if (!map->useCache) {
113 x1 =
G3D_MIN(x0 + nx, map->region.cols);
114 y1 =
G3D_MIN(y0 + ny, map->region.rows);
115 z1 =
G3D_MIN(z0 + nz, map->region.depths);
119 for (z = z0; z < z1; z++) {
120 for (y = y0; y < y1; y++) {
121 for (x = x0; x < x1; x++) {
129 nNull = (y0 + ny -
y) * nx;
133 nNull = (z0 + nz - z) * ny * nx;
void G3d_getValueRegion(G3D_Map *map, int x, int y, int z, void *value, int type)
Returns in *value the cell-value of the cell with region-coordinate (x, y, z). The value returned is ...
void G3d_setNullValue(void *c, int nofElts, int type)
Fills the vector pointed to by c with nofElts NULL-values of type.
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
void G3d_copyValues(const void *src, int offsSrc, int typeSrc, void *dst, int offsDst, int typeDst, int nElts)
void * G3d_getTilePtr(G3D_Map *map, int tileIndex)
This function returns a pointer to a tile which contains the data for the tile with index tileIndex...
void G3d_setNullTile(G3D_Map *map, void *tile)
Is equivalent to G3d_setNullTileType (map, tile, G3d_fileTypeMap (map)).
void * G3d_allocTilesType(G3D_Map *map, int nofTiles, int type)
Allocates a vector of nofTiles tiles with the same dimensions as the tiles of map and large enough to...
int G3d_tileIndexInRange(G3D_Map *map, int tileIndex)
Returns 1 if tileIndex is a valid index for map. Returns 0 otherwise.
void G3d_freeTiles(void *tiles)
Is equivalent to G3d_free (tiles);
void G3d_getBlockNocache(G3D_Map *map, int x0, int y0, int z0, int nx, int ny, int nz, void *block, int type)
void G3d_coord2tileCoord(G3D_Map *map, int x, int y, int z, int *xTile, int *yTile, int *zTile, int *xOffs, int *yOffs, int *zOffs)
Converts cell-coordinates (x, y, z) into tile-coordinates (xTile, yTile, zTile) and the coordinate of...
void G3d_getBlock(G3D_Map *map, int x0, int y0, int z0, int nx, int ny, int nz, void *block, int type)
Copies the cells contained in the block (cube) with vertices (x0, y0, z0) and (x0 + nx - 1...
int G3d_readTile(G3D_Map *map, int tileIndex, void *tile, int type)
Reads tile with index tileIndex into the tile buffer. The cells are stored with type type which must ...
int G3d_tile2tileIndex(G3D_Map *map, int xTile, int yTile, int zTile)
Returns tile-index corresponding to tile-coordinates (xTile, yTile, zTile).
void G3d_fatalError(const char *,...)
This function prints the error message msg, and terminates the program with an error status...