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
This commit is contained in:
parent
272e0bc615
commit
39b604b333
106 changed files with 6078 additions and 3715 deletions
94
client/src/gfx/pxl8_cpu.h
Normal file
94
client/src/gfx/pxl8_cpu.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#pragma once
|
||||
|
||||
#include "pxl8_atlas.h"
|
||||
#include "pxl8_colormap.h"
|
||||
#include "pxl8_math.h"
|
||||
#include "pxl8_mesh.h"
|
||||
#include "pxl8_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct pxl8_cpu_backend pxl8_cpu_backend;
|
||||
typedef struct pxl8_cpu_render_target pxl8_cpu_render_target;
|
||||
|
||||
typedef struct pxl8_cpu_render_target_desc {
|
||||
u32 width;
|
||||
u32 height;
|
||||
bool with_depth;
|
||||
bool with_lighting;
|
||||
} pxl8_cpu_render_target_desc;
|
||||
|
||||
typedef struct pxl8_3d_frame {
|
||||
u8 ambient_light;
|
||||
pxl8_vec3 camera_dir;
|
||||
pxl8_vec3 camera_pos;
|
||||
f32 far_clip;
|
||||
u8 fog_color;
|
||||
f32 fog_density;
|
||||
f32 near_clip;
|
||||
pxl8_mat4 projection;
|
||||
f32 time;
|
||||
pxl8_mat4 view;
|
||||
} pxl8_3d_frame;
|
||||
|
||||
pxl8_cpu_backend* pxl8_cpu_create(u32 width, u32 height);
|
||||
void pxl8_cpu_destroy(pxl8_cpu_backend* cpu);
|
||||
|
||||
void pxl8_cpu_begin_frame(pxl8_cpu_backend* cpu, const pxl8_3d_frame* frame);
|
||||
void pxl8_cpu_end_frame(pxl8_cpu_backend* cpu);
|
||||
|
||||
void pxl8_cpu_clear(pxl8_cpu_backend* cpu, u8 color);
|
||||
void pxl8_cpu_clear_depth(pxl8_cpu_backend* cpu);
|
||||
|
||||
void pxl8_cpu_set_colormap(pxl8_cpu_backend* cpu, const pxl8_colormap* cm);
|
||||
void pxl8_cpu_set_palette(pxl8_cpu_backend* cpu, const u32* palette);
|
||||
|
||||
void pxl8_cpu_draw_pixel(pxl8_cpu_backend* cpu, i32 x, i32 y, u8 color);
|
||||
u8 pxl8_cpu_get_pixel(pxl8_cpu_backend* cpu, i32 x, i32 y);
|
||||
void pxl8_cpu_draw_line_2d(pxl8_cpu_backend* cpu, i32 x0, i32 y0, i32 x1, i32 y1, u8 color);
|
||||
void pxl8_cpu_draw_rect(pxl8_cpu_backend* cpu, i32 x, i32 y, i32 w, i32 h, u8 color);
|
||||
void pxl8_cpu_draw_rect_fill(pxl8_cpu_backend* cpu, i32 x, i32 y, i32 w, i32 h, u8 color);
|
||||
void pxl8_cpu_draw_circle(pxl8_cpu_backend* cpu, i32 cx, i32 cy, i32 radius, u8 color);
|
||||
void pxl8_cpu_draw_circle_fill(pxl8_cpu_backend* cpu, i32 cx, i32 cy, i32 radius, u8 color);
|
||||
void pxl8_cpu_draw_line_3d(pxl8_cpu_backend* cpu, pxl8_vec3 v0, pxl8_vec3 v1, u8 color);
|
||||
|
||||
void pxl8_cpu_draw_mesh(
|
||||
pxl8_cpu_backend* cpu,
|
||||
const pxl8_mesh* mesh,
|
||||
pxl8_mat4 model,
|
||||
pxl8_material material,
|
||||
const pxl8_atlas* textures
|
||||
);
|
||||
|
||||
void pxl8_cpu_draw_mesh_wireframe(
|
||||
pxl8_cpu_backend* cpu,
|
||||
const pxl8_mesh* mesh,
|
||||
pxl8_mat4 model,
|
||||
u8 color
|
||||
);
|
||||
|
||||
u8* pxl8_cpu_get_framebuffer(pxl8_cpu_backend* cpu);
|
||||
u32 pxl8_cpu_get_height(const pxl8_cpu_backend* cpu);
|
||||
u32 pxl8_cpu_get_width(const pxl8_cpu_backend* cpu);
|
||||
|
||||
pxl8_cpu_render_target* pxl8_cpu_create_render_target(const pxl8_cpu_render_target_desc* desc);
|
||||
void pxl8_cpu_destroy_render_target(pxl8_cpu_render_target* target);
|
||||
|
||||
pxl8_cpu_render_target* pxl8_cpu_get_target(pxl8_cpu_backend* cpu);
|
||||
void pxl8_cpu_set_target(pxl8_cpu_backend* cpu, pxl8_cpu_render_target* target);
|
||||
|
||||
void pxl8_cpu_blit(pxl8_cpu_backend* cpu, pxl8_cpu_render_target* src, i32 x, i32 y, u8 transparent_idx);
|
||||
|
||||
bool pxl8_cpu_push_target(pxl8_cpu_backend* cpu);
|
||||
void pxl8_cpu_pop_target(pxl8_cpu_backend* cpu);
|
||||
u32 pxl8_cpu_get_target_depth(const pxl8_cpu_backend* cpu);
|
||||
|
||||
u8* pxl8_cpu_render_target_get_framebuffer(pxl8_cpu_render_target* target);
|
||||
u32 pxl8_cpu_render_target_get_height(const pxl8_cpu_render_target* target);
|
||||
u32 pxl8_cpu_render_target_get_width(const pxl8_cpu_render_target* target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue