Mercurial > love-experiments
diff src/scripts/graphics.lua @ 1401:bee3f7b0dca0 MRTs
fixed canvas:clear() when multi-canvas rendering is active, changed some names and wording
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Tue, 26 Mar 2013 04:58:43 -0300 |
| parents | fa3eabb3602a |
| children | a96b4e6c9a7e |
line wrap: on
line diff
--- a/src/scripts/graphics.lua Mon Mar 25 21:23:09 2013 -0300 +++ b/src/scripts/graphics.lua Tue Mar 26 04:58:43 2013 -0300 @@ -1338,7 +1338,7 @@ gl_FragColor = effect(VaryingColor, _tex0_, VaryingTexCoord.st, gl_FragCoord.xy); }]], - FOOTER_MRT = [[ + FOOTER_MULTI_CANVAS = [[ void main() { // fix crashing issue in OSX when _tex0_ is unused within effect() float dummy = texture2D(_tex0_, vec2(.5)).r; @@ -1357,13 +1357,13 @@ return table_concat(vertexcodes, "\n") end - local function createPixelCode(pixelcode, is_mrt) + local function createPixelCode(pixelcode, is_multicanvas) local pixelcodes = { GLSL_VERSION, GLSL_SYNTAX, GLSL_PIXEL.HEADER, GLSL_UNIFORMS, "#line 0", pixelcode, - is_mrt and GLSL_PIXEL.FOOTER_MRT or GLSL_PIXEL.FOOTER, + is_multicanvas and GLSL_PIXEL.FOOTER_MULTI_CANVAS or GLSL_PIXEL.FOOTER, } return table_concat(pixelcodes, "\n") end @@ -1375,7 +1375,7 @@ local function isPixelCode(code) if code:match("vec4%s*effect%(") then return true - elseif code:match("void%s*effects%(") then -- multiple render targets (MRT) + elseif code:match("void%s*effects%(") then -- render to multiple canvases simultaniously return true, true else return false @@ -1384,7 +1384,7 @@ function love.graphics._shaderCodeToGLSL(arg1, arg2) local vertexcode, pixelcode - local is_mrt = false -- whether pixel code has "effects" function instead of "effect" + local is_multicanvas = false -- whether pixel code has "effects" function instead of "effect" if arg1 then local s = arg1:gsub("\r\n\t", " ") -- convert whitespace to spaces for parsing @@ -1394,10 +1394,10 @@ vertexcode = arg1 -- first arg contains vertex shader code end - local ispixel, isMRT = isPixelCode(s) + local ispixel, isMultiCanvas = isPixelCode(s) if ispixel then pixelcode = arg1 -- first arg contains pixel shader code - is_mrt = isMRT + is_multicanvas = isMultiCanvas end end @@ -1409,10 +1409,10 @@ vertexcode = arg2 -- second arg contains vertex shader code end - local ispixel, isMRT = isPixelCode(s) + local ispixel, isMultiCanvas = isPixelCode(s) if ispixel then pixelcode = arg2 -- second arg contains pixel shader code - is_mrt = isMRT + is_multicanvas = isMultiCanvas end end @@ -1420,7 +1420,7 @@ vertexcode = createVertexCode(vertexcode) end if pixelcode then - pixelcode = createPixelCode(pixelcode, is_mrt) + pixelcode = createPixelCode(pixelcode, is_multicanvas) end return vertexcode, pixelcode
