Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Draws a layer of an Array Texture.
Draws a layer of an Array Texture.
love.graphics.drawLayer( texture, layerindex, x, y, r, sx, sy, ox, oy, kx, ky )
Texture texture
number layerindex
number x (0)
number y (0)
number r (0)
number sx (1)
number sy (sx)
number ox (0)
number oy (0)
number kx (0)
number ky (0)
Nothing.
Draws a layer of an Array Texture using the specified Quad.
love.graphics.drawLayer( texture, layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky )
Texture texture
number layerindex
Quad quad
number x (0)
number y (0)
number r (0)
number sx (1)
number sy (sx)
number ox (0)
number oy (0)
number kx (0)
number ky (0)
Nothing.
The specified layer index overrides any layer index set on the Quad via Quad:setLayer.
Draws a layer of an Array Texture using the specified Transform.
love.graphics.drawLayer( texture, layerindex, transform )
Texture texture
number layerindex
Transform transform
Nothing.
Draws a layer of an Array Texture using the specified Quad and Transform.
love.graphics.drawLayer( texture, layerindex, quad, transform )
Texture texture
number layerindex
Quad quad
Transform transform
Nothing.
The specified layer index overrides any layer index set on the Quad via Quad:setLayer.
In order to use an Array Texture or other non-2D texture types as the main texture in a custom Shader, the void effect() variant must be used in the pixel shader, and MainTex must be declared as an ArrayImage or sampler2DArray like so: uniform ArrayImage MainTex;
.
function love.load() local sprites = {"sprite1.png", "sprite2.png"} image = love.graphics.newArrayImage(sprites) end function love.draw() love.graphics.drawLayer(image, 1, 50, 50) love.graphics.drawLayer(image, 2, 250, 50) end
shader = love.graphics.newShader[[ uniform ArrayImage MainTex; void effect() { // Texel uses a third component of the texture coordinate for the layer index, when an Array Texture is passed in. // love sets up the texture coordinates to contain the layer index specified in love.graphics.drawLayer, when // rendering the Array Texture. love_PixelColor = Texel(MainTex, VaryingTexCoord.xyz) * VaryingColor; } ]] function love.load() local sprites = {"sprite1.png", "sprite2.png"} image = love.graphics.newArrayImage(sprites) end function love.draw() love.graphics.setShader(shader) love.graphics.drawLayer(image, 1, 50, 50) love.graphics.drawLayer(image, 2, 250, 50) end