54 lines
1.2 KiB
Lua
54 lines
1.2 KiB
Lua
--[[
|
|
0
|
|
20 -- once sailable.bmp is brighter than this, the area is traversable by ships
|
|
60 -- once sailable.bmp and territory.bmp are brighter than this, ships can be placed here
|
|
130 -- if territory.bmp is brighter than this and sailable is darker than 60, structures are placeable.
|
|
|
|
SO:
|
|
SAILABLE: 0 (not), 21 (traverse not place), 61 ( traverse and place )
|
|
TERRITORY: 131 ( place land if sailable <= 60 ), 61 ( place sea ), 0
|
|
]]
|
|
|
|
return love.graphics.newShader[[
|
|
#pragma language glsl3
|
|
uniform int radius;
|
|
uniform Image sailable;
|
|
|
|
bool seaPlace( float x, float y )
|
|
{
|
|
return ( x * 255.0 > 60.0 ) && ( y * 255.0 > 60.0 );
|
|
}
|
|
|
|
bool own( float x )
|
|
{
|
|
if( x * 255.0 > 130.0 ){
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool land( float x )
|
|
{
|
|
if( x * 255.0 <= 60.0 ){
|
|
return true;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool placeable( Image tex, vec2 uv )
|
|
{
|
|
return own(Texel(tex, uv).r) && land(Texel(sailable, uv).r);
|
|
}
|
|
|
|
vec4 effect( vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords )
|
|
{
|
|
if (placeable( tex, texture_coords + offset )){
|
|
return color;
|
|
}
|
|
return vec4( 0.0, 0.0, 0.0, 0.0 );
|
|
}
|
|
]] |