]> git.xolatile.top Git - xolatile-badassbug.git/commitdiff
Minor cleanups, just compiles...
authorxolatile <xolatile@proton.me>
Tue, 5 Aug 2025 15:04:48 +0000 (17:04 +0200)
committerxolatile <xolatile@proton.me>
Tue, 5 Aug 2025 15:04:48 +0000 (17:04 +0200)
30 files changed:
data/glsl.cfg
packages/hud/damage.png [deleted file]
packages/models/health/iqm.cfg [deleted file]
packages/models/health/md3.cfg [new file with mode: 0644]
packages/models/health/model.iqm [deleted file]
packages/models/health/model.md3 [new file with mode: 0644]
packages/models/hudguns/chaing/md5.cfg
packages/models/hudguns/fist/md5.cfg
packages/models/hudguns/gl/md5.cfg
packages/models/hudguns/pistol/md5.cfg
packages/models/hudguns/rifle/md5.cfg
packages/models/hudguns/rocket/md5.cfg
packages/models/hudguns/shotg/md5.cfg
packages/models/mrfixit/hudguns/md5.cfg
packages/textures/evillair/light_u201_c.png
packages/textures/evillair/lightpanel_01_c.png
packages/textures/evillair/package.cfg
src/engine/lightmap.cpp
src/engine/main.cpp
src/engine/material.cpp
src/engine/octaedit.cpp
src/engine/octarender.cpp
src/engine/ragdoll.h
src/engine/rendergl.cpp
src/engine/renderva.cpp
src/engine/shader.cpp
src/engine/texture.cpp
src/engine/worldio.cpp
src/fpsgame/waypoint.cpp
src/shared/geom.h

index dac63f2401d555bea89837effec480b687736b66..e058dddaea3b251407fbec0f893bff0f83b2946e 100644 (file)
@@ -162,6 +162,69 @@ shader 0 "cubemap" [
     }
 ]
 
+//////////////////////////////////////////////////////////////////////
+//
+// fogged variants of default shaders
+//
+//////////////////////////////////////////////////////////////////////
+
+shader 0 "fogged" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec2 vtexcoord0;
+    uniform mat4 camprojmatrix;
+    varying vec2 texcoord0;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        texcoord0 = vtexcoord0;
+        color = vcolor;
+    }
+] [
+    varying vec2 texcoord0;
+    varying vec4 color;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        gl_FragColor = color * texture2D(tex0, texcoord0);
+    }
+]
+
+shader 0 "foggednotexture" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    uniform mat4 camprojmatrix;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+    }
+] [
+    varying vec4 color;
+    void main(void)
+    {
+        gl_FragColor = color;
+    }
+]
+
+shader 0 "fogoverlay" [
+    attribute vec4 vvertex, vcolor;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        color = vcolor;
+    }
+] [
+    varying vec4 color;
+    void main(void)
+    {
+        gl_FragColor = color;
+    }
+]
+
 //////////////////////////////////////////////////////////////////////
 //
 // for filling the z-buffer only (i.e. multi-pass rendering, OQ)
@@ -243,6 +306,36 @@ worldshader = [
     ]
 ]
 
+glareworldshader = [
+    variantshader (if (< (strstr $arg1 "env") 0) 4 6) $arg1 4 [
+        //:fog
+        @(if (>= $numargs 4) [result $arg4])
+        attribute vec4 vvertex;
+        attribute vec3 vnormal;
+        attribute vec2 vtexcoord0, vtexcoord1;
+        uniform mat4 camprojmatrix;
+        uniform vec2 texgenscroll;
+        varying vec2 texcoord0, texcoord1;
+        void main(void)
+        {
+            gl_Position = camprojmatrix * vvertex;
+            texcoord0 = vtexcoord0 + texgenscroll;
+            texcoord1 = vtexcoord1 * @lmcoordscale;
+
+            @arg2
+        }
+    ] [
+        @(if (>= $numargs 4) [result $arg4])
+        @(if (>= $numargs 5) [result $arg5])
+        uniform vec4 colorparams;
+        varying vec2 texcoord0, texcoord1;
+        void main(void)
+        {
+            @arg3
+        }
+    ]
+]
+
 worldshader "stdworld" [] []
 worldshader "alphaworld" [] []
 
@@ -253,6 +346,89 @@ defershader 0 "decalworld" [
   ] [] [] [uniform sampler2D decal;]
 ]
 
+glowshader = [
+  defershader 0 $arg1 [
+    defuniformparam "glowcolor" 1 1 1 // glow color
+    worldshader @arg1 [] [] [
+      vec3 glow = texture2D(glowmap, texcoord0).rgb;
+      glow *= glowcolor.rgb;
+      gl_FragColor = diffuse*lm + vec4(glow, 0.0);
+    ] [] [uniform sampler2D glowmap;]
+    glareworldshader @arg1 [] [
+      vec3 glow = texture2D(glowmap, texcoord0).rgb;
+      glow *= glowcolor.rgb;
+      float k = max(glow.r, max(glow.g, glow.b));
+      gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
+      gl_FragColor.a =
+          //:variantoverride texture2D(lightmap, texcoord1).a
+          colorparams.a
+          ;
+    ] [] [
+      uniform sampler2D glowmap;
+      //:variant uniform sampler2D lightmap;
+    ]
+  ]
+]
+glowshader "glowworld"
+glowshader "glowalphaworld"
+
+defershader 0 "pulseworld" [
+  defuniformparam "pulsespeed" 1 // pulse frequency (Hz)
+  worldshader "pulseworld" [
+    pulse = abs(fract(millis * pulsespeed.x)*2.0 - 1.0);
+  ] [
+    vec3 diffuse2 = texture2D(decal, texcoord0).rgb;
+    diffuse.rgb = mix(diffuse.rgb, diffuse2, pulse);
+  ] [] [uniform float millis; varying float pulse;] [uniform sampler2D decal;]
+]
+
+pulseglowshader = [
+  defershader 0 $arg1 [
+    defuniformparam "glowcolor" 1 1 1 // glow color
+    defuniformparam "pulseglowspeed" 1 // pulse frequency (Hz)
+    defuniformparam "pulseglowcolor" 0 0 0 // pulse glow color
+    worldshader @arg1 [
+      pulse = mix(glowcolor.rgb, pulseglowcolor.rgb, abs(fract(millis * pulseglowspeed.x)*2.0 - 1.0));
+    ] [] [
+      vec3 glow = texture2D(glowmap, texcoord0).rgb;
+      gl_FragColor = diffuse*lm + vec4(glow*pulse, 0.0);
+    ] [uniform float millis; varying vec3 pulse;] [uniform sampler2D glowmap;]
+    glareworldshader @arg1 [
+      pulse = mix(glowcolor.rgb, pulseglowcolor.rgb, abs(fract(millis * pulseglowspeed.x)*2.0 - 1.0));
+    ] [
+      vec3 glow = texture2D(glowmap, texcoord0).rgb;
+      glow *= pulse;
+      float k = max(glow.r, max(glow.g, glow.b));
+      gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
+      gl_FragColor.a =
+          //:variantoverride texture2D(lightmap, texcoord1).a
+          colorparams.a
+          ;
+    ] [uniform float millis; varying vec3 pulse;] [
+      uniform sampler2D glowmap;
+      //:variant uniform sampler2D lightmap;
+    ]
+  ]
+]
+pulseglowshader "pulseglowworld"
+pulseglowshader "pulseglowalphaworld"
+
+shader 0 "fogworld" [
+    //:water
+    attribute vec4 vvertex;
+    uniform mat4 camprojmatrix;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+    }
+] [
+    uniform vec3 fogcolor;
+    void main(void)
+    {
+        gl_FragColor = vec4(fogcolor, 1.0);
+    }
+]
+
 shader 0 "noglareworld" [
     attribute vec4 vvertex;
     uniform mat4 camprojmatrix;
@@ -304,12 +480,90 @@ shader 0 "noglarealphaworld" [
     }
 ]
 
+defershader 2 "envworld" [
+  defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+  worldshader "envworld" [
+    normal = vnormal;
+    camvec = camera - vvertex.xyz;
+  ] [
+    vec3 reflect = textureCube(envmap, 2.0*normal*dot(camvec, normal) - camvec).rgb;
+  ] [
+    diffuse *= lm;
+    gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
+    gl_FragColor.a = diffuse.a;
+  ] [uniform vec3 camera; varying vec3 normal, camvec;] [uniform samplerCube envmap;]
+
+  defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+  worldshader "envworldfast" [
+    vec3 camvec = camera - vvertex.xyz;
+    rvec = 2.0*vnormal*dot(camvec, vnormal) - camvec;
+  ] [
+    vec3 reflect = textureCube(envmap, rvec).rgb;
+  ] [
+    diffuse *= lm;
+    gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
+    gl_FragColor.a = diffuse.a;
+  ] [uniform vec3 camera; varying vec3 rvec;] [uniform samplerCube envmap;]
+
+  defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+  worldshader "envworldalt" [] []
+
+  altshader envworld envworldalt
+  fastshader envworld envworldfast 2
+  fastshader envworld envworldalt 1
+]
+
+shader 0 "depthfxworld" [
+    attribute vec4 vvertex;
+    uniform mat4 camprojmatrix;
+    uniform vec4 depthscale, depthoffsets;
+    varying vec4 depthranges;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        depthranges = depthoffsets + gl_Position.w*depthscale;
+    }
+] [
+    varying vec4 depthranges;
+    void main(void)
+    {
+        gl_FragColor = depthranges;
+    }
+]
+
+shader 0 depthfxsplitworld [
+    attribute vec4 vvertex;
+    uniform mat4 camprojmatrix;
+    uniform vec4 depthscale, depthoffsets;
+    varying vec4 depthranges;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        depthranges = depthoffsets + gl_Position.w*depthscale;
+    }
+] [
+    varying vec4 depthranges;
+    void main(void)
+    {
+        vec4 ranges = vec4(depthranges.x, fract(depthranges.yzw));
+        ranges.xy -= ranges.yz*vec2(0.00390625, 0.00390625);
+        gl_FragColor = ranges;
+    }
+]
+
 // bumptype:
+//    e -> reserve envmap texture slot
 //    o -> orthonormalize
 //    t -> tangent space cam
+//    r -> envmap reflection
+//    R -> modulate envmap reflection with spec map
 //    s -> spec
 //    S -> spec map
 //    p -> parallax
+//    P -> steep parallax (7 steps)
+//    g -> glow
+//    G -> pulse glow
+//    i -> glare intensity
 //    a -> alpha map
 
 btopt = [ >= (strstr $bumptype $arg1) 0 ]
@@ -318,6 +572,13 @@ bumpvariantshader = [
     bumptype = $arg2
     stype = (? (btopt "e") 3 1)
     if (! (btopt "i")) [
+        if (btopt "G") [
+            defuniformparam "glowcolor" 1 1 1 // glow color
+            defuniformparam "pulseglowspeed" 1     // pulse frequency (Hz)
+            defuniformparam "pulseglowcolor" 0 0 0 // pulse glow color
+        ] [if (btopt "g") [
+            defuniformparam "glowcolor" 1 1 1  // glow color
+        ]]
         if (btopt "S") [
             defuniformparam "specscale" 6 6 6 // spec map multiplier
         ] [if (btopt "s") [
@@ -326,6 +587,11 @@ bumpvariantshader = [
         if (|| (btopt "p") (btopt "P")) [
             defuniformparam "parallaxscale" 0.06 -0.03 // parallax scaling
         ]
+        if (btopt "R") [
+            defuniformparam "envscale" 1 1 1 // reflectivity map multiplier
+        ] [if (btopt "r") [
+            defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+        ]]
     ] [
         if (btopt "s") [stype = (+ $stype 8)]
     ]
@@ -338,6 +604,9 @@ bumpvariantshader = [
         uniform mat4 camprojmatrix;
         uniform vec2 texgenscroll;
         varying vec2 texcoord0, texcoord1;
+        @(if (|| (btopt "t") (btopt "r")) [result [uniform vec3 camera; varying vec3 camvec;]])
+        @(if (btopt "G") [result [uniform float millis; varying float pulse;]])
+        @(if (btopt "r") [result [varying mat3 world;]])
         void main(void)
         {
             gl_Position = camprojmatrix * vvertex;
@@ -360,6 +629,10 @@ bumpvariantshader = [
                 ]])
             ]])
 
+            @(if (btopt "G") [result [
+                pulse = abs(fract(millis*pulseglowspeed.x)*2.0 - 1.0);
+            ]])
+
             @(if (|| (! (btopt "i")) (btopt "s")) [result [
                 //:dynlight
             ]])
@@ -373,6 +646,11 @@ bumpvariantshader = [
         varying vec2 texcoord0, texcoord1;
         uniform sampler2D diffusemap, lmcolor, lmdir;
         @(if (|| (! (btopt "i")) (btopt "s") (btopt "p") (btopt "P")) [result [uniform sampler2D normalmap;]])
+        @(if (|| (btopt "t") (btopt "r")) [result [varying vec3 camvec;]])
+        @(if (btopt "g") [result [uniform sampler2D glowmap;]])
+        @(if (btopt "G") [result [varying float pulse;]])
+        @(if (btopt "r") [result [uniform samplerCube envmap; varying mat3 world;]])
+        @(if (|| (! (btopt "i")) (btopt "s")) [result [uniform vec4 ambient;]])
         void main(void)
         {
             @(if (|| (! (btopt "i")) (btopt "s")) [result [
@@ -399,6 +677,28 @@ bumpvariantshader = [
             ]])
             @(if (|| (btopt "p") (btopt "P")) [] [result [#define dtc texcoord0]])
 
+            @(if (|| (! (btopt "i")) (btopt "S") (btopt "a")) [result [
+                vec4 diffuse = texture2D(diffusemap, dtc);
+                @(if (&& (btopt "a") (! (btopt "S"))) [result [
+                    #define alpha diffuse.a
+                ]])
+            ]])
+            @(if (! (btopt "i")) [result [
+                diffuse.rgb *= colorparams.rgb;
+            ]])
+            @(if (|| (! (btopt "i")) (btopt "s") (btopt "a")) [result [
+                @(if (! (btopt "P")) [
+                    if (&& (btopt "a") (btopt "S")) [result [
+                        vec4 normal = texture2D(normalmap, dtc);
+                        #define alpha normal.a
+                        #define bump normal.rgb
+                    ]] [result [
+                        vec3 bump = texture2D(normalmap, dtc).rgb;
+                    ]]
+                ])
+                bump = bump*2.0 - 1.0;
+            ]])
+
             @(if (btopt "s") [result [
                 vec3 halfangle = normalize(camdir + lmlv);
                 float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), @(? (btopt "i") "128.0" "32.0"));
@@ -411,6 +711,65 @@ bumpvariantshader = [
                 ]])
             ]])
 
+            @(if (|| (! (btopt "i")) (btopt "s")) [result [
+                lmc.rgb = max(lmc.rgb*clamp(dot(lmlv, bump), 0.0, 1.0), ambient.xyz);
+                @(if (btopt "i") [result [
+                    //:dynlight lmc
+
+                    @(? (btopt "g") "diffuse.rgb" "gl_FragColor.rgb") = diffuse.rgb * lmc.rgb;
+                ]] [result [
+                    //:shadowmap lmc
+                    //:dynlight lmc
+
+                    @(? (|| (btopt "g") (btopt "r")) "diffuse.rgb" "gl_FragColor.rgb") = diffuse.rgb * lmc.rgb;
+                ]])
+            ]])
+
+            @(if (btopt "r") [result [
+                vec3 rvec;
+                @(if (btopt "t") [result [
+                    vec3 rvects = 2.0*bump*dot(camvec, bump) - camvec;
+                    rvec = world * rvects;
+                ]] [result [
+                    vec3 bumpw = world * bump;
+                    rvec = 2.0*bumpw*dot(camvec, bumpw) - camvec;
+                ]])
+                vec3 reflect = textureCube(envmap, rvec).rgb;
+                @@(if (btopt "R") [result [
+                    vec3 rmod = envscale.xyz*diffuse.a;
+                ]] [result [
+                    #define rmod envscale.xyz
+                ]])
+                @(? (btopt "g") "diffuse.rgb" "gl_FragColor.rgb") = mix(diffuse.rgb, reflect, rmod);
+            ]])
+
+            @(if (btopt "a") [result [
+                @(? (btopt "g") "diffuse.rgb" "gl_FragColor.rgb") *= alpha;
+            ]])
+
+            @(if (btopt "g") [result [
+                vec3 glow = texture2D(glowmap, dtc).rgb;
+                @@(if (btopt "G") [result [
+                    vec3 pulsecol = mix(glowcolor.xyz, pulseglowcolor.xyz, pulse);
+                ]])
+                @@(if (btopt "i") [result [
+                    glow *= @(? (btopt "G") "pulsecol" "glowcolor.xyz");
+                    float k = max(glow.r, max(glow.g, glow.b));
+                    k = min(k*k*32.0, 1.0);
+                    @(if (btopt "s") [result [
+                        gl_FragColor.rgb = glow*k + diffuse.rgb;
+                    ]] [result [
+                        gl_FragColor.rgb = glow*k;
+                        gl_FragColor.a =
+                            //:variantoverride texture2D(lmcolor, texcoord1).a
+                            colorparams.a
+                            ;
+                    ]])
+                ]] [result [
+                    gl_FragColor.rgb = glow * @(? (btopt "G") "pulsecol" "glowcolor.xyz") + diffuse.rgb;
+                ]])
+            ]])
+
             @(if (btopt "a") [result [
                 gl_FragColor.a *= alpha;
                 //:fog fogcolor * alpha
@@ -444,6 +803,20 @@ bumpshader "bumpspecmapalphaworld" "otsSa"
 fastshader bumpspecmapalphaworld bumpalphaworld 1
 altshader bumpspecmapalphaworld bumpalphaworld
 
+bumpshader "bumpglowworld" "g"
+bumpshader "bumpspecglowworld" "otsg"
+altshader bumpspecglowworld bumpglowworld
+bumpshader "bumpspecmapglowworld" "otsSg"
+fastshader bumpspecmapglowworld bumpglowworld 2
+altshader bumpspecmapglowworld bumpglowworld
+
+bumpshader "bumppulseglowworld" "gG"
+bumpshader "bumpspecpulseglowworld" "otsgG"
+altshader bumpspecpulseglowworld bumppulseglowworld
+bumpshader "bumpspecmappulseglowworld" "otsSgG"
+fastshader bumpspecmappulseglowworld bumppulseglowworld 2
+altshader bumpspecmappulseglowworld bumppulseglowworld
+
 bumpshader "bumpparallaxworld" "pot"
 fastshader bumpparallaxworld bumpworld 1
 altshader bumpparallaxworld bumpworld
@@ -456,6 +829,30 @@ fastshader bumpspecmapparallaxworld bumpparallaxworld 2
 fastshader bumpspecmapparallaxworld bumpworld 1
 altshader bumpspecmapparallaxworld bumpworld
 
+bumpshader "bumpparallaxglowworld" "potg"
+fastshader bumpparallaxglowworld bumpglowworld 1
+altshader bumpparallaxglowworld bumpglowworld
+bumpshader "bumpspecparallaxglowworld" "potsg"
+fastshader bumpspecparallaxglowworld bumpparallaxglowworld 2
+fastshader bumpspecparallaxglowworld bumpglowworld 1
+altshader bumpspecparallaxglowworld bumpglowworld
+bumpshader "bumpspecmapparallaxglowworld" "potsSg"
+fastshader bumpspecmapparallaxglowworld bumpparallaxglowworld 2
+fastshader bumpspecmapparallaxglowworld bumpglowworld 1
+altshader bumpspecmapparallaxglowworld bumpglowworld
+
+bumpshader "bumpparallaxpulseglowworld" "potgG"
+fastshader bumpparallaxpulseglowworld bumppulseglowworld 1
+altshader bumpparallaxpulseglowworld bumppulseglowworld
+bumpshader "bumpspecparallaxpulseglowworld" "potsgG"
+fastshader bumpspecparallaxpulseglowworld bumpparallaxpulseglowworld 2
+fastshader bumpspecparallaxpulseglowworld bumppulseglowworld 1
+altshader bumpspecparallaxpulseglowworld bumppulseglowworld
+bumpshader "bumpspecmapparallaxpulseglowworld" "potsSgG"
+fastshader bumpspecmapparallaxpulseglowworld bumpparallaxpulseglowworld 2
+fastshader bumpspecmapparallaxpulseglowworld bumppulseglowworld 1
+altshader bumpspecmapparallaxpulseglowworld bumppulseglowworld
+
 bumpshader "bumpenvworldalt" "e"
 bumpshader "bumpenvworld" "eor"
 altshader bumpenvworld bumpenvworldalt
@@ -467,6 +864,28 @@ bumpshader "bumpenvspecmapworld" "eotsSrR"
 altshader bumpenvspecmapworld bumpenvworldalt
 fastshader bumpenvspecmapworld bumpenvworldalt 2
 
+bumpshader "bumpenvglowworldalt" "eg"
+bumpshader "bumpenvglowworld" "eorg"
+altshader bumpenvglowworld bumpenvglowworldalt
+fastshader bumpenvglowworld bumpenvglowworldalt 2
+bumpshader "bumpenvspecglowworld" "eotsrg"
+altshader bumpenvspecglowworld bumpenvglowworldalt
+fastshader bumpenvspecglowworld bumpenvglowworldalt 2
+bumpshader "bumpenvspecmapglowworld" "eotsSrRg"
+altshader bumpenvspecmapglowworld bumpenvglowworldalt
+fastshader bumpenvspecmapglowworld bumpenvglowworldalt 2
+
+bumpshader "bumpenvpulseglowworldalt" "egG"
+bumpshader "bumpenvpulseglowworld" "eorgG"
+altshader bumpenvpulseglowworld bumpenvpulseglowworldalt
+fastshader bumpenvpulseglowworld bumpenvpulseglowworldalt 2
+bumpshader "bumpenvspecpulseglowworld" "eotsrgG"
+altshader bumpenvspecpulseglowworld bumpenvpulseglowworldalt
+fastshader bumpenvspecpulseglowworld bumpenvpulseglowworldalt 2
+bumpshader "bumpenvspecmappulseglowworld" "eotsSrRgG"
+altshader bumpenvspecmappulseglowworld bumpenvpulseglowworldalt
+fastshader bumpenvspecmappulseglowworld bumpenvpulseglowworldalt 2
+
 bumpshader "bumpenvparallaxworldalt" "epot"
 altshader bumpenvparallaxworldalt bumpenvworldalt
 bumpshader "bumpenvparallaxworld" "epotr"
@@ -482,6 +901,38 @@ altshader bumpenvspecmapparallaxworld bumpenvparallaxworldalt
 fastshader bumpenvspecmapparallaxworld bumpenvparallaxworldalt 2
 fastshader bumpenvspecmapparallaxworld bumpenvworldalt 1
 
+bumpshader "bumpenvparallaxglowworldalt" "epotg"
+altshader bumpenvparallaxglowworldalt bumpenvglowworldalt
+bumpshader "bumpenvparallaxglowworld" "epotrg"
+altshader bumpenvparallaxglowworld bumpenvparallaxglowworldalt
+fastshader bumpenvparallaxglowworld bumpenvparallaxglowworldalt 2
+fastshader bumpenvparallaxglowworld bumpenvglowworldalt 1
+bumpshader "bumpenvspecparallaxglowworld" "epotsrg"
+altshader bumpenvspecparallaxglowworld bumpenvparallaxglowworldalt
+fastshader bumpenvspecparallaxglowworld bumpenvparallaxglowworldalt 2
+fastshader bumpenvspecparallaxglowworld bumpenvglowworldalt 1
+bumpshader "bumpenvspecmapparallaxglowworld" "epotsSrRg"
+altshader bumpenvspecmapparallaxglowworld bumpenvparallaxglowworldalt
+fastshader bumpenvspecmapparallaxglowworld bumpenvparallaxglowworldalt 2
+fastshader bumpenvspecmapparallaxglowworld bumpenvglowworldalt 1
+
+bumpshader "bumpenvparallaxpulseglowworldalt" "epotgG"
+altshader bumpenvparallaxpulseglowworldalt bumpenvpulseglowworldalt
+bumpshader "bumpenvparallaxpulseglowworld" "epotrgG"
+altshader bumpenvparallaxpulseglowworld bumpenvparallaxpulseglowpulseglowworldalt
+fastshader bumpenvparallaxpulseglowworld bumpenvparallaxpulseglowpulseglowworldalt 2
+fastshader bumpenvparallaxpulseglowworld bumpenvpulseglowworldalt 1
+bumpshader "bumpenvspecparallaxpulseglowworld" "epotsrgG"
+altshader bumpenvspecparallaxpulseglowworld bumpenvparallaxpulseglowworldalt
+fastshader bumpenvspecparallaxpulseglowworld bumpenvparallaxpulseglowworldalt 2
+fastshader bumpenvspecparallaxpulseglowworld bumpenvpulseglowworldalt 1
+bumpshader "bumpenvspecmapparallaxpulseglowworld" "epotsSrRgG"
+altshader bumpenvspecmapparallaxpulseglowworld bumpenvparallaxpulseglowworldalt
+fastshader bumpenvspecmapparallaxpulseglowworld bumpenvparallaxpulseglowworldalt 2
+fastshader bumpenvspecmapparallaxpulseglowworld bumpenvpulseglowworldalt 1
+
+//bumpshader "steepworld" "Pot"
+
 ////////////////////////////////////////////////
 //
 // model shaders
@@ -631,12 +1082,14 @@ loop i 4 [
 ]
 
 // mdltype:
+//    e -> envmap
 //    n -> normalmap
 //    s -> spec
 //    m -> masks
 //    b -> dual-quat skeletal animation
 //    a -> alpha-tested
 //    q -> qtangents
+//    i -> glare intensity
 
 mdlopt = [ >= (strstr $modeltype $arg1) 0 ]
 
@@ -671,6 +1124,7 @@ modelvertexshader = [
             ]])
             @(if (mdlopt "e") [result [
                 uniform mat3 modelworld;
+                uniform vec2 envmapscale;
                 varying vec3 rvec;
                 varying float rmod;
             ]])
@@ -728,6 +1182,7 @@ modelvertexshader = [
                 @(if (mdlopt "e") [result [
                     float invfresnel = dot(camdir, mnormal);
                     rvec = modelworld * (2.0*invfresnel*mnormal - camdir);
+                    rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
                 ]])
             ]])
         }
@@ -743,6 +1198,7 @@ modelfragmentshader = [
             @(if (mdlopt "e") [result [
                 #define lightvec lightdirworld
                 uniform vec3 lightdirworld;
+                uniform vec2 envmapscale;
                 varying vec3 camvec;
                 varying mat3 world;
             ]] [result [
@@ -777,6 +1233,11 @@ modelfragmentshader = [
 
             light.rgb *= 2.0;
 
+            @(if (mdlopt "m") [result [
+                vec3 masks = texture2D(tex1, texcoord0).rgb;
+                vec3 glow = light.rgb * maskscale.y;
+            ]])
+
             @(if (mdlopt "n") [result [
                 vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5;
                 @(if (mdlopt "e") [result [
@@ -824,6 +1285,7 @@ modelfragmentshader = [
                     vec3 camn = normalize(camvec);
                     float invfresnel = dot(camn, normal);
                     vec3 rvec = 2.0*invfresnel*normal - camn;
+                    float rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
                 ]])
                 vec3 reflect = textureCube(tex2, rvec).rgb;
                 @(if (! (mdlopt "m")) [result [
@@ -831,6 +1293,18 @@ modelfragmentshader = [
                 ]])
             ]])
 
+            @(if (mdlopt "m") [result [
+                @(if (mdlopt "e") [result [
+                    light.rgb = mix(light.rgb, glow, masks.g); // glow mask in green channel
+                    gl_FragColor.rgb = mix(light.rgb, reflect, rmod*masks.b); // envmap mask in blue channel
+                ]] [if (mdlopt "i") [result [
+                    float k = min(masks.g*masks.g*maskscale.w, 1.0); // glow mask in green channel
+                    gl_FragColor.rgb = @(? (mdlopt "s") "glow*k + light.rgb" "glow*k");
+                ]] [result [
+                    gl_FragColor.rgb = mix(light.rgb, glow, masks.g); // glow mask in green channel
+                ]]])
+            ]])
+
             @(if (|| (mdlopt "i") (mdlopt "m") (mdlopt "e")) [result [
                 gl_FragColor.a = light.a * color.a;
             ]])
@@ -846,6 +1320,12 @@ modelshader = [
         loop i 4 [
             variantshader 0 $shadername 0 (modelvertexshader (concatword $arg1 "b") (+ $i 1)) []
         ]
+        glaremodeltype = (strreplace (concatword $arg1 "i") "e")
+        if (< (strstr $glaremodeltype "s") 0) [glaremodeltype = (strreplace $glaremodeltype "n")]
+        variantshader 0 $shadername 1 (modelvertexshader $glaremodeltype) (modelfragmentshader $glaremodeltype)
+        loop i 4 [
+            variantshader 0 $shadername 1 (modelvertexshader (concatword $glaremodeltype "b") (+ $i 1)) 1
+        ]
         if (>= (strstr $arg1 "e") 0) [
             altshader $shadername (modelshader (strreplace $arg1 "e"))
         ]
@@ -927,6 +1407,131 @@ loop i 7 [
     ]
 ]
 
+////////////////////////////////////////////////
+//
+// full screen shaders:
+//
+////////////////////////////////////////////////
+
+fsvs = [result [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    uniform vec2 postfxscale;
+    varying vec2 texcoord0;
+    @arg2
+    void main(void)
+    {
+        gl_Position = vvertex;   // woohoo, no mvp :)
+        texcoord0 = vtexcoord0;
+        @arg1
+    }
+]]
+
+fsps = [result [
+    uniform sampler2D tex0;
+    varying vec2 texcoord0;
+    @arg2
+    void main(void)
+    {
+        vec4 color = texture2D(tex0, texcoord0);
+        @arg1
+    }
+]]
+
+fsvs4 = [
+    fsvs [
+        texcoord1 = vtexcoord0 + vec2(-1.5, -1.5)*postfxscale;
+        texcoord2 = vtexcoord0 + vec2( 1.5, -1.5)*postfxscale;
+        texcoord3 = vtexcoord0 + vec2(-1.5,  1.5)*postfxscale;
+        texcoord4 = vtexcoord0 + vec2( 1.5,  1.5)*postfxscale;
+        @arg1
+    ] [
+        varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
+    ]
+]
+
+fsps4 = [
+    fsps [
+        vec4 s00 = texture2D(tex0, texcoord1);
+        vec4 s02 = texture2D(tex0, texcoord2);
+        vec4 s20 = texture2D(tex0, texcoord3);
+        vec4 s22 = texture2D(tex0, texcoord4);
+        @arg1
+    ] [
+        varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
+    ]
+]
+
+// some simple ones that just do an effect on the RGB value...
+
+lazyshader 0 "invert" (fsvs) (fsps [gl_FragColor = 1.0 - color;])
+lazyshader 0 "gbr"    (fsvs) (fsps [gl_FragColor = color.yzxw;])
+lazyshader 0 "bw"     (fsvs) (fsps [gl_FragColor = vec4(dot(color.xyz, vec3(0.333)));])
+
+// sobel
+
+lazyshader 0 "sobel" (fsvs4) (fsps4 [
+    vec4 t = s00 + s20 - s02 - s22;
+    vec4 u = s00 + s02 - s20 - s22;
+    gl_FragColor = color + t*t + u*u;
+])
+
+// rotoscope
+
+lazyshader 0 "rotoscope" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    uniform vec2 postfxscale;
+    uniform vec4 params;
+    varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        t11 = vtexcoord0;
+        vec2 scale = postfxscale*params.x;
+        t00 = vec2(-1.0, -1.0)*scale + vtexcoord0;
+        t12 = vec2( 0.0,  1.0)*scale + vtexcoord0;
+        t01 = vec2(-1.0,  0.0)*scale + vtexcoord0;
+        t20 = vec2( 1.0, -1.0)*scale + vtexcoord0;
+        t02 = vec2(-1.0,  1.0)*scale + vtexcoord0;
+        t21 = vec2( 1.0,  0.0)*scale + vtexcoord0;
+        t10 = vec2( 0.0, -1.0)*scale + vtexcoord0;
+        t22 = vec2( 1.0,  1.0)*scale + vtexcoord0;
+    }
+] [
+    uniform sampler2D tex0;
+    varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
+    void main(void)
+    {
+        vec4 c00 = texture2D(tex0, t00);
+        vec4 c01 = texture2D(tex0, t01);
+        vec4 c02 = texture2D(tex0, t02);
+        vec4 c10 = texture2D(tex0, t10);
+        vec4 c11 = texture2D(tex0, t11);
+        vec4 c12 = texture2D(tex0, t12);
+        vec4 c20 = texture2D(tex0, t20);
+        vec4 c21 = texture2D(tex0, t21);
+        vec4 c22 = texture2D(tex0, t22);
+
+        vec4 diag1 = c00 - c22;
+        vec4 diag2 = c02 - c20;
+        vec4 xedge = (c01 - c21)*2.0 + diag1 + diag2;
+        vec4 yedge = (c10 - c12)*2.0 + diag1 - diag2;
+        xedge *= xedge;
+        yedge *= yedge;
+
+        vec4 xyedge = xedge + yedge;
+        float sobel = step(max(xyedge.x, max(xyedge.y, xyedge.z)), 0.1);
+
+        float hue = dot(c11.xyz, vec3(1.0));
+        c11 /= hue;
+        vec3 cc = step(vec3(0.2, 0.8, 1.5), vec3(hue));
+        c11 *= dot(cc, vec3(0.5, 0.5, 1.5));
+
+        gl_FragColor = c11 * max(cc.z, sobel);
+    }
+]
+
 blur3shader = [
     lazyshader 0 $arg1 [
         attribute vec4 vvertex;
@@ -976,38 +1581,128 @@ blur5shader = [
 blur5shader hblur5 1 0
 blur5shader vblur5 0 1
 
-////////////////////////////////////////////////
-//
-// miscellaneous effect shaders:
-//
-////////////////////////////////////////////////
-
-// wobbles the vertices of an explosion sphere
-// and generates all texcoords
-// and blends the edge color
-// and modulates the texture
-explosionshader = [
-    shader 0 $arg1 [
-        //:fog
-        attribute vec4 vvertex, vcolor;
-        attribute vec2 vtexcoord0;
-        uniform mat4 explosionmatrix;
-        uniform vec3 center;
-        uniform float millis;
-        uniform vec3 texgenS, texgenT;
-        varying vec4 color;
-        varying vec2 texcoord0, texcoord1, texcoord2;
-        @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
-        void main(void)
-        {
-            vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + millis*2.0) - 0.5)), vvertex.w);
-            @(if (>= (strstr $arg1 "soft") 0) [result [
-                gl_Position = explosionmatrix * wobble;
+rotoscope = [
+    clearpostfx
+    if (>= $numargs 1) [addpostfx rotoscope 0 0 0 $arg1]
+    if (>= $numargs 2) [
+        if (= $arg2 1) [addpostfx hblur3; addpostfx vblur3]
+        if (= $arg2 2) [addpostfx hblur5; addpostfx vblur5]
+    ]
+]
 
-                texcoord3 = vec4(0.5*(gl_Position.xy + gl_Position.w), gl_Position.w, depthfxparams.y + gl_Position.w*depthfxparams.x);
-            ]] [result [
-                gl_Position = explosionmatrix * wobble;
-            ]])
+shader 0 "screenrect" [
+    attribute vec4 vvertex, vcolor;
+    @(screentexcoord 0)
+    varying vec2 texcoord0;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0;
+        color = vcolor;
+    }
+] [
+    varying vec2 texcoord0;
+    varying vec4 color;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        gl_FragColor = color * texture2D(tex0, texcoord0);
+    }
+]
+
+// bloom-ish
+
+lazyshader 0 "bloom_scale" (fsvs4) (fsps4 [
+    gl_FragColor = 0.2 * (s02 + s00 + s22 + s20 + color);
+])
+
+lazyshader 0 "bloom_init" (fsvs) (fsps [
+    float t = max(color.r, max(color.g, color.b));
+    gl_FragColor = t*t*color;
+])
+
+bloomshader = [
+  defershader 0 $arg1 [
+    forceshader "bloom_scale"
+    forceshader "bloom_init"
+    shader 0 @arg1 [
+        attribute vec4 vvertex;
+        @(screentexcoord 0)
+        varying vec2 texcoord0;
+        void main(void)
+        {
+            gl_Position = vvertex;
+            texcoord0 = vtexcoord0;
+        }
+    ] [
+        uniform vec4 params;
+        varying vec2 texcoord0;
+        uniform sampler2D tex0 @@(loopconcat i $arg2 [result [, tex@(+ $i 1)]]);
+        void main(void)
+        {
+            vec4 sample = texture2D(tex0, texcoord0);
+            @@(loopconcat i $arg2 [result [
+                @(? $i "bloom +=" "vec4 bloom =") texture2D(tex@(+ $i 1), texcoord0);
+            ]])
+            gl_FragColor = bloom*params.x + sample;
+        }
+    ]
+  ]
+]
+
+bloomshader bloom1 1
+bloomshader bloom2 2
+bloomshader bloom3 3
+bloomshader bloom4 4
+bloomshader bloom5 5
+bloomshader bloom6 6
+
+setupbloom = [
+    addpostfx bloom_init 1 1 "+0"
+    loop i (- $arg1 1) [
+        addpostfx bloom_scale (+ $i 2) (+ $i 2) (concatword "+" (+ $i 1))
+    ]
+    addpostfx (concatword bloom $arg1) 0 0 (loopconcat i (+ $arg1 1) [result $i]) $arg2
+]
+
+bloom = [
+    clearpostfx
+    if (>= $numargs 1) [setupbloom 6 $arg1]
+]
+
+////////////////////////////////////////////////
+//
+// miscellaneous effect shaders:
+//
+////////////////////////////////////////////////
+
+// wobbles the vertices of an explosion sphere
+// and generates all texcoords
+// and blends the edge color
+// and modulates the texture
+explosionshader = [
+    shader 0 $arg1 [
+        //:fog
+        attribute vec4 vvertex, vcolor;
+        attribute vec2 vtexcoord0;
+        uniform mat4 explosionmatrix;
+        uniform vec3 center;
+        uniform float millis;
+        uniform vec3 texgenS, texgenT;
+        varying vec4 color;
+        varying vec2 texcoord0, texcoord1, texcoord2;
+        @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
+        void main(void)
+        {
+            vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + millis*2.0) - 0.5)), vvertex.w);
+            @(if (>= (strstr $arg1 "soft") 0) [result [
+                gl_Position = explosionmatrix * wobble;
+
+                texcoord3 = vec4(0.5*(gl_Position.xy + gl_Position.w), gl_Position.w, depthfxparams.y + gl_Position.w*depthfxparams.x);
+            ]] [result [
+                gl_Position = explosionmatrix * wobble;
+            ]])
 
             color = vcolor;
 
@@ -1031,6 +1726,15 @@ explosionshader = [
             vec2 dtc = texcoord0 + texture2D(tex0, texcoord2).xy*0.1; // use color texture as noise to distort texcoords
             vec4 diffuse = texture2D(tex0, dtc);
             float blend = max(pow(clamp(1.0 - dot(texcoord1, texcoord1), 0.0, 1.0), blendparams.x), blendparams.y);
+            @(if (>= (strstr $arg1 "glare") 0) [result [
+                float k = blend*blend;
+                diffuse.rgb *= k*8.0;
+                diffuse.a *= k;
+                diffuse.b += k*k;
+            ]] [result [
+                diffuse *= blend*4.0; // dup alpha into RGB channels + intensify and over saturate
+                diffuse.b += 0.5 - blend*0.5; // blue tint
+            ]])
 
             @(if (>= (strstr $arg1 "soft") 0) [result [
                 gl_FragColor.rgb = diffuse.rgb * color.rgb;
@@ -1049,7 +1753,7 @@ explosionshader = [
     ]
 ]
 
-looplist i ["" "soft" "soft8"] [
+looplist i ["" "glare" "soft" "soft8"] [
     explosionshader [explosion@i]
 ]
 
@@ -1127,6 +1831,28 @@ looplist i ["" "soft" "soft8"] [
     particleshader [particle@i]
 ]
 
+shader 0 "blendbrush" [
+    attribute vec4 vvertex, vcolor;
+    uniform mat4 camprojmatrix;
+    uniform vec4 texgenS, texgenT;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        texcoord0 = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex));
+    }
+] [
+    varying vec4 color;
+    varying vec2 texcoord0;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        gl_FragColor = texture2D(tex0, texcoord0).r * color;
+    }
+]
+
 lazyshader 0 "prefab" [
     attribute vec4 vvertex, vcolor;
     attribute vec3 vnormal;
@@ -1148,6 +1874,752 @@ lazyshader 0 "prefab" [
     }
 ]
 
+lazyshader 0 "moviergb" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0;
+    }
+] [
+    varying vec2 texcoord0;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        gl_FragColor = texture2D(tex0, texcoord0);
+    }
+]
+
+lazyshader 0 "movieyuv" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0;
+    }
+] [
+    varying vec2 texcoord0;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        vec3 sample = texture2D(tex0, texcoord0).rgb;
+        gl_FragColor = vec4(dot(sample, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
+                            dot(sample, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961,
+                            dot(sample, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
+                            0.0);
+    }
+]
+
+lazyshader 0 "moviey" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    uniform vec2 moviescale;
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0 + vec2(-1.5, 0.0)*moviescale;
+        texcoord1 = vtexcoord0 + vec2(-0.5, 0.0)*moviescale;
+        texcoord2 = vtexcoord0 + vec2( 0.5, 0.0)*moviescale;
+        texcoord3 = vtexcoord0 + vec2( 1.5, 0.0)*moviescale;
+    }
+] [
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        vec3 sample1 = texture2D(tex0, texcoord0).rgb;
+        vec3 sample2 = texture2D(tex0, texcoord1).rgb;
+        vec3 sample3 = texture2D(tex0, texcoord2).rgb;
+        vec3 sample4 = texture2D(tex0, texcoord3).rgb;
+        gl_FragColor = vec4(dot(sample3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
+                            dot(sample2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
+                            dot(sample1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
+                            dot(sample4, vec3(0.256788, 0.504125, 0.097905)) + 0.062745);
+    }
+]
+
+lazyshader 0 "movieu" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    uniform vec2 moviescale;
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
+        texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
+        texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
+        texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
+    }
+] [
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        vec3 sample1 = texture2D(tex0, texcoord0).rgb;
+        vec3 sample2 = texture2D(tex0, texcoord1).rgb;
+        vec3 sample3 = texture2D(tex0, texcoord2).rgb;
+        vec3 sample4 = texture2D(tex0, texcoord3).rgb;
+        gl_FragColor = vec4(dot(sample3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
+                            dot(sample2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
+                            dot(sample1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
+                            dot(sample4, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961);
+    }
+]
+
+lazyshader 0 "moviev" [
+    attribute vec4 vvertex;
+    @(screentexcoord 0)
+    uniform vec2 moviescale;
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    void main(void)
+    {
+        gl_Position = vvertex;
+        texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
+        texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
+        texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
+        texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
+    }
+] [
+    varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        vec3 sample1 = texture2D(tex0, texcoord0).rgb;
+        vec3 sample2 = texture2D(tex0, texcoord1).rgb;
+        vec3 sample3 = texture2D(tex0, texcoord2).rgb;
+        vec3 sample4 = texture2D(tex0, texcoord3).rgb;
+        gl_FragColor = vec4(dot(sample3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
+                            dot(sample2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
+                            dot(sample1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
+                            dot(sample4, vec3(0.439216, -0.367788, -0.071427)) + 0.501961);
+    }
+]
+
+///////////////////////////////////////////////////
+//
+// reflective/refractive water shaders:
+//
+///////////////////////////////////////////////////
+
+watershader = [
+    specular = $arg2
+    rgbfog = $arg3
+    distort = $arg4
+    combine = $arg5
+    lazyshader 0 $arg1 [
+        attribute vec4 vvertex;
+        attribute vec3 vcolor;
+        uniform mat4 camprojmatrix;
+        uniform vec3 camera;
+        uniform mat4 watermatrix;
+        uniform float waterheight;
+        uniform float millis;
+        @(if $specular [result [uniform vec3 lightpos; varying vec3 lightdir;]])
+        varying vec3 camdir, color;
+        varying vec4 texcoord0;
+        varying vec2 texcoord1, texcoord2;
+        void main(void)
+        {
+            gl_Position = camprojmatrix * vvertex;
+            color = vcolor;
+            texcoord0 = watermatrix * vvertex;
+            @(if (>= (strstr $arg1 "underwater") 0) [result [
+                texcoord0.z = waterheight - vvertex.z;
+            ]] [result [
+                texcoord0.z = vvertex.z - waterheight;
+            ]])
+            vec2 tc = vvertex.xy * 0.02;
+            texcoord1 = tc + millis*0.05;
+            texcoord2 = tc - millis*0.03;
+            camdir = camera - vvertex.xyz;
+            @(if $specular [result [
+                lightdir = lightpos - vvertex.xyz;
+            ]])
+        }
+    ] [
+        @(if $rgbfog [result [
+            //:fog
+        ]] [result [
+            //:fogrgba vec4(vec3(0.0), 1.0)
+        ]])
+        uniform vec2 depth;
+        @(if $specular [result [uniform vec3 lightcolor; uniform float lightradius; varying vec3 lightdir;]])
+        varying vec3 camdir, color;
+        varying vec4 texcoord0;
+        varying vec2 texcoord1, texcoord2;
+        @(if (>= (strstr $arg1 "env") 0) [result [
+            uniform samplerCube tex0;
+        ]] [result [
+            uniform sampler2D tex0;
+        ]])
+        uniform sampler2D tex1, tex2, tex3;
+        void main(void)
+        {
+            vec3 camvec = normalize(camdir);
+            @(if $specular [result [
+                vec3 lightvec = normalize(lightdir);
+                vec3 halfangle = normalize(camvec + lightvec);
+            ]])
+
+            vec2 dudv = texture2D(tex2, texcoord1).xy*2.0 - 1.0;
+
+            @distort
+
+            @(if $specular [result [
+                float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), 96.0);
+                vec3 light = lightcolor * (1.0 - clamp(length(lightdir)/lightradius, 0.0, 1.0));
+            ]])
+
+            @combine
+        }
+    ]
+]
+
+watershader "waterglare" 1 1 [
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    gl_FragColor = vec4(light*spec*spec*32.0, 0.0);
+]
+lazyshader 0 "waterglarefast" [
+    //:fog
+    attribute vec4 vvertex;
+    uniform mat4 camprojmatrix;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+    }
+] [
+    void main(void)
+    {
+        gl_FragColor = vec4(0.0);
+    }
+]
+fastshader waterglare waterglarefast 2
+altshader waterglare waterglarefast
+
+lazyshader 0 "underwater" [
+    attribute vec4 vvertex;
+    attribute vec3 vcolor;
+    uniform mat4 camprojmatrix;
+    varying vec3 color;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+    }
+] [
+    //:fogrgba vec4(vec3(0.0), 1.0)
+    uniform vec2 depth;
+    varying vec3 color;
+    void main(void)
+    {
+        gl_FragColor.rgb = 0.8*depth.x*color;
+        gl_FragColor.a = 0.5*depth.y;
+    }
+]
+
+watershader "underwaterrefract" 0 1 [
+    dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
+
+    gl_FragColor = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv);
+] []
+watershader "underwaterrefractfast" 0 1 [
+    gl_FragColor = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0));
+] []
+fastshader underwaterrefract underwaterrefractfast 2
+altshader underwaterrefract underwaterrefractfast
+
+watershader "underwaterfade" 0 1 [
+    dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
+
+    vec2 projtc = texcoord0.xy/texcoord0.w;
+    float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
+    gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
+    gl_FragColor.rgb = texture2D(tex3, projtc + 0.007*dudv).rgb;
+] []
+watershader "underwaterfadefast" 0 1 [
+    gl_FragColor.rgb = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
+    gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
+] []
+fastshader underwaterfade underwaterfadefast 2
+altshader underwaterfade underwaterfadefast
+
+watershader "water" 1 0 [
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5) + spec*light;
+    gl_FragColor.a = invfresnel*depth.y;
+]
+watershader "waterfast" 0 0 [
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5);
+    gl_FragColor.a = invfresnel*depth.y;
+]
+fastshader water waterfast 1
+altshader water waterfast
+
+watershader "waterreflect" 1 0 [
+    vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
+    gl_FragColor.a = invfresnel*depth.y;
+]
+watershader "waterreflectfast" 0 0 [
+    vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
+    gl_FragColor.a = invfresnel*depth.y;
+]
+fastshader waterreflect waterreflectfast 2
+altshader waterreflect waterreflectfast
+
+watershader "waterrefract" 1 1 [
+    vec2 dtc = texcoord2 + 0.025*dudv;
+    vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
+    dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
+
+    vec2 rtc = texcoord0.xy/texcoord0.w + 0.007*dudv;
+    vec3 reflect = texture2D(tex0, rtc).rgb;
+    vec3 refract = texture2D(tex3, rtc).rgb;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
+]
+watershader "waterrefractfast" 0 1 [
+    vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
+    vec3 reflect = texture2DProj(tex0, rtc).rgb;
+    vec3 refract = texture2DProj(tex3, rtc).rgb;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
+]
+fastshader waterrefract waterrefractfast 2
+altshader waterrefract waterrefractfast
+
+watershader "waterfade" 1 1 [
+    vec2 dtc = texcoord2 + 0.025*dudv;
+    vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
+    dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
+
+    vec2 projtc = texcoord0.xy/texcoord0.w;
+    vec2 rtc = projtc + 0.007*dudv;
+    vec3 reflect = texture2D(tex0, rtc).rgb;
+    vec3 refract = texture2D(tex3, rtc).rgb;
+    float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
+    gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
+]
+watershader "waterfadefast" 0 1 [
+    vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
+    vec3 reflect = texture2DProj(tex0, rtc).rgb;
+    vec3 refract = texture2DProj(tex3, rtc).rgb;
+    gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+] [
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
+]
+fastshader waterfade waterfadefast 2
+altshader waterfade waterrefract
+
+watershader "waterenv" 1 0 [
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
+    gl_FragColor.a = invfresnel*depth.y;
+]
+watershader "waterenvfast" 0 0 [
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
+    gl_FragColor.a = invfresnel*depth.y;
+]
+fastshader waterenv waterenvfast 2
+altshader waterenv waterenvfast
+
+watershader "waterenvrefract" 1 1 [
+    vec2 dtc = texcoord2 + 0.025*dudv;
+    vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
+    dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
+
+    vec3 refract = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv).rgb;
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
+]
+watershader "waterenvrefractfast" 0 1 [
+    vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
+]
+fastshader waterenvrefract waterenvrefractfast 2
+altshader waterenvrefract waterenvrefractfast
+
+watershader "waterenvfade" 1 1 [
+    vec2 dtc = texcoord2 + 0.025*dudv;
+    vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
+    dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
+
+    vec2 projtc = texcoord0.xy/texcoord0.w;
+    vec3 refract = texture2D(tex3, projtc + 0.007*dudv).rgb;
+    float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
+    gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
+
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
+]
+watershader "waterenvfadefast" 0 1 [
+    vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
+    gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
+    vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
+    float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
+    vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
+] [
+    gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
+]
+fastshader waterenvfade waterenvfadefast 2
+altshader waterenvfade waterenvrefract
+
+causticshader = [
+    lazyshader 0 $arg1 [
+        attribute vec4 vvertex;
+        uniform mat4 camprojmatrix;
+        uniform vec3 texgenS, texgenT;
+        varying vec2 texcoord0;
+        void main(void)
+        {
+            gl_Position = camprojmatrix * vvertex;
+            texcoord0 = vec2(dot(texgenS, vvertex.xyz), dot(texgenT, vvertex.xyz));
+        }
+    ] [
+        //:fog vec3(1.0)
+        uniform vec4 frameblend;
+        varying vec2 texcoord0;
+        uniform sampler2D tex0, tex1;
+        void main(void)
+        {
+            @arg2
+        }
+    ]
+]
+causticshader caustic [
+    gl_FragColor = vec4(vec3(frameblend.x*texture2D(tex0, texcoord0).r + frameblend.y*texture2D(tex1, texcoord0).r + frameblend.w), 1.0);
+]
+
+lazyshader 0 "lava" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec3 vnormal;
+    uniform mat4 camprojmatrix;
+    varying vec4 color;
+    uniform vec4 lavatexgen;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
+        texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
+    }
+] [
+    uniform sampler2D tex0;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_FragColor = color * texture2D(tex0, texcoord0) * 2.0;
+    }
+]
+
+lazyshader 0 "lavaglare" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec3 vnormal;
+    uniform mat4 camprojmatrix;
+    varying vec4 color;
+    uniform vec4 lavatexgen;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vec4(vcolor.rgb*2.0 - 1.0, vcolor.a);
+        vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
+        texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
+    }
+] [
+    uniform sampler2D tex0;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        vec4 glow = texture2D(tex0, texcoord0) * color;
+        float k = max(glow.r, max(glow.g, glow.b));
+        gl_FragColor = glow*k*k*32.0;
+    }
+]
+
+lazyshader 0 "waterfall" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec3 vnormal;
+    uniform mat4 camprojmatrix;
+    varying vec4 color;
+    uniform vec4 waterfalltexgen;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
+        texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
+    }
+] [
+    uniform sampler2D tex0;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_FragColor = color * texture2D(tex0, texcoord0);
+    }
+]
+
+lazyshader 0 "waterfallrefract" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec3 vnormal;
+    uniform mat4 camprojmatrix;
+    uniform mat4 watermatrix;
+    varying vec4 color;
+    uniform vec4 waterfalltexgen;
+    varying vec2 texcoord0;
+    varying vec4 texcoord1;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
+        texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
+        texcoord1 = watermatrix * vvertex;
+    }
+] [
+    uniform vec2 dudvoffset;
+    uniform sampler2D tex0, tex2, tex4;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    varying vec4 texcoord1;
+    void main(void)
+    {
+        vec4 diffuse = texture2D(tex0, texcoord0);
+        vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
+        vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
+        gl_FragColor = mix(refract, color, diffuse);
+    }
+]
+
+lazyshader 0 "waterfallenvrefract" [
+    //:fog
+    attribute vec4 vvertex, vcolor;
+    attribute vec3 vnormal;
+    uniform mat4 camprojmatrix;
+    uniform mat4 watermatrix;
+    uniform vec3 camera;
+    varying vec4 color;
+    uniform vec4 waterfalltexgen;
+    varying vec2 texcoord0;
+    varying vec4 texcoord1;
+    varying vec3 camdir;
+    varying mat3 world;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        camdir = camera - vvertex.xyz;
+        vec3 absnorm = abs(vnormal);
+        world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
+        vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
+        texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
+        texcoord1 = watermatrix * vvertex;
+    }
+] [
+    uniform vec2 dudvoffset;
+    uniform sampler2D tex0, tex1, tex2, tex4;
+    uniform samplerCube tex3;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    varying vec4 texcoord1;
+    varying vec3 camdir;
+    varying mat3 world;
+    void main(void)
+    {
+        vec4 diffuse = texture2D(tex0, texcoord0);
+        vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
+        vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
+        vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
+        vec3 camvec = normalize(camdir);
+        float invfresnel = dot(normal, camvec);
+        vec4 reflect = textureCube(tex3, 2.0*invfresnel*normal - camvec);
+        gl_FragColor = mix(mix(reflect, refract, 1.0 - 0.4*step(0.0, invfresnel)), color, diffuse);
+    }
+]
+altshader waterfallenvrefract waterfallrefract
+
+lazyshader 0 "waterfallenv" [
+    //:fog
+    attribute vec4 vvertex;
+    attribute vec3 vcolor, vnormal;
+    uniform mat4 camprojmatrix;
+    uniform vec3 camera;
+    uniform vec4 waterfalltexgen;
+    varying vec2 texcoord0;
+    varying vec3 color, camdir;
+    varying mat3 world;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        camdir = camera - vvertex.xyz;
+        vec3 absnorm = abs(vnormal);
+        world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
+        vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
+        texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
+    }
+] [
+    uniform vec2 dudvoffset;
+    uniform sampler2D tex0, tex1, tex2;
+    uniform samplerCube tex3;
+    varying vec2 texcoord0;
+    varying vec3 color, camdir;
+    varying mat3 world;
+    void main(void)
+    {
+        vec4 diffuse = texture2D(tex0, texcoord0);
+        vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
+        vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
+        vec3 camvec = normalize(camdir);
+        vec4 reflect = textureCube(tex3, 2.0*dot(normal, camvec)*normal - camvec);
+        gl_FragColor.rgb = mix(reflect.rgb, color, diffuse.rgb);
+        gl_FragColor.a = 0.25 + 0.75*diffuse.r;
+    }
+]
+
+lazyshader 0 "glass" [
+    attribute vec4 vvertex;
+    attribute vec3 vcolor, vnormal;
+    uniform mat4 camprojmatrix;
+    uniform vec3 camera;
+    varying vec3 color, rvec, camdir, normal;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        normal = vnormal;
+        camdir = camera - vvertex.xyz;
+        rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
+    }
+] [
+    //:fogrgba vec4(vec3(0.0), 1.0)
+    uniform samplerCube tex0;
+    varying vec3 color, rvec, camdir, normal;
+    void main(void)
+    {
+        vec3 camvec = normalize(camdir);
+        vec3 reflect = textureCube(tex0, rvec).rgb;
+
+        float invfresnel = max(dot(camvec, normal), 0.70);
+        gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
+        gl_FragColor.a = invfresnel * 0.95;
+    }
+]
+lazyshader 0 "glassfast" [
+    attribute vec4 vvertex;
+    attribute vec3 vcolor, vnormal;
+    uniform mat4 camprojmatrix;
+    uniform vec3 camera;
+    varying vec3 color, rvec;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        vec3 camdir = camera - vvertex.xyz;
+        rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
+    }
+] [
+    //:fogrgba vec4(vec3(0.0), 1.0)
+    uniform samplerCube tex0;
+    varying vec3 color, rvec;
+    void main(void)
+    {
+        vec3 reflect = textureCube(tex0, rvec).rgb;
+        const float invfresnel = 0.75;
+        gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
+        gl_FragColor.a = invfresnel * 0.95;
+    }
+]
+fastshader glass glassfast 2
+altshader glass glassfast
+
+lazyshader 0 "grass" [
+    attribute vec4 vvertex, vcolor;
+    attribute vec2 vtexcoord0, vtexcoord1;
+    attribute vec4 vtangent;
+    uniform mat4 camprojmatrix;
+    uniform vec3 camera;
+    uniform vec3 grassmargin;
+    varying vec4 color;
+    varying vec2 texcoord0, texcoord1;
+    varying vec2 bounds;
+    void main(void)
+    {
+        gl_Position = camprojmatrix * vvertex;
+        color = vcolor;
+        texcoord0 = vtexcoord0;
+        texcoord1 = vtexcoord1 * @lmcoordscale;
+        vec2 camdir = (camera.xy - vvertex.xy) * grassmargin.y;
+        bounds = vec2(dot(camdir, vtangent.xy), dot(camdir, vtangent.zw)) + grassmargin.z;
+    }
+] [
+    //:fogrgba vec4(0.0)
+    varying vec4 color;
+    varying vec2 texcoord0, texcoord1;
+    varying vec2 bounds;
+    uniform sampler2D tex0, tex1;
+    void main(void)
+    {
+        vec4 diffuse = texture2D(tex0, texcoord0);
+        diffuse.rgb *= 2.0;
+        vec4 lm = texture2D(tex1, texcoord1) * color;
+        lm.rgb *= lm.a;
+        float margin = clamp(min(bounds.x, bounds.y), 0.0, 1.0);
+        gl_FragColor = diffuse * lm * margin;
+    }
+]
+
 shader 0 "overbrightdecal" [
     attribute vec4 vvertex, vcolor;
     attribute vec2 vtexcoord0;
@@ -1161,6 +2633,7 @@ shader 0 "overbrightdecal" [
         texcoord0 = vtexcoord0;
     }
 ] [
+    //:fog vec3(0.5)
     varying vec4 color;
     varying vec2 texcoord0;
     uniform sampler2D tex0;
@@ -1172,6 +2645,7 @@ shader 0 "overbrightdecal" [
 ]
 
 shader 0 "saturatedecal" [
+    //:fog
     attribute vec4 vvertex, vcolor;
     attribute vec2 vtexcoord0;
     uniform mat4 camprojmatrix;
@@ -1194,3 +2668,135 @@ shader 0 "saturatedecal" [
         gl_FragColor = diffuse * color;
     }
 ]
+
+shader 0 "skybox" [
+    attribute vec4 vvertex, vcolor;
+    attribute vec2 vtexcoord0;
+    uniform mat4 skymatrix;
+    varying vec2 texcoord0;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = skymatrix * vvertex;
+        texcoord0 = vtexcoord0;
+        color = vcolor;
+    }
+] [
+    varying vec2 texcoord0;
+    varying vec4 color;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        gl_FragColor = color * texture2D(tex0, texcoord0);
+    }
+]
+
+shader 0 "skyboxglare" [
+    attribute vec4 vvertex, vcolor;
+    attribute vec2 vtexcoord0;
+    uniform mat4 skymatrix;
+    varying vec4 color;
+    varying vec2 texcoord0;
+    void main(void)
+    {
+        gl_Position = skymatrix * vvertex;
+        color = vcolor;
+        texcoord0 = vtexcoord0;
+    }
+] [
+    varying vec4 color;
+    varying vec2 texcoord0;
+    uniform sampler2D tex0;
+    void main(void)
+    {
+        vec4 glare = texture2D(tex0, texcoord0) * color;
+        gl_FragColor.rgb = vec3(dot(glare.rgb, vec3(10.56, 10.88, 10.56)) - 30.4);
+        gl_FragColor.a = glare.a;
+    }
+]
+
+shader 0 "skyfog" [
+    attribute vec4 vvertex, vcolor;
+    uniform mat4 skymatrix;
+    varying vec4 color;
+    void main(void)
+    {
+        gl_Position = skymatrix * vvertex;
+        color = vcolor;
+    }
+] [
+    varying vec4 color;
+    void main(void)
+    {
+        gl_FragColor = color;
+    }
+]
+
+loop i 2 [
+  lazyshader 0 (? $i "atmosphereglare" "atmosphere") [
+    attribute vec4 vvertex;
+    uniform mat4 skymatrix;
+    varying vec3 camvec;
+    void main(void)
+    {
+        gl_Position = skymatrix * vvertex;
+
+        camvec = vvertex.xyz;
+    }
+  ] [
+    uniform vec4 sunlight;
+    uniform vec3 sundir;
+    uniform vec3 sunweight;
+    uniform vec3 sundiskcolor;
+    uniform vec2 sundiskparams;
+    uniform vec4 opticaldepthparams;
+    uniform vec3 mieparams;
+    uniform vec3 betarayleigh, betamie, betaozone;
+    varying vec3 camvec;
+
+    void main(void)
+    {
+        vec3 camdir = normalize(camvec);
+        float costheta = dot(camdir, sundir);
+
+        // sun disk
+        float edgeoffset = max(1.0 - (1.0 - max(costheta, 0.0)*costheta)*sundiskparams.x, 0.0);
+        // limb darken with distance to edge
+        float limbdarken = sqrt(edgeoffset);
+        // lighten edges for corona, but limit it to not interfere with limb darkening
+        float corona = min(edgeoffset * sundiskparams.y, 1.0);
+        corona = max(0.75 / (1.5 - corona * corona) - 0.5, 0.0);
+        // apply limb darkening and corona to clamped sunlight color
+        vec3 sundisk = sundiskcolor * limbdarken * corona;
+
+        // optical depth along view ray
+        float offset = camdir.z*opticaldepthparams.w;
+        vec3 depth = sqrt(offset*offset + opticaldepthparams.xyz) - offset;
+        vec3 rayleighweight = betarayleigh * depth.x;
+        vec3 mieweight = betamie * depth.y;
+        vec3 ozoneweight = betaozone * (depth.z - depth.x);
+
+        // extinction of light along view ray
+        vec3 viewweight = sunweight - (rayleighweight + mieweight + ozoneweight);
+        vec3 extinction = (exp2(viewweight) - 1.0) / viewweight;
+
+        @(? $i [
+            // only glare sundisk, excluding other scattering
+            // squared (by skipping gamma encode) to limit it
+            gl_FragColor = vec4(sundisk * extinction, sunlight.a);
+        ] [
+            // calculate in-scattering
+            float rphase = (1.5 + 0.5*costheta*costheta) * (3.0 / (16.0 * 3.14159265));
+            float mphase = inversesqrt(mieparams.x + mieparams.y*min(costheta, mieparams.z));
+            vec3 scatter = rayleighweight * rphase + mieweight * (mphase * mphase * mphase);
+
+            // combine scattering and extinction with sundisk
+            vec3 inscatter = (sunlight.rgb * scatter + sundisk) * extinction;
+
+            // gamma encode
+            gl_FragColor = vec4(sqrt(inscatter), sunlight.a);
+        ])
+    }
+  ]
+]
+
diff --git a/packages/hud/damage.png b/packages/hud/damage.png
deleted file mode 100644 (file)
index 77fef80..0000000
Binary files a/packages/hud/damage.png and /dev/null differ
diff --git a/packages/models/health/iqm.cfg b/packages/models/health/iqm.cfg
deleted file mode 100644 (file)
index f492fcd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-iqmload model.iqm\r
-iqmskin * "diffuse.png" "mask.png"\r
-iqmbumpmap * "normal.png"\r
-iqmalphatest Cylinder01\r
-iqmalphatest Cylinder02\r
-iqmalphatest Cylinder03\r
-iqmskin Cylinder01 "overlay_diffuse.png" "overlay_mask.png"\r
-iqmskin Cylinder02 "overlay_diffuse.png" "overlay_mask.png"\r
-iqmskin Cylinder03 "overlay_diffuse.png" "overlay_mask.png"\r
-mdlambient 40\r
-mdlspec 120\r
-mdlscale 75\r
diff --git a/packages/models/health/md3.cfg b/packages/models/health/md3.cfg
new file mode 100644 (file)
index 0000000..a26ea6d
--- /dev/null
@@ -0,0 +1,12 @@
+md3load model.md3\r
+md3skin * "diffuse.png" "mask.png"\r
+md3bumpmap * "normal.png"\r
+md3alphatest Cylinder01\r
+md3alphatest Cylinder02\r
+md3alphatest Cylinder03\r
+md3skin Cylinder01 "overlay_diffuse.png" "overlay_mask.png"\r
+md3skin Cylinder02 "overlay_diffuse.png" "overlay_mask.png"\r
+md3skin Cylinder03 "overlay_diffuse.png" "overlay_mask.png"\r
+mdlambient 40\r
+mdlspec 120\r
+mdlscale 75\r
diff --git a/packages/models/health/model.iqm b/packages/models/health/model.iqm
deleted file mode 100644 (file)
index 3824f0a..0000000
Binary files a/packages/models/health/model.iqm and /dev/null differ
diff --git a/packages/models/health/model.md3 b/packages/models/health/model.md3
new file mode 100644 (file)
index 0000000..06419c9
Binary files /dev/null and b/packages/models/health/model.md3 differ
index 86b23d916a03cb2566e4346d32f4f4a6c3e4befa..09499a4ba65029319514283d99f2cdbd28a9e922 100644 (file)
@@ -10,7 +10,6 @@ md5load "chaing.md5mesh"
 md5skin minigun "m134.png" "m134_mask.png"// .6 .2
 md5bumpmap minigun "m134_normals.png"
 md5spec minigun 200
-md5glare minigun 0.5 1
 md5tag Muzzle_Flash tag_muzzle
 md5adjust Root 0 0 0      -0.75 0.5 0.1
 md5anim "gun idle" "chaing_idle.md5anim"
index 1ef74dc58dc8ac0497f05f331e914ef99c551c5a..77bb526165926134f50cff8591a9a8b3cf8e8c6f 100644 (file)
@@ -21,7 +21,6 @@ md5anim "gun shoot" "hands_saw_attack.md5anim" 15
 md5load "chainsaw.md5mesh"
 md5skin chainsaw "chainsaw.png" "chainsaw_mask.png" .2 .05
 md5bumpmap chainsaw "chainsaw_normals.png"
-md5glare chainsaw 0.5 1
 md5anim "gun idle" "chainsaw_idle.md5anim"
 md5anim "gun shoot" "chainsaw_attack.md5anim" 120
 
index 6aa7dbdffe81640eeb24db3708f68f39fb8e75fd..a45a2d5f17ae6ff181952c3e39996563838d4a45 100644 (file)
@@ -8,8 +8,6 @@ md5anim "gun shoot" "hands_gl_shoot.md5anim" 35
 md5load "gl.md5mesh"
 md5skin gl "gl.png" "gl_mask.png"
 md5bumpmap gl "gl_normals.png"
