refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "pxl8_math.h"
|
|
|
|
|
#include "pxl8_types.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define PXL8_MESH_MAX_VERTICES 65536
|
|
|
|
|
#define PXL8_MESH_MAX_INDICES 65536
|
|
|
|
|
|
|
|
|
|
typedef enum pxl8_blend_mode {
|
|
|
|
|
PXL8_BLEND_OPAQUE = 0,
|
|
|
|
|
PXL8_BLEND_ALPHA_TEST,
|
|
|
|
|
PXL8_BLEND_ALPHA,
|
|
|
|
|
PXL8_BLEND_ADDITIVE,
|
|
|
|
|
} pxl8_blend_mode;
|
|
|
|
|
|
2026-01-21 23:19:50 -06:00
|
|
|
typedef struct pxl8_gfx_material {
|
|
|
|
|
char name[16];
|
|
|
|
|
pxl8_vec3 u_axis;
|
|
|
|
|
pxl8_vec3 v_axis;
|
|
|
|
|
f32 u_offset;
|
|
|
|
|
f32 v_offset;
|
|
|
|
|
|
refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
u32 texture_id;
|
2026-01-21 23:19:50 -06:00
|
|
|
u32 lightmap_id;
|
refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
u8 alpha;
|
|
|
|
|
u8 blend_mode;
|
|
|
|
|
bool dither;
|
|
|
|
|
bool double_sided;
|
|
|
|
|
bool dynamic_lighting;
|
2026-02-02 17:48:25 -06:00
|
|
|
bool emissive;
|
refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
bool per_pixel;
|
2026-01-21 23:19:50 -06:00
|
|
|
} pxl8_gfx_material;
|
refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
|
|
|
|
|
typedef struct pxl8_vertex {
|
|
|
|
|
pxl8_vec3 position;
|
|
|
|
|
pxl8_vec3 normal;
|
|
|
|
|
f32 u, v;
|
2026-01-21 23:19:50 -06:00
|
|
|
f32 lu, lv;
|
refactor: reorganize pxl8 into client/src/ module structure
- core/: main entry, types, logging, I/O, RNG
- asset/: ase loader, cart, save, embed
- gfx/: graphics, animation, atlas, fonts, tilemap, transitions
- sfx/: audio
- script/: lua/fennel runtime, REPL
- hal/: platform abstraction (SDL3)
- world/: BSP, world, procedural gen
- math/: math utilities
- game/: GUI, replay
- lua/: Lua API modules
2026-01-12 21:46:31 -06:00
|
|
|
u8 color;
|
|
|
|
|
u8 light;
|
|
|
|
|
u8 _pad[2];
|
|
|
|
|
} pxl8_vertex;
|
|
|
|
|
|
|
|
|
|
typedef struct pxl8_mesh {
|
|
|
|
|
pxl8_vertex* vertices;
|
|
|
|
|
u16* indices;
|
|
|
|
|
u32 vertex_count;
|
|
|
|
|
u32 index_count;
|
|
|
|
|
u32 vertex_capacity;
|
|
|
|
|
u32 index_capacity;
|
|
|
|
|
} pxl8_mesh;
|
|
|
|
|
|
|
|
|
|
pxl8_mesh* pxl8_mesh_create(u32 vertex_capacity, u32 index_capacity);
|
|
|
|
|
void pxl8_mesh_destroy(pxl8_mesh* mesh);
|
|
|
|
|
void pxl8_mesh_clear(pxl8_mesh* mesh);
|
|
|
|
|
|
|
|
|
|
u16 pxl8_mesh_push_vertex(pxl8_mesh* mesh, pxl8_vertex v);
|
|
|
|
|
void pxl8_mesh_push_triangle(pxl8_mesh* mesh, u16 i0, u16 i1, u16 i2);
|
|
|
|
|
void pxl8_mesh_push_quad(pxl8_mesh* mesh, u16 i0, u16 i1, u16 i2, u16 i3);
|
|
|
|
|
|
|
|
|
|
void pxl8_mesh_push_box(pxl8_mesh* mesh, pxl8_vec3 center, pxl8_vec3 half_extents, u8 color);
|
|
|
|
|
void pxl8_mesh_push_box_uv(pxl8_mesh* mesh, pxl8_vec3 center, pxl8_vec3 half_extents, u8 color, f32 u_scale, f32 v_scale);
|
|
|
|
|
|
|
|
|
|
static inline u32 pxl8_mesh_triangle_count(const pxl8_mesh* mesh) {
|
|
|
|
|
return mesh->index_count / 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|