From 3d478057348af1044c254dc26eb3f89081941308 Mon Sep 17 00:00:00 2001 From: v_lasser Date: Tue, 14 Feb 2023 19:13:01 +0100 Subject: [PATCH] fix run_linux, adding light to scene --- run_linux.sh | 2 +- shaders/quad.fs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/run_linux.sh b/run_linux.sh index e5ea789..22abfca 100755 --- a/run_linux.sh +++ b/run_linux.sh @@ -1,6 +1,6 @@ # takes an argument for compilation -LD_LIBRARY_PATH=$(pwd) ./a.out +##LD_LIBRARY_PATH=$(pwd) ./a.out # Exits and displays error if there is no argument provided if [ $# -eq 0 ]; then echo "This script requires an argument." diff --git a/shaders/quad.fs b/shaders/quad.fs index 5c4b4e8..d6f0f8b 100644 --- a/shaders/quad.fs +++ b/shaders/quad.fs @@ -50,7 +50,8 @@ vec3 Get_Color(vec3 origin,vec3 dir){ vec4 impact = Get_Impact(origin,dir); if(impact.w<0.) return vec3(.5,.7,1.); vec3 normale=grad(impact.xyz); - return normale; + vec3 sunPos=vec3(3.*sin(Time*1.5),3.*cos(Time*3.),3.*cos(Time*1.5));//vec3(1.,1.5,.5); + return vec3(clamp(0.,1.,dot(sunPos-impact.xyz,normale)));//normale; } float Mandel(vec2 co){ @@ -58,7 +59,7 @@ float Mandel(vec2 co){ float limf=100.0; float cf=0.0; int c; - for(c=0;c<100;c++){ + for(c=0;c<30;c++){ coo=vec2(pow(coo.x,2.0)-pow(coo.y,2.0)+co.x,2.*coo.x*coo.y+co.y); if(length(coo)>=2.0){ return cf/limf; @@ -70,8 +71,8 @@ float Mandel(vec2 co){ void main() { - vec3 lookingAt = vec3(0.,0.,0.); - vec3 posCam = vec3(3.*sin(Time*.5),0.,3.*cos(Time*.5)); + vec3 lookingAt = vec3(0.); + vec3 posCam = vec3(-3.*sin(Time*.15),.6*cos(Time*.15),3.*cos(Time*.15)); vec3 ez = normalize(lookingAt-posCam);////base orthonormée vec3 ex = normalize(cross(ez,vec3(0.,1.,0.)));