pxl8/src/gfx/pxl8_shader.h

74 lines
1.3 KiB
C
Raw Normal View History

2026-02-02 17:48:25 -06:00
#pragma once
#include "pxl8_lights.h"
#include "pxl8_math.h"
#include "pxl8_types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pxl8_vertex_in {
pxl8_vec3 a_position;
pxl8_vec3 a_normal;
pxl8_vec2 a_uv;
u8 a_color;
u8 a_light;
} pxl8_vertex_in;
typedef struct pxl8_vertex_out {
pxl8_vec4 gl_Position;
pxl8_vec2 v_uv;
pxl8_vec3 v_world;
pxl8_vec3 v_normal;
f32 v_light;
f32 v_depth;
} pxl8_vertex_out;
typedef struct pxl8_shader_uniforms {
u8 ambient;
bool baked_lighting;
pxl8_vec3 celestial_dir;
f32 celestial_intensity;
bool dither;
bool dynamic_lighting;
bool emissive;
u8 fog_color;
f32 fog_density;
const pxl8_light* lights;
u32 lights_count;
bool textures;
f32 time;
bool wireframe;
} pxl8_shader_uniforms;
typedef struct pxl8_shader_bindings {
const u8* colormap;
const u32* palette;
const u8* texture;
u32 tex_width;
u32 tex_height;
} pxl8_shader_bindings;
typedef struct pxl8_shader_ctx {
i32 x, y;
pxl8_vec2 v_uv;
pxl8_vec3 v_world;
pxl8_vec3 v_normal;
f32 v_color;
f32 v_light;
f32 v_depth;
const pxl8_shader_bindings* bindings;
const pxl8_shader_uniforms* uniforms;
u32 out_light_color;
} pxl8_shader_ctx;
typedef u8 (*pxl8_shader_fn)(pxl8_shader_ctx* ctx);
#ifdef __cplusplus
}
#endif