summaryrefslogtreecommitdiff
path: root/src/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/shaders')
-rw-r--r--src/shaders/common/core.c6
-rw-r--r--src/shaders/common/core.h4
-rw-r--r--src/shaders/common/light.h9
-rw-r--r--src/shaders/common/mathlib.c14
-rw-r--r--src/shaders/pbr.c3
5 files changed, 23 insertions, 13 deletions
diff --git a/src/shaders/common/core.c b/src/shaders/common/core.c
index 703458c..ffaa649 100644
--- a/src/shaders/common/core.c
+++ b/src/shaders/common/core.c
@@ -20,11 +20,11 @@ Vec2 texsize(Texture* texture) {
return size;
}
-float linear01depth(float depth) {
+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);
+float linearEyeDepth(float depth) {
+ return _proj_params.y * linear01Depth(depth);
} \ No newline at end of file
diff --git a/src/shaders/common/core.h b/src/shaders/common/core.h
index 623409e..69ff48b 100644
--- a/src/shaders/common/core.h
+++ b/src/shaders/common/core.h
@@ -66,7 +66,7 @@ out_v3->x = color.x * 2 - 1; \
out_v3->y = color.y * 2 - 1; \
out_v3->z = color.z * 2 - 1;
-float linear01depth(float depth);
-float lineareyedepth(float depth);
+float linear01Depth(float depth);
+float linearEyeDepth(float depth);
#endif \ No newline at end of file
diff --git a/src/shaders/common/light.h b/src/shaders/common/light.h
index e69de29..44c54c3 100644
--- a/src/shaders/common/light.h
+++ b/src/shaders/common/light.h
@@ -0,0 +1,9 @@
+#ifndef _LIGHT_H_
+#define _LIGHT_H_
+
+#include "mathlib.h"
+
+
+
+
+#endif
diff --git a/src/shaders/common/mathlib.c b/src/shaders/common/mathlib.c
index 356357c..acac51a 100644
--- a/src/shaders/common/mathlib.c
+++ b/src/shaders/common/mathlib.c
@@ -16,8 +16,8 @@ Vec2 vec2(float x, float y) {
return v;
}
-INTERNAL_FUNCTION(Vec2, vec2_minus);
-INTERNAL_FUNCTION(Vec2, vec2_plus);
+INTERNAL_FUNCTION(Vec2, vec2_minus)
+INTERNAL_FUNCTION(Vec2, vec2_plus)
float vec2_dot(Vec2 v1, Vec2 v2) {
return internal_vec2_dot(&v1, &v2);
@@ -31,9 +31,9 @@ Vec3 vec3(float x, float y, float z) {
return v;
}
-INTERNAL_FUNCTION(Vec3, vec3_minus);
-INTERNAL_FUNCTION(Vec3, vec3_plus);
-INTERNAL_FUNCTION(Vec3, vec3_cross);
+INTERNAL_FUNCTION(Vec3, vec3_minus)
+INTERNAL_FUNCTION(Vec3, vec3_plus)
+INTERNAL_FUNCTION(Vec3, vec3_cross)
float vec3_dot(Vec3 v1, Vec3 v2) {
return internal_vec3_dot(&v1, &v2);
@@ -72,8 +72,8 @@ Vec4 vec4(float x, float y, float z, float w) {
return v;
}
-INTERNAL_FUNCTION(Vec4, vec4_minus);
-INTERNAL_FUNCTION(Vec4, vec4_plus);
+INTERNAL_FUNCTION(Vec4, vec4_minus)
+INTERNAL_FUNCTION(Vec4, vec4_plus)
Vec4 vec4_scale(Vec4 v, float scale) {
Vec4 out;
diff --git a/src/shaders/pbr.c b/src/shaders/pbr.c
index bbf1c2b..b8ee4be 100644
--- a/src/shaders/pbr.c
+++ b/src/shaders/pbr.c
@@ -43,11 +43,12 @@ static bool frag(UniformCollection* uniforms, FragmentShaderIn* in, Vec4* color)
//float rough = 1- internal_vec3_dot(&in->normal, light);
float depth = _clip_pos->x / _clip_pos->y;
depth = (depth + 1) / 2;
- depth = linear01depth(depth);
+ depth = linear01Depth(depth);
Vec4 c = tex2d(_albedo_tex, _texcoord);
//Color32 nc = tex2d(noramltex, in->texcoord);
//internal_vec3_scale(&c, roughness, &c);
*color = vec4_saturate(c);
+ //*color = vec4(depth, depth, depth, 1);
//internal_vec3_scale(color, 1 - depth, color);
return 1;
}