This commit is contained in:
2025-11-11 19:52:09 -06:00
parent d39ed1ea5a
commit 7d7a3f30e6
7 changed files with 36 additions and 51 deletions

View File

@@ -73,7 +73,7 @@ static const assettypedef_t ASSET_TYPE_DEFINITIONS[ASSET_TYPE_COUNT] = {
[ASSET_TYPE_MAP] = {
.header = "DMF",
.loadStrategy = ASSET_LOAD_STRAT_ENTIRE,
.dataSize = sizeof(assetmap_t),
.dataSize = sizeof(1),
.entire = assetMapLoad
},

View File

@@ -111,7 +111,6 @@ errorret_t assetChunkLoad(assetcustom_t custom) {
errorThrow("Failed to read chunk model vertex data.");
}
// Init the mesh
mesh_t *mesh = &chunk->meshes[i];
meshInit(

View File

@@ -13,19 +13,7 @@ errorret_t assetMapLoad(void *data, void *output) {
assertNotNull(data, "Data cannot be NULL");
assertNotNull(output, "Output cannot be NULL");
assetmap_t *mapData = (assetmap_t *)data;
assetmap_t *out = (assetmap_t *)output;
memoryCopy(out, mapData, sizeof(assetmap_t));
meshInit(
&out->models[0].mesh,
MESH_PRIMITIVE_TRIANGLES,
out->models[0].vertexCount,
out->models[0].vertices
);
printf("Load asset\n");
assertUnreachable("map not finished");
errorOk();
}

View File

@@ -10,21 +10,6 @@
#include "rpg/world/map.h"
#include "display/mesh/mesh.h"
typedef struct {
uint32_t vertexCount;
meshvertex_t vertices[6 * CHUNK_TILE_COUNT];
mesh_t mesh;
} assetmapmodel_t;
#pragma pack(push, 1)
typedef struct {
uint32_t tileCount;
uint8_t modelCount;
tile_t tiles[CHUNK_TILE_COUNT];
assetmapmodel_t models[1];
} assetmap_t;
#pragma pack(pop)
/**
* Loads a map asset from the given data pointer into the output map structure.
*

View File

@@ -172,7 +172,7 @@ chunkindex_t mapGetChunkIndexAt(const chunkpos_t position) {
chunk_t* mapGetChunk(const uint8_t index) {
if(index >= MAP_CHUNK_COUNT) return NULL;
return &MAP.chunks[index];
return MAP.chunkOrder[index];
}
tile_t mapGetTile(const worldpos_t position) {

View File

@@ -26,7 +26,7 @@ errorret_t sceneMapInit(scenedata_t *data) {
data->sceneMap.camera.projType = CAMERA_PROJECTION_TYPE_PERSPECTIVE_FLIPPED;
data->sceneMap.camera.viewType = CAMERA_VIEW_TYPE_LOOKAT_PIXEL_PERFECT;
glm_vec3_zero(data->sceneMap.camera.lookatPixelPerfect.offset);
data->sceneMap.camera.lookatPixelPerfect.offset[2] = 32.0f;
data->sceneMap.camera.lookatPixelPerfect.offset[1] = TILE_HEIGHT;
glm_vec3_copy(
(vec3){ 0.0f, 0.0f, 0.0f },
data->sceneMap.camera.lookatPixelPerfect.target