So, the inofficial (but nonetheless genius) 3ds port of Löve doesn't support stencils,
but I love the idea of making a game for 3ds, even if it's only homebrew.
Is there any way to emulate stencils without support for, well stencils and shaders?
I thought about using love.graphics.setBlendMode on an intermediate canvas, or two and somehow hacking my way around it, but it seems I misread the blendMode formulas found here: https://love2d.org/wiki/BlendMode_Formulas
I'll also attach the .love file to give you an idea of what I want to achieve: objects being occluded in an isometric (dimetric) environment.
I've tried just re-drawing the tiles over the object in question, but that needs to also redraw the tiles in front of it, could overdraw other objects, etc.
The Löve file is also full of other errors, bugs and smaller and bigger problems, but please ignore that.
The .love example here runs correctly, but I'd need to replace this simple shader here with something different that is supported by LövePotion:
Code: Select all
local mask_shader = LG.newShader([[
extern Image mask;
extern float mask_size;
extern vec2 canvas_origin;
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords){
vec2 mask_coords = screen_coords - canvas_origin;
vec2 mask_uv = mask_coords / mask_size;
vec4 mask_pixel = Texel(mask, mask_uv);
return vec4(color.rgb, color.a - mask_pixel.a);
}
]])
mask_shader:send( 'mask', c )
mask_shader:send( 'mask_size', cw )
mask_shader:send( 'canvas_origin', {x - cw / 2, y - cw / 2} )