-//md5spec gl 200
-md5glare gl 0.5 1
 md5tag Muzzle_Flash tag_muzzle
 md5anim "gun idle" "gl_idle.md5anim"
 md5anim "gun shoot" "gl_shoot.md5anim" 35
index 55fde7c8a8af4ba93e19c742e4d40a62df8a3be1..c2b45794785d1d65116c1093a660f61a2b95247f 100644 (file)
@@ -15,7 +15,5 @@ md5anim "gun shoot" "revolver_shoot.md5anim" 18
 
 md5link 0 1 tag_weapon
 mdlscale 300
-//mdltrans 1.75 .25 -1 //-1.5
-//mdltrans 1.75 -0.25 -1.25
 mdltrans 1.2 -1.2 -1.0
 
index 12c36233986ec0062967db8f3fb360da2d750c7c..9078554d5467cea0d368500f7b6d9ddb6b3fa6ee 100644 (file)
@@ -10,15 +10,12 @@ md5load "rifle.md5mesh"
 md5skin rifle "sniper.png" "sniper_mask.png"
 md5bumpmap rifle "sniper_normals.png"
 md5spec rifle 150
-md5glare rifle 0.5 1
 md5tag muzzle_flash tag_muzzle
 md5anim "gun idle" "rifle_idle.md5anim"
 md5anim "gun shoot" "rifle_shoot.md5anim" 60
 
 md5link 0 1 tag_bicep
 mdlscale 300
-//mdltrans 2.7 .65 -0.95
-//mdltrans 3 0.95 -1.15
 mdltrans 1.0 -2.0 -0.3
 
 
index 38bb4c161a27ef47d3bc0bde14d007cbb78b946e..0deb01324cdfe774244c85ee73933bff402704b0 100644 (file)
@@ -14,7 +14,6 @@ md5anim "gun shoot" "hands_rl_shoot.md5anim" 26
 md5load "rl.md5mesh"
 md5skin rl "rl.png" "rl_mask.png"
 md5spec rl 50
-md5glare rl 0.5 1
 md5tag Flash tag_muzzle
 md5adjust Root 0 0 0 0.18 1.5 -2
 md5anim "gun idle" "rl_idle.md5anim"
index 8ffbec6e33ba9ee88cc6305ecb66ba80edef3241..f2d9fa742db98f39c96ca37d6cb8b67c0d8c3bf1 100644 (file)
@@ -8,8 +8,6 @@ md5anim "gun shoot" "hands_shotgun_shoot.md5anim" 50
 md5load "shotgun.md5mesh"
 md5skin shotgun "shotgun.png" "shotgun_mask.png"// .4 .15
 md5bumpmap shotgun "shotgun_normals.png"
-//md5spec shotgun 200
-md5glare shotgun 0.5 1
 md5skin "shell"  "shotgun_shell.png" "shotgun_shell_mask.png"// .4 .15
 md5bumpmap "shell" "shotgun_shell_normals.png"
 md5tag flash tag_muzzle
