24 lines
648 B
Lua
24 lines
648 B
Lua
return love.graphics.newShader[[
|
|
#define fog vec4( 0.85, 0.85, 1.0, 1.0 )
|
|
#define fogHigh vec4( 1.0, 1.0, 0.85, 1.0 )
|
|
varying float depth;
|
|
varying float height;
|
|
#ifdef VERTEX
|
|
uniform mat4 view;
|
|
uniform mat4 proj;
|
|
vec4 position( mat4 mdl, vec4 pos ){
|
|
vec4 world = mdl * pos;
|
|
height = world.y;
|
|
vec4 eye = view * world;
|
|
depth = -eye.z;
|
|
return proj*eye;
|
|
}
|
|
#endif
|
|
#ifdef PIXEL
|
|
vec4 effect( vec4 color, Image tex, vec2 texuv, vec2 scruv) {
|
|
return mix( mix( color * Texel( tex, texuv ), fog,
|
|
clamp( depth / 20.0, 0.0, 1.0)), fogHigh,
|
|
clamp( height / 20.0, 0.0, 1.0)) ;
|
|
}
|
|
#endif
|
|
]] |