Array textures can be easily drawn without a shader (resolves issue #1111).

Added love.graphics.drawLayer(texture, layerindex, …). ‘texture’ must be an array texture.
Added SpriteBatch:add/setLayer.

Added Quad:get/setLayer. This applies to array textures that are drawn without specifying an explicit layer index in the draw call.

Added love.graphics.newQuad variants which have layer arguments.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-02-26 17:11:22 -04:00
parent 9ba7234f14
commit 66b299822a
27 changed files with 559 additions and 295 deletions
+24
View File
@@ -22,12 +22,36 @@
#include "common/runtime.h"
#include "SpriteBatch.h"
#include "math/wrap_Transform.h"
namespace love
{
namespace graphics
{
template <typename T>
static void luax_checkstandardtransform(lua_State *L, int idx, const T &func)
{
if (luax_istype(L, idx, math::Transform::type))
{
math::Transform *tf = luax_totype<math::Transform>(L, idx);
func(tf->getMatrix());
}
else
{
float x = (float) luaL_optnumber(L, idx + 0, 0.0);
float y = (float) luaL_optnumber(L, idx + 1, 0.0);
float a = (float) luaL_optnumber(L, idx + 2, 0.0);
float sx = (float) luaL_optnumber(L, idx + 3, 1.0);
float sy = (float) luaL_optnumber(L, idx + 4, sx);
float ox = (float) luaL_optnumber(L, idx + 5, 0.0);
float oy = (float) luaL_optnumber(L, idx + 6, 0.0);
float kx = (float) luaL_optnumber(L, idx + 7, 0.0);
float ky = (float) luaL_optnumber(L, idx + 8, 0.0);
func(Matrix4(x, y, a, sx, sy, ox, oy, kx, ky));
}
}
SpriteBatch *luax_checkspritebatch(lua_State *L, int idx);
extern "C" int luaopen_spritebatch(lua_State *L);