89 lines
2.1 KiB
C
89 lines
2.1 KiB
C
#ifndef RT_GFX_H
|
|
#define RT_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 "runtime/runtime.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
#elif defined(_MSC_VER)
|
|
#pragma warning(push)
|
|
#pragma warning(disable : 4201) /* anonymous struct */
|
|
#endif
|
|
typedef union {
|
|
float v[4];
|
|
struct {
|
|
float r;
|
|
float g;
|
|
float b;
|
|
float a;
|
|
};
|
|
} rt_color;
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#pragma GCC diagnostic pop
|
|
#elif defined(_MSC_VER)
|
|
#pragma warning(pop)
|
|
#endif
|
|
|
|
/* NOTE(kevin): When you add a value here, you need to handle them in
|
|
* framegraph_processor.c : ParseFramegraph
|
|
* and in the render target and texture functions of all renderers. */
|
|
|
|
typedef enum {
|
|
RT_PIXEL_FORMAT_INVALID,
|
|
|
|
RT_PIXEL_FORMAT_R8G8B8A8_UNORM,
|
|
RT_PIXEL_FORMAT_B8G8R8A8_UNORM,
|
|
RT_PIXEL_FORMAT_R8G8B8A8_SRGB,
|
|
RT_PIXEL_FORMAT_B8G8R8A8_SRGB,
|
|
RT_PIXEL_FORMAT_R8G8B8_UNORM,
|
|
RT_PIXEL_FORMAT_B8G8R8_UNORM,
|
|
RT_PIXEL_FORMAT_R8G8B8_SRGB,
|
|
RT_PIXEL_FORMAT_B8G8R8_SRGB,
|
|
|
|
RT_PIXEL_FORMAT_DEPTH24_STENCIL8,
|
|
RT_PIXEL_FORMAT_DEPTH32,
|
|
|
|
/* Special value indicating whichever format the swapchain uses */
|
|
RT_PIXEL_FORMAT_SWAPCHAIN,
|
|
|
|
RT_PIXEL_FORMAT_count,
|
|
} rt_pixel_format;
|
|
|
|
RT_INLINE int rtIsDepthFormat(rt_pixel_format format) {
|
|
return format == RT_PIXEL_FORMAT_DEPTH24_STENCIL8 || format == RT_PIXEL_FORMAT_DEPTH32;
|
|
}
|
|
|
|
/* In renderer_api.h -> Not necessary for almost all gfx usage */
|
|
typedef struct rt_renderer_init_info_s rt_renderer_init_info;
|
|
|
|
RT_DLLEXPORT void rtRegisterRendererCVars(void);
|
|
|
|
RT_DLLEXPORT rt_result rtInitGFX(rt_renderer_init_info *renderer_info);
|
|
|
|
RT_DLLEXPORT void rtShutdownGFX(void);
|
|
|
|
RT_DLLEXPORT void rtBeginGFXFrame(unsigned int frame_id);
|
|
|
|
RT_DLLEXPORT void rtEndGFXFrame(unsigned int frame_id);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|