@@ -18,6 +16,4 @@ md5anim "gun shoot" "shotgun_attack.md5anim" 50
 
 md5link 0 1 tag_weapon
 mdlscale 300
-//mdltrans 3.5 .2 -1
-//mdltrans 3 0 -.5
 mdltrans 1.5 -1.85 -0.3
index 9d7295676b4f76a37d014f488c51d7d8c3249d8b..4a13e8033714855a6dbdb64c239e292d8d300673 100644 (file)
@@ -11,4 +11,3 @@ if (>= (strstr (mdlname) "blue") 0) [
 ]
 md5bumpmap "fixit_hands" "fixit_hands_normals.png"
 md5spec "fixit_hands" 100
-md5glare "fixit_hands" 0.5 1
index aa2a3e90145bdb0220325c4ef2b03c5f4234e010..10f8ab3393a3c6194a767332ea5d1ef03bb7595b 100644 (file)
Binary files a/packages/textures/evillair/light_u201_c.png and b/packages/textures/evillair/light_u201_c.png differ
index 3629b939624620a0850a0e3860dd8f6ec32f614d..08439b447298254a07342998ec6fb751a0252a78 100644 (file)
Binary files a/packages/textures/evillair/lightpanel_01_c.png and b/packages/textures/evillair/lightpanel_01_c.png differ
index e970b7825239b1ca795a708c7b32ccd1a2bb4dae..03d09d9bd2d32d01bbeefbb0c276fb4965a2fd8f 100644 (file)
@@ -1,22 +1,16 @@
-setshader bumpspecmapglowworld\r
-setshaderparam specscale 0.8 0.7 0.6\r
-setshaderparam glowcolor 1.0 0.6 0.1\r
+setshader "bumpspecmapworld"\r
+setshaderparam "specscale" 1.2 1.1 1.0\r
 \r
 texture c "textures/evillair/light_u201_c.png"\r
 texture n "textures/evillair/light_u201_n.png"\r
 texture s "textures/evillair/light_u201_s.png"\r
-texture g "textures/evillair/light_u201_g.png"\r
 texscale 0.5\r
 \r
 texture c "textures/evillair/lightpanel_01_c.png"\r
 texture n "textures/evillair/lightpanel_01_n.png"\r
 texture s "textures/evillair/lightpanel_01_s.png"\r
-texture g "textures/evillair/lightpanel_01_g.png"\r
 texscale 0.5\r
 \r
-setshader bumpspecmapworld\r
-setshaderparam specscale 1.2 1.1 1.0\r
-\r
 texture c "textures/evillair/clangfloor_01_c.png"\r
 texture n "textures/evillair/clangfloor_01_n.png"\r
 texture s "textures/evillair/clangfloor_01_s.png"\r
index e705e4b99b9ef3b4d5f437d241298f54a02fe825..a317dd55384c798772f9196bc4926b122e799f66 100644 (file)
@@ -349,13 +349,6 @@ static void insertlightmap(lightmapinfo &li, layoutinfo &si)
        }
 }
 
-static void copylightmap(lightmapinfo &li, layoutinfo &si)
-{
-       lightmaps[si.lmid-LMID_RESERVED].copy(si.x, si.y, li.colorbuf, si.w, si.h);
-       if((li.type&LM_TYPE)==LM_BUMPMAP0 && lightmaps.inrange(si.lmid+1-LMID_RESERVED))
-               lightmaps[si.lmid+1-LMID_RESERVED].copy(si.x, si.y, (uchar *)li.raybuf, si.w, si.h);
-}
-
 static inline bool htcmp(const lightmapinfo &k, const layoutinfo &v)
 {
        int kw = k.w, kh = k.h;
index d00e0e4b0ad2d1c841a44e07a5b46790189ac75b..5d264ed955158fc9b1bf3b69eea3cfb6d380de1a 100644 (file)
@@ -1270,6 +1270,9 @@ int main(int argc, char **argv)
                if(minimized) continue;
 
                inbetweenframes = false;
+
+               glClearColor(0,0,0,1);///TODO
+
                if(mainmenu) gl_drawmainmenu();
                else gl_drawframe();
                swapbuffers();
index b8a3f7f1688bd409b7c039c0c6d83b130f9a72ec..e29ccf5a50893adc361dc44752e56639aa6d96c1 100644 (file)
@@ -59,8 +59,6 @@ struct QuadNode {
        }
 };
 
