rtengine/src/runtime/gfx.h
Kevin Trogant 81798df3e9 ref, feat: Restructure
- The renderer backend is now its own library, loaded at runtime.
- Removed GLFW dependency, instead use win32 directly.
- Broke linux window creation, because it's not implemented yet.
  - Maybe use GLFW for linux?
2023-10-17 00:54:51 +02:00

61 lines
1.5 KiB
C

#ifndef VY_GFX_H
#define VY_GFX_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 <stdint.h>
#include <stdbool.h>
#include "runtime.h"
/* In renderer_api.h -> Not necessary for almost all gfx usage */
typedef struct vy_renderer_init_info_s vy_renderer_init_info;
VY_DLLEXPORT bool vyInitGFX(vy_renderer_init_info *renderer_info);
VY_DLLEXPORT void vyShutdownGFX(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