My current code is like this:
Code: Select all
haveshaders = love.graphics.isSupported("pixeleffect")
if haveshaders then
pixeleffect = love.graphics.newPixelEffect [[
extern vec2 pos;
extern number tilesize;
//extern number width;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen)
{
vec4 pixel = Texel(texture, texture_coords)*color;
number distance = distance(pos, screen);
pixel = (pixel/(distance*tilesize));
return pixel;
}
]]
end
What I've been having trouble with is figuring out how to send torch data to the shader. I'll need to send a different amount of torches each time depending on which are on screen. So I can't set up something like a vec4, because I don't always know I'll have 4 torches.
Any help on this would be greatly appreciated, I really just want to know how I can send a table of varying size to the shader.
I can supply a .love later if necessary, I'm just not sure if this is a simple question that can be fixed without it.