fov slider input maps menu stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / gpos.h
index 1cb364e0f324bca58941f1af8bf24bdb20868ce0..3c17cbb628280023113fcdf2c814a27f818b89d8 100644 (file)
@@ -18,8 +18,8 @@ static struct vg_shader _shader_gpos = {
 "\n"
 "#line      2        0 \n"
 "\n"
-"uniform mat4 uPv;\n"
 "uniform mat4x3 uMdl;\n"
+"uniform mat4 uPv;\n"
 "\n"
 "out vec4 aColour;\n"
 "out vec2 aUv;\n"
@@ -64,6 +64,7 @@ static struct vg_shader _shader_gpos = {
 "   float g_water_fog;\n"
 "   int g_light_count;\n"
 "   int g_light_preview;\n"
+"   int g_shadow_samples;\n"
 "};\n"
 "\n"
 "uniform sampler2D g_world_depth;\n"
@@ -128,6 +129,11 @@ static struct vg_shader _shader_gpos = {
 "\n"
 "vec3 do_light_shadowing( vec3 vfrag )\n"
 "{\n"
+"   if( g_shadow_samples == 0 )\n"
+"   {\n"
+"      return vfrag;\n"
+"   }\n"
+"\n"
 "   float fspread = g_light_colours[0].w;\n"
 "   vec3  vdir = g_light_directions[0].xyz;\n"
 "   float flength = g_light_directions[0].w;\n"
@@ -174,16 +180,16 @@ static struct vg_shader _shader_gpos = {
 ""},
 };
 
-static GLuint _uniform_gpos_uPv;
 static GLuint _uniform_gpos_uMdl;
+static GLuint _uniform_gpos_uPv;
 static GLuint _uniform_gpos_uCamera;
 static GLuint _uniform_gpos_g_world_depth;
-static void shader_gpos_uPv(m4x4f m){
-   glUniformMatrix4fv( _uniform_gpos_uPv, 1, GL_FALSE, (float *)m );
-}
 static void shader_gpos_uMdl(m4x3f m){
    glUniformMatrix4x3fv( _uniform_gpos_uMdl, 1, GL_FALSE, (float *)m );
 }
+static void shader_gpos_uPv(m4x4f m){
+   glUniformMatrix4fv( _uniform_gpos_uPv, 1, GL_FALSE, (float *)m );
+}
 static void shader_gpos_uCamera(v3f v){
    glUniform3fv( _uniform_gpos_uCamera, 1, v );
 }
@@ -195,8 +201,8 @@ static void shader_gpos_register(void){
 }
 static void shader_gpos_use(void){ glUseProgram(_shader_gpos.id); }
 static void shader_gpos_link(void){
-   _uniform_gpos_uPv = glGetUniformLocation( _shader_gpos.id, "uPv" );
    _uniform_gpos_uMdl = glGetUniformLocation( _shader_gpos.id, "uMdl" );
+   _uniform_gpos_uPv = glGetUniformLocation( _shader_gpos.id, "uPv" );
    _uniform_gpos_uCamera = glGetUniformLocation( _shader_gpos.id, "uCamera" );
    _uniform_gpos_g_world_depth = glGetUniformLocation( _shader_gpos.id, "g_world_depth" );
 }