38 lines
951 B
C
38 lines
951 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "rpg/world/tile.h"
|
|
#include "worldpos.h"
|
|
#include "display/mesh/quad.h"
|
|
|
|
typedef struct chunk_s {
|
|
chunkpos_t position;
|
|
tile_t tiles[CHUNK_TILE_COUNT];
|
|
|
|
uint8_t meshCount;
|
|
meshvertex_t vertices[CHUNK_VERTEX_COUNT_MAX];
|
|
mesh_t meshes[CHUNK_MESH_COUNT_MAX];
|
|
uint8_t entities[CHUNK_ENTITY_COUNT_MAX];
|
|
} chunk_t;
|
|
|
|
/**
|
|
* Gets the tile index for a tile position within a chunk.
|
|
*
|
|
* @param position The position within the chunk.
|
|
* @return The tile index within the chunk.
|
|
*/
|
|
uint32_t chunkGetTileIndex(const chunkpos_t position);
|
|
|
|
/**
|
|
* Checks if two chunk positions are equal.
|
|
*
|
|
* @param a The first chunk position.
|
|
* @param b The second chunk position.
|
|
* @return true if equal, false otherwise.
|
|
*/
|
|
bool_t chunkPositionIsEqual(const chunkpos_t a, const chunkpos_t b); |