refactor separate framework from game code, add demo3d
This commit is contained in:
parent
19ae869769
commit
40f5cdcaa5
92 changed files with 2665 additions and 6547 deletions
55
demo3d/client/world/demo3d_chunk_cache.h
Normal file
55
demo3d/client/world/demo3d_chunk_cache.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include "pxl8_mesh.h"
|
||||
#include "demo3d_protocol.h"
|
||||
#include "pxl8_types.h"
|
||||
#include "demo3d_chunk.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEMO3D_CHUNK_CACHE_SIZE 512
|
||||
#define DEMO3D_CHUNK_MAX_FRAGMENTS 255
|
||||
#define DEMO3D_CHUNK_MAX_DATA_SIZE 131072
|
||||
|
||||
typedef struct demo3d_chunk_cache_entry {
|
||||
demo3d_chunk* chunk;
|
||||
u64 last_used;
|
||||
bool valid;
|
||||
} demo3d_chunk_cache_entry;
|
||||
|
||||
typedef struct demo3d_chunk_assembly {
|
||||
u32 id;
|
||||
i32 cx, cy, cz;
|
||||
u32 version;
|
||||
u8 fragment_count;
|
||||
u8 fragments_received;
|
||||
u8* data;
|
||||
u32 data_size;
|
||||
u32 data_capacity;
|
||||
bool active;
|
||||
bool complete;
|
||||
} demo3d_chunk_assembly;
|
||||
|
||||
typedef struct demo3d_chunk_cache {
|
||||
demo3d_chunk_cache_entry entries[DEMO3D_CHUNK_CACHE_SIZE];
|
||||
demo3d_chunk_assembly assembly;
|
||||
u32 entry_count;
|
||||
u64 frame_counter;
|
||||
} demo3d_chunk_cache;
|
||||
|
||||
demo3d_chunk_cache* demo3d_chunk_cache_create(void);
|
||||
void demo3d_chunk_cache_destroy(demo3d_chunk_cache* cache);
|
||||
|
||||
pxl8_result demo3d_chunk_cache_receive(demo3d_chunk_cache* cache,
|
||||
const demo3d_chunk_msg_header* hdr,
|
||||
const u8* payload, usize len);
|
||||
|
||||
demo3d_chunk* demo3d_chunk_cache_get_bsp(demo3d_chunk_cache* cache, u32 id);
|
||||
|
||||
void demo3d_chunk_cache_tick(demo3d_chunk_cache* cache);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue