rtengine/include/gfx.h
2023-10-11 22:23:26 +02:00

57 lines
1.3 KiB
C

#ifndef VY_GFX_H
#define VY_GFX_H
#include <stdint.h>
/* graphics system. this is the interface of the rendering code.
*
* we need (at least) three different renderers:
* - world cell renderer (for world & dungeon environments)
* - character renderer (for animated models)
* - object renderer (for static models)
*/
#include <stdbool.h>
bool vyInitRenderer(void);
void vyShutdownRenderer(void);
/* Generational indices for backend objects */
typedef struct {
uint32_t index;
} vy_gfx_pipeline_id;
#define VY_IS_GFX_ID_VALID(id) ((id).index != 0)
/* Attributes are used to bind buffers (or textures) to symbolic values.
* For example, an attribute might be bound to "CELL_GRID", which would be
* replaced with the (at the time of the invoke) grid buffer of the current
* world cell.
*/
typedef enum {
VY_ATTRIBUTE_VALUE_UNDEFINED,
VY_ATTRIBUTE_VALUE_MATERIAL_ALBEDO,
} vy_attribute_value;
typedef struct {
uint32_t index;
vy_attribute_value value;
} vy_attribute_binding;
typedef struct {
vy_attribute_binding *uniform_bindings;
vy_attribute_binding *storage_bindings;
vy_attribute_binding *texture_bindings;
vy_gfx_pipeline_id pipeline;
unsigned int uniform_binding_count;
unsigned int storage_binding_count;
unsigned int texture_binding_count;
} vy_shader;
#endif