local love = love local gpu = require( "gpu" ) local t = {} local canvas local meshes = {} local isDebugging = false local tf = love.math.newTransform() local debugTF = love.math.newTransform() local sky local bell local contempra function t.start() canvas = { love.graphics.newCanvas(), stencil = false, depth = true, } sky = require( "models.sky" ) bell = require( "models.bell" ) contempra = require( "models.contempra" ) end function t.debug() isDebugging = true end local function matte( ) local list = drawLists.matte local shader = shaders.matte love.graphics.setShader( shader ) for mesh in pairs( list ) do shader:send( "mdl", "column", meshes[mesh]) love.graphics.draw( mesh ) end end function t.draw( view, proj ) if isDebugging then end love.graphics.push( "all" ) love.graphics.setScissor( 0, 0, love.graphics.getDimensions() ) love.graphics.setCanvas( canvas ) love.graphics.clear() love.graphics.setDepthMode( "less", true ) love.graphics.replaceTransform( tf ) love.graphics.setMeshCullMode( "back" ) sky.draw( view, proj ) bell.draw( view, proj ) contempra.draw( view, proj ) love.graphics.pop() love.graphics.setColor( 1, 1, 1, 1 ) love.graphics.draw( canvas[1] ) if isDebugging then isDebugging = false io.flush() end end function t.update( mesh, modelMatrix ) meshes[mesh] = modelMatrix end function t.add( mesh, shaderName ) shaderName = shaderName or "matte" meshes[mesh] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, {0, 0, 1, 0}, {0, 0, 0, 1} } drawLists[shaderName][mesh] = true end return t