diff --git a/spine-as3/spine-as3-example/.settings/launch/spine-as3-example.launch b/spine-as3/spine-as3-example/.settings/launch/spine-as3-example.launch
index 0423423fd..ef1cb5c89 100644
--- a/spine-as3/spine-as3-example/.settings/launch/spine-as3-example.launch
+++ b/spine-as3/spine-as3-example/.settings/launch/spine-as3-example.launch
@@ -13,7 +13,7 @@
-
+
diff --git a/spine-as3/spine-as3-example/lib/spine-as3.swc b/spine-as3/spine-as3-example/lib/spine-as3.swc
index 9e90cbc9d..0ec88c564 100644
Binary files a/spine-as3/spine-as3-example/lib/spine-as3.swc and b/spine-as3/spine-as3-example/lib/spine-as3.swc differ
diff --git a/spine-as3/spine-as3-example/src/spine/Main.as b/spine-as3/spine-as3-example/src/spine/examples/Main.as
similarity index 99%
rename from spine-as3/spine-as3-example/src/spine/Main.as
rename to spine-as3/spine-as3-example/src/spine/examples/Main.as
index 9e4a294ee..1ebfb48b5 100644
--- a/spine-as3/spine-as3-example/src/spine/Main.as
+++ b/spine-as3/spine-as3-example/src/spine/examples/Main.as
@@ -29,10 +29,11 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-package spine {
+package spine.examples {
import flash.display.Sprite;
+import spine.*;
import spine.animation.AnimationStateData;
import spine.atlas.Atlas;
import spine.attachments.AtlasAttachmentLoader;
diff --git a/spine-as3/spine-as3/.settings/com.powerflasher.fdt.classpath b/spine-as3/spine-as3/.settings/com.powerflasher.fdt.classpath
index 7e38cfa95..02f907113 100644
--- a/spine-as3/spine-as3/.settings/com.powerflasher.fdt.classpath
+++ b/spine-as3/spine-as3/.settings/com.powerflasher.fdt.classpath
@@ -1,5 +1,9 @@
- frameworks/libs/player/{playerVersion}/playerglobal.swc
src
+ frameworks/libs/player/{playerVersion}/playerglobal.swc
+ frameworks/libs/textLayout.swc
+ frameworks/libs/osmf.swc
+ frameworks/libs/authoringsupport.swc
+ frameworks/libs/core.swc
diff --git a/spine-as3/spine-as3/.settings/com.powerflasher.fdt.exclude b/spine-as3/spine-as3/.settings/com.powerflasher.fdt.exclude
new file mode 100644
index 000000000..2391d8c0d
--- /dev/null
+++ b/spine-as3/spine-as3/.settings/com.powerflasher.fdt.exclude
@@ -0,0 +1,13 @@
+
+
+ frameworks/libs/air/aircore.swc
+ frameworks/libs/air/airglobal.swc
+ frameworks/libs/air/applicationupdater.swc
+ frameworks/libs/air/applicationupdater_ui.swc
+ frameworks/libs/air/servicemonitor.swc
+ frameworks/libs/authoringsupport.swc
+ frameworks/libs/core.swc
+ frameworks/libs/osmf.swc
+ frameworks/libs/textLayout.swc
+
+
diff --git a/spine-as3/spine-as3/src/spine/Polygon.as b/spine-as3/spine-as3/src/spine/Polygon.as
index ae459c587..b7acb8ca7 100644
--- a/spine-as3/spine-as3/src/spine/Polygon.as
+++ b/spine-as3/spine-as3/src/spine/Polygon.as
@@ -34,6 +34,9 @@ package spine {
public class Polygon {
public var vertices:Vector. = new Vector.();
+ public function Polygon () {
+ }
+
/** Returns true if the polygon contains the point. */
public function containsPoint (x:Number, y:Number) : Boolean {
var nn:int = vertices.length;
diff --git a/spine-as3/spine-as3/src/spine/SkeletonBounds.as b/spine-as3/spine-as3/src/spine/SkeletonBounds.as
index 9024d12f5..06f7d8ee7 100644
--- a/spine-as3/spine-as3/src/spine/SkeletonBounds.as
+++ b/spine-as3/spine-as3/src/spine/SkeletonBounds.as
@@ -38,6 +38,9 @@ public class SkeletonBounds {
public var boundingBoxes:Vector. = new Vector.();
public var polygons:Vector. = new Vector.();
public var minX:Number, minY:Number, maxX:Number, maxY:Number;
+
+ public function SkeletonBounds () {
+ }
public function update (skeleton:Skeleton, updateAabb:Boolean) : void {
var slots:Vector. = skeleton.slots;
diff --git a/spine-as3/spine-as3/src/spine/SkeletonData.as b/spine-as3/spine-as3/src/spine/SkeletonData.as
index 1a0802ccd..6c96eb440 100644
--- a/spine-as3/spine-as3/src/spine/SkeletonData.as
+++ b/spine-as3/spine-as3/src/spine/SkeletonData.as
@@ -45,6 +45,9 @@ public class SkeletonData {
public var transformConstraints:Vector. = new Vector.();
public var width:Number, height:Number;
public var version:String, hash:String;
+
+ public function SkeletonData () {
+ }
// --- Bones.
diff --git a/spine-as3/spine-as3/src/spine/animation/Listeners.as b/spine-as3/spine-as3/src/spine/animation/Listeners.as
index f517c40e6..7e7062b4f 100644
--- a/spine-as3/spine-as3/src/spine/animation/Listeners.as
+++ b/spine-as3/spine-as3/src/spine/animation/Listeners.as
@@ -33,6 +33,9 @@ package spine.animation {
public class Listeners {
private var _listeners:Vector. = new Vector.();
+ public function Listeners () {
+ }
+
public function get listeners () : Vector. {
return _listeners;
}
diff --git a/spine-as3/spine-as3/src/spine/animation/TrackEntry.as b/spine-as3/spine-as3/src/spine/animation/TrackEntry.as
index 4eecb3dc5..8112bba58 100644
--- a/spine-as3/spine-as3/src/spine/animation/TrackEntry.as
+++ b/spine-as3/spine-as3/src/spine/animation/TrackEntry.as
@@ -40,6 +40,9 @@ public class TrackEntry {
internal var mixTime:Number, mixDuration:Number, mix:Number = 1;
public var onStart:Function, onEnd:Function, onComplete:Function, onEvent:Function;
+ public function TrackEntry () {
+ }
+
public function toString () : String {
return animation == null ? "" : animation.name;
}
diff --git a/spine-as3/spine-as3/src/spine/atlas/AtlasPage.as b/spine-as3/spine-as3/src/spine/atlas/AtlasPage.as
index e11edacd2..cc0bf3dbb 100644
--- a/spine-as3/spine-as3/src/spine/atlas/AtlasPage.as
+++ b/spine-as3/spine-as3/src/spine/atlas/AtlasPage.as
@@ -41,6 +41,9 @@ public class AtlasPage {
public var rendererObject:Object;
public var width:int;
public var height:int;
+
+ public function AtlasPage () {
+ }
}
}
diff --git a/spine-as3/spine-as3/src/spine/atlas/AtlasRegion.as b/spine-as3/spine-as3/src/spine/atlas/AtlasRegion.as
index 553d2abfa..7e3e9488e 100644
--- a/spine-as3/spine-as3/src/spine/atlas/AtlasRegion.as
+++ b/spine-as3/spine-as3/src/spine/atlas/AtlasRegion.as
@@ -51,6 +51,9 @@ public class AtlasRegion {
public var splits:Vector.;
public var pads:Vector.;
public var rendererObject:Object;
+
+ public function AtlasRegion () {
+ }
}
}
diff --git a/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.classpath b/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.classpath
index e81cadb11..c35f9e0ac 100644
--- a/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.classpath
+++ b/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.classpath
@@ -3,7 +3,7 @@
lib
frameworks/libs/player/{playerVersion}/playerglobal.swc
src
- lib/spine-starling.swc
+ lib/starling-2.0.1.swc
lib/spine-as3.swc
- lib/starling-1.7.swc
+ lib/spine-starling.swc
diff --git a/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.ui.sourceLocation.prefs b/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.ui.sourceLocation.prefs
new file mode 100644
index 000000000..6cc33682a
--- /dev/null
+++ b/spine-starling/spine-starling-example/.settings/com.powerflasher.fdt.ui.sourceLocation.prefs
@@ -0,0 +1,2 @@
+//lib/starling-2.0.1.swc=/Applications/flash/starling/src
+eclipse.preferences.version=1
diff --git a/spine-starling/spine-starling-example/.settings/launch/spine-starling-example.launch b/spine-starling/spine-starling-example/.settings/launch/spine-starling-example.launch
index fd22c65ed..a58d277bf 100644
--- a/spine-starling/spine-starling-example/.settings/launch/spine-starling-example.launch
+++ b/spine-starling/spine-starling-example/.settings/launch/spine-starling-example.launch
@@ -8,12 +8,15 @@
-
+
+
+
+
-
+
diff --git a/spine-starling/spine-starling-example/lib/spine-as3.swc b/spine-starling/spine-starling-example/lib/spine-as3.swc
index 3f90b6481..0ec88c564 100644
Binary files a/spine-starling/spine-starling-example/lib/spine-as3.swc and b/spine-starling/spine-starling-example/lib/spine-as3.swc differ
diff --git a/spine-starling/spine-starling-example/lib/spine-starling.swc b/spine-starling/spine-starling-example/lib/spine-starling.swc
index b22d2786c..20b9922e9 100644
Binary files a/spine-starling/spine-starling-example/lib/spine-starling.swc and b/spine-starling/spine-starling-example/lib/spine-starling.swc differ
diff --git a/spine-starling/spine-starling-example/lib/starling-1.7.swc b/spine-starling/spine-starling-example/lib/starling-1.7.swc
deleted file mode 100644
index dd36fb67a..000000000
Binary files a/spine-starling/spine-starling-example/lib/starling-1.7.swc and /dev/null differ
diff --git a/spine-starling/spine-starling-example/lib/starling-2.0.1.swc b/spine-starling/spine-starling-example/lib/starling-2.0.1.swc
new file mode 100644
index 000000000..eb24c27fa
Binary files /dev/null and b/spine-starling/spine-starling-example/lib/starling-2.0.1.swc differ
diff --git a/spine-starling/spine-starling-example/src/spine/GoblinsExample.as b/spine-starling/spine-starling-example/src/spine/examples/GoblinsExample.as
similarity index 97%
rename from spine-starling/spine-starling-example/src/spine/GoblinsExample.as
rename to spine-starling/spine-starling-example/src/spine/examples/GoblinsExample.as
index e8b12a11c..77203114c 100644
--- a/spine-starling/spine-starling-example/src/spine/GoblinsExample.as
+++ b/spine-starling/spine-starling-example/src/spine/examples/GoblinsExample.as
@@ -29,8 +29,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-package spine {
-
+package spine.examples {
+import spine.*;
import spine.atlas.Atlas;
import spine.attachments.AtlasAttachmentLoader;
import spine.attachments.AttachmentLoader;
@@ -81,7 +81,7 @@ public class GoblinsExample extends Sprite {
var json:SkeletonJson = new SkeletonJson(attachmentLoader);
var skeletonData:SkeletonData = json.readSkeletonData(new GoblinsJson());
- skeleton = new SkeletonAnimation(skeletonData, true);
+ skeleton = new SkeletonAnimation(skeletonData);
skeleton.x = 320;
skeleton.y = 420;
skeleton.skeleton.skinName = "goblin";
diff --git a/spine-starling/spine-starling-example/src/spine/Main.as b/spine-starling/spine-starling-example/src/spine/examples/Main.as
similarity index 94%
rename from spine-starling/spine-starling-example/src/spine/Main.as
rename to spine-starling/spine-starling-example/src/spine/examples/Main.as
index 7636a041c..bec76fbbe 100644
--- a/spine-starling/spine-starling-example/src/spine/Main.as
+++ b/spine-starling/spine-starling-example/src/spine/examples/Main.as
@@ -29,7 +29,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-package spine {
+package spine.examples {
import flash.display.Sprite;
@@ -41,13 +41,14 @@ public class Main extends Sprite {
public function Main () {
var example:Class;
- //example = SpineboyExample;
- //example = GoblinsExample;
+ // example = SpineboyExample;
+ // example = GoblinsExample;
example = RaptorExample;
_starling = new Starling(example, stage);
_starling.enableErrorChecking = true;
_starling.showStats = true;
+ _starling.skipUnchangedFrames = false;
_starling.start();
}
}
diff --git a/spine-starling/spine-starling-example/src/spine/RaptorExample.as b/spine-starling/spine-starling-example/src/spine/examples/RaptorExample.as
similarity index 97%
rename from spine-starling/spine-starling-example/src/spine/RaptorExample.as
rename to spine-starling/spine-starling-example/src/spine/examples/RaptorExample.as
index 29280ec83..fb3289099 100644
--- a/spine-starling/spine-starling-example/src/spine/RaptorExample.as
+++ b/spine-starling/spine-starling-example/src/spine/examples/RaptorExample.as
@@ -29,8 +29,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-package spine {
+package spine.examples {
import spine.atlas.Atlas;
+import spine.*;
import spine.attachments.AtlasAttachmentLoader;
import spine.attachments.AttachmentLoader;
import spine.starling.SkeletonAnimation;
@@ -64,7 +65,7 @@ public class RaptorExample extends Sprite {
json.scale = 0.5;
var skeletonData:SkeletonData = json.readSkeletonData(new RaptorJson());
- skeleton = new SkeletonAnimation(skeletonData, true);
+ skeleton = new SkeletonAnimation(skeletonData);
skeleton.x = 400;
skeleton.y = 560;
skeleton.state.setAnimationByName(0, "walk", true);
diff --git a/spine-starling/spine-starling-example/src/spine/SpineboyExample.as b/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as
similarity index 97%
rename from spine-starling/spine-starling-example/src/spine/SpineboyExample.as
rename to spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as
index 22ff7b3a5..602914bfb 100644
--- a/spine-starling/spine-starling-example/src/spine/SpineboyExample.as
+++ b/spine-starling/spine-starling-example/src/spine/examples/SpineboyExample.as
@@ -29,8 +29,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-package spine {
+package spine.examples {
import spine.animation.AnimationStateData;
+import spine.*;
import spine.atlas.Atlas;
import spine.attachments.AtlasAttachmentLoader;
import spine.attachments.AttachmentLoader;
@@ -67,7 +68,7 @@ public class SpineboyExample extends Sprite {
stateData.setMixByName("jump", "run", 0.4);
stateData.setMixByName("jump", "jump", 0.2);
- skeleton = new SkeletonAnimation(skeletonData, false, stateData);
+ skeleton = new SkeletonAnimation(skeletonData, stateData);
skeleton.x = 400;
skeleton.y = 560;
diff --git a/spine-starling/spine-starling/.settings/com.powerflasher.fdt.classpath b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.classpath
index 53c37a5fa..e4540bec9 100644
--- a/spine-starling/spine-starling/.settings/com.powerflasher.fdt.classpath
+++ b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.classpath
@@ -1,8 +1,16 @@
lib
- frameworks/libs/player/{playerVersion}/playerglobal.swc
src
lib/spine-as3.swc
- lib/starling-1.7.swc
+ lib/starling-2.0.1.swc
+ frameworks/libs/air/airglobal.swc
+ frameworks/libs/textLayout.swc
+ frameworks/libs/osmf.swc
+ frameworks/libs/authoringsupport.swc
+ frameworks/libs/core.swc
+ frameworks/libs/air/aircore.swc
+ frameworks/libs/air/applicationupdater.swc
+ frameworks/libs/air/applicationupdater_ui.swc
+ frameworks/libs/air/servicemonitor.swc
diff --git a/spine-starling/spine-starling/.settings/com.powerflasher.fdt.core.prefs b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.core.prefs
index 403470f21..bd3538e23 100644
--- a/spine-starling/spine-starling/.settings/com.powerflasher.fdt.core.prefs
+++ b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.core.prefs
@@ -1,8 +1,8 @@
-com.powerflasher.fdt.core.CompatiblePlayers=External_SWF_Viewer\:Browser\:Standalone_Flash_Player
+com.powerflasher.fdt.core.CompatiblePlayers=AIR_Debug_Launcher
com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-libraries\=true\n-target-player\={playerVersion}\n-library-path+\="{flexSDK}/frameworks/locale/en_US"\n-default-size\=550,400
com.powerflasher.fdt.core.CompilerConstants=CONFIG\:\:AUTHOR\!"{user.name}"\nCONFIG\:\:DEBUG\!{debug}
com.powerflasher.fdt.core.DefaultOutputFolder=bin
-com.powerflasher.fdt.core.DefaultPlayer=External_SWF_Viewer
+com.powerflasher.fdt.core.DefaultPlayer=AIR_Debug_Launcher
com.powerflasher.fdt.core.IncludeTestResources=false
com.powerflasher.fdt.core.Language=AS3
com.powerflasher.fdt.core.Manifests=
@@ -13,9 +13,9 @@ com.powerflasher.fdt.core.PassMainclass=true
com.powerflasher.fdt.core.PassManifests=true
com.powerflasher.fdt.core.PassRsls=false
com.powerflasher.fdt.core.PassSwcs=true
-com.powerflasher.fdt.core.PlatformType=WEB
+com.powerflasher.fdt.core.PlatformType=AIR
com.powerflasher.fdt.core.PlayerVersion=22.0
-com.powerflasher.fdt.core.ProjectTypeHint=Web
-com.powerflasher.fdt.core.Runtime=Flash_Player
+com.powerflasher.fdt.core.ProjectTypeHint=Library AIR
+com.powerflasher.fdt.core.Runtime=AIR
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
eclipse.preferences.version=1
diff --git a/spine-starling/spine-starling/.settings/com.powerflasher.fdt.exclude b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.exclude
new file mode 100644
index 000000000..ea01af7bd
--- /dev/null
+++ b/spine-starling/spine-starling/.settings/com.powerflasher.fdt.exclude
@@ -0,0 +1,22 @@
+
+
+ SDK:frameworks/libs/air/aircore.swc
+ SDK:frameworks/libs/air/airglobal.swc
+ SDK:frameworks/libs/air/applicationupdater.swc
+ SDK:frameworks/libs/air/applicationupdater_ui.swc
+ SDK:frameworks/libs/air/servicemonitor.swc
+ SDK:frameworks/libs/authoringsupport.swc
+ SDK:frameworks/libs/core.swc
+ SDK:frameworks/libs/osmf.swc
+ SDK:frameworks/libs/textLayout.swc
+ frameworks/libs/air/aircore.swc
+ frameworks/libs/air/airglobal.swc
+ frameworks/libs/air/applicationupdater.swc
+ frameworks/libs/air/applicationupdater_ui.swc
+ frameworks/libs/air/servicemonitor.swc
+ frameworks/libs/authoringsupport.swc
+ frameworks/libs/core.swc
+ frameworks/libs/osmf.swc
+ frameworks/libs/textLayout.swc
+
+
diff --git a/spine-starling/spine-starling/.settings/org.eclipse.core.resources.prefs b/spine-starling/spine-starling/.settings/org.eclipse.core.resources.prefs
index 99f26c020..8b768ecaa 100644
--- a/spine-starling/spine-starling/.settings/org.eclipse.core.resources.prefs
+++ b/spine-starling/spine-starling/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1,7 @@
eclipse.preferences.version=1
+encoding//src/spine/starling/SkeletonAnimation.as=UTF-8
+encoding//src/spine/starling/SkeletonMesh.as=UTF-8
+encoding//src/spine/starling/SkeletonSprite.as=UTF-8
+encoding//src/spine/starling/StarlingAtlasAttachmentLoader.as=UTF-8
+encoding//src/spine/starling/StarlingTextureLoader.as=UTF-8
encoding/=UTF-8
diff --git a/spine-starling/spine-starling/lib/spine-as3.swc b/spine-starling/spine-starling/lib/spine-as3.swc
index 3f90b6481..0ec88c564 100644
Binary files a/spine-starling/spine-starling/lib/spine-as3.swc and b/spine-starling/spine-starling/lib/spine-as3.swc differ
diff --git a/spine-starling/spine-starling/lib/starling-1.7.swc b/spine-starling/spine-starling/lib/starling-1.7.swc
deleted file mode 100644
index dd36fb67a..000000000
Binary files a/spine-starling/spine-starling/lib/starling-1.7.swc and /dev/null differ
diff --git a/spine-starling/spine-starling/lib/starling-2.0.1.swc b/spine-starling/spine-starling/lib/starling-2.0.1.swc
new file mode 100644
index 000000000..eb24c27fa
Binary files /dev/null and b/spine-starling/spine-starling/lib/starling-2.0.1.swc differ
diff --git a/spine-starling/spine-starling/src/spine/starling/PolygonBatch.as b/spine-starling/spine-starling/src/spine/starling/PolygonBatch.as
deleted file mode 100644
index 55a823148..000000000
--- a/spine-starling/spine-starling/src/spine/starling/PolygonBatch.as
+++ /dev/null
@@ -1,289 +0,0 @@
-/******************************************************************************
- * Spine Runtimes Software License
- * Version 2.3
- *
- * Copyright (c) 2013-2015, Esoteric Software
- * All rights reserved.
- *
- * You are granted a perpetual, non-exclusive, non-sublicensable and
- * non-transferable license to use, install, execute and perform the Spine
- * Runtimes Software (the "Software") and derivative works solely for personal
- * or internal use. Without the written permission of Esoteric Software (see
- * Section 2 of the Spine Software License Agreement), you may not (a) modify,
- * translate, adapt or otherwise create derivative works, improvements of the
- * Software or develop new applications using the Software or (b) remove,
- * delete, alter or obscure any trademarks or any copyright, trademark, patent
- * or other intellectual property or proprietary rights notices on or in the
- * Software, including any copy thereof. Redistributions in binary or source
- * form must include this license and terms.
- *
- * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
-package spine.starling {
-import spine.BlendMode;
-
-import starling.core.RenderSupport;
-import starling.core.Starling;
-import starling.textures.Texture;
-import starling.textures.TextureSmoothing;
-import starling.utils.MatrixUtil;
-import starling.utils.VertexData;
-
-import flash.display3D.Context3D;
-import flash.display3D.Context3DProgramType;
-import flash.display3D.Context3DTextureFormat;
-import flash.display3D.Context3DVertexBufferFormat;
-import flash.display3D.IndexBuffer3D;
-import flash.display3D.Program3D;
-import flash.display3D.VertexBuffer3D;
-import flash.events.Event;
-import flash.geom.Matrix;
-import flash.geom.Point;
-import flash.utils.Dictionary;
-
-internal class PolygonBatch {
- static private var _tempPoint:Point = new Point();
- static private var _renderAlpha:Vector. = new [1.0, 1.0, 1.0, 1.0];
- static private var _programNameCache:Dictionary = new Dictionary();
-
- private var _capacity:int;
- public var maxCapacity:int = 2000;
- public var smoothing:String = TextureSmoothing.BILINEAR;
-
- private var _texture:Texture;
- private var _support:RenderSupport;
- private var _programBits:uint;
- private var _blendModeNormal:String;
- private var _blendMode:spine.BlendMode;
- private var _alpha:Number;
-
- private var _verticesCount:int;
- private var _vertices:Vector. = new [];
- private var _verticesBuffer:VertexBuffer3D;
-
- private var _trianglesCount:int;
- private var _triangles:Vector. = new [];
- private var _trianglesBuffer:IndexBuffer3D;
-
- public function PolygonBatch () {
- Starling.current.stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated, false, 0, true);
- }
-
- public function dispose () : void {
- Starling.current.stage3D.removeEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
- if (_verticesBuffer) _verticesBuffer.dispose();
- if (_trianglesBuffer) _trianglesBuffer.dispose();
- }
-
- public function begin (support:RenderSupport, alpha:Number, blendMode:String) : void {
- _support = support;
- _alpha = alpha;
- _programBits = 0xffffffff;
- _blendMode = null;
-
- support.finishQuadBatch();
- support.blendMode = blendMode;
- _blendModeNormal = support.blendMode;
-
- var context:Context3D = Starling.context;
- context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, support.mvpMatrix3D, true);
-
- var verticesBuffer:VertexBuffer3D = _verticesBuffer;
- if (verticesBuffer) {
- context.setVertexBufferAt(0, verticesBuffer, VertexData.POSITION_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
- context.setVertexBufferAt(1, verticesBuffer, VertexData.COLOR_OFFSET, Context3DVertexBufferFormat.FLOAT_4);
- context.setVertexBufferAt(2, verticesBuffer, VertexData.TEXCOORD_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
- }
- }
-
- public function end () : void {
- flush();
- var context:Context3D = Starling.context;
- context.setTextureAt(0, null);
- context.setVertexBufferAt(2, null);
- context.setVertexBufferAt(1, null);
- context.setVertexBufferAt(0, null);
- }
-
- public function add (texture:Texture, vertices:Vector., vl:int, uvs:Vector., triangles:Vector.,
- r:Number, g:Number, b:Number, a:Number, blendMode:spine.BlendMode, matrix:Matrix) : void {
- if (blendMode != _blendMode) {
- _blendMode = blendMode;
- flush();
- if (blendMode == spine.BlendMode.normal)
- _support.blendMode = _blendModeNormal;
- else
- _support.blendMode = spine.starling.SkeletonSprite.blendModes[blendMode.ordinal];
- _support.applyBlendMode(true);
- }
-
- if (!_texture || texture.base != _texture.base) {
- flush();
- _texture = texture;
- }
-
- var vc:int = _verticesCount, firstVertex:int = vc >> 3;
- if (firstVertex + (vl >> 1) > _capacity) {
- resize(firstVertex + (vl >> 1) - _capacity);
- vc = _verticesCount;
- firstVertex = vc >> 3;
- }
- var tl:int = triangles.length, tc:int = _trianglesCount;
- if (tc + tl > _triangles.length) {
- resize((tc + tl - _triangles.length) / 3);
- vc = _verticesCount;
- firstVertex = vc >> 3;
- tc = _trianglesCount;
- }
-
- var i:int, t:Vector. = _triangles;
- for (i = 0; i < tl; i += 3, tc += 3) {
- t[tc] = firstVertex + triangles[i];
- t[int(tc + 1)] = firstVertex + triangles[int(i + 1)];
- t[int(tc + 2)] = firstVertex + triangles[int(i + 2)];
- }
- _trianglesCount = tc;
-
- var v:Vector. = _vertices;
- if (matrix) {
- var point:Point = _tempPoint;
- for (i = 0; i < vl; i += 2, vc += 8) {
- MatrixUtil.transformCoords(matrix, vertices[i], vertices[int(i + 1)], point);
- v[vc] = point.x;
- v[int(vc + 1)] = point.y;
- v[int(vc + 2)] = r;
- v[int(vc + 3)] = g;
- v[int(vc + 4)] = b;
- v[int(vc + 5)] = a;
- v[int(vc + 6)] = uvs[i];
- v[int(vc + 7)] = uvs[int(i + 1)];
- }
- } else {
- for (i = 0; i < vl; i += 2, vc += 8) {
- v[vc] = vertices[i];
- v[int(vc + 1)] = vertices[int(i + 1)];
- v[int(vc + 2)] = r;
- v[int(vc + 3)] = g;
- v[int(vc + 4)] = b;
- v[int(vc + 5)] = a;
- v[int(vc + 6)] = uvs[i];
- v[int(vc + 7)] = uvs[int(i + 1)];
- }
- }
- _verticesCount = vc;
- }
-
- private function resize (additional:int) : void {
- var newCapacity:int = Math.min(maxCapacity, Math.max(_capacity + additional, _capacity * 2));
- if (newCapacity == maxCapacity) {
- flush();
- newCapacity = additional;
- if (newCapacity < _capacity) return;
- if (newCapacity > maxCapacity) throw new ArgumentError("Too many vertices: " + newCapacity + " > " + maxCapacity);
- }
- _capacity = newCapacity;
- _vertices.length = newCapacity << 3;
- _triangles.length = newCapacity * 3;
- _verticesBuffer = null;
- _trianglesBuffer = null;
- }
-
- public function flush () : void {
- if (!_verticesCount) return;
-
- var context:Context3D = Starling.context;
-
- if (!_verticesBuffer) {
- _verticesBuffer = context.createVertexBuffer(_capacity, 8);
- var count:int = _verticesCount >> 3;
- _verticesBuffer.uploadFromVector(_vertices, 0, count);
- var verticesTemp:Vector. = new []; // Buffer must be filled completely once.
- verticesTemp.length = (_capacity << 3) - _verticesCount;
- _verticesBuffer.uploadFromVector(verticesTemp, count, _capacity - count);
- verticesTemp = null;
-
- _trianglesBuffer = context.createIndexBuffer(_capacity * 3);
- _trianglesBuffer.uploadFromVector(_triangles, 0, _trianglesCount);
- var trianglesTemp:Vector. = new []; // Buffer must be filled completely once.
- trianglesTemp.length = _capacity * 3 - _trianglesCount;
- _trianglesBuffer.uploadFromVector(trianglesTemp, _trianglesCount, trianglesTemp.length);
- trianglesTemp = null;
-
- context.setVertexBufferAt(0, _verticesBuffer, VertexData.POSITION_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
- context.setVertexBufferAt(1, _verticesBuffer, VertexData.COLOR_OFFSET, Context3DVertexBufferFormat.FLOAT_4);
- context.setVertexBufferAt(2, _verticesBuffer, VertexData.TEXCOORD_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
- } else {
- _verticesBuffer.uploadFromVector(_vertices, 0, _verticesCount >> 3);
- _trianglesBuffer.uploadFromVector(_triangles, 0, _trianglesCount);
- }
-
- var pma:Boolean = _texture ? _texture.premultipliedAlpha : true;
- _renderAlpha[0] = _renderAlpha[1] = _renderAlpha[2] = pma ? _alpha : 1.0;
- _renderAlpha[3] = _alpha;
-
- _support.applyBlendMode(pma);
- context.setProgramConstantsFromVector(Context3DProgramType.VERTEX, 0, _renderAlpha, 1);
-
- setProgram(context);
- context.setTextureAt(0, _texture.base);
- context.drawTriangles(_trianglesBuffer, 0, _trianglesCount / 3);
-
- _verticesCount = 0;
- _trianglesCount = 0;
-
- _support.raiseDrawCount();
- }
-
- private function onContextCreated (event:Event) : void {
- _verticesBuffer = null;
- _trianglesBuffer = null;
- }
-
- private function setProgram (context:Context3D) : void {
- var bits:uint = 0;
- var texture:Texture = _texture;
- if (texture.mipMapping) bits |= 1 << 1;
- if (texture.repeat) bits |= 1 << 2;
- if (smoothing != TextureSmoothing.BILINEAR) bits |= 1 << (smoothing == TextureSmoothing.TRILINEAR ? 3 : 4);
- if (texture.format != Context3DTextureFormat.BGRA) bits |= 1 << (texture.format == "compressedAlpha" ? 5 : 6);
- if (bits == _programBits) return;
- _programBits = bits;
-
- var name:String = _programNameCache[bits];
- if (name == null) {
- name = "PB_i." + bits.toString(16);
- _programNameCache[bits] = name;
- }
-
- var program:Program3D = Starling.current.getProgram(name);
- if (!program) {
- // va0 -> position
- // va1 -> color
- // va2 -> texCoords
- // vc0 -> alpha
- // vc1 -> mvpMatrix
- // fs0 -> texture
- var vertexShader:String =
- "m44 op, va0, vc1 \n" + // 4x4 matrix transform to output clipspace
- "mul v0, va1, vc0 \n" + // multiply alpha (vc0) with color (va1)
- "mov v1, va2 \n"; // pass texture coordinates to fragment program
- var flags:String = RenderSupport.getTextureLookupFlags(texture.format, texture.mipMapping, texture.repeat, smoothing);
- var fragmentShader:String =
- "tex ft1, v1, fs0 " + flags + " \n" + // sample texture 0
- "mul oc, ft1, v0 \n"; // multiply color with texel color
- program = Starling.current.registerProgramFromSource(name, vertexShader, fragmentShader);
- }
- context.setProgram(program);
- }
-}
-}
diff --git a/spine-starling/spine-starling/src/spine/starling/SkeletonAnimation.as b/spine-starling/spine-starling/src/spine/starling/SkeletonAnimation.as
index 8a03be1a8..41e656809 100644
--- a/spine-starling/spine-starling/src/spine/starling/SkeletonAnimation.as
+++ b/spine-starling/spine-starling/src/spine/starling/SkeletonAnimation.as
@@ -39,10 +39,9 @@ import starling.animation.IAnimatable;
public class SkeletonAnimation extends SkeletonSprite implements IAnimatable {
public var state:AnimationState;
public var timeScale:Number = 1;
-
- /** @param renderMeshes If false, meshes won't be rendered. This may improve batching with non-Spine display objects. */
- public function SkeletonAnimation (skeletonData:SkeletonData, renderMeshes:Boolean = true, stateData:AnimationStateData = null) {
- super(skeletonData, renderMeshes);
+
+ public function SkeletonAnimation (skeletonData:SkeletonData, stateData:AnimationStateData = null) {
+ super(skeletonData);
state = new AnimationState(stateData ? stateData : new AnimationStateData(skeletonData));
}
@@ -52,6 +51,7 @@ public class SkeletonAnimation extends SkeletonSprite implements IAnimatable {
state.update(time);
state.apply(skeleton);
skeleton.updateWorldTransform();
+ this.setRequiresRedraw();
}
}
diff --git a/spine-starling/spine-starling/src/spine/starling/SkeletonImage.as b/spine-starling/spine-starling/src/spine/starling/SkeletonMesh.as
similarity index 75%
rename from spine-starling/spine-starling/src/spine/starling/SkeletonImage.as
rename to spine-starling/spine-starling/src/spine/starling/SkeletonMesh.as
index dc98c00df..201c2693a 100644
--- a/spine-starling/spine-starling/src/spine/starling/SkeletonImage.as
+++ b/spine-starling/spine-starling/src/spine/starling/SkeletonMesh.as
@@ -30,27 +30,26 @@
*****************************************************************************/
package spine.starling {
-
-import starling.display.Image;
import starling.textures.Texture;
-import starling.utils.VertexData;
+import starling.styles.MeshStyle;
+import starling.rendering.IndexData;
+import starling.rendering.VertexData;
+import starling.display.Mesh;
-public class SkeletonImage extends Image {
- public function SkeletonImage (texture:Texture) {
- super(texture);
+public class SkeletonMesh extends Mesh {
+
+ public function SkeletonMesh(texture:Texture, vertexData:VertexData = null, indexData:IndexData = null, style:MeshStyle=null) {
+ super(vertexData == null? new VertexData(): vertexData, indexData == null? new IndexData(): indexData, style);
+ this.texture = texture;
+ }
+
+ public function getVertexData(): VertexData {
+ return this.vertexData;
}
-
- public function get vertexData () : VertexData {
- return mVertexData;
- }
-
- public function updateVertices () : void {
- onVertexDataChanged();
- }
-
- override public function get tinted () : Boolean {
- return true;
+
+ public function getIndexData(): IndexData {
+ return this.indexData;
}
}
-}
+}
\ No newline at end of file
diff --git a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as
index 80883fd22..eee354650 100644
--- a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as
+++ b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as
@@ -40,12 +40,14 @@ import spine.attachments.MeshAttachment;
import spine.attachments.RegionAttachment;
import spine.attachments.WeightedMeshAttachment;
-import starling.core.RenderSupport;
import starling.display.BlendMode;
import starling.display.DisplayObject;
+import starling.display.Image;
+import starling.rendering.IndexData;
+import starling.rendering.Painter;
+import starling.rendering.VertexData;
import starling.utils.Color;
import starling.utils.MatrixUtil;
-import starling.utils.VertexData;
import flash.geom.Matrix;
import flash.geom.Point;
@@ -54,129 +56,23 @@ import flash.geom.Rectangle;
public class SkeletonSprite extends DisplayObject {
static private var _tempPoint:Point = new Point();
static private var _tempMatrix:Matrix = new Matrix();
- static private var _tempVertices:Vector. = new Vector.(8);
- static private var _quadTriangles:Vector. = new [0, 1, 2, 2, 3, 0];
+ static private var _tempVertices:Vector. = new Vector.(8);
static internal var blendModes:Vector. = new [
BlendMode.NORMAL, BlendMode.ADD, BlendMode.MULTIPLY, BlendMode.SCREEN];
- private var _skeleton:Skeleton;
- private var _polygonBatch:PolygonBatch;
- public var batchable:Boolean = true;
- private var _batched:Boolean;
+ private var _skeleton:Skeleton;
+ public var batchable:Boolean = true;
private var _smoothing:String = "bilinear";
-
- /** @param renderMeshes If false, meshes won't be rendered. This may improve batching with non-Spine display objects. */
- public function SkeletonSprite (skeletonData:SkeletonData, renderMeshes:Boolean = true) {
+
+ public function SkeletonSprite (skeletonData:SkeletonData) {
Bone.yDown = true;
-
- if (renderMeshes) _polygonBatch = new PolygonBatch();
-
_skeleton = new Skeleton(skeletonData);
_skeleton.updateWorldTransform();
}
- override public function render (support:RenderSupport, alpha:Number) : void {
- alpha *= this.alpha * skeleton.a;
- var originalBlendMode:String = support.blendMode;
- if (_polygonBatch)
- renderMeshes(support, alpha);
- else
- renderRegions(support, alpha);
- support.blendMode = originalBlendMode;
- }
-
- private function renderMeshes (support:RenderSupport, alpha:Number) : void {
- if (!batchable) {
- _polygonBatch.begin(support, alpha, blendMode);
- addToBatch(_polygonBatch, alpha, null);
- _polygonBatch.end();
- } else if (!_batched) {
- support.popMatrix();
- _polygonBatch.begin(support, alpha, blendMode);
- addToBatch(_polygonBatch, alpha, transformationMatrix);
- for(var i:int = parent.getChildIndex(this) + 1, n:int = parent.numChildren; i < n; ++i) {
- var sibling:SkeletonSprite = parent.getChildAt(i) as SkeletonSprite;
- if (!sibling || !sibling.batchable || sibling.blendMode != blendMode || !sibling.visible) break;
- sibling._batched = true;
- sibling.addToBatch(_polygonBatch, alpha, sibling.transformationMatrix);
- }
- _polygonBatch.end();
- support.pushMatrix();
- support.transformMatrix(this);
- } else
- _batched = false;
- }
-
- private function addToBatch (polygonBatch:PolygonBatch, skeletonA:Number, matrix:Matrix) : void {
- var skeletonR:Number = skeleton.r;
- var skeletonG:Number = skeleton.g;
- var skeletonB:Number = skeleton.b;
- var x:Number = skeleton.x;
- var y:Number = skeleton.y;
- var worldVertices:Vector. = _tempVertices;
- var drawOrder:Vector. = skeleton.drawOrder;
- for (var i:int = 0, n:int = drawOrder.length; i < n; ++i) {
- var slot:Slot = drawOrder[i];
- var attachment:Attachment = slot.attachment;
- if (!attachment) continue;
- var image:SkeletonImage, verticesLength:int, uvs:Vector., triangles:Vector.;
- var r:Number, g:Number, b:Number, a:Number;
- if (attachment is RegionAttachment) {
- var region:RegionAttachment = RegionAttachment(slot.attachment);
- verticesLength = 8;
- region.computeWorldVertices(x, y, slot.bone, worldVertices);
- uvs = region.uvs;
- triangles = _quadTriangles;
- r = region.r;
- g = region.g;
- b = region.b;
- a = region.a;
- image = region.rendererObject as SkeletonImage;
- if (image == null) region.rendererObject = image = SkeletonImage(AtlasRegion(region.rendererObject).rendererObject);
- } else if (attachment is MeshAttachment) {
- var mesh:MeshAttachment = MeshAttachment(attachment);
- verticesLength = mesh.vertices.length;
- if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
- mesh.computeWorldVertices(x, y, slot, worldVertices);
- uvs = mesh.uvs;
- triangles = mesh.triangles;
- r = mesh.r;
- g = mesh.g;
- b = mesh.b;
- a = mesh.a;
- image = mesh.rendererObject as SkeletonImage;
- if (image == null) mesh.rendererObject = image = SkeletonImage(AtlasRegion(mesh.rendererObject).rendererObject);
- } else if (attachment is WeightedMeshAttachment) {
- var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(attachment);
- verticesLength = weightedMesh.uvs.length;
- if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
- weightedMesh.computeWorldVertices(x, y, slot, worldVertices);
- uvs = weightedMesh.uvs;
- triangles = weightedMesh.triangles;
- r = weightedMesh.r;
- g = weightedMesh.g;
- b = weightedMesh.b;
- a = weightedMesh.a;
- image = weightedMesh.rendererObject as SkeletonImage;
- if (image == null) weightedMesh.rendererObject = image = SkeletonImage(AtlasRegion(weightedMesh.rendererObject).rendererObject);
- }
- if (image) {
- a *= skeletonA * slot.a;
- if (image.texture.premultipliedAlpha) {
- r *= skeletonR * slot.r * a;
- g *= skeletonG * slot.g * a;
- b *= skeletonB * slot.b * a;
- } else {
- r *= skeletonR * slot.r;
- g *= skeletonG * slot.g;
- b *= skeletonB * slot.b;
- }
- polygonBatch.add(image.texture, worldVertices, verticesLength, uvs, triangles, r, g, b, a, slot.data.blendMode, matrix);
- }
- }
- }
-
- private function renderRegions (support:RenderSupport, alpha:Number) : void {
+ override public function render (painter:Painter) : void {
+ alpha *= this.alpha * skeleton.a;
+ var originalBlendMode:String = painter.state.blendMode;
var r:Number = skeleton.r * 255;
var g:Number = skeleton.g * 255;
var b:Number = skeleton.b * 255;
@@ -184,43 +80,144 @@ public class SkeletonSprite extends DisplayObject {
var y:Number = skeleton.y;
var drawOrder:Vector. = skeleton.drawOrder;
var worldVertices:Vector. = _tempVertices;
+ var ii:int, iii:int;
+ var rgb:uint, a:Number;
+ var mesh:SkeletonMesh;
+ var verticesLength:int, verticesCount:int, indicesLength:int;
+ var indexData:IndexData, indices:Vector., vertexData:VertexData;
+ var uvs: Vector.;
+
for (var i:int = 0, n:int = drawOrder.length; i < n; ++i) {
- var slot:Slot = drawOrder[i];
- var region:RegionAttachment = slot.attachment as RegionAttachment;
- if (region != null) {
+ var slot:Slot = drawOrder[i];
+ if (slot.attachment is RegionAttachment) {
+ var region:RegionAttachment = slot.attachment as RegionAttachment;
region.computeWorldVertices(x, y, slot.bone, worldVertices);
- var a:Number = slot.a * region.a;
- var rgb:uint = Color.rgb(
+ // FIXME pre-multiplied alpha?
+ a = slot.a * region.a;
+ rgb = Color.rgb(
r * slot.r * region.r,
g * slot.g * region.g,
b * slot.b * region.b);
- var image:SkeletonImage = region.rendererObject as SkeletonImage;
- if (image == null) region.rendererObject = image = SkeletonImage(AtlasRegion(region.rendererObject).rendererObject);
-
- var vertexData:VertexData = image.vertexData;
- vertexData.setPosition(0, worldVertices[2], worldVertices[3]);
- vertexData.setColorAndAlpha(0, rgb, a);
+ var image:Image = region.rendererObject as Image;
+ if (image == null) region.rendererObject = image = Image(AtlasRegion(region.rendererObject).rendererObject);
- vertexData.setPosition(1, worldVertices[4], worldVertices[5]);
- vertexData.setColorAndAlpha(1, rgb, a);
+ image.setVertexPosition(0, worldVertices[2], worldVertices[3]);
+ image.setVertexColor(0, rgb);
+ image.setVertexAlpha(0, a);
- vertexData.setPosition(2, worldVertices[0], worldVertices[1]);
- vertexData.setColorAndAlpha(2, rgb, a);
+ image.setVertexPosition(1, worldVertices[4], worldVertices[5]);
+ image.setVertexColor(1, rgb);
+ image.setVertexAlpha(1, a);
- vertexData.setPosition(3, worldVertices[6], worldVertices[7]);
- vertexData.setColorAndAlpha(3, rgb, a);
+ image.setVertexPosition(2, worldVertices[0], worldVertices[1]);
+ image.setVertexColor(2, rgb);
+ image.setVertexAlpha(2, a);
- image.updateVertices();
- support.blendMode = blendModes[slot.data.blendMode.ordinal];
- support.batchQuad(image, alpha, image.texture, _smoothing);
+ image.setVertexPosition(3, worldVertices[6], worldVertices[7]);
+ image.setVertexColor(3, rgb);
+ image.setVertexAlpha(3, a);
+
+ image.setRequiresRedraw();
+ painter.state.blendMode = blendModes[slot.data.blendMode.ordinal];
+ // FIXME set smoothing/filter
+ painter.batchMesh(image);
+ } else if (slot.attachment is MeshAttachment) {
+ var meshAttachment:MeshAttachment = MeshAttachment(slot.attachment);
+ verticesLength = meshAttachment.vertices.length;
+ verticesCount = verticesLength >> 1;
+ if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
+ meshAttachment.computeWorldVertices(x, y, slot, worldVertices);
+ mesh = meshAttachment.rendererObject as SkeletonMesh;
+ if (mesh == null) {
+ if (meshAttachment.rendererObject is Image)
+ meshAttachment.rendererObject = mesh = new SkeletonMesh(Image(meshAttachment.rendererObject).texture);
+ if (meshAttachment.rendererObject is AtlasRegion)
+ meshAttachment.rendererObject = mesh = new SkeletonMesh(Image(AtlasRegion(meshAttachment.rendererObject).rendererObject).texture);
+ }
+
+ if (mesh.numIndices != meshAttachment.triangles.length) {
+ indexData = mesh.getIndexData();
+ indices = meshAttachment.triangles;
+ indicesLength = meshAttachment.triangles.length;
+ for (ii = 0; ii < indicesLength; ii++) {
+ indexData.setIndex(ii, indices[ii]);
+ }
+ indexData.numIndices = indicesLength;
+ indexData.trim();
+ }
+
+ // FIXME pre-multiplied alpha?
+ a = slot.a * meshAttachment.a;
+ rgb = Color.rgb(
+ r * slot.r * meshAttachment.r,
+ g * slot.g * meshAttachment.g,
+ b * slot.b * meshAttachment.b);
+
+ vertexData = mesh.getVertexData();
+ uvs = meshAttachment.uvs;
+ for (ii = 0, iii = 0; ii < verticesCount; ii++, iii+=2) {
+ mesh.setVertexPosition(ii, worldVertices[iii], worldVertices[iii+1]);
+ mesh.setTexCoords(ii, uvs[iii], uvs[iii+1]);
+ mesh.setVertexColor(ii, rgb);
+ mesh.setVertexAlpha(ii, alpha);
+ }
+ vertexData.numVertices = verticesCount;
+ // FIXME set smoothing/filter
+ painter.batchMesh(mesh);
+ } else if (slot.attachment is WeightedMeshAttachment) {
+ var weightedMeshAttachment:WeightedMeshAttachment = WeightedMeshAttachment(slot.attachment);
+ verticesLength = weightedMeshAttachment.uvs.length;
+ verticesCount = verticesLength >> 1;
+ if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
+ weightedMeshAttachment.computeWorldVertices(x, y, slot, worldVertices);
+ mesh = weightedMeshAttachment.rendererObject as SkeletonMesh;
+ if (mesh == null) {
+ if (weightedMeshAttachment.rendererObject is Image)
+ weightedMeshAttachment.rendererObject = mesh = new SkeletonMesh(Image(weightedMeshAttachment.rendererObject).texture);
+ else if (weightedMeshAttachment.rendererObject is AtlasRegion)
+ weightedMeshAttachment.rendererObject = mesh = new SkeletonMesh(Image(AtlasRegion(weightedMeshAttachment.rendererObject).rendererObject).texture);
+ else throw new Error("Unknown rendererObject");
+ }
+
+ if (mesh.numIndices != weightedMeshAttachment.triangles.length) {
+ indexData = mesh.getIndexData();
+ indices = weightedMeshAttachment.triangles;
+ indicesLength = weightedMeshAttachment.triangles.length;
+ for (ii = 0; ii < indicesLength; ii++) {
+ indexData.setIndex(ii, indices[ii]);
+ }
+ indexData.numIndices = indicesLength;
+ indexData.trim();
+ }
+
+ // FIXME pre-multiplied alpha?
+ a = slot.a * weightedMeshAttachment.a;
+ rgb = Color.rgb(
+ r * slot.r * weightedMeshAttachment.r,
+ g * slot.g * weightedMeshAttachment.g,
+ b * slot.b * weightedMeshAttachment.b);
+
+ vertexData = mesh.getVertexData();
+ uvs = weightedMeshAttachment.uvs;
+ for (ii = 0, iii = 0; ii < verticesCount; ii++, iii+=2) {
+ mesh.setVertexPosition(ii, worldVertices[iii], worldVertices[iii+1]);
+ mesh.setTexCoords(ii, uvs[iii], uvs[iii+1]);
+ mesh.setVertexColor(ii, rgb);
+ mesh.setVertexAlpha(ii, alpha);
+ }
+ vertexData.numVertices = verticesCount;
+ // FIXME set smoothing/filter
+ painter.batchMesh(mesh);
}
}
+ painter.state.blendMode = originalBlendMode;
}
- override public function hitTest (localPoint:Point, forTouch:Boolean = false) : DisplayObject {
- if (forTouch && (!visible || !touchable))
- return null;
+ override public function hitTest (localPoint:Point) : DisplayObject {
+ // FIXME what to do here?
+// if (forTouch && (!visible || !touchable))
+// return null;
var minX:Number = Number.MAX_VALUE, minY:Number = Number.MAX_VALUE;
var maxX:Number = -Number.MAX_VALUE, maxY:Number = -Number.MAX_VALUE;
@@ -298,8 +295,7 @@ public class SkeletonSprite extends DisplayObject {
}
public function set smoothing (smoothing:String) : void {
- _smoothing = smoothing;
- if (_polygonBatch) _polygonBatch.smoothing = _smoothing;
+ _smoothing = smoothing;
}
}
diff --git a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as
index 3deae3290..90605fec5 100644
--- a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as
+++ b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as
@@ -30,6 +30,7 @@
*****************************************************************************/
package spine.starling {
+ import starling.display.Image;
import spine.Bone;
import spine.Skin;
import spine.attachments.AttachmentLoader;
@@ -58,7 +59,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
if (texture == null)
throw new Error("Region not found in Starling atlas: " + path + " (region attachment: " + name + ")");
var attachment:RegionAttachment = new RegionAttachment(name);
- attachment.rendererObject = new SkeletonImage(Texture.fromTexture(texture)); // Discard frame.
+ attachment.rendererObject = new Image(Texture.fromTexture(texture)); // Discard frame.
var frame:Rectangle = texture.frame;
attachment.regionOffsetX = frame ? -frame.x : 0;
attachment.regionOffsetY = frame ? -frame.y : 0;
@@ -90,7 +91,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
if (texture == null)
throw new Error("Region not found in Starling atlas: " + path + " (mesh attachment: " + name + ")");
var attachment:MeshAttachment = new MeshAttachment(name);
- attachment.rendererObject = new SkeletonImage(Texture.fromTexture(texture)); // Discard frame.
+ attachment.rendererObject = new Image(Texture.fromTexture(texture)); // Discard frame.
var subTexture:SubTexture = texture as SubTexture;
if (subTexture) {
var root:Texture = subTexture.root;
@@ -99,6 +100,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
attachment.regionV = rectRegion.y / root.height;
attachment.regionU2 = (rectRegion.x + subTexture.width) / root.width;
attachment.regionV2 = (rectRegion.y + subTexture.height) / root.height;
+ attachment.rendererObject = new Image(root);
} else {
attachment.regionU = 0;
attachment.regionV = 1;
@@ -120,7 +122,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
if (texture == null)
throw new Error("Region not found in Starling atlas: " + path + " (weighted mesh attachment: " + name + ")");
var attachment:WeightedMeshAttachment = new WeightedMeshAttachment(name);
- attachment.rendererObject = new SkeletonImage(Texture.fromTexture(texture)); // Discard frame.
+ attachment.rendererObject = new Image(Texture.fromTexture(texture)); // Discard frame.
var subTexture:SubTexture = texture as SubTexture;
if (subTexture) {
var root:Texture = subTexture.root;
@@ -129,6 +131,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
attachment.regionV = rectRegion.y / root.height;
attachment.regionU2 = (rectRegion.x + subTexture.width) / root.width;
attachment.regionV2 = (rectRegion.y + subTexture.height) / root.height;
+ attachment.rendererObject = new Image(root);
} else {
attachment.regionU = 0;
attachment.regionV = 1;
diff --git a/spine-starling/spine-starling/src/spine/starling/StarlingTextureLoader.as b/spine-starling/spine-starling/src/spine/starling/StarlingTextureLoader.as
index 46721a064..4dcc54e7b 100644
--- a/spine-starling/spine-starling/src/spine/starling/StarlingTextureLoader.as
+++ b/spine-starling/spine-starling/src/spine/starling/StarlingTextureLoader.as
@@ -30,6 +30,7 @@
*****************************************************************************/
package spine.starling {
+ import starling.display.Image;
import spine.atlas.AtlasPage;
import spine.atlas.AtlasRegion;
import spine.atlas.TextureLoader;
@@ -78,17 +79,17 @@ public class StarlingTextureLoader implements TextureLoader {
}
public function loadRegion (region:AtlasRegion) : void {
- var image:SkeletonImage = new SkeletonImage(Texture(region.page.rendererObject));
- if (region.rotate) {
- image.setTexCoordsTo(0, region.u, region.v2);
- image.setTexCoordsTo(1, region.u, region.v);
- image.setTexCoordsTo(2, region.u2, region.v2);
- image.setTexCoordsTo(3, region.u2, region.v);
+ var image:Image = new Image(Texture(region.page.rendererObject));
+ if (region.rotate) {
+ image.setTexCoords(0, region.u, region.v2);
+ image.setTexCoords(1, region.u, region.v);
+ image.setTexCoords(2, region.u2, region.v2);
+ image.setTexCoords(3, region.u2, region.v);
} else {
- image.setTexCoordsTo(0, region.u, region.v);
- image.setTexCoordsTo(1, region.u2, region.v);
- image.setTexCoordsTo(2, region.u, region.v2);
- image.setTexCoordsTo(3, region.u2, region.v2);
+ image.setTexCoords(0, region.u, region.v);
+ image.setTexCoords(1, region.u2, region.v);
+ image.setTexCoords(2, region.u, region.v2);
+ image.setTexCoords(3, region.u2, region.v2);
}
region.rendererObject = image;
}