Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const GLchar *vertSource = \
- "#version 110\n"
- "\n"
- "attribute vec3 Vert;\n"
- "attribute vec2 TexCoords;\n"
- "attribute vec2 LMCoords;\n"
- "\n"
- "varying float FogFragCoord;\n"
- "varying vec2 tc_tex; varying vec2 tc_lm;"
- "\n"
- "void main()\n"
- "{\n"
- " tc_tex = TexCoords;\n"
- " tc_lm = LMCoords;\n"
- " gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n"
- " FogFragCoord = gl_Position.w;\n"
- "}\n";
- const GLchar *fragSource = \
- "#version 110\n"
- "\n"
- "uniform sampler2D Tex;\n"
- "uniform sampler2D LMTex;\n"
- "uniform sampler2D FullbrightTex;\n"
- "uniform bool UseFullbrightTex;\n"
- "uniform bool UseOverbright;\n"
- "uniform bool UseAlphaTest;\n"
- "uniform float Alpha;\n"
- "\n"
- "varying float FogFragCoord;\n"
- "varying vec2 tc_tex; varying vec2 tc_lm;"
- "\n"
- "void main()\n"
- "{\n"
- " vec4 result = texture2D(Tex, tc_tex.xy);\n"
- " if (UseAlphaTest && (result.a < 0.666))\n"
- " discard;\n"
- " result *= texture2D(LMTex, tc_lm.xy);\n"
- " if (UseOverbright)\n"
- " result.rgb *= 2.0;\n"
- " if (UseFullbrightTex)\n"
- " result += texture2D(FullbrightTex, tc_tex.xy);\n"
- " result = clamp(result, 0.0, 1.0);\n"
- " float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
- " fog = clamp(fog, 0.0, 1.0);\n"
- " result = mix(gl_Fog.color, result, fog);\n"
- " result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
- " gl_FragColor = result;\n"
- "}\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement