81 lines
1.4 KiB
C
81 lines
1.4 KiB
C
#ifndef RENDER_H
|
|
#define RENDER_H
|
|
|
|
#include <core.h>
|
|
|
|
typedef enum {
|
|
R_ENTITY_STATIC,
|
|
R_ENTITY_ANIMATED,
|
|
R_ENTITY_INSTANCED // Particles, foliage, etc.
|
|
} REntityType_e;
|
|
|
|
typedef struct {
|
|
REntityType_e type;
|
|
uint32_t modelId;
|
|
Matrix transform;
|
|
|
|
union {
|
|
struct {
|
|
int activeAnim;
|
|
float time;
|
|
} anim;
|
|
struct {
|
|
Matrix *transforms;
|
|
int instanceCount;
|
|
} instancing;
|
|
} data;
|
|
} RenderEntity;
|
|
|
|
typedef struct {
|
|
RenderEntity *entities;
|
|
int count;
|
|
int capacity;//may use frame allocator instead to not have dynamic capacity
|
|
} Scene;
|
|
|
|
typedef struct {
|
|
Model *models;
|
|
int count;
|
|
} ModelRegistry;
|
|
|
|
typedef struct {
|
|
ModelAnimation *animations;
|
|
int count;
|
|
} AnimationRegistry;
|
|
|
|
typedef struct {
|
|
Texture *tex;
|
|
int count;
|
|
} TextureRegistry;
|
|
|
|
typedef struct {
|
|
Font *font;
|
|
int count;
|
|
} FontRegistry;
|
|
|
|
typedef struct {
|
|
Shader gbuffer;
|
|
Shader deferred;
|
|
Shader filter;
|
|
} ShaderRD;
|
|
|
|
typedef struct {
|
|
unsigned int framebufferId;
|
|
unsigned int normal_tex_id;
|
|
unsigned int albedoSpec_tex_id;
|
|
unsigned int depth_tex_id;
|
|
} GBuffer;
|
|
|
|
typedef struct {
|
|
uint16_t height;
|
|
uint16_t width;
|
|
void* window;
|
|
//RenderTexture rendtex;
|
|
GBuffer gbuffer;
|
|
Camera3D camera3d;
|
|
Camera2D camera2d;
|
|
ShaderRD shader;
|
|
bool hud_on, debug_on;
|
|
} RenderCtx;
|
|
|
|
#endif
|