X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fmodel_gate.h;h=fc9c1ea326b904532f78be6249efb0e78f08e549;hb=a1056ed8198f0f5be0e0f341da8bd49aa6c47198;hp=013c916a5e9d6a9af0e1aef89ec119541e1d7442;hpb=2e4531dfd7bd0d9a0776fda1a62653806d85eb3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/model_gate.h b/shaders/model_gate.h index 013c916..fc9c1ea 100644 --- a/shaders/model_gate.h +++ b/shaders/model_gate.h @@ -42,6 +42,7 @@ static struct vg_shader _shader_model_gate = { "uniform float uTime;\n" "uniform vec3 uCam;\n" "uniform vec2 uInvRes;\n" +"uniform vec4 uColour;\n" "\n" "in vec3 aNorm;\n" "in vec2 aUv;\n" @@ -50,7 +51,7 @@ static struct vg_shader _shader_model_gate = { "void main()\n" "{\n" " vec2 ssuv = gl_FragCoord.xy;\n" -" float opacity = 1.0-smoothstep(0.4,1.0,aUv.y);\n" +" float opacity = 1.0-smoothstep(0.0,1.0,aUv.y+uColour.a);\n" " \n" " vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );\n" " float dither = fract( vDither.g / 71.0 ) - 0.5;\n" @@ -58,7 +59,7 @@ static struct vg_shader _shader_model_gate = { " if( opacity+dither<0.5 )\n" " discard;\n" "\n" -" FragColor = vec4( 0.0, 1.0, 0.0, 1.0 );\n" +" FragColor = uColour;\n" "}\n" ""}, }; @@ -68,6 +69,7 @@ static GLuint _uniform_model_gate_uMdl; static GLuint _uniform_model_gate_uTime; static GLuint _uniform_model_gate_uCam; static GLuint _uniform_model_gate_uInvRes; +static GLuint _uniform_model_gate_uColour; static void shader_model_gate_uPv(m4x4f m){ glUniformMatrix4fv(_uniform_model_gate_uPv,1,GL_FALSE,(float*)m); } @@ -83,6 +85,9 @@ static void shader_model_gate_uCam(v3f v){ static void shader_model_gate_uInvRes(v2f v){ glUniform2fv(_uniform_model_gate_uInvRes,1,v); } +static void shader_model_gate_uColour(v4f v){ + glUniform4fv(_uniform_model_gate_uColour,1,v); +} static void shader_model_gate_register(void){ vg_shader_register( &_shader_model_gate ); } @@ -93,5 +98,6 @@ static void shader_model_gate_link(void){ _uniform_model_gate_uTime = glGetUniformLocation( _shader_model_gate.id, "uTime" ); _uniform_model_gate_uCam = glGetUniformLocation( _shader_model_gate.id, "uCam" ); _uniform_model_gate_uInvRes = glGetUniformLocation( _shader_model_gate.id, "uInvRes" ); + _uniform_model_gate_uColour = glGetUniformLocation( _shader_model_gate.id, "uColour" ); } #endif /* SHADER_model_gate_H */