/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "tile.h" void tileRender( chunk_t *chunk, tileid_t id, tiledef_t *tileDef, int32_t i, int32_t x, int32_t y, int32_t z, int32_t verticeStart, int32_t indiceStart ) { tilesetdiv_t *div = (MAP_STATE.tileset->divisions + id); quadBuffer(chunk->primitive, z, x, y, div->x0, div->y0, x+1, y+1, div->x1, div->y1, verticeStart, indiceStart ); } tilegetresult_t tileGet(int32_t x, int32_t y, int32_t z) { tilegetresult_t result; // First, determine the chunk that I belong to. result.chunkX = x / CHUNK_WIDTH; result.chunkY = y / CHUNK_HEIGHT; result.chunkZ = z / CHUNK_DEPTH; // And determine the local coordinates result.localX = mathMod(x, CHUNK_WIDTH); result.localY = mathMod(y, CHUNK_HEIGHT); result.localZ = mathMod(z, CHUNK_DEPTH); return result; }