Auto-batched draws (except for love.graphics.print, for now) are affected by 3D transforms.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-05-17 22:03:09 -03:00
parent 955fb9b60c
commit 7694edfd52
12 changed files with 174 additions and 79 deletions
+23
View File
@@ -191,6 +191,13 @@ public:
template <typename Vdst, typename Vsrc>
void transformXY(Vdst *dst, const Vsrc *src, int size) const;
/**
* Transforms an array of 2-component vertices by this Matrix, and stores
* them in an array of 3-component vertices.
**/
template <typename Vdst, typename Vsrc>
void transformXY0(Vdst *dst, const Vsrc *src, int size) const;
/**
* Transforms an array of 3-component vertices by this Matrix. The source
* and destination arrays may be the same.
@@ -320,6 +327,22 @@ void Matrix4::transformXY(Vdst *dst, const Vsrc *src, int size) const
}
}
template <typename Vdst, typename Vsrc>
void Matrix4::transformXY0(Vdst *dst, const Vsrc *src, int size) const
{
for (int i = 0; i < size; i++)
{
// Store in temp variables in case src = dst
float x = (e[0]*src[i].x) + (e[4]*src[i].y) + (0) + (e[12]);
float y = (e[1]*src[i].x) + (e[5]*src[i].y) + (0) + (e[13]);
float z = (e[2]*src[i].x) + (e[6]*src[i].y) + (0) + (e[14]);
dst[i].x = x;
dst[i].y = y;
dst[i].z = z;
}
}
// | x |
// | y |
// | z |