[starling] Closes #662. Each region attachment receives a renderObject which is a Starling Image. A Starling Image is essentially like a libGDX region, holding a texture and uvs. When two slots share the same region attachment, we run into issues. E.g. if the slots differ in color, the shared Image color will be set to the last slot being drawn. Since Starling does batching, stuff breaks.

This commit is contained in:
badlogic 2016-08-09 11:06:11 +02:00
parent d27e1cd845
commit ddb7e52a41
3 changed files with 8 additions and 10 deletions

View File

@ -9,14 +9,5 @@
<resource>SDK:frameworks/libs/core.swc</resource>
<resource>SDK:frameworks/libs/osmf.swc</resource>
<resource>SDK:frameworks/libs/textLayout.swc</resource>
<resource>frameworks/libs/air/aircore.swc</resource>
<resource>frameworks/libs/air/airglobal.swc</resource>
<resource>frameworks/libs/air/applicationupdater.swc</resource>
<resource>frameworks/libs/air/applicationupdater_ui.swc</resource>
<resource>frameworks/libs/air/servicemonitor.swc</resource>
<resource>frameworks/libs/authoringsupport.swc</resource>
<resource>frameworks/libs/core.swc</resource>
<resource>frameworks/libs/osmf.swc</resource>
<resource>frameworks/libs/textLayout.swc</resource>
</exclude>

View File

@ -99,7 +99,14 @@ public class SkeletonSprite extends DisplayObject {
b * slot.b * region.b);
var image:Image = region.rendererObject as Image;
if (image == null) region.rendererObject = image = Image(AtlasRegion(region.rendererObject).rendererObject);
if (image == null) {
var origImage:Image = Image(AtlasRegion(region.rendererObject).rendererObject);
region.rendererObject = image = new Image(origImage.texture);
for (var j:int = 0; j < 4; j++) {
var p: Point = origImage.getTexCoords(j);
image.setTexCoords(j, p.x, p.y);
}
}
image.setVertexPosition(0, worldVertices[2], worldVertices[3]);
image.setVertexColor(0, rgb);