diff options
author | chai <chaifix@163.com> | 2020-07-12 13:31:28 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-07-12 13:31:28 +0800 |
commit | a0439c8d387579a1727ad00c2e105e7602aedbb6 (patch) | |
tree | 8ea09b13e179a7d8cd9ac6518410cd10035f48f4 /src/shaders/common.c | |
parent | ec7aa42781a9108901fbde7210d8285bbbeaf5fc (diff) |
+mathlib
Diffstat (limited to 'src/shaders/common.c')
-rw-r--r-- | src/shaders/common.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/shaders/common.c b/src/shaders/common.c deleted file mode 100644 index 333b433..0000000 --- a/src/shaders/common.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "common.h" - -Vec4 _proj_params; -Vec2 _time; -Vec4 _screen_params; - -Vec3 unpacknormal(Color32 c32) { - Vec3 normal = { - c32.r * 2 - 1, - c32.g * 2 - 1, - c32.b * 2 - 1, - }; - return normal; -} - -Mat4 mat4(Vec4* c1, Vec4* c2, Vec4* c3, Vec4* c4); - -Mat3 mat3(Vec3* c1, Vec3* c2, Vec3* c3) { - Mat3 m = { - c1->x,c1->y,c1->z, - c2->x,c2->y,c2->z, - c3->x,c3->y,c3->z, - }; - return m; -} - -Vec2 texsize(Texture* texture) { - Vec2 size = {texture->width, texture->height}; - return size; -} - -float linear01depth(float depth) { - float n = _proj_params.x, f = _proj_params.y; - return n / ((n-f)*depth + f); -} - -float lineareyedepth(float depth) { - return _proj_params.y * linear01depth(depth); -}
\ No newline at end of file |