#ifndef TWN_DEFERRED_COMMANDS_H #define TWN_DEFERRED_COMMANDS_H #include "twn_types.h" #include "twn_gpu_texture_c.h" #include "twn_textures_c.h" #include #include typedef enum { PIPELINE_NO, PIPELINE_SPACE, PIPELINE_2D, /* TODO: rename to PIPELINE_PLANE? */ } Pipeline; typedef struct { size_t offset; uint32_t type; uint32_t stride; uint32_t buffer; uint8_t arity; /* leave at 0 to signal pointer as unused */ } AttributeArrayPointer; /* allows us to have generic way to issue draws as well as */ /* deferring new draw calls while previous frame is still being drawn */ typedef struct { AttributeArrayPointer vertices; AttributeArrayPointer texcoords; union { AttributeArrayPointer colors; Color color; }; 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; bool constant_colored; bool textured, texture_repeat, uses_gpu_key; } DeferredCommandDraw; typedef struct { char *paths; } DeferredCommandDrawSkybox; typedef struct { Color color; bool clear_color; bool clear_depth; bool clear_stencil; } DeferredCommandClear; typedef struct { enum DeferredCommandType { DEFERRED_COMMAND_TYPE_DRAW, DEFERRED_COMMAND_TYPE_DRAW_SKYBOX, DEFERRED_COMMAND_TYPE_CLEAR, } type; union { DeferredCommandDraw draw; DeferredCommandDrawSkybox draw_skybox; DeferredCommandClear clear; }; } DeferredCommand; extern DeferredCommand *deferred_commands; #endif