Shader material ECS example
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "display/texture/texture.h"
|
||||
|
||||
typedef struct shadergl_s shadergl_t;
|
||||
typedef union shadermaterial_u shadermaterial_t;
|
||||
|
||||
typedef errorret_t (*shadersettexturefn_t)(
|
||||
shadergl_t *,
|
||||
@@ -17,7 +18,22 @@ typedef errorret_t (*shadersettexturefn_t)(
|
||||
texture_t *
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
errorret_t (*setMaterial)(shadergl_t *, const shadermaterial_t *);
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
void *nothing;
|
||||
#else
|
||||
errorret_t (*setTexture)(shadergl_t *, const char_t *, texture_t *);
|
||||
|
||||
const char_t *vert;
|
||||
const char_t *frag;
|
||||
#endif
|
||||
} shaderdefinitiongl_t;
|
||||
|
||||
typedef struct shadergl_s {
|
||||
const shaderdefinitiongl_t *definition;
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
@@ -26,21 +42,9 @@ typedef struct shadergl_s {
|
||||
GLuint shaderProgramId;
|
||||
GLuint vertexShaderId;
|
||||
GLuint fragmentShaderId;
|
||||
shadersettexturefn_t setTexture;
|
||||
#endif
|
||||
} shadergl_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
void *nothing;
|
||||
#else
|
||||
const char_t *vert;
|
||||
const char_t *frag;
|
||||
shadersettexturefn_t setTexture;
|
||||
#endif
|
||||
} shaderdefinitiongl_t;
|
||||
|
||||
#if DUSK_OPENGL_LEGACY
|
||||
typedef struct {
|
||||
shadergl_t *boundShader;
|
||||
@@ -121,11 +125,11 @@ errorret_t shaderSetTextureGL(
|
||||
* @param color The color data to set.
|
||||
* @return An errorret_t indicating success or failure.
|
||||
*/
|
||||
// errorret_t shaderSetColorGL(
|
||||
// shadergl_t *shader,
|
||||
// const char_t *name,
|
||||
// color_t color
|
||||
// );
|
||||
errorret_t shaderSetColorGL(
|
||||
shadergl_t *shader,
|
||||
const char_t *name,
|
||||
color_t color
|
||||
);
|
||||
|
||||
/**
|
||||
* Disposes of a shader, freeing any associated resources.
|
||||
|
||||
Reference in New Issue
Block a user