-static float wfwave;
-
 static const bvec4 matnormals[6] = {
        bvec4(0x80, 0, 0),
        bvec4(0x7F, 0, 0),
@@ -366,7 +364,6 @@ void sortmaterials(vector<materialsurface *> &vismats)
                        materialsurface &m = va->matbuf[i];
                        if(!editmode || !showmat || drawtex)
                        {
-                               int matvol = 0;
                                if(m.visible == MATSURF_EDIT_ONLY) { i += m.skip; continue; }
                        }
                        vismats.add(&m);
@@ -413,7 +410,6 @@ void rendermaterials()
 
        glDisable(GL_CULL_FACE);
 
-       MSlot *mslot = NULL;
        int lastorient = -1, lastmat = -1;
        bool depth = true, blended = false;
 
index af8e9ecc30f3f63e18c14709fdf6a30797e1fe26..fb370886f9afe5b08bf244b95894431fa18d57a8 100644 (file)
@@ -2522,14 +2522,12 @@ void rendertexturepanel(int w, int h)
                        {
                                VSlot &vslot = lookupvslot(texmru[ti]), *layer = NULL;
                                Slot &slot = *vslot.slot;
-                               Texture *tex = slot.sts.empty() ? notexture : slot.sts[0].t, *layertex = NULL;
+                               Texture *tex = slot.sts.empty() ? notexture : slot.sts[0].t;
                                if(vslot.layer)
                                {
                                        layer = &lookupvslot(vslot.layer);
-                                       layertex = layer->slot->sts.empty() ? notexture : layer->slot->sts[0].t;
                                }
                                float sx = min(1.0f, tex->xs/(float)tex->ys), sy = min(1.0f, tex->ys/(float)tex->xs);
-                               int x = w*1800/h-s-50, r = s;
                                vec2 tc[4] = { vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1) };
                                float xoff = vslot.offset.x, yoff = vslot.offset.y;
                                if(vslot.rotation)
index 9253379a61b04c41ab06ab93e568a3ab5ad204a3..6b8a5b59730487bee21681d6c772784e6e8e0976 100644 (file)
@@ -1106,8 +1106,7 @@ int genmergedfaces(cube &c, const ivec &co, int size, int minlevel = -1)
                        while(tj >= 0 && tjoints[tj].edge < i*(MAXFACEVERTS+1)) tj = tjoints[tj].next;
                        if(tj >= 0 && tjoints[tj].edge < (i+1)*(MAXFACEVERTS+1)) mf.tjoints = tj;
 
-                       VSlot &vslot = lookupvslot(mf.tex, true),
-                                 *layer = vslot.layer && !(c.material&MAT_ALPHA) ? &lookupvslot(vslot.layer, true) : NULL;
+                       VSlot &vslot = lookupvslot(mf.tex, true);
 
                        if(surf.numverts&LAYER_TOP) vamerges[level].add(mf);
                        if(surf.numverts&LAYER_BOTTOM)
index 1e51c8187743fc17b573e0f8dfe2f81f9f097a99..4dac48c585ae35bae7a77d642a390af2f2b9e3b7 100644 (file)
@@ -446,7 +446,6 @@ void ragdolldata::move(dynent *pl, float ts)
        extern const float GRAVITY;
        if(collidemillis && lastmillis > collidemillis) return;
 
-       int material = lookupmaterial(vec(center.x, center.y, center.z + radius/2));
        pl->inwater = MAT_AIR;
 
        calcrotfriction();
index 08766a69d8f834fe69b54811305c1eaa784f7203..7489ff58b7b79d4f80646598bf4ccc7d3c8e4284 100644 (file)
@@ -579,8 +579,6 @@ void setcamprojmatrix(bool init = true, bool flush = false)
 
        GLOBALPARAM(camprojmatrix, camprojmatrix);
 
-       vec2 lineardepthscale = projmatrix.lineardepthscale();
-
        if(flush && Shader::lastshader) Shader::lastshader->flushparams();
 }
 
@@ -1026,22 +1024,6 @@ void hudquad(float x, float y, float w, float h, float tx, float ty, float tw, f
        HUDQUAD(x, y, x+w, y+h, tx, ty, tx+tw, ty+th);
 }
 
-static float findsurface(const vec &v, int &abovemat)
-{
-       ivec o(v), co;
-       int csize;
-       do
-       {
-               cube &c = lookupcube(o, 0, co, csize);
-               abovemat = (int) MAT_AIR;
-               return o.z;
-               o.z = co.z + csize;
-       }
-       while(o.z < worldsize);
-       abovemat = MAT_AIR;
-       return worldsize;
-}
-
 bool renderedgame = false;
 
 void rendergame(bool mainpass)
index 854f569732151899cc3d2ff5b9abb32d33b35d6e..1e33702fdf3c8bdc3e64f86d4689eab5d006421f 100644 (file)
@@ -1176,20 +1176,6 @@ void cleanupgeom(renderstate &cur)
        if(cur.vbuf) disablevbuf(cur);
 }
 
-static void rendergeommultipass(renderstate &cur, int pass)
-{
-       if(cur.vbuf) disablevbuf(cur);
-       if(!cur.vattribs) enablevattribs(cur, false);
-       cur.texgendim = -1;
-       for(vtxarray *va = visibleva; va; va = va->next)
-       {
-               if(!va->texs) continue;
-               if(va->occluded >= OCCLUDE_GEOM) continue;
-               renderva(cur, va, pass);
-       }
-       if(geombatches.length()) renderbatches(cur, pass);
-}
-
 VAR(oqgeom, 0, 1, 1);
 
 void rendergeom(void)
index 5e56e816c0158366547cc0234503570af7737dbc..67b9e425579a14dc46d3970500dec7eda7cc785b 100644 (file)
@@ -399,31 +399,6 @@ void GlobalShaderParamState::resetversions()
        });
 }
 
-static float *findslotparam(Slot &s, const char *name, float *noval = NULL)
-{
-       loopv(s.params)
-       {
-               SlotShaderParam &param = s.params[i];
-               if(name == param.name) return param.val;
-       }
-       loopv(s.shader->defaultparams)
-       {
-               SlotShaderParamState &param = s.shader->defaultparams[i];
-               if(name == param.name) return param.val;
-       }
-       return noval;
-}
-
-static float *findslotparam(VSlot &s, const char *name, float *noval = NULL)
-{
-       loopv(s.params)
-       {
-               SlotShaderParam &param = s.params[i];
-               if(name == param.name) return param.val;
-       }
-       return findslotparam(*s.slot, name, noval);
-}
-
 static inline void setslotparam(SlotShaderParamState &l, const float *val)
 {
        switch(l.format)
index 77eac65122d18e24ee8390b9d6a081f077331d9d..7f391a96a65815dab0ee7984dced759e1b5a9299 100644 (file)
@@ -2040,7 +2040,6 @@ int findslottex(const char *name)
 void texture(char *type, char *name, int *rot, int *xoffset, int *yoffset, float *scale)
 {
        if(slots.length()>=0x10000) return;
-       static int lastmatslot = -1;
        int tnum = findslottex(type);
        if(tnum<0) tnum = atoi(type);
        Slot &s = *(tnum!=TEX_DIFFUSE ? slots.last() : slots.add(new Slot(slots.length())));
index 4d5e178a332cdfe6897c92e11cb7e3245fd3fdac..4e309a8b819814d9898d16b14f7005534d2175fe 100644 (file)
@@ -70,22 +70,12 @@ bool loadents(const char *fname, vector<entity> &ents, uint *crc)
 
        string gametype;
        copystring(gametype, "fps");
-       bool samegame = true;
        int eif = 0;
-       {
-               int len = f->getchar();
-               f->read(gametype, len+1);
-       }
-       if(strcmp(gametype, game::gameident()))
-       {
-               samegame = false;
-               conoutf(CON_WARN, "WARNING: loading map from %s game, ignoring entities except for lights/mapmodels", gametype);
-       }
-       {
-               eif = f->getlil<ushort>();
-               int extrasize = f->getlil<ushort>();
-               f->seek(extrasize, SEEK_CUR);
-       }
+       int len = f->getchar();
+       f->read(gametype, len+1);
+       eif = f->getlil<ushort>();
+       int extrasize = f->getlil<ushort>();
+       f->seek(extrasize, SEEK_CUR);
 
        ushort nummru = f->getlil<ushort>();
        f->seek(nummru*sizeof(ushort), SEEK_CUR);
@@ -803,24 +793,14 @@ bool load_world(const char *mname, const char *cname)             // still supports all map
 
        string gametype;
        copystring(gametype, "fps");
-       bool samegame = true;
        int eif = 0;
-       {
-               int len = f->getchar();
-               f->read(gametype, len+1);
-       }
-       if(strcmp(gametype, game::gameident())!=0)
-       {
-               samegame = false;
-               conoutf(CON_WARN, "WARNING: loading map from %s game, ignoring entities except for lights/mapmodels", gametype);
-       }
-       {
-               eif = f->getlil<ushort>();
-               int extrasize = f->getlil<ushort>();
-               vector<char> extras;
-               f->read(extras.pad(extrasize), extrasize);
-               if(samegame) game::readgamedata(extras);
-       }
+       int len = f->getchar();
+       f->read(gametype, len+1);
+       eif = f->getlil<ushort>();
+       int extrasize = f->getlil<ushort>();
+       vector<char> extras;
+       f->read(extras.pad(extrasize), extrasize);
+       game::readgamedata(extras);
 
        texmru.shrink(0);
        ushort nummru = f->getlil<ushort>();
@@ -838,19 +818,7 @@ bool load_world(const char *mname, const char *cname)              // still supports all map
                f->read(&e, sizeof(entity));
                lilswap(&e.o.x, 3);
                lilswap(&e.attr1, 5);
-               if(samegame)
-               {
-                       if(einfosize > 0) f->read(ebuf, einfosize);
-               }
-               else
-               {
-                       if(eif > 0) f->seek(eif, SEEK_CUR);
-                       if(e.type>=ET_GAMESPECIFIC)
-                       {
-                               entities::deleteentity(ents.pop());
-                               continue;
-                       }
-               }
+               if(einfosize > 0) f->read(ebuf, einfosize);
                if(!insideworld(e.o))
                {
                        if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT)
@@ -864,7 +832,7 @@ bool load_world(const char *mname, const char *cname)               // still supports all map
        if(hdr.numents > MAXENTS)
        {
                conoutf(CON_WARN, "warning: map has %d entities", hdr.numents);
-               f->seek((hdr.numents-MAXENTS)*(samegame ? sizeof(entity) + einfosize : eif), SEEK_CUR);
+               f->seek((hdr.numents-MAXENTS)*(sizeof(entity) + einfosize), SEEK_CUR);
        }
 
        renderprogress(0, "loading slots...");
index 22e48d0da72e51d19325404712cc395ee4d1d114..30a1403bfd8b49eb4851448df6cfd0647f65198d 100644 (file)
@@ -19,7 +19,7 @@ namespace ai
                vec pos = o; pos.z += ai::JUMPMIN;
                if(!insideworld(vec(pos.x, pos.y, min(pos.z, getworldsize() - 1e-3f)))) return -2;
                float dist = raycube(pos, vec(0, 0, -1), 0, RAY_CLIPMAT);
-               int posmat = lookupmaterial(pos), weight = 1;
+               int weight = 1;
                if(dist >= 0)
                {
                        weight = int(dist/ai::JUMPMIN);
index e01acc271b7a8454afbce684d9a28c9e1a8e4738..a0ef7c802d40d58d72d93c3b5b546a4909e91c55 100644 (file)
@@ -1761,11 +1761,6 @@ struct matrix4
        vec4 roww() const { return vec4(a.w, b.w, c.w, d.w); }
 
        bool invert(const matrix4 &m, double mindet = 1.0e-12);
-
-       vec2 lineardepthscale() const
-       {
-               return vec2(d.w, -d.z).div(c.z*d.w - d.z*c.w);
-       }
 };
 
 inline matrix3::matrix3(const matrix4 &m)