mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
Love 11.2
Now it runs with Love 11.2, but 'phosphor.glsl' should be revised.
This commit is contained in:
parent
eaade0dd3c
commit
cd5ac35662
@ -27,12 +27,13 @@ local util = require(_PACKAGE..'/util')
|
||||
local post_shader = {}
|
||||
post_shader.__index = post_shader
|
||||
|
||||
local files = love.filesystem.getInfo(_PACKAGE .. "/shaders/postshaders")
|
||||
local files = love.filesystem.getDirectoryItems(_PACKAGE .. "/shaders/postshaders")
|
||||
local shaders = {}
|
||||
|
||||
for i,v in ipairs(files) do
|
||||
local name = _PACKAGE.."/shaders/postshaders".."/"..v
|
||||
if love.filesystem.isFile(name) then
|
||||
inf = love.filesystem.getInfo(name)
|
||||
if love.filesystem.getInfo(name).type == "file" then
|
||||
local str = love.filesystem.read(name)
|
||||
local effect = util.loadShader(name)
|
||||
local defs = {}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
// 0.5 = the spot stays inside the original pixel
|
||||
// 1.0 = the spot bleeds up to the center of next pixel
|
||||
|
||||
#define PHOSPHOR_WIDTH 0.9
|
||||
#define PHOSPHOR_HEIGHT 0.65
|
||||
|
||||
@ -61,6 +62,8 @@ vec4 A_IN = vec4( 12.0/(InputGamma+1.0)-3.0 );
|
||||
vec4 B_IN = vec4(1.0) - A_IN;
|
||||
vec4 A_OUT = vec4(6.0 - 15.0 * OutputGamma / 2.0 / (OutputGamma+1.0));
|
||||
vec4 B_OUT = vec4(1.0) - A_OUT;
|
||||
uniform Image _tex0_;
|
||||
|
||||
#define GAMMA_IN(color) ( (A_IN + B_IN * color) * color * color )
|
||||
#define GAMMA_OUT(color) ( A_OUT * sqrt(color) + B_OUT * sqrt( sqrt(color) ) )
|
||||
|
||||
@ -78,7 +81,7 @@ vec4 B_IN = vec4(1.0) - A_IN;
|
||||
#ifdef DEBUG
|
||||
vec4 grid_color( vec2 coords )
|
||||
{
|
||||
vec2 snes = floor( coords * love_ScreenSize );
|
||||
vec2 snes = floor( coords * love_ScreenSize.xy );
|
||||
if ( (mod(snes.x, 3.0) == 0.0) && (mod(snes.y, 3.0) == 0.0) )
|
||||
return texture2D(_tex0_, coords);
|
||||
else
|
||||
|
@ -13,7 +13,7 @@ function util.drawCanvasToCanvas(canvas, other_canvas, options)
|
||||
|
||||
util.drawto(other_canvas, 0, 0, 1, function()
|
||||
if options["blendmode"] then
|
||||
love.graphics.setBlendMode(options["blendmode"])
|
||||
love.graphics.setBlendMode(options["blendmode"], "premultiplied")
|
||||
end
|
||||
if options["shader"] then
|
||||
love.graphics.setShader(options["shader"])
|
||||
@ -60,6 +60,7 @@ function util.drawto(canvas, x, y, scale, cb)
|
||||
end
|
||||
|
||||
function util.loadShader(name)
|
||||
print("loading:", name)
|
||||
local shader = ""
|
||||
local externInit = {}
|
||||
for line in love.filesystem.lines(name) do
|
||||
|
Loading…
Reference in New Issue
Block a user