big rendering overhaul (cleaning and api abstraction)

This commit is contained in:
veclavtalica
2025-01-14 23:20:54 +03:00
parent b7cb37c06a
commit 5059802d09
25 changed files with 290 additions and 424 deletions

View File

@ -12,7 +12,7 @@
typedef enum {
PIPELINE_NO,
PIPELINE_SPACE,
PIPELINE_2D,
PIPELINE_2D, /* TODO: rename to PIPELINE_PLANE? */
} Pipeline;
@ -30,25 +30,27 @@ typedef struct {
typedef struct {
AttributeArrayPointer vertices;
AttributeArrayPointer texcoords;
bool constant_colored;
union {
AttributeArrayPointer colors;
AttributeArrayPointer colors;
Color color;
};
bool textured, texture_repeat, uses_gpu_key;
double depth_range_low, depth_range_high;
Pipeline pipeline;
TextureMode texture_mode;
TextureKey texture_key;
GPUTexture gpu_texture;
/* could be either `element_count` with supplied `element_buffer`, or this, but not both */
uint32_t primitive_count;
uint32_t element_buffer;
uint32_t element_count;
uint32_t range_start, range_end;
/* could be either `element_count` with supplied `element_buffer`, or this, but not both */
uint32_t primitive_count;
double depth_range_low, depth_range_high;
bool constant_colored;
bool textured, texture_repeat, uses_gpu_key;
} DeferredCommandDraw;
@ -65,47 +67,17 @@ typedef struct {
} DeferredCommandClear;
typedef struct {
Pipeline pipeline;
} DeferredCommandUsePipeline;
typedef struct {
TextureMode mode;
} DeferredCommandUseTextureMode;
typedef struct {
double low, high;
} DeferredCommandDepthRange;
typedef struct {
float start, end, density;
Color color;
} DeferredCommandApplyFog;
typedef struct {
enum DeferredCommandType {
DEFERRED_COMMAND_TYPE_DRAW,
DEFERRED_COMMAND_TYPE_DRAW_SKYBOX,
DEFERRED_COMMAND_TYPE_CLEAR,
DEFERRED_COMMAND_TYPE_USE_PIPIELINE,
DEFERRED_COMMAND_TYPE_USE_TEXTURE_MODE,
DEFERRED_COMMAND_TYPE_DEPTH_RANGE,
DEFERRED_COMMAND_TYPE_APPLY_FOG,
DEFERRED_COMMAND_TYPE_POP_FOG,
} type;
union {
DeferredCommandDraw draw;
DeferredCommandDrawSkybox draw_skybox;
DeferredCommandClear clear;
DeferredCommandUsePipeline use_pipeline;
DeferredCommandUseTextureMode use_texture_mode;
DeferredCommandDepthRange depth_range;
DeferredCommandApplyFog apply_fog;
};
} DeferredCommand;