summaryrefslogtreecommitdiff
path: root/src/shaders/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shaders/common.h')
-rw-r--r--src/shaders/common.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/shaders/common.h b/src/shaders/common.h
index 8b74bec..cae9309 100644
--- a/src/shaders/common.h
+++ b/src/shaders/common.h
@@ -1,13 +1,14 @@
#ifndef _SOFTSHADEROOM_COMMON_HEADER_H_
#define _SOFTSHADEROOM_COMMON_HEADER_H_
+/*
+** Common shader header
+*/
#include "../core/shader.h"
extern void ssrR_putline(int x0, int y0, int x1, int y1, Color color);
-/*
-** shader built in functions
-*/
+/*shader built in functions*/
Vec3 normal_from_color(Color32 c32);
Mat4 mat4(Vec4* c1, Vec4* c2, Vec4* c3, Vec4* c4);
@@ -26,4 +27,18 @@ static Vec4 p; p.xyz = in->vertex->position; p.w = 1; \
mat4_mulvec4(uniforms->mvp, &p, clipcoord); \
}while(0)
+#define _model_matrix (uniforms->model)
+#define _view_matrix (uniforms->view)
+#define _proj_matrix (uniforms->projection)
+#define _mvp_matrix (uniforms->mvp)
+#define _inverse_model_matrix (uniforms->inverse_model)
+
+#define object2clip(pos, out) mat4_mulvec4(_mvp_matrix, pos, out);
+
+/*need defined _it_model_matrix of model matrix, i-nverse, t-ranspose*/
+#define object2world_normal(normal, out) \
+mat4_mulvec4(_it_model_matrix, normal, out)
+
+
+
#endif \ No newline at end of file