summaryrefslogtreecommitdiff
path: root/src/core/shader.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-07-18 03:43:19 +0800
committerchai <chaifix@163.com>2020-07-18 03:43:19 +0800
commit4deff343b5fd928ae9475eedcf9b6add34b31ae2 (patch)
treed9108f5fedc9f0dd57bf964763edc508983c80c5 /src/core/shader.h
parent4984946caf0397a13da7605bc1ee406ea7354628 (diff)
-uniform collection
Diffstat (limited to 'src/core/shader.h')
-rw-r--r--src/core/shader.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/shader.h b/src/core/shader.h
index 043ba1e..be3819f 100644
--- a/src/core/shader.h
+++ b/src/core/shader.h
@@ -24,13 +24,15 @@ typedef struct {
void* userdata;
} UniformCollection;
-#define UTEX(i) (uniforms->var_tex[i])
-#define UM4(i) (&uniforms->var_mat4[i])
-#define UV2(i) (&uniforms->var_vec2[i])
-#define UV3(i) (&uniforms->var_vec3[i])
-#define UV4(i) (&uniforms->var_vec4[i])
-#define UN(i) (&uniforms->var_num[i])
-#define UU (uniforms->userdata)
+extern UniformCollection* g_uniforms;
+
+#define UTEX(i) (g_uniforms->var_tex[i])
+#define UM4(i) (&g_uniforms->var_mat4[i])
+#define UV2(i) (&g_uniforms->var_vec2[i])
+#define UV3(i) (&g_uniforms->var_vec3[i])
+#define UV4(i) (&g_uniforms->var_vec4[i])
+#define UN(i) (&g_uniforms->var_num[i])
+#define UU (g_uniforms->userdata)
#define REG_TOTAL 32
#define REG_NUM_COUNT 4
@@ -42,7 +44,7 @@ typedef struct {
// Vertex* vertex;
//} Vertex;
-typedef void(*VertexShader)(UniformCollection* uniforms, Vertex* in, Vec4* homocoord);
+typedef void(*VertexShader)(Vertex* in, Vec4* homocoord);
typedef struct {
float num[REG_NUM_COUNT];
@@ -51,7 +53,7 @@ typedef struct {
Vec4 v4[REG_V4_COUNT];
} FragmentShaderIn;
-typedef bool(*FragmentShader)(UniformCollection* uniforms, Color32* color);
+typedef bool(*FragmentShader)(Color32* color);
typedef struct {
VertexShader vertexshader;