diff options
author | chai <chaifix@163.com> | 2019-12-23 23:59:02 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-12-23 23:59:02 +0800 |
commit | d49f3d3f73709a9a7c0bce53aa13ed28a2bd27cb (patch) | |
tree | 3fc2cca442106a56fc151c5faffbb24217ca83f5 /src/shaders/common.h | |
parent | ec111247c614663d8231245a17c314b9b8b4a28c (diff) |
*misc
Diffstat (limited to 'src/shaders/common.h')
-rw-r--r-- | src/shaders/common.h | 21 |
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 |