Transformation Stack and SpriteBatch

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
mode7
Prole
Posts: 35
Joined: Tue Aug 21, 2012 5:45 pm
Contact:

Transformation Stack and SpriteBatch

Post by mode7 » Fri Aug 01, 2014 1:05 pm

Hey everyone, I'm working on a modular animation runtime for my game, similar to spine, spriter or anime studio (whose file format I'm currently parsing). Drawing these animations results in a high number of draw calls which can be really slow for many characters.

Using a texture atlas and a spriteBatch can really speed this up but my problem is, that I have to rely on coordinate system transformations via the love2d transformations stack especially (with push and pop) as I'm doing several transformations (e.g. one for the layer, one for the bone).

The spriteBatch's add and set methods unfortunately ignore the transformation stack. I can however put values for scaling, rotation and shearing in there.

I think if I could do the coordinate system transformations myself but I don't know how to pull it off. Especially as I need to have controll over the order in which the transformation is applied. For example sometimes I need to scale a rotated image resulting in some shearing. But how do I calculate this kn a way that I can pass it to spritebatch:add?

I hope any of this makes any sense. Thanks in advance
Alex

Post Reply

Who is online

Users browsing this forum: No registered users and 62 guests