45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "maptile.h"
|
|
#include "worldpos.h"
|
|
#include "display/mesh/quad.h"
|
|
|
|
typedef struct chunk_s {
|
|
chunkpos_t position;
|
|
maptile_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];
|
|
} mapchunk_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 mapChunkGetTileindex(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 mapChunkPositionIsEqual(const chunkpos_t a, const chunkpos_t b);
|
|
|
|
/**
|
|
* Renders the given map chunk.
|
|
*
|
|
* @param chunk The map chunk to render.
|
|
*/
|
|
void mapChunkRender(const mapchunk_t *chunk); |