From efe7768e5b65022b2dd418feff017b97012a6b24 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 13 Jul 2020 09:33:38 +0800 Subject: *misc --- src/shaders/common/core.c | 6 +++--- src/shaders/common/core.h | 4 ++-- src/shaders/common/light.h | 9 +++++++++ src/shaders/common/mathlib.c | 14 +++++++------- 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/shaders/common') 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; -- cgit v1.1-26-g67d0