challenge effects
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_fxglow.h
index 3f5e0c69d0fe4e2ea8ba529d978af336980aeae2..a86f5207db00688f5ded3d26c3a33049a8a4bb57 100644 (file)
@@ -7,7 +7,7 @@ static struct vg_shader _shader_scene_fxglow = {
    .link = shader_scene_fxglow_link,
    .vs = 
 {
-.orig_file = "shaders/scene.vs",
+.orig_file = "shaders/scene_fxglow.vs",
 .static_src = 
 "layout (location=0) in vec3  a_co;\n"
 "layout (location=1) in vec4  a_norm;\n"
@@ -36,6 +36,7 @@ static struct vg_shader _shader_scene_fxglow = {
 "uniform mat4x3 uMdl;\n"
 "uniform mat4   uPv;\n"
 "uniform mat4   uPvmPrev;\n"
+"uniform vec2   uUvOffset;\n"
 "\n"
 "out vec2 aUv;\n"
 "out vec4 aNorm;\n"
@@ -52,7 +53,7 @@ static struct vg_shader _shader_scene_fxglow = {
 "\n"
 "   gl_Position = vproj0;\n"
 "\n"
-"   aUv = a_uv;\n"
+"   aUv = a_uv + uUvOffset;\n"
 "   aNorm = vec4( mat3(uMdl) * a_norm.xyz, a_norm.w );\n"
 "   aCo = a_co;\n"
 "   aWorldCo = world_pos0;\n"
@@ -273,7 +274,7 @@ static struct vg_shader _shader_scene_fxglow = {
 "   light_delta = normalize( light_delta );\n"
 "\n"
 "   float quadratic = dist2*100.0;\n"
-"   float attenuation  = 1.0f/( 1.0f + quadratic );\n"
+"   float attenuation  = 1.0/( 1.0 + quadratic );\n"
 "         attenuation *= max( dot( light_delta, normal ), 0.0 );\n"
 "\n"
 "   float falloff = max( 0.0, 1.0-(dist2*light_co.w) );\n"
@@ -444,6 +445,7 @@ static struct vg_shader _shader_scene_fxglow = {
 static GLuint _uniform_scene_fxglow_uMdl;
 static GLuint _uniform_scene_fxglow_uPv;
 static GLuint _uniform_scene_fxglow_uPvmPrev;
+static GLuint _uniform_scene_fxglow_uUvOffset;
 static GLuint _uniform_scene_fxglow_uTexMain;
 static GLuint _uniform_scene_fxglow_uCamera;
 static GLuint _uniform_scene_fxglow_g_world_depth;
@@ -458,6 +460,9 @@ static void shader_scene_fxglow_uPv(m4x4f m){
 static void shader_scene_fxglow_uPvmPrev(m4x4f m){
    glUniformMatrix4fv(_uniform_scene_fxglow_uPvmPrev,1,GL_FALSE,(float*)m);
 }
+static void shader_scene_fxglow_uUvOffset(v2f v){
+   glUniform2fv(_uniform_scene_fxglow_uUvOffset,1,v);
+}
 static void shader_scene_fxglow_uTexMain(int i){
    glUniform1i(_uniform_scene_fxglow_uTexMain,i);
 }
@@ -475,6 +480,7 @@ static void shader_scene_fxglow_link(void){
    _uniform_scene_fxglow_uMdl = glGetUniformLocation( _shader_scene_fxglow.id, "uMdl" );
    _uniform_scene_fxglow_uPv = glGetUniformLocation( _shader_scene_fxglow.id, "uPv" );
    _uniform_scene_fxglow_uPvmPrev = glGetUniformLocation( _shader_scene_fxglow.id, "uPvmPrev" );
+   _uniform_scene_fxglow_uUvOffset = glGetUniformLocation( _shader_scene_fxglow.id, "uUvOffset" );
    _uniform_scene_fxglow_uTexMain = glGetUniformLocation( _shader_scene_fxglow.id, "uTexMain" );
    _uniform_scene_fxglow_uCamera = glGetUniformLocation( _shader_scene_fxglow.id, "uCamera" );
    _uniform_scene_fxglow_g_world_depth = glGetUniformLocation( _shader_scene_fxglow.id, "g_world_depth" );