From dcab788763ff0af5918ca0c50538daa8bbfc84d8 Mon Sep 17 00:00:00 2001 From: Sebastian Park Date: Mon, 6 May 2024 02:23:43 -0400 Subject: make depth and skyheight uniforms. --- resources/shaders/shader.vert | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'resources') diff --git a/resources/shaders/shader.vert b/resources/shaders/shader.vert index 2d0bfe2..1409039 100755 --- a/resources/shaders/shader.vert +++ b/resources/shaders/shader.vert @@ -4,7 +4,8 @@ layout(location = 0) in vec3 position; // Position of the vertex layout(location = 1) in vec3 normal; // Normal of the vertex layout(location = 3) in vec3 texCoords; // Normal of the vertex - +uniform float depth = -1500.f; +uniform float skyHeight = 500.f; uniform mat4 proj; uniform mat4 view; uniform mat4 model; @@ -25,7 +26,7 @@ out vec2 uv; out float matIor; vec4 getRefrPos() { - float depth = -1000.f; // TODO: Pass as uniform +// float depth = -1000.f; // TODO: Pass as uniform vec3 w_o = normalize(pos - camera_worldSpace); float cos_theta_i = dot(-w_o, normal_worldSpace); float n_i = 1; @@ -55,11 +56,11 @@ vec4 getRefrPos() { } vec3 getReflPos() { - float depth = 500.f; // TODO: Pass as uniform +// float depth = 500.f; // TODO: Pass as uniform vec3 w_o = normalize(pos - camera_worldSpace); vec3 reflectedRay = w_o - 2 * dot(w_o, normal_worldSpace) * normal_worldSpace; - float dist = depth - position.y; + float dist = skyHeight - position.y; float depthScale = dist / reflectedRay.y; vec3 skyContactPoint = (reflectedRay * depthScale) + position; return skyContactPoint; -- cgit v1.2.3-70-g09d2