optimization in whole tiles creation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
myShader = love.graphics.newShader[[
|
||||
Shaders = {}
|
||||
Shaders.InsideLight = love.graphics.newShader[[
|
||||
uniform vec2 light_pos;
|
||||
uniform vec3 light_color;
|
||||
uniform float range;
|
||||
@@ -10,12 +11,10 @@ myShader = love.graphics.newShader[[
|
||||
|
||||
float distance_x = light_pos.x - screen_coords.x;
|
||||
float distance_y = light_pos.y - screen_coords.y;
|
||||
float distance = 1-sqrt( pow(distance_x,2) + pow(distance_y,2) ) / game_scale;
|
||||
float distance = sqrt( pow(distance_x,2) + pow(distance_y,2) ) / game_scale;
|
||||
if (distance < range){
|
||||
float alpha = (distance/range);
|
||||
if (pixel.a > alpha){
|
||||
pixel.a = alpha;
|
||||
}
|
||||
float alpha = 1-(distance/10);
|
||||
pixel.a = alpha;
|
||||
if (color.r<light_color.r){
|
||||
color.r = light_color.r;
|
||||
}
|
||||
@@ -29,3 +28,25 @@ myShader = love.graphics.newShader[[
|
||||
return pixel * color;
|
||||
}
|
||||
]]
|
||||
|
||||
Shaders.OutsideDark = love.graphics.newShader[[
|
||||
uniform vec2 light_pos;
|
||||
uniform float range;
|
||||
uniform float game_scale;
|
||||
|
||||
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
|
||||
|
||||
vec4 pixel = Texel(texture, texture_coords );//This is the current pixel color
|
||||
|
||||
float distance_x = light_pos.x - screen_coords.x;
|
||||
float distance_y = light_pos.y - screen_coords.y;
|
||||
float distance = sqrt( pow(distance_x,2) + pow(distance_y,2) ) / game_scale;
|
||||
if (distance < range){
|
||||
float alpha = (distance/range);
|
||||
if (pixel.a > alpha){
|
||||
pixel.a = alpha;
|
||||
}
|
||||
}
|
||||
return pixel * color;
|
||||
}
|
||||
]]
|
||||
|
||||
Reference in New Issue
Block a user