nulldesign/nd2d — Issue #22: SpriteCloud offers no performance boost when using a spritesheets.
Author: shawnblais
Created: 2011-10-20 22:49:43+00:00
State: open

In my test, SpriteCloud is not rendering any faster than then normal Sprite2D's, when I'm using SpriteSheet.

Using a single spritesheet, shared across all animations, caps out at about 380 @ 60fps, regardless of rendering technique.

Code for adding Sprite2D's is something like this:
texture = Texture2D.textureFromBitmapData(moleData);
for(var i:int = particleList.length; i < numParticles; i++){
spriteSheet = new SpriteSheet(texture.bitmapWidth, texture.bitmapHeight, frameWidth, frameHeight, 60);
spriteSheet.addAnimation("dig", [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], true);
var s:Sprite2D = new Sprite2D(texture);
s.spriteSheet = spriteSheet;
s.spriteSheet.playAnimation("dig");
scene.addChild(s);
}

Code for adding with cloud, is like this:

texture = Texture2D.textureFromBitmapData(moleData);
cloud = new Sprite2DCloud(500, moleData);
scene.addChild(cloud);

for(var i:int = particleList.length; i < numParticles; i++){
spriteSheet = new SpriteSheet(texture.bitmapWidth, texture.bitmapHeight, frameWidth, frameHeight, 60);
spriteSheet.addAnimation("dig", [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19], true);

var s:Sprite2D = new Sprite2D();
s.spriteSheet = spriteSheet;
s.spriteSheet.playAnimation("dig");
cloud.addChild(s);
}

I have to use different spritesheet's, otherwise all animations are in sync with eachother, which doesn't look good. But surely, there is batching that can be done for all identical frames??