Merge pull request #638 from EsotericSoftware/as3-update-3.3.0
[as3][starling] Update to 3.4, update to Starling 2.0
@ -10,18 +10,32 @@ The Spine Runtimes are developed with the intent to be used with data exported f
|
||||
|
||||
## Spine version
|
||||
|
||||
spine-as3 works with data exported from Spine 3.1.08. Updating spine-as3 to [v3.2](https://github.com/EsotericSoftware/spine-runtimes/issues/586) and [v3.3](https://github.com/EsotericSoftware/spine-runtimes/issues/613) is in progress.
|
||||
spine-as3 works with data exported from the latest Spine version.
|
||||
|
||||
spine-as3 supports all Spine features, including meshes. If using the `spine.flash` classes for rendering, meshes are not supported.
|
||||
|
||||
spine-as3 does not yet support loading the binary format.
|
||||
|
||||
## Setup
|
||||
## Usage
|
||||
1. Create a new Flex or Adobe AIR project in your preferred IDE.
|
||||
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip)
|
||||
3. Add the sources from `spine-as3/spine-as3/src/` to your project
|
||||
|
||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip).
|
||||
1. Using [FDT](http://fdt.powerflasher.com/), import the spine-as3 project by choosing File -> Import -> Existing projects. For other IDEs you will need to create a new project and import the source.
|
||||
## Example
|
||||
The Spine AS3 example works on Windows, Linux and Mac OS X. This guide assumes you are using [FDT Free](http://fdt.powerflasher.com/) as your development environment.
|
||||
|
||||
Alternatively, the contents of the `spine-as3/src` directory can be copied into your project.
|
||||
1. Download [FDT free](http://fdt.powerflasher.com/buy-download/) for your operating system.
|
||||
3. Download and install Adobe Flash Player 22 with debugging support](https://www.adobe.com/support/flashplayer/debug_downloads.html#fp15)
|
||||
2. Download the latest [Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html). We assume it will be installed to some folder on your disk called `flex_sdk`.
|
||||
3. Download the latest [Adobe AIR SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)
|
||||
4. Extract the AIR SDK contents, and copy them to your `flex_sdk` folder. This will replace the Adobe AIR version shipped with Flex.
|
||||
5. Open FDT, go to `Preferences -> FDT -> Installed SDKs`
|
||||
6. Click `Add` and browse to `flex_sdk`
|
||||
7. Go to `File -> Import -> General -> Existing Projects into Workspace`
|
||||
6. Browse to `spine-as3/`. You should see both the `spine-as3` and `spine-as3-example` project in the import dialog. Click `Finish`
|
||||
8. Right click the `Main.as` file in `spine-as3-example/src/spine` in the FDT explorer and select `Debug As -> FDT SWF Application`
|
||||
|
||||
**Note**: FDT Free does not allow project dependencies. If you modify the sources of `spine-as3`, you will have to compile the project to an `.swc` and place it in `spine-as3-example/libs`.
|
||||
|
||||
## Demos
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-librarie
|
||||
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.IncludeTestResources=false
|
||||
com.powerflasher.fdt.core.Language=AS3
|
||||
com.powerflasher.fdt.core.Manifests=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -13,7 +14,7 @@ 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.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<booleanAttribute key="FORCE_FRESH_COMPILATION" value="false"/>
|
||||
<booleanAttribute key="KILL_PREVIOUS_VIEWER" value="true"/>
|
||||
<stringAttribute key="LAUNCHER_DEPENDENCIES" value="[Self]"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/Main.as"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/examples/Main.as"/>
|
||||
<stringAttribute key="MOBILE_PRESET" value=""/>
|
||||
<booleanAttribute key="NEW_WINDOW_EACH_LAUNCH" value="false"/>
|
||||
<stringAttribute key="OUTPUT" value="bin/spine-as3-example.swf"/>
|
||||
|
||||
@ -1,292 +0,0 @@
|
||||
|
||||
goblins-mesh.png
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
dagger
|
||||
rotate: true
|
||||
xy: 372, 100
|
||||
size: 26, 108
|
||||
orig: 26, 108
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/eyes-closed
|
||||
rotate: false
|
||||
xy: 2, 7
|
||||
size: 34, 12
|
||||
orig: 34, 12
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/head
|
||||
rotate: false
|
||||
xy: 107, 36
|
||||
size: 103, 66
|
||||
orig: 103, 66
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-arm
|
||||
rotate: false
|
||||
xy: 901, 56
|
||||
size: 37, 35
|
||||
orig: 37, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-foot
|
||||
rotate: false
|
||||
xy: 929, 95
|
||||
size: 65, 31
|
||||
orig: 65, 31
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-hand
|
||||
rotate: false
|
||||
xy: 452, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-lower-leg
|
||||
rotate: true
|
||||
xy: 713, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-shoulder
|
||||
rotate: false
|
||||
xy: 610, 44
|
||||
size: 29, 44
|
||||
orig: 29, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/left-upper-leg
|
||||
rotate: true
|
||||
xy: 638, 93
|
||||
size: 33, 73
|
||||
orig: 33, 73
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/neck
|
||||
rotate: false
|
||||
xy: 490, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/pelvis
|
||||
rotate: false
|
||||
xy: 482, 45
|
||||
size: 62, 43
|
||||
orig: 62, 43
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-arm
|
||||
rotate: true
|
||||
xy: 690, 2
|
||||
size: 23, 50
|
||||
orig: 23, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-foot
|
||||
rotate: false
|
||||
xy: 771, 58
|
||||
size: 63, 33
|
||||
orig: 63, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-hand
|
||||
rotate: false
|
||||
xy: 940, 56
|
||||
size: 36, 37
|
||||
orig: 36, 37
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-lower-leg
|
||||
rotate: true
|
||||
xy: 482, 90
|
||||
size: 36, 76
|
||||
orig: 36, 76
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-shoulder
|
||||
rotate: true
|
||||
xy: 602, 3
|
||||
size: 39, 45
|
||||
orig: 39, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/right-upper-leg
|
||||
rotate: true
|
||||
xy: 641, 57
|
||||
size: 34, 63
|
||||
orig: 34, 63
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/torso
|
||||
rotate: true
|
||||
xy: 212, 34
|
||||
size: 68, 96
|
||||
orig: 68, 96
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/undie-straps
|
||||
rotate: false
|
||||
xy: 380, 5
|
||||
size: 55, 19
|
||||
orig: 55, 19
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblin/undies
|
||||
rotate: false
|
||||
xy: 174, 5
|
||||
size: 36, 29
|
||||
orig: 36, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/eyes-closed
|
||||
rotate: false
|
||||
xy: 269, 11
|
||||
size: 37, 21
|
||||
orig: 37, 21
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/head
|
||||
rotate: false
|
||||
xy: 2, 21
|
||||
size: 103, 81
|
||||
orig: 103, 81
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-arm
|
||||
rotate: true
|
||||
xy: 978, 56
|
||||
size: 37, 35
|
||||
orig: 37, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-foot
|
||||
rotate: false
|
||||
xy: 107, 3
|
||||
size: 65, 31
|
||||
orig: 65, 31
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-hand
|
||||
rotate: false
|
||||
xy: 565, 2
|
||||
size: 35, 40
|
||||
orig: 35, 40
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-lower-leg
|
||||
rotate: true
|
||||
xy: 785, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-shoulder
|
||||
rotate: true
|
||||
xy: 690, 27
|
||||
size: 28, 46
|
||||
orig: 28, 46
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/left-upper-leg
|
||||
rotate: true
|
||||
xy: 857, 93
|
||||
size: 33, 70
|
||||
orig: 33, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/neck
|
||||
rotate: false
|
||||
xy: 528, 2
|
||||
size: 35, 41
|
||||
orig: 35, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/pelvis
|
||||
rotate: false
|
||||
xy: 546, 45
|
||||
size: 62, 43
|
||||
orig: 62, 43
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-arm
|
||||
rotate: false
|
||||
xy: 452, 48
|
||||
size: 28, 50
|
||||
orig: 28, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-foot
|
||||
rotate: false
|
||||
xy: 836, 58
|
||||
size: 63, 33
|
||||
orig: 63, 33
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-hand
|
||||
rotate: true
|
||||
xy: 771, 20
|
||||
size: 36, 37
|
||||
orig: 36, 37
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-lower-leg
|
||||
rotate: true
|
||||
xy: 560, 90
|
||||
size: 36, 76
|
||||
orig: 36, 76
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-shoulder
|
||||
rotate: false
|
||||
xy: 649, 10
|
||||
size: 39, 45
|
||||
orig: 39, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/right-upper-leg
|
||||
rotate: true
|
||||
xy: 706, 57
|
||||
size: 34, 63
|
||||
orig: 34, 63
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/torso
|
||||
rotate: false
|
||||
xy: 310, 2
|
||||
size: 68, 96
|
||||
orig: 68, 96
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/undie-straps
|
||||
rotate: false
|
||||
xy: 212, 13
|
||||
size: 55, 19
|
||||
orig: 55, 19
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goblingirl/undies
|
||||
rotate: false
|
||||
xy: 810, 27
|
||||
size: 36, 29
|
||||
orig: 36, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
shield
|
||||
rotate: false
|
||||
xy: 380, 26
|
||||
size: 70, 72
|
||||
orig: 70, 72
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
spear
|
||||
rotate: true
|
||||
xy: 2, 104
|
||||
size: 22, 368
|
||||
orig: 22, 368
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
|
Before Width: | Height: | Size: 217 KiB |
@ -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;
|
||||
@ -68,7 +69,7 @@ public class Main extends Sprite {
|
||||
skeleton.y = 560;
|
||||
|
||||
skeleton.state.onStart.add(function (trackIndex:int) : void {
|
||||
trace(trackIndex + " start: " + skeleton.state.getCurrent(trackIndex));
|
||||
trace(trackIndex + " fuu start: " + skeleton.state.getCurrent(trackIndex));
|
||||
});
|
||||
skeleton.state.onEnd.add(function (trackIndex:int) : void {
|
||||
trace(trackIndex + " end: " + skeleton.state.getCurrent(trackIndex));
|
||||
@ -1,194 +1,216 @@
|
||||
|
||||
spineboy.png
|
||||
size: 1024,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
eye_indifferent
|
||||
rotate: true
|
||||
xy: 389, 5
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
xy: 648, 629
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eye_surprised
|
||||
rotate: false
|
||||
xy: 580, 34
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
rotate: true
|
||||
xy: 233, 179
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 732, 85
|
||||
size: 35, 48
|
||||
orig: 35, 48
|
||||
xy: 245, 2
|
||||
size: 58, 80
|
||||
orig: 58, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_closed
|
||||
rotate: false
|
||||
xy: 556, 91
|
||||
size: 45, 49
|
||||
orig: 45, 49
|
||||
xy: 168, 45
|
||||
size: 75, 82
|
||||
orig: 75, 82
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_open
|
||||
rotate: false
|
||||
xy: 668, 32
|
||||
size: 52, 52
|
||||
orig: 52, 52
|
||||
xy: 844, 646
|
||||
size: 86, 87
|
||||
orig: 86, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot
|
||||
rotate: false
|
||||
xy: 924, 201
|
||||
size: 76, 41
|
||||
orig: 76, 41
|
||||
rotate: true
|
||||
xy: 310, 326
|
||||
size: 126, 69
|
||||
orig: 126, 69
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend1
|
||||
rotate: false
|
||||
xy: 845, 200
|
||||
size: 77, 42
|
||||
orig: 77, 42
|
||||
rotate: true
|
||||
xy: 951, 894
|
||||
size: 128, 70
|
||||
orig: 128, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 186
|
||||
size: 65, 56
|
||||
orig: 65, 56
|
||||
xy: 2, 33
|
||||
size: 108, 93
|
||||
orig: 108, 93
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_shin
|
||||
rotate: true
|
||||
xy: 444, 91
|
||||
size: 49, 110
|
||||
orig: 49, 110
|
||||
xy: 739, 735
|
||||
size: 82, 184
|
||||
orig: 82, 184
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_thigh
|
||||
rotate: true
|
||||
xy: 603, 89
|
||||
size: 29, 67
|
||||
orig: 29, 67
|
||||
rotate: false
|
||||
xy: 381, 340
|
||||
size: 48, 112
|
||||
orig: 48, 112
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_upper_arm
|
||||
rotate: true
|
||||
xy: 672, 86
|
||||
size: 32, 58
|
||||
orig: 32, 58
|
||||
rotate: false
|
||||
xy: 112, 29
|
||||
size: 54, 97
|
||||
orig: 54, 97
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goggles
|
||||
rotate: false
|
||||
xy: 444, 142
|
||||
size: 157, 100
|
||||
orig: 157, 100
|
||||
xy: 156, 454
|
||||
size: 261, 166
|
||||
orig: 261, 166
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gun
|
||||
rotate: false
|
||||
xy: 603, 120
|
||||
size: 126, 122
|
||||
orig: 126, 122
|
||||
xy: 739, 819
|
||||
size: 210, 203
|
||||
orig: 210, 203
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: false
|
||||
xy: 279, 63
|
||||
size: 163, 179
|
||||
orig: 163, 179
|
||||
xy: 466, 724
|
||||
size: 271, 298
|
||||
orig: 271, 298
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_board
|
||||
rotate: true
|
||||
xy: 2, 128
|
||||
size: 492, 152
|
||||
orig: 492, 152
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_thruster
|
||||
rotate: false
|
||||
xy: 602, 558
|
||||
size: 60, 64
|
||||
orig: 60, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverglow_small
|
||||
rotate: true
|
||||
xy: 156, 178
|
||||
size: 274, 75
|
||||
orig: 274, 75
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_grind
|
||||
rotate: false
|
||||
xy: 845, 163
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 951, 799
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_oooo
|
||||
rotate: false
|
||||
xy: 842, 126
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 245, 84
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_smile
|
||||
rotate: false
|
||||
xy: 769, 97
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
xy: 925, 738
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
muzzle
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 275, 240
|
||||
orig: 277, 240
|
||||
xy: 2, 622
|
||||
size: 462, 400
|
||||
orig: 462, 400
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
neck
|
||||
rotate: false
|
||||
xy: 903, 173
|
||||
size: 22, 25
|
||||
orig: 22, 25
|
||||
xy: 168, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_bracer
|
||||
rotate: false
|
||||
xy: 722, 40
|
||||
size: 34, 43
|
||||
orig: 34, 43
|
||||
xy: 932, 664
|
||||
size: 56, 72
|
||||
orig: 56, 72
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot
|
||||
rotate: false
|
||||
xy: 444, 11
|
||||
size: 68, 36
|
||||
orig: 68, 36
|
||||
xy: 487, 562
|
||||
size: 113, 60
|
||||
orig: 113, 60
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend1
|
||||
rotate: false
|
||||
xy: 444, 49
|
||||
size: 70, 40
|
||||
orig: 70, 40
|
||||
rotate: true
|
||||
xy: 419, 503
|
||||
size: 117, 66
|
||||
orig: 117, 66
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 134
|
||||
size: 62, 50
|
||||
orig: 62, 50
|
||||
xy: 739, 650
|
||||
size: 103, 83
|
||||
orig: 103, 83
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_shin
|
||||
rotate: false
|
||||
xy: 731, 135
|
||||
size: 45, 107
|
||||
orig: 45, 107
|
||||
xy: 233, 274
|
||||
size: 75, 178
|
||||
orig: 75, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_thigh
|
||||
rotate: true
|
||||
xy: 516, 50
|
||||
size: 39, 62
|
||||
orig: 39, 62
|
||||
xy: 487, 495
|
||||
size: 65, 104
|
||||
orig: 65, 104
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_upper_arm
|
||||
rotate: false
|
||||
xy: 638, 35
|
||||
size: 28, 52
|
||||
orig: 28, 52
|
||||
rotate: true
|
||||
xy: 156, 129
|
||||
size: 47, 87
|
||||
orig: 47, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
torso
|
||||
rotate: true
|
||||
xy: 279, 2
|
||||
size: 59, 108
|
||||
orig: 59, 108
|
||||
xy: 466, 624
|
||||
size: 98, 180
|
||||
orig: 98, 180
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
|
||||
@ -1,39 +1,31 @@
|
||||
{
|
||||
"skeleton": { "hash": "rPoYyBLFG6F0CGZ5wsUEBKDJU9U", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "hip", "y": 247.47 },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "x": -17.45, "y": -11.64, "rotation": -95.51, "color": "00ff04ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "x": 8.91, "y": -5.62, "rotation": -72.54, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "x": -1.61, "y": 4.9, "rotation": 103.82, "color": "e0da19ff" },
|
||||
{
|
||||
"name": "front_shin",
|
||||
"parent": "front_thigh",
|
||||
"length": 128.76,
|
||||
"x": 78.69,
|
||||
"y": 1.6,
|
||||
"rotation": -2.21,
|
||||
"inheritScale": false,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "x": 103.75, "y": 19.32, "rotation": 168.37, "color": "00ff04ff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "x": 127.49, "y": -0.3, "rotation": -31.53, "color": "e0da19ff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "x": 86.1, "y": -1.32, "rotation": -19.83, "color": "ff000dff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "x": 92.35, "y": -19.22, "rotation": -169.55, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "rotation": 103.82, "x": -1.61, "y": 4.9, "color": "e0da19ff" },
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "rotation": 168.37, "x": 103.75, "y": 19.32, "color": "00ff04ff" },
|
||||
{
|
||||
"name": "front_bracer",
|
||||
"parent": "front_upper_arm",
|
||||
"length": 40.57,
|
||||
"rotation": 18.29,
|
||||
"x": 68.8,
|
||||
"y": -0.68,
|
||||
"rotation": 18.29,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "x": 128.75, "y": -0.33, "rotation": 77.9, "color": "00ff04ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "x": 27.66, "y": -0.25, "rotation": 23.18, "color": "e0da19ff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "x": 51.35, "rotation": 23.15, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "x": 121.45, "y": -0.75, "rotation": 69.3, "color": "ff000dff" },
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "x": 40.56, "y": 0.19, "rotation": 12.43, "color": "00ff04ff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "x": 34.42, "y": -0.45, "rotation": 5.34, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "x": 201.04, "y": 52.13, "rotation": 6.83, "color": "ff000dff" }
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "rotation": 12.43, "x": 40.56, "y": 0.19, "color": "00ff04ff" },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "rotation": -95.51, "x": -17.45, "y": -11.64, "color": "00ff04ff" },
|
||||
{ "name": "front_shin", "parent": "front_thigh", "length": 128.76, "rotation": -2.21, "x": 78.69, "y": 1.6, "color": "00ff04ff" },
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "rotation": 77.9, "x": 128.75, "y": -0.33, "color": "00ff04ff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "rotation": -169.55, "x": 92.35, "y": -19.22, "color": "ff000dff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "rotation": 23.15, "x": 51.35, "color": "ff000dff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "rotation": 5.34, "x": 34.42, "y": -0.45, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "rotation": 6.83, "x": 201.04, "y": 52.13, "color": "ff000dff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "rotation": -31.53, "x": 127.49, "y": -0.3, "color": "e0da19ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "rotation": 23.18, "x": 27.66, "y": -0.25, "color": "e0da19ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "rotation": -72.54, "x": 8.91, "y": -5.62, "color": "ff000dff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "rotation": -19.83, "x": 86.1, "y": -1.32, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "rotation": 69.3, "x": 121.45, "y": -0.75, "color": "ff000dff" }
|
||||
],
|
||||
"slots": [
|
||||
{ "name": "rear_upper_arm", "bone": "rear_upper_arm", "attachment": "rear_upper_arm" },
|
||||
@ -96,7 +88,8 @@
|
||||
"head-bb": {
|
||||
"head": {
|
||||
"type": "boundingbox",
|
||||
"vertices": [ -19.143097, -70.30209, 40.80313, -118.074234, 257.77155, -115.61827, 285.16193, 57.18005, 120.77191, 164.95125, -5.067627, 76.94907 ]
|
||||
"vertexCount": 6,
|
||||
"vertices": [ -19.14, -70.3, 40.8, -118.07, 257.77, -115.61, 285.16, 57.18, 120.77, 164.95, -5.06, 76.94 ]
|
||||
}
|
||||
},
|
||||
"mouth": {
|
||||
@ -1832,10 +1825,6 @@
|
||||
]
|
||||
},
|
||||
"muzzle": {
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
],
|
||||
"color": [
|
||||
{
|
||||
"time": 0.1333,
|
||||
@ -1848,6 +1837,10 @@
|
||||
"curve": [ 0.821, 0, 0.909, 0.89 ]
|
||||
},
|
||||
{ "time": 0.2666, "color": "ffffff00" }
|
||||
],
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -2015,7 +2008,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"draworder": [
|
||||
"drawOrder": [
|
||||
{
|
||||
"time": 0.6666,
|
||||
"offsets": [
|
||||
|
||||
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 678 KiB |
@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/textLayout.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/osmf.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/authoringsupport.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/core.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
@ -3,6 +3,7 @@ com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-librarie
|
||||
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.IncludeTestResources=false
|
||||
com.powerflasher.fdt.core.Language=AS3
|
||||
com.powerflasher.fdt.core.Manifests=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -13,7 +14,7 @@ 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.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
|
||||
|
||||
13
spine-as3/spine-as3/.settings/com.powerflasher.fdt.exclude
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<exclude>
|
||||
<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>
|
||||
|
||||
@ -37,14 +37,15 @@ public class Bone implements Updatable {
|
||||
internal var _data:BoneData;
|
||||
internal var _skeleton:Skeleton;
|
||||
internal var _parent:Bone;
|
||||
internal var _children:Vector.<Bone> = new Vector.<Bone>();
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var rotation:Number;
|
||||
public var scaleX:Number;
|
||||
public var scaleY:Number;
|
||||
public var appliedRotation:Number;
|
||||
public var appliedScaleX:Number;
|
||||
public var appliedScaleY:Number;
|
||||
public var shearX:Number;
|
||||
public var shearY:Number;
|
||||
public var appliedRotation:Number;
|
||||
|
||||
internal var _a:Number;
|
||||
internal var _b:Number;
|
||||
@ -54,6 +55,8 @@ public class Bone implements Updatable {
|
||||
internal var _worldY:Number;
|
||||
internal var _worldSignX:Number;
|
||||
internal var _worldSignY:Number;
|
||||
|
||||
internal var _sorted:Boolean;
|
||||
|
||||
/** @param parent May be null. */
|
||||
public function Bone (data:BoneData, skeleton:Skeleton, parent:Bone) {
|
||||
@ -64,26 +67,25 @@ public class Bone implements Updatable {
|
||||
_parent = parent;
|
||||
setToSetupPose();
|
||||
}
|
||||
|
||||
/** Same as updateWorldTransform(). This method exists for Bone to implement Updatable. */
|
||||
public function update () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
|
||||
}
|
||||
|
||||
/** Computes the world SRT using the parent bone and this bone's local SRT. */
|
||||
public function updateWorldTransform () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY);
|
||||
}
|
||||
|
||||
/** Same as updateWorldTransform(). This method exists for Bone to implement Updatable. */
|
||||
public function update () : void {
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY);
|
||||
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
|
||||
}
|
||||
|
||||
/** Computes the world SRT using the parent bone and the specified local SRT. */
|
||||
public function updateWorldTransformWith (x:Number, y:Number, rotation:Number, scaleX:Number, scaleY:Number) : void {
|
||||
public function updateWorldTransformWith (x:Number, y:Number, rotation:Number, scaleX:Number, scaleY:Number, shearX:Number, shearY:Number) : void {
|
||||
appliedRotation = rotation;
|
||||
appliedScaleX = scaleX;
|
||||
appliedScaleY = scaleY;
|
||||
|
||||
var radians:Number = rotation * MathUtils.degRad;
|
||||
var cos:Number = Math.cos(radians), sin:Number = Math.sin(radians);
|
||||
var la:Number = cos * scaleX, lb:Number = -sin * scaleY, lc:Number = sin * scaleX, ld:Number = cos * scaleY;
|
||||
var rotationY:Number = rotation + 90 + shearY;
|
||||
var la:Number = MathUtils.cosDeg(rotation + shearX) * scaleX, lb:Number = MathUtils.cosDeg(rotationY) * scaleY;
|
||||
var lc:Number = MathUtils.sinDeg(rotation + shearX) * scaleX, ld:Number = MathUtils.sinDeg(rotationY) * scaleY;
|
||||
|
||||
var parent:Bone = _parent;
|
||||
if (!parent) { // Root bone.
|
||||
var skeleton:Skeleton = _skeleton;
|
||||
@ -126,15 +128,13 @@ public class Bone implements Updatable {
|
||||
pc = 0;
|
||||
pd = 1;
|
||||
do {
|
||||
radians = parent.appliedRotation * MathUtils.degRad;
|
||||
cos = Math.cos(radians);
|
||||
sin = Math.sin(radians);
|
||||
var temp1:Number = pa * cos + pb * sin;
|
||||
pb = pa * -sin + pb * cos;
|
||||
pa = temp1;
|
||||
temp1 = pc * cos + pd * sin;
|
||||
pd = pc * -sin + pd * cos;
|
||||
pc = temp1;
|
||||
var cos:Number = MathUtils.cosDeg(parent.appliedRotation), sin:Number = MathUtils.sinDeg(parent.appliedRotation);
|
||||
var temp:Number = pa * cos + pb * sin;
|
||||
pb = pb * cos - pa * sin;
|
||||
pa = temp;
|
||||
temp = pc * cos + pd * sin;
|
||||
pd = pd * cos - pc * sin;
|
||||
pc = temp;
|
||||
|
||||
if (!parent.data.inheritRotation) break;
|
||||
parent = parent.parent;
|
||||
@ -149,27 +149,23 @@ public class Bone implements Updatable {
|
||||
pc = 0;
|
||||
pd = 1;
|
||||
do {
|
||||
radians = parent.rotation * MathUtils.degRad;
|
||||
cos = Math.cos(radians);
|
||||
sin = Math.sin(radians);
|
||||
var psx:Number = parent.appliedScaleX, psy:Number = parent.appliedScaleY;
|
||||
var za:Number = cos * psx, zb:Number = -sin * psy, zc:Number = sin * psx, zd:Number = cos * psy;
|
||||
var temp2:Number = pa * za + pb * zc;
|
||||
pb = pa * zb + pb * zd;
|
||||
pa = temp2;
|
||||
temp2 = pc * za + pd * zc;
|
||||
pd = pc * zb + pd * zd;
|
||||
pc = temp2;
|
||||
|
||||
if (psx < 0) radians = -radians;
|
||||
cos = Math.cos(-radians);
|
||||
sin = Math.sin(-radians);
|
||||
temp2 = pa * cos + pb * sin;
|
||||
pb = pa * -sin + pb * cos;
|
||||
pa = temp2;
|
||||
temp2 = pc * cos + pd * sin;
|
||||
pd = pc * -sin + pd * cos;
|
||||
pc = temp2;
|
||||
cos = MathUtils.cosDeg(parent.appliedRotation), sin = MathUtils.sinDeg(parent.appliedRotation);
|
||||
var psx:Number = parent.scaleX, psy:Number = parent.scaleY;
|
||||
var za:Number = cos * psx, zb:Number = sin * psy, zc:Number = sin * psx, zd:Number = cos * psy;
|
||||
temp = pa * za + pb * zc;
|
||||
pb = pb * zd - pa * zb;
|
||||
pa = temp;
|
||||
temp = pc * za + pd * zc;
|
||||
pd = pd * zd - pc * zb;
|
||||
pc = temp;
|
||||
|
||||
if (psx >= 0) sin = -sin;
|
||||
temp = pa * cos + pb * sin;
|
||||
pb = pb * cos - pa * sin;
|
||||
pa = temp;
|
||||
temp = pc * cos + pd * sin;
|
||||
pd = pd * cos - pc * sin;
|
||||
pc = temp;
|
||||
|
||||
if (!parent.data.inheritScale) break;
|
||||
parent = parent.parent;
|
||||
@ -201,18 +197,24 @@ public class Bone implements Updatable {
|
||||
rotation = _data.rotation;
|
||||
scaleX = _data.scaleX;
|
||||
scaleY = _data.scaleY;
|
||||
shearX = _data.shearX;
|
||||
shearY = _data.shearY;
|
||||
}
|
||||
|
||||
public function get data () : BoneData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get skeleton () : Skeleton {
|
||||
return _skeleton;
|
||||
}
|
||||
|
||||
public function get parent () : Bone {
|
||||
return _parent;
|
||||
}
|
||||
|
||||
public function get skeleton () : Skeleton {
|
||||
return _skeleton;
|
||||
public function get children () : Vector.<Bone> {;
|
||||
return _children;
|
||||
}
|
||||
|
||||
public function get a () : Number {
|
||||
@ -262,11 +264,81 @@ public class Bone implements Updatable {
|
||||
public function get worldScaleY () : Number {
|
||||
return Math.sqrt(_c * _c + _d * _d) * _worldSignY;
|
||||
}
|
||||
|
||||
public function worldToLocalRotationX () : Number {
|
||||
var parent:Bone = _parent;
|
||||
if (parent == null) return rotation;
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d, a:Number = this.a, c:Number = this.c;
|
||||
return Math.atan2(pa * c - pc * a, pd * a - pb * c) * MathUtils.radDeg;
|
||||
}
|
||||
|
||||
public function worldToLocalRotationY () : Number {
|
||||
var parent:Bone = _parent;
|
||||
if (parent == null) return rotation;
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d, b:Number = this.b, d:Number = this.d;
|
||||
return Math.atan2(pa * d - pc * b, pd * b - pb * d) * MathUtils.radDeg;
|
||||
}
|
||||
|
||||
public function rotateWorld (degrees:Number) : void {
|
||||
var a:Number = this.a, b:Number = this.b, c:Number = this.c, d:Number = this.d;
|
||||
var cos:Number = MathUtils.cosDeg(degrees), sin:Number = MathUtils.sinDeg(degrees);
|
||||
this._a = cos * a - sin * c;
|
||||
this._b = cos * b - sin * d;
|
||||
this._c = sin * a + cos * c;
|
||||
this._d = sin * b + cos * d;
|
||||
}
|
||||
|
||||
/** Computes the local transform from the world transform. This can be useful to perform processing on the local transform
|
||||
* after the world transform has been modified directly (eg, by a constraint).
|
||||
* <p>
|
||||
* Some redundant information is lost by the world transform, such as -1,-1 scale versus 180 rotation. The computed local
|
||||
* transform values may differ from the original values but are functionally the same. */
|
||||
public function updateLocalTransform () : void {
|
||||
var parent:Bone = this.parent;
|
||||
if (parent == null) {
|
||||
x = worldX;
|
||||
y = worldY;
|
||||
rotation = Math.atan2(c, a) * MathUtils.radDeg;
|
||||
scaleX = Math.sqrt(a * a + c * c);
|
||||
scaleY = Math.sqrt(b * b + d * d);
|
||||
var det:Number = a * d - b * c;
|
||||
shearX = 0;
|
||||
shearY = Math.atan2(a * b + c * d, det) * MathUtils.radDeg;
|
||||
return;
|
||||
}
|
||||
var pa:Number = parent.a, pb:Number = parent.b, pc:Number = parent.c, pd:Number = parent.d;
|
||||
var pid:Number = 1 / (pa * pd - pb * pc);
|
||||
var dx:Number = worldX - parent.worldX, dy:Number = worldY - parent.worldY;
|
||||
x = (dx * pd * pid - dy * pb * pid);
|
||||
y = (dy * pa * pid - dx * pc * pid);
|
||||
var ia:Number = pid * pd;
|
||||
var id:Number = pid * pa;
|
||||
var ib:Number = pid * pb;
|
||||
var ic:Number = pid * pc;
|
||||
var ra:Number = ia * a - ib * c;
|
||||
var rb:Number = ia * b - ib * d;
|
||||
var rc:Number = id * c - ic * a;
|
||||
var rd:Number = id * d - ic * b;
|
||||
shearX = 0;
|
||||
scaleX = Math.sqrt(ra * ra + rc * rc);
|
||||
if (scaleX > 0.0001) {
|
||||
det = ra * rd - rb * rc;
|
||||
scaleY = det / scaleX;
|
||||
shearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;
|
||||
rotation = Math.atan2(rc, ra) * MathUtils.radDeg;
|
||||
} else {
|
||||
scaleX = 0;
|
||||
scaleY = Math.sqrt(rb * rb + rd * rd);
|
||||
shearY = 0;
|
||||
rotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
||||
}
|
||||
appliedRotation = rotation;
|
||||
}
|
||||
|
||||
public function worldToLocal (world:Vector.<Number>) : void {
|
||||
var x:Number = world[0] - _worldX, y:Number = world[1] - _worldY;
|
||||
var a:Number = _a, b:Number = _b, c:Number = _c, d:Number = _d;
|
||||
var invDet:Number = 1 / (a * d - b * c);
|
||||
var x:Number = world[0] - _worldX, y:Number = world[1] - _worldY;
|
||||
world[0] = (x * d * invDet - y * b * invDet);
|
||||
world[1] = (y * a * invDet - x * c * invDet);
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
package spine {
|
||||
|
||||
public class BoneData {
|
||||
internal var _index:int;
|
||||
internal var _name:String;
|
||||
internal var _parent:BoneData;
|
||||
public var length:Number;
|
||||
@ -40,15 +41,23 @@ public class BoneData {
|
||||
public var rotation:Number;
|
||||
public var scaleX:Number = 1;
|
||||
public var scaleY:Number = 1;
|
||||
public var inheritScale:Boolean = true;
|
||||
public var shearX:Number;
|
||||
public var shearY:Number;
|
||||
public var inheritRotation:Boolean = true;
|
||||
public var inheritScale:Boolean = true;
|
||||
|
||||
/** @param parent May be null. */
|
||||
public function BoneData (name:String, parent:BoneData) {
|
||||
public function BoneData (index:int, name:String, parent:BoneData) {
|
||||
if (index < 0) throw new ArgumentError("index must be >= 0");
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_index = index;
|
||||
_name = name;
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public function get index () : int {
|
||||
return _index;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
|
||||
@ -35,8 +35,10 @@ public class IkConstraint implements Updatable {
|
||||
internal var _data:IkConstraintData;
|
||||
public var bones:Vector.<Bone>;
|
||||
public var target:Bone;
|
||||
public var bendDirection:int;
|
||||
public var mix:Number;
|
||||
public var bendDirection:int;
|
||||
|
||||
public var level:int;
|
||||
|
||||
public function IkConstraint (data:IkConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
@ -77,121 +79,128 @@ public class IkConstraint implements Updatable {
|
||||
/** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world
|
||||
* coordinate system. */
|
||||
static public function apply1 (bone:Bone, targetX:Number, targetY:Number, alpha:Number) : void {
|
||||
var parentRotation:Number = bone._parent == null ? 0 : bone._parent.worldRotationX;
|
||||
var rotation:Number = bone.rotation;
|
||||
var rotationIK:Number = Math.atan2(targetY - bone._worldY, targetX - bone._worldX) * MathUtils.radDeg - parentRotation;
|
||||
if ((bone._worldSignX != bone._worldSignY) != (bone._skeleton.flipX != (bone._skeleton.flipY != Bone.yDown)))
|
||||
rotationIK = 360 - rotationIK;
|
||||
if (rotationIK > 180) rotationIK -= 360;
|
||||
var pp:Bone = bone.parent;
|
||||
var id:Number = 1 / (pp.a * pp.d - pp.b * pp.c);
|
||||
var x:Number = targetX - pp.worldX, y:Number = targetY - pp.worldY;
|
||||
var tx:Number = (x * pp.d - y * pp.b) * id - bone.x, ty:Number = (y * pp.a - x * pp.c) * id - bone.y;
|
||||
var rotationIK:Number = Math.atan2(ty, tx) * MathUtils.radDeg - bone.shearX - bone.rotation;
|
||||
if (bone.scaleX < 0) rotationIK += 180;
|
||||
if (rotationIK > 180)
|
||||
rotationIK -= 360;
|
||||
else if (rotationIK < -180) rotationIK += 360;
|
||||
bone.updateWorldTransformWith(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.appliedScaleX, bone.appliedScaleY);
|
||||
bone.updateWorldTransformWith(bone.x, bone.y, bone.rotation + rotationIK * alpha, bone.scaleX, bone.scaleY, bone.shearX,
|
||||
bone.shearY);
|
||||
}
|
||||
|
||||
/** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The
|
||||
* target is specified in the world coordinate system.
|
||||
* @param child Any descendant bone of the parent. */
|
||||
static public function apply2 (parent:Bone, child:Bone, targetX:Number, targetY:Number, bendDir:int, alpha:Number) : void {
|
||||
if (alpha == 0) return;
|
||||
var px:Number = parent.x, py:Number = parent.y, psx:Number = parent.appliedScaleX, psy:Number = parent.appliedScaleY;
|
||||
var o1:int, o2:int, s2:int;
|
||||
if (alpha == 0) {
|
||||
child.updateWorldTransform();
|
||||
return;
|
||||
}
|
||||
var px:Number = parent.x, py:Number = parent.y, psx:Number = parent.scaleX, psy:Number = parent.scaleY, csx:Number = child.scaleX;;
|
||||
var os1:int, os2:int, s2:int;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
o1 = 180;
|
||||
os1 = 180;
|
||||
s2 = -1;
|
||||
} else {
|
||||
o1 = 0;
|
||||
os1 = 0;
|
||||
s2 = 1;
|
||||
}
|
||||
if (psy < 0) {
|
||||
psy = -psy;
|
||||
s2 = -s2;
|
||||
}
|
||||
var cx:Number = child.x, cy:Number = child.y, csx:Number = child.appliedScaleX;
|
||||
var u:Boolean = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u && cy != 0) {
|
||||
child._worldX = parent.a * cx + parent.worldX;
|
||||
child._worldY = parent.c * cx + parent.worldY;
|
||||
cy = 0;
|
||||
}
|
||||
if (csx < 0) {
|
||||
csx = -csx;
|
||||
o2 = 180;
|
||||
os2 = 180;
|
||||
} else
|
||||
o2 = 0;
|
||||
var pp:Bone = parent.parent;
|
||||
var tx:Number, ty:Number, dx:Number, dy:Number;
|
||||
if (!pp) {
|
||||
tx = targetX - px;
|
||||
ty = targetY - py;
|
||||
dx = child._worldX - px;
|
||||
dy = child._worldY - py;
|
||||
os2 = 0;
|
||||
var cx:Number = child.x, cy:Number, cwx:Number, cwy:Number, a:Number = parent.a, b:Number = parent.b, c:Number = parent.c, d:Number = parent.d;
|
||||
var u:Boolean = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
} else {
|
||||
var ppa:Number = pp.a, ppb:Number = pp.b, ppc:Number = pp.c, ppd:Number = pp.d;
|
||||
var invDet:Number = 1 / (ppa * ppd - ppb * ppc);
|
||||
var wx:Number = pp._worldX, wy:Number = pp._worldY, twx:Number = targetX - wx, twy:Number = targetY - wy;
|
||||
tx = (twx * ppd - twy * ppb) * invDet - px;
|
||||
ty = (twy * ppa - twx * ppc) * invDet - py;
|
||||
twx = child._worldX - wx;
|
||||
twy = child._worldY - wy;
|
||||
dx = (twx * ppd - twy * ppb) * invDet - px;
|
||||
dy = (twy * ppa - twx * ppc) * invDet - py;
|
||||
cy = child.y;
|
||||
cwx = a * cx + b * cy + parent.worldX;
|
||||
cwy = c * cx + d * cy + parent.worldY;
|
||||
}
|
||||
var pp:Bone = parent.parent;
|
||||
a = pp.a;
|
||||
b = pp.b;
|
||||
c = pp.c;
|
||||
d = pp.d;
|
||||
var id:Number = 1 / (a * d - b * c), x:Number = targetX - pp.worldX, y:Number = targetY - pp.worldY;
|
||||
var tx:Number = (x * d - y * b) * id - px, ty:Number = (y * a - x * c) * id - py;
|
||||
x = cwx - pp.worldX;
|
||||
y = cwy - pp.worldY;
|
||||
var dx:Number = (x * d - y * b) * id - px, dy:Number = (y * a - x * c) * id - py;
|
||||
var l1:Number = Math.sqrt(dx * dx + dy * dy), l2:Number = child.data.length * csx, a1:Number, a2:Number;
|
||||
outer:
|
||||
if (u) {
|
||||
l2 *= psx;
|
||||
var cos:Number = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1) cos = -1;
|
||||
if (cos < -1)
|
||||
cos = -1;
|
||||
else if (cos > 1) cos = 1;
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
var ad:Number = l1 + l2 * cos, o:Number = l2 * Math.sin(a2);
|
||||
a1 = Math.atan2(ty * ad - tx * o, tx * ad + ty * o);
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);
|
||||
} else {
|
||||
var a:Number = psx * l2, b:Number = psy * l2, ta:Number = Math.atan2(ty, tx);
|
||||
var aa:Number = a * a, bb:Number = b * b, ll:Number = l1 * l1, dd:Number = tx * tx + ty * ty;
|
||||
var c0:Number = bb * ll + aa * dd - aa * bb, c1:Number = -2 * bb * l1, c2:Number = bb - aa;
|
||||
var d:Number = c1 * c1 - 4 * c2 * c0;
|
||||
a = psx * l2;
|
||||
b = psy * l2;
|
||||
var aa:Number = a * a, bb:Number = b * b, dd:Number = tx * tx + ty * ty, ta:Number = Math.atan2(ty, tx);
|
||||
c = bb * l1 * l1 + aa * dd - aa * bb;
|
||||
var c1:Number = -2 * bb * l1, c2:Number = bb - aa;
|
||||
d = c1 * c1 - 4 * c2 * c;
|
||||
if (d >= 0) {
|
||||
var q:Number = Math.sqrt(d);
|
||||
if (c1 < 0) q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
var r0:Number = q / c2, r1:Number = c0 / q;
|
||||
var r0:Number = q / c2, r1:Number = c / q;
|
||||
var r:Number = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
var y1:Number = Math.sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - Math.atan2(y1, r);
|
||||
a2 = Math.atan2(y1 / psy, (r - l1) / psx);
|
||||
y = Math.sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - Math.atan2(y, r);
|
||||
a2 = Math.atan2(y / psy, (r - l1) / psx);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
var minAngle:Number = 0, minDist:Number = Number.MAX_VALUE, minX:Number = 0, minY:Number = 0;
|
||||
var maxAngle:Number = 0, maxDist:Number = 0, maxX:Number = 0, maxY:Number = 0;
|
||||
var x:Number = l1 + a, dist:Number = x * x;
|
||||
if (dist > maxDist) {
|
||||
x = l1 + a;
|
||||
d = x * x;
|
||||
if (d > maxDist) {
|
||||
maxAngle = 0;
|
||||
maxDist = dist;
|
||||
maxDist = d;
|
||||
maxX = x;
|
||||
}
|
||||
x = l1 - a;
|
||||
dist = x * x;
|
||||
if (dist < minDist) {
|
||||
d = x * x;
|
||||
if (d < minDist) {
|
||||
minAngle = Math.PI;
|
||||
minDist = dist;
|
||||
minDist = d;
|
||||
minX = x;
|
||||
}
|
||||
var angle:Number = Math.acos(-a * l1 / (aa - bb));
|
||||
x = a * Math.cos(angle) + l1;
|
||||
var y:Number = b * Math.sin(angle);
|
||||
dist = x * x + y * y;
|
||||
if (dist < minDist) {
|
||||
y = b * Math.sin(angle);
|
||||
d = x * x + y * y;
|
||||
if (d < minDist) {
|
||||
minAngle = angle;
|
||||
minDist = dist;
|
||||
minDist = d;
|
||||
minX = x;
|
||||
minY = y;
|
||||
}
|
||||
if (dist > maxDist) {
|
||||
if (d > maxDist) {
|
||||
maxAngle = angle;
|
||||
maxDist = dist;
|
||||
maxDist = d;
|
||||
maxX = x;
|
||||
maxY = y;
|
||||
}
|
||||
@ -204,16 +213,18 @@ public class IkConstraint implements Updatable {
|
||||
}
|
||||
}
|
||||
var os:Number = Math.atan2(cy, cx) * s2;
|
||||
a1 = (a1 - os) * MathUtils.radDeg + o1;
|
||||
a2 = (a2 + os) * MathUtils.radDeg * s2 + o2;
|
||||
if (a1 > 180) a1 -= 360;
|
||||
else if (a1 < -180) a1 += 360;
|
||||
if (a2 > 180) a2 -= 360;
|
||||
else if (a2 < -180) a2 += 360;
|
||||
var rotation:Number = parent.rotation;
|
||||
parent.updateWorldTransformWith(px, py, rotation + (a1 - rotation) * alpha, parent.appliedScaleX, parent.appliedScaleY);
|
||||
a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;
|
||||
if (a1 > 180)
|
||||
a1 -= 360;
|
||||
else if (a1 < -180) a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, parent.scaleX, parent.scaleY, 0, 0);
|
||||
rotation = child.rotation;
|
||||
child.updateWorldTransformWith(cx, cy, rotation + (a2 - rotation) * alpha, child.appliedScaleX, child.appliedScaleY);
|
||||
a2 = ((a2 + os) * MathUtils.radDeg - child.shearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
a2 -= 360;
|
||||
else if (a2 < -180) a2 += 360;
|
||||
child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.scaleX, child.scaleY, child.shearX, child.shearY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,20 @@ package spine {
|
||||
public class MathUtils {
|
||||
static public var radDeg:Number = 180 / Math.PI;
|
||||
static public var degRad:Number = Math.PI / 180;
|
||||
|
||||
static public function cosDeg(degrees:Number): Number {
|
||||
return Math.cos(degrees * degRad);
|
||||
}
|
||||
|
||||
static public function sinDeg(degrees:Number): Number {
|
||||
return Math.sin(degrees * degRad);
|
||||
}
|
||||
|
||||
static public function clamp (value:Number, min:Number, max:Number) : Number {
|
||||
if (value < min) return min;
|
||||
if (value > max) return max;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
420
spine-as3/spine-as3/src/spine/PathConstraint.as
Normal file
@ -0,0 +1,420 @@
|
||||
/******************************************************************************
|
||||
* 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 {
|
||||
import spine.attachments.PathAttachment;
|
||||
|
||||
public class PathConstraint implements Updatable {
|
||||
private static const NONE:int = -1, BEFORE:int = -2, AFTER:int = -3;
|
||||
|
||||
internal var _data:PathConstraintData;
|
||||
internal var _bones:Vector.<Bone>;
|
||||
public var target:Slot;
|
||||
public var position:Number, spacing:Number, rotateMix:Number, translateMix:Number;
|
||||
|
||||
internal const _spaces:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _positions:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _world:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _curves:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _lengths:Vector.<Number> = new Vector.<Number>();
|
||||
internal const _segments:Vector.<Number> = new Vector.<Number>(10);
|
||||
|
||||
public function PathConstraint (data:PathConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
if (skeleton == null) throw new ArgumentError("skeleton cannot be null.");
|
||||
_data = data;
|
||||
_bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones)
|
||||
_bones.push(skeleton.findBone(boneData.name));
|
||||
target = skeleton.findSlot(data.target.name);
|
||||
position = data.position;
|
||||
spacing = data.spacing;
|
||||
rotateMix = data.rotateMix;
|
||||
translateMix = data.translateMix;
|
||||
}
|
||||
|
||||
public function apply () : void {
|
||||
update();
|
||||
}
|
||||
|
||||
public function update () : void {
|
||||
var attachment:PathAttachment = target.attachment as PathAttachment;
|
||||
if (attachment == null) return;
|
||||
|
||||
var rotateMix:Number = this.rotateMix, translateMix:Number = this.translateMix;
|
||||
var translate:Boolean = translateMix > 0, rotate:Boolean = rotateMix > 0;
|
||||
if (!translate && !rotate) return;
|
||||
|
||||
var data:PathConstraintData = this._data;
|
||||
var spacingMode:SpacingMode = data.spacingMode;
|
||||
var lengthSpacing:Boolean = spacingMode == SpacingMode.length;
|
||||
var rotateMode:RotateMode = data.rotateMode;
|
||||
var tangents:Boolean = rotateMode == RotateMode.tangent, scale:Boolean = rotateMode == RotateMode.chainScale;
|
||||
var boneCount:int = this._bones.length, spacesCount:int = tangents ? boneCount : boneCount + 1;
|
||||
var bones:Vector.<Bone> = this._bones;
|
||||
this._spaces.length = spacesCount;
|
||||
var spaces:Vector.<Number> = this._spaces, lengths:Vector.<Number> = null;
|
||||
var spacing:Number = this.spacing;
|
||||
if (scale || lengthSpacing) {
|
||||
if (scale) {
|
||||
this._lengths.length = boneCount;
|
||||
lengths = this._lengths;
|
||||
}
|
||||
for (var i:int = 0, n:int = spacesCount - 1; i < n;) {
|
||||
var bone:Bone = bones[i];
|
||||
var length:Number = bone.data.length, x:Number = length * bone.a, y:Number = length * bone.c;
|
||||
length = Math.sqrt(x * x + y * y);
|
||||
if (scale) lengths[i] = length;
|
||||
spaces[++i] = lengthSpacing ? Math.max(0, length + spacing) : spacing;
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i < spacesCount; i++)
|
||||
spaces[i] = spacing;
|
||||
}
|
||||
|
||||
var positions:Vector.<Number> = computeWorldPositions(attachment, spacesCount, tangents,
|
||||
data.positionMode == PositionMode.percent, spacingMode == SpacingMode.percent);
|
||||
var skeleton:Skeleton = target.skeleton;
|
||||
var skeletonX:Number = skeleton.x, skeletonY:Number = skeleton.y;
|
||||
var boneX:Number = positions[0], boneY:Number = positions[1], offsetRotation:Number = data.offsetRotation;
|
||||
var tip:Boolean = rotateMode == RotateMode.chain && offsetRotation == 0;
|
||||
var p:Number;
|
||||
for (i = 0, p = 3; i < boneCount; i++, p += 3) {
|
||||
bone = bones[i];
|
||||
bone._worldX += (boneX - skeletonX - bone.worldX) * translateMix;
|
||||
bone._worldY += (boneY - skeletonY - bone.worldY) * translateMix;
|
||||
x = positions[p]; y = positions[p + 1]; var dx:Number = x - boneX, dy:Number = y - boneY;
|
||||
if (scale) {
|
||||
length = lengths[i];
|
||||
if (length != 0) {
|
||||
var s:Number = (Math.sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
}
|
||||
}
|
||||
boneX = x;
|
||||
boneY = y;
|
||||
if (rotate) {
|
||||
var a:Number = bone.a, b:Number = bone.b, c:Number = bone.c, d:Number = bone.d, r:Number, cos:Number, sin:Number;
|
||||
if (tangents)
|
||||
r = positions[p - 1];
|
||||
else if (spaces[i + 1] == 0)
|
||||
r = positions[p + 2];
|
||||
else
|
||||
r = Math.atan2(dy, dx);
|
||||
r -= Math.atan2(c, a) - offsetRotation * MathUtils.degRad;
|
||||
if (tip) {
|
||||
cos = Math.cos(r);
|
||||
sin = Math.sin(r);
|
||||
length = bone.data.length;
|
||||
boneX += (length * (cos * a - sin * c) - dx) * rotateMix;
|
||||
boneY += (length * (sin * a + cos * c) - dy) * rotateMix;
|
||||
}
|
||||
if (r > Math.PI)
|
||||
r -= (Math.PI * 2);
|
||||
else if (r < -Math.PI) //
|
||||
r += (Math.PI * 2);
|
||||
r *= rotateMix;
|
||||
cos = Math.cos(r);
|
||||
sin = Math.sin(r);
|
||||
bone._a = cos * a - sin * c;
|
||||
bone._b = cos * b - sin * d;
|
||||
bone._c = sin * a + cos * c;
|
||||
bone._d = sin * b + cos * d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function computeWorldPositions (path:PathAttachment, spacesCount:int, tangents:Boolean, percentPosition:Boolean,
|
||||
percentSpacing:Boolean) : Vector.<Number> {
|
||||
var target:Slot = this.target;
|
||||
var position:Number = this.position;
|
||||
var spaces:Vector.<Number> = this._spaces;
|
||||
this._positions.length = spacesCount * 3 + 2;
|
||||
var out:Vector.<Number> = this._positions, world:Vector.<Number>;
|
||||
var closed:Boolean = path.closed;
|
||||
var verticesLength:int = path.worldVerticesLength, curveCount:int = verticesLength / 6, prevCurve:int = NONE;
|
||||
|
||||
if (!path.constantSpeed) {
|
||||
var lengths:Vector.<Number> = path.lengths;
|
||||
curveCount -= closed ? 1 : 2;
|
||||
var pathLength:Number = lengths[curveCount];
|
||||
if (percentPosition) position *= pathLength;
|
||||
if (percentSpacing) {
|
||||
for (var i:int = 0; i < spacesCount; i++)
|
||||
spaces[i] *= pathLength;
|
||||
}
|
||||
this._world.length = 8;
|
||||
world = this._world;
|
||||
var o:int, curve:int;
|
||||
for (i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {
|
||||
var space:Number = spaces[i];
|
||||
position += space;
|
||||
var p:Number = position;
|
||||
|
||||
if (closed) {
|
||||
p %= pathLength;
|
||||
if (p < 0) p += pathLength;
|
||||
curve = 0;
|
||||
} else if (p < 0) {
|
||||
if (prevCurve != BEFORE) {
|
||||
prevCurve = BEFORE;
|
||||
path.computeWorldVertices2(target, 2, 4, world, 0);
|
||||
}
|
||||
addBeforePosition(p, world, 0, out, o);
|
||||
continue;
|
||||
} else if (p > pathLength) {
|
||||
if (prevCurve != AFTER) {
|
||||
prevCurve = AFTER;
|
||||
path.computeWorldVertices2(target, verticesLength - 6, 4, world, 0);
|
||||
}
|
||||
addAfterPosition(p - pathLength, world, 0, out, o);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine curve containing position.
|
||||
for (;; curve++) {
|
||||
var length:Number = lengths[curve];
|
||||
if (p > length) continue;
|
||||
if (curve == 0)
|
||||
p /= length;
|
||||
else {
|
||||
var prev:Number = lengths[curve - 1];
|
||||
p = (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (curve != prevCurve) {
|
||||
prevCurve = curve;
|
||||
if (closed && curve == curveCount) {
|
||||
path.computeWorldVertices2(target, verticesLength - 4, 4, world, 0);
|
||||
path.computeWorldVertices2(target, 0, 4, world, 4);
|
||||
} else
|
||||
path.computeWorldVertices2(target, curve * 6 + 2, 8, world, 0);
|
||||
}
|
||||
addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o,
|
||||
tangents || (i > 0 && space == 0));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// World vertices.
|
||||
if (closed) {
|
||||
verticesLength += 2;
|
||||
this._world.length = verticesLength;
|
||||
world = this._world;
|
||||
path.computeWorldVertices2(target, 2, verticesLength - 4, world, 0);
|
||||
path.computeWorldVertices2(target, 0, 2, world, verticesLength - 4);
|
||||
world[verticesLength - 2] = world[0];
|
||||
world[verticesLength - 1] = world[1];
|
||||
} else {
|
||||
curveCount--;
|
||||
verticesLength -= 4;
|
||||
this._world.length = verticesLength;
|
||||
world = this._world;
|
||||
path.computeWorldVertices2(target, 2, verticesLength, world, 0);
|
||||
}
|
||||
|
||||
// Curve lengths.
|
||||
this._curves.length = curveCount;
|
||||
var curves:Vector.<Number> = this._curves;
|
||||
pathLength = 0;
|
||||
var x1:Number = world[0], y1:Number = world[1], cx1:Number = 0, cy1:Number = 0, cx2:Number = 0, cy2:Number = 0, x2:Number = 0, y2:Number = 0;
|
||||
var tmpx:Number, tmpy:Number, dddfx:Number, dddfy:Number, ddfx:Number, ddfy:Number, dfx:Number, dfy:Number;
|
||||
var w:int;
|
||||
for (i = 0, w = 2; i < curveCount; i++, w += 6) {
|
||||
cx1 = world[w];
|
||||
cy1 = world[w + 1];
|
||||
cx2 = world[w + 2];
|
||||
cy2 = world[w + 3];
|
||||
x2 = world[w + 4];
|
||||
y2 = world[w + 5];
|
||||
tmpx = (x1 - cx1 * 2 + cx2) * 0.1875;
|
||||
tmpy = (y1 - cy1 * 2 + cy2) * 0.1875;
|
||||
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;
|
||||
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;
|
||||
ddfx = tmpx * 2 + dddfx;
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;
|
||||
dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
curves[i] = pathLength;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
if (percentPosition) position *= pathLength;
|
||||
if (percentSpacing) {
|
||||
for (i = 0; i < spacesCount; i++)
|
||||
spaces[i] *= pathLength;
|
||||
}
|
||||
|
||||
var segments:Vector.<Number> = this._segments;
|
||||
var curveLength:Number = 0;
|
||||
var segment:int;
|
||||
for (i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {
|
||||
space = spaces[i];
|
||||
position += space;
|
||||
p = position;
|
||||
|
||||
if (closed) {
|
||||
p %= pathLength;
|
||||
if (p < 0) p += pathLength;
|
||||
curve = 0;
|
||||
} else if (p < 0) {
|
||||
addBeforePosition(p, world, 0, out, o);
|
||||
continue;
|
||||
} else if (p > pathLength) {
|
||||
addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine curve containing position.
|
||||
for (;; curve++) {
|
||||
length = curves[curve];
|
||||
if (p > length) continue;
|
||||
if (curve == 0)
|
||||
p /= length;
|
||||
else {
|
||||
prev = curves[curve - 1];
|
||||
p = (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Curve segment lengths.
|
||||
if (curve != prevCurve) {
|
||||
prevCurve = curve;
|
||||
var ii:int = curve * 6;
|
||||
x1 = world[ii];
|
||||
y1 = world[ii + 1];
|
||||
cx1 = world[ii + 2];
|
||||
cy1 = world[ii + 3];
|
||||
cx2 = world[ii + 4];
|
||||
cy2 = world[ii + 5];
|
||||
x2 = world[ii + 6];
|
||||
y2 = world[ii + 7];
|
||||
tmpx = (x1 - cx1 * 2 + cx2) * 0.03;
|
||||
tmpy = (y1 - cy1 * 2 + cy2) * 0.03;
|
||||
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;
|
||||
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;
|
||||
ddfx = tmpx * 2 + dddfx;
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;
|
||||
dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;
|
||||
curveLength = Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[0] = curveLength;
|
||||
for (ii = 1; ii < 8; ii++) {
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[ii] = curveLength;
|
||||
}
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[8] = curveLength;
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
|
||||
segments[9] = curveLength;
|
||||
segment = 0;
|
||||
}
|
||||
|
||||
// Weight by segment length.
|
||||
p *= curveLength;
|
||||
for (;; segment++) {
|
||||
length = segments[segment];
|
||||
if (p > length) continue;
|
||||
if (segment == 0)
|
||||
p /= length;
|
||||
else {
|
||||
prev = segments[segment - 1];
|
||||
p = segment + (p - prev) / (length - prev);
|
||||
}
|
||||
break;
|
||||
}
|
||||
addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private function addBeforePosition (p:Number, temp:Vector.<Number>, i:int, out:Vector.<Number>, o:int) : void {
|
||||
var x1:Number = temp[i], y1:Number = temp[i + 1], dx:Number = temp[i + 2] - x1, dy:Number = temp[i + 3] - y1, r:Number = Math.atan2(dy, dx);
|
||||
out[o] = x1 + p * Math.cos(r);
|
||||
out[o + 1] = y1 + p * Math.sin(r);
|
||||
out[o + 2] = r;
|
||||
}
|
||||
|
||||
private function addAfterPosition (p:Number, temp:Vector.<Number>, i:int, out:Vector.<Number>, o:int) : void {
|
||||
var x1:Number = temp[i + 2], y1:Number = temp[i + 3], dx:Number = x1 - temp[i], dy:Number = y1 - temp[i + 1], r:Number = Math.atan2(dy, dx);
|
||||
out[o] = x1 + p * Math.cos(r);
|
||||
out[o + 1] = y1 + p * Math.sin(r);
|
||||
out[o + 2] = r;
|
||||
}
|
||||
|
||||
private function addCurvePosition (p:Number, x1:Number, y1:Number, cx1:Number, cy1:Number, cx2:Number, cy2:Number, x2:Number, y2:Number,
|
||||
out:Vector.<Number>, o:int, tangents:Boolean) : void {
|
||||
if (p == 0) p = 0.0001;
|
||||
var tt:Number = p * p, ttt:Number = tt * p, u:Number = 1 - p, uu:Number = u * u, uuu:Number = uu * u;
|
||||
var ut:Number = u * p, ut3:Number = ut * 3, uut3:Number = u * ut3, utt3:Number = ut3 * p;
|
||||
var x:Number = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y:Number = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
|
||||
out[o] = x;
|
||||
out[o + 1] = y;
|
||||
if (tangents) out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<Bone> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get data () : PathConstraintData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return _data.name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
62
spine-as3/spine-as3/src/spine/PathConstraintData.as
Normal file
@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
* 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 {
|
||||
|
||||
public dynamic class PathConstraintData {
|
||||
internal var _name:String;
|
||||
internal var _bones:Vector.<BoneData> = new Vector.<BoneData>();
|
||||
public var target:SlotData;
|
||||
public var positionMode:PositionMode;
|
||||
public var spacingMode:SpacingMode;
|
||||
public var rotateMode:RotateMode;
|
||||
public var offsetRotation:Number;
|
||||
public var position:Number, spacing:Number, rotateMix:Number, translateMix:Number;
|
||||
|
||||
public function PathConstraintData (name:String) {
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<BoneData> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,6 +34,9 @@ package spine {
|
||||
public class Polygon {
|
||||
public var vertices:Vector.<Number> = new Vector.<Number>();
|
||||
|
||||
public function Polygon () {
|
||||
}
|
||||
|
||||
/** Returns true if the polygon contains the point. */
|
||||
public function containsPoint (x:Number, y:Number) : Boolean {
|
||||
var nn:int = vertices.length;
|
||||
|
||||
@ -29,10 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.attachments {
|
||||
|
||||
public interface FfdAttachment {
|
||||
function applyFFD (sourceAttachment:Attachment) : Boolean;
|
||||
package spine {
|
||||
|
||||
public class PositionMode {
|
||||
public static const fixed:PositionMode = new PositionMode();
|
||||
public static const percent:PositionMode = new PositionMode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
40
spine-as3/spine-as3/src/spine/RotateMode.as
Normal file
@ -0,0 +1,40 @@
|
||||
/******************************************************************************
|
||||
* 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 {
|
||||
|
||||
public class RotateMode {
|
||||
public static const tangent:RotateMode = new RotateMode();
|
||||
public static const chain:RotateMode = new RotateMode();
|
||||
public static const chainScale:RotateMode = new RotateMode();
|
||||
}
|
||||
|
||||
}
|
||||
@ -30,6 +30,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
import flash.utils.Dictionary;
|
||||
import spine.attachments.PathAttachment;
|
||||
import spine.attachments.Attachment;
|
||||
|
||||
public class Skeleton {
|
||||
@ -37,8 +39,9 @@ public class Skeleton {
|
||||
public var bones:Vector.<Bone>;
|
||||
public var slots:Vector.<Slot>;
|
||||
public var drawOrder:Vector.<Slot>;
|
||||
public var ikConstraints:Vector.<IkConstraint>;
|
||||
public var ikConstraints:Vector.<IkConstraint>, ikConstraintsSorted:Vector.<IkConstraint>;
|
||||
public var transformConstraints:Vector.<TransformConstraint>;
|
||||
public var pathConstraints:Vector.<PathConstraint>;
|
||||
private var _updateCache:Vector.<Updatable> = new Vector.<Updatable>();
|
||||
private var _skin:Skin;
|
||||
public var r:Number = 1, g:Number = 1, b:Number = 1, a:Number = 1;
|
||||
@ -53,55 +56,181 @@ public class Skeleton {
|
||||
|
||||
bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones) {
|
||||
var parent:Bone = boneData.parent == null ? null : bones[data.bones.indexOf(boneData.parent)];
|
||||
bones[bones.length] = new Bone(boneData, this, parent);
|
||||
var bone:Bone;
|
||||
if (boneData.parent == null)
|
||||
bone = new Bone(boneData, this, null);
|
||||
else {
|
||||
var parent:Bone = bones[boneData.parent.index];
|
||||
bone = new Bone(boneData, this, parent);
|
||||
parent.children.push(bone);
|
||||
}
|
||||
bones.push(bone);
|
||||
}
|
||||
|
||||
slots = new Vector.<Slot>();
|
||||
drawOrder = new Vector.<Slot>();
|
||||
for each (var slotData:SlotData in data.slots) {
|
||||
var bone:Bone = bones[data.bones.indexOf(slotData.boneData)];
|
||||
bone = bones[slotData.boneData.index];
|
||||
var slot:Slot = new Slot(slotData, bone);
|
||||
slots[slots.length] = slot;
|
||||
slots.push(slot);
|
||||
drawOrder[drawOrder.length] = slot;
|
||||
}
|
||||
|
||||
ikConstraints = new Vector.<IkConstraint>();
|
||||
ikConstraintsSorted = new Vector.<IkConstraint>();
|
||||
for each (var ikConstraintData:IkConstraintData in data.ikConstraints)
|
||||
ikConstraints[ikConstraints.length] = new IkConstraint(ikConstraintData, this);
|
||||
ikConstraints.push(new IkConstraint(ikConstraintData, this));
|
||||
|
||||
transformConstraints = new Vector.<TransformConstraint>();
|
||||
for each (var transformConstraintData:TransformConstraintData in data.transformConstraints)
|
||||
transformConstraints[transformConstraints.length] = new TransformConstraint(transformConstraintData, this);
|
||||
transformConstraints.push(new TransformConstraint(transformConstraintData, this));
|
||||
|
||||
pathConstraints = new Vector.<PathConstraint>();
|
||||
for each (var pathConstraintData:PathConstraintData in data.pathConstraints)
|
||||
pathConstraints.push(new PathConstraint(pathConstraintData, this));
|
||||
|
||||
updateCache();
|
||||
}
|
||||
|
||||
/** Caches information about bones and constraints. Must be called if bones or constraints are added or removed. */
|
||||
/** Caches information about bones and constraints. Must be called if bones, constraints, or weighted path attachments are
|
||||
* added or removed. */
|
||||
public function updateCache () : void {
|
||||
var updateCache:Vector.<Updatable> = _updateCache;
|
||||
var ikConstraints:Vector.<IkConstraint> = this.ikConstraints;
|
||||
var transformConstraints:Vector.<TransformConstraint> = this.transformConstraints;
|
||||
updateCache.length = bones.length + ikConstraints.length;
|
||||
var i:int = 0;
|
||||
for each (var bone:Bone in bones) {
|
||||
updateCache[i++] = bone;
|
||||
for each (var ikConstraint:IkConstraint in ikConstraints) {
|
||||
if (bone == ikConstraint.bones[ikConstraint.bones.length - 1]) {
|
||||
updateCache[i++] = ikConstraint;
|
||||
break;
|
||||
}
|
||||
var updateCache:Vector.<Updatable> = this._updateCache;
|
||||
updateCache.length = 0;
|
||||
|
||||
var bones:Vector.<Bone> = this.bones;
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++)
|
||||
bones[i]._sorted = false;
|
||||
|
||||
// IK first, lowest hierarchy depth first.
|
||||
var ikConstraints:Vector.<IkConstraint> = this.ikConstraintsSorted;
|
||||
ikConstraints.length = 0;
|
||||
for each (var c:IkConstraint in this.ikConstraints)
|
||||
ikConstraints.push(c);
|
||||
var ikCount:int = ikConstraints.length;
|
||||
var level:int;
|
||||
for (i = 0, n = ikCount; i < n; i++) {
|
||||
var ik:IkConstraint = ikConstraints[i];
|
||||
var bone:Bone = ik.bones[0].parent;
|
||||
for (level = 0; bone != null; level++)
|
||||
bone = bone.parent;
|
||||
ik.level = level;
|
||||
}
|
||||
var ii:int;
|
||||
for (i = 1; i < ikCount; i++) {
|
||||
ik = ikConstraints[i];
|
||||
level = ik.level;
|
||||
for (ii = i - 1; ii >= 0; ii--) {
|
||||
var other:IkConstraint = ikConstraints[ii];
|
||||
if (other.level < level) break;
|
||||
ikConstraints[ii + 1] = other;
|
||||
}
|
||||
ikConstraints[ii + 1] = ik;
|
||||
}
|
||||
for (i = 0, n = ikConstraints.length; i < n; i++) {
|
||||
var ikConstraint:IkConstraint = ikConstraints[i];
|
||||
var target:Bone = ikConstraint.target;
|
||||
sortBone(target);
|
||||
|
||||
var constrained:Vector.<Bone> = ikConstraint.bones;
|
||||
var parent:Bone = constrained[0];
|
||||
sortBone(parent);
|
||||
|
||||
updateCache.push(ikConstraint);
|
||||
|
||||
sortReset(parent.children);
|
||||
constrained[constrained.length - 1]._sorted = true;
|
||||
}
|
||||
|
||||
for each (var transformConstraint:TransformConstraint in transformConstraints) {
|
||||
for (i = updateCache.length - 1; i >= 0; i--) {
|
||||
var updatable:Updatable = updateCache[i];
|
||||
if (updatable == transformConstraint.bone || updatable == transformConstraint.target) {
|
||||
updateCache.splice(i + 1, 0, transformConstraint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var pathConstraints:Vector.<PathConstraint> = this.pathConstraints;
|
||||
for (i = 0, n = pathConstraints.length; i < n; i++) {
|
||||
var pathConstraint:PathConstraint = pathConstraints[i];
|
||||
|
||||
var slot:Slot = pathConstraint.target;
|
||||
var slotIndex:int = slot.data.index;
|
||||
var slotBone:Bone = slot.bone;
|
||||
if (skin != null) sortPathConstraintAttachment(skin, slotIndex, slotBone);
|
||||
if (_data.defaultSkin != null && _data.defaultSkin != skin)
|
||||
sortPathConstraintAttachment(_data.defaultSkin, slotIndex, slotBone);
|
||||
|
||||
var nn:int;
|
||||
for (ii = 0, nn = _data.skins.length; ii < nn; ii++)
|
||||
sortPathConstraintAttachment(_data.skins[ii], slotIndex, slotBone);
|
||||
|
||||
var attachment:PathAttachment = slot.attachment as PathAttachment;
|
||||
if (attachment != null) sortPathConstraintAttachment2(attachment, slotBone);
|
||||
|
||||
constrained = pathConstraint.bones;
|
||||
var boneCount:int = constrained.length;
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortBone(constrained[ii]);
|
||||
|
||||
updateCache.push(pathConstraint);
|
||||
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortReset(constrained[ii].children);
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
constrained[ii]._sorted = true;
|
||||
}
|
||||
|
||||
var transformConstraints:Vector.<TransformConstraint> = this.transformConstraints;
|
||||
for (i = 0, n = transformConstraints.length; i < n; i++) {
|
||||
var transformConstraint:TransformConstraint = transformConstraints[i];
|
||||
|
||||
sortBone(transformConstraint.target);
|
||||
|
||||
constrained = transformConstraint.bones;
|
||||
boneCount = constrained.length;
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortBone(constrained[ii]);
|
||||
|
||||
updateCache.push(transformConstraint);
|
||||
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
sortReset(constrained[ii].children);
|
||||
for (ii = 0; ii < boneCount; ii++)
|
||||
constrained[ii]._sorted = true;
|
||||
}
|
||||
|
||||
for (i = 0, n = bones.length; i < n; i++)
|
||||
sortBone(bones[i]);
|
||||
}
|
||||
|
||||
private function sortPathConstraintAttachment (skin:Skin, slotIndex:int, slotBone:Bone) : void {
|
||||
var dict:Dictionary = skin.attachments[slotIndex];
|
||||
if (!dict) return;
|
||||
|
||||
for each (var value:Attachment in dict) {
|
||||
sortPathConstraintAttachment2(value, slotBone);
|
||||
}
|
||||
}
|
||||
|
||||
private function sortPathConstraintAttachment2 (attachment:Attachment, slotBone:Bone) : void {
|
||||
var pathAttachment:PathAttachment = attachment as PathAttachment;
|
||||
if (!pathAttachment) return;
|
||||
var pathBones:Vector.<int> = pathAttachment.bones;
|
||||
if (pathBones == null)
|
||||
sortBone(slotBone);
|
||||
else {
|
||||
var bones:Vector.<Bone> = this.bones;
|
||||
for each (var boneIndex:int in pathBones)
|
||||
sortBone(bones[boneIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
private function sortBone (bone:Bone) : void {
|
||||
if (bone._sorted) return;
|
||||
var parent:Bone = bone.parent;
|
||||
if (parent != null) sortBone(parent);
|
||||
bone._sorted = true;
|
||||
_updateCache.push(bone);
|
||||
}
|
||||
|
||||
private function sortReset (bones:Vector.<Bone>) : void {
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++) {
|
||||
var bone:Bone = bones[i];
|
||||
if (bone._sorted) sortReset(bone.children);
|
||||
bone._sorted = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,9 +257,17 @@ public class Skeleton {
|
||||
}
|
||||
|
||||
for each (var transformConstraint:TransformConstraint in transformConstraints) {
|
||||
transformConstraint.rotateMix = transformConstraint._data.rotateMix;
|
||||
transformConstraint.translateMix = transformConstraint._data.translateMix;
|
||||
transformConstraint.x = transformConstraint._data.x;
|
||||
transformConstraint.y = transformConstraint._data.y;
|
||||
transformConstraint.scaleMix = transformConstraint._data.scaleMix;
|
||||
transformConstraint.shearMix = transformConstraint._data.shearMix;
|
||||
}
|
||||
|
||||
for each (var pathConstraint:PathConstraint in pathConstraints) {
|
||||
pathConstraint.position = pathConstraint._data.position;
|
||||
pathConstraint.spacing = pathConstraint._data.spacing;
|
||||
pathConstraint.rotateMix = pathConstraint._data.rotateMix;
|
||||
pathConstraint.translateMix = pathConstraint._data.translateMix;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,6 +282,10 @@ public class Skeleton {
|
||||
public function get data () : SkeletonData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get getUpdateCache () : Vector.<Updatable> {
|
||||
return _updateCache;
|
||||
}
|
||||
|
||||
public function get rootBone () : Bone {
|
||||
if (bones.length == 0) return null;
|
||||
@ -282,6 +423,14 @@ public class Skeleton {
|
||||
if (transformConstraint._data._name == constraintName) return transformConstraint;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return May be null. */
|
||||
public function findPathConstraint (constraintName:String) : PathConstraint {
|
||||
if (constraintName == null) throw new ArgumentError("constraintName cannot be null.");
|
||||
for each (var pathConstraint:PathConstraint in pathConstraints)
|
||||
if (pathConstraint._data._name == constraintName) return pathConstraint;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function update (delta:Number) : void {
|
||||
time += delta;
|
||||
|
||||
@ -38,11 +38,13 @@ public class SkeletonBounds {
|
||||
public var boundingBoxes:Vector.<BoundingBoxAttachment> = new Vector.<BoundingBoxAttachment>();
|
||||
public var polygons:Vector.<Polygon> = new Vector.<Polygon>();
|
||||
public var minX:Number, minY:Number, maxX:Number, maxY:Number;
|
||||
|
||||
public function SkeletonBounds () {
|
||||
}
|
||||
|
||||
public function update (skeleton:Skeleton, updateAabb:Boolean) : void {
|
||||
var slots:Vector.<Slot> = skeleton.slots;
|
||||
var slotCount:int = slots.length;
|
||||
var x:Number = skeleton.x, y:Number = skeleton.y;
|
||||
var slotCount:int = slots.length;
|
||||
|
||||
boundingBoxes.length = 0;
|
||||
for each (var polygon:Polygon in polygons)
|
||||
@ -63,8 +65,8 @@ public class SkeletonBounds {
|
||||
polygon = new Polygon();
|
||||
polygons[polygons.length] = polygon;
|
||||
|
||||
polygon.vertices.length = boundingBox.vertices.length;
|
||||
boundingBox.computeWorldVertices(x, y, slot.bone, polygon.vertices);
|
||||
polygon.vertices.length = boundingBox.worldVerticesLength;
|
||||
boundingBox.computeWorldVertices(slot, polygon.vertices);
|
||||
}
|
||||
|
||||
if (updateAabb) aabbCompute();
|
||||
|
||||
@ -43,8 +43,12 @@ public class SkeletonData {
|
||||
public var animations:Vector.<Animation> = new Vector.<Animation>();
|
||||
public var ikConstraints:Vector.<IkConstraintData> = new Vector.<IkConstraintData>();
|
||||
public var transformConstraints:Vector.<TransformConstraintData> = new Vector.<TransformConstraintData>();
|
||||
public var pathConstraints:Vector.<PathConstraintData> = new Vector.<PathConstraintData>();
|
||||
public var width:Number, height:Number;
|
||||
public var version:String, hash:String;
|
||||
|
||||
public function SkeletonData () {
|
||||
}
|
||||
|
||||
// --- Bones.
|
||||
|
||||
@ -135,6 +139,37 @@ public class SkeletonData {
|
||||
if (transformConstraintData._name == constraintName) return transformConstraintData;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return -1 if the transform constraint was not found. */
|
||||
public function findTransformConstraintIndex (transformConstraintName:String) : int {
|
||||
if (transformConstraintName == null) throw new ArgumentError("transformConstraintName cannot be null.");
|
||||
var transformConstraints:Vector.<TransformConstraintData> = this.transformConstraints;
|
||||
for (var i:int = 0, n:int = transformConstraints.length; i < n; i++)
|
||||
if (transformConstraints[i].name == transformConstraintName) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// --- Path constraints.
|
||||
|
||||
/** @return May be null. */
|
||||
public function findPathConstraint (constraintName:String) : PathConstraintData {
|
||||
if (constraintName == null) throw new ArgumentError("constraintName cannot be null.");
|
||||
var pathConstraints:Vector.<PathConstraintData> = this.pathConstraints;
|
||||
for (var i:int = 0, n:int = pathConstraints.length; i < n; i++) {
|
||||
var constraint:PathConstraintData = pathConstraints[i];
|
||||
if (constraint.name == constraintName) return constraint;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @return -1 if the path constraint was not found. */
|
||||
public function findPathConstraintIndex (pathConstraintName:String) : int {
|
||||
if (pathConstraintName == null) throw new ArgumentError("pathConstraintName cannot be null.");
|
||||
var pathConstraints:Vector.<PathConstraintData> = this.pathConstraints;
|
||||
for (var i:int = 0, n:int = pathConstraints.length; i < n; i++)
|
||||
if (pathConstraints[i].name == pathConstraintName) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
|
||||
@ -29,6 +29,13 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
package spine {
|
||||
import spine.animation.PathConstraintMixTimeline;
|
||||
import spine.animation.PathConstraintSpacingTimeline;
|
||||
import spine.animation.PathConstraintPositionTimeline;
|
||||
import spine.animation.TransformConstraintTimeline;
|
||||
import spine.animation.ShearTimeline;
|
||||
import spine.attachments.PathAttachment;
|
||||
import spine.attachments.VertexAttachment;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
import spine.animation.Animation;
|
||||
@ -37,7 +44,7 @@ import spine.animation.ColorTimeline;
|
||||
import spine.animation.CurveTimeline;
|
||||
import spine.animation.DrawOrderTimeline;
|
||||
import spine.animation.EventTimeline;
|
||||
import spine.animation.FfdTimeline;
|
||||
import spine.animation.DeformTimeline;
|
||||
import spine.animation.IkConstraintTimeline;
|
||||
import spine.animation.RotateTimeline;
|
||||
import spine.animation.ScaleTimeline;
|
||||
@ -49,7 +56,6 @@ import spine.attachments.AttachmentType;
|
||||
import spine.attachments.BoundingBoxAttachment;
|
||||
import spine.attachments.MeshAttachment;
|
||||
import spine.attachments.RegionAttachment;
|
||||
import spine.attachments.WeightedMeshAttachment;
|
||||
|
||||
public class SkeletonJson {
|
||||
public var attachmentLoader:AttachmentLoader;
|
||||
@ -83,8 +89,8 @@ public class SkeletonJson {
|
||||
skeletonData.hash = skeletonMap["hash"];
|
||||
skeletonData.version = skeletonMap["spine"];
|
||||
skeletonData.width = skeletonMap["width"] || 0;
|
||||
skeletonData.height = skeletonMap["height"] || 0;
|
||||
}
|
||||
skeletonData.height = skeletonMap["height"] || 0;
|
||||
}
|
||||
|
||||
// Bones.
|
||||
var boneData:BoneData;
|
||||
@ -95,60 +101,27 @@ public class SkeletonJson {
|
||||
parent = skeletonData.findBone(parentName);
|
||||
if (!parent) throw new Error("Parent bone not found: " + parentName);
|
||||
}
|
||||
boneData = new BoneData(boneMap["name"], parent);
|
||||
boneData = new BoneData(skeletonData.bones.length, boneMap["name"], parent);
|
||||
boneData.length = Number(boneMap["length"] || 0) * scale;
|
||||
boneData.x = Number(boneMap["x"] || 0) * scale;
|
||||
boneData.y = Number(boneMap["y"] || 0) * scale;
|
||||
boneData.rotation = (boneMap["rotation"] || 0);
|
||||
boneData.scaleX = boneMap.hasOwnProperty("scaleX") ? boneMap["scaleX"] : 1;
|
||||
boneData.scaleY = boneMap.hasOwnProperty("scaleY") ? boneMap["scaleY"] : 1;
|
||||
boneData.inheritScale = boneMap.hasOwnProperty("inheritScale") ? boneMap["inheritScale"] : true;
|
||||
boneData.inheritRotation = boneMap.hasOwnProperty("inheritRotation") ? boneMap["inheritRotation"] : true;
|
||||
skeletonData.bones[skeletonData.bones.length] = boneData;
|
||||
boneData.shearX = Number(boneMap["shearX"] || 0);
|
||||
boneData.shearY = Number(boneMap["shearY"] || 0);
|
||||
boneData.inheritRotation = boneMap.hasOwnProperty("inheritRotation") ? Boolean(boneMap["inheritRotation"]) : true;
|
||||
boneData.inheritScale = boneMap.hasOwnProperty("inheritScale") ? Boolean(boneMap["inheritScale"]) : true;
|
||||
skeletonData.bones.push(boneData);
|
||||
}
|
||||
|
||||
// IK constraints.
|
||||
for each (var ikMap:Object in root["ik"]) {
|
||||
var ikConstraintData:IkConstraintData = new IkConstraintData(ikMap["name"]);
|
||||
|
||||
for each (var boneName:String in ikMap["bones"]) {
|
||||
var bone:BoneData = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("IK bone not found: " + boneName);
|
||||
ikConstraintData.bones[ikConstraintData.bones.length] = bone;
|
||||
}
|
||||
|
||||
ikConstraintData.target = skeletonData.findBone(ikMap["target"]);
|
||||
if (!ikConstraintData.target) throw new Error("Target bone not found: " + ikMap["target"]);
|
||||
|
||||
ikConstraintData.bendDirection = (!ikMap.hasOwnProperty("bendPositive") || ikMap["bendPositive"]) ? 1 : -1;
|
||||
ikConstraintData.mix = ikMap.hasOwnProperty("mix") ? ikMap["mix"] : 1;
|
||||
|
||||
skeletonData.ikConstraints[skeletonData.ikConstraints.length] = ikConstraintData;
|
||||
}
|
||||
|
||||
// Transform constraints.
|
||||
for each (var transformMap:Object in root["transform"]) {
|
||||
var transformConstraintData:TransformConstraintData = new TransformConstraintData(transformMap["name"]);
|
||||
|
||||
transformConstraintData.bone = skeletonData.findBone(transformMap["bone"]);
|
||||
if (!transformConstraintData.bone) throw new Error("Bone not found: " + transformMap["bone"]);
|
||||
|
||||
transformConstraintData.target = skeletonData.findBone(transformMap["target"]);
|
||||
if (!transformConstraintData.target) throw new Error("Target bone not found: " + transformMap["target"]);
|
||||
|
||||
transformConstraintData.translateMix = transformMap.hasOwnProperty("translateMix") ? transformMap["translateMix"] : 1;
|
||||
transformConstraintData.x = Number(boneMap["x"] || 0) * scale;
|
||||
transformConstraintData.y = Number(boneMap["y"] || 0) * scale;
|
||||
|
||||
skeletonData.transformConstraints[skeletonData.transformConstraints.length] = transformConstraintData;
|
||||
}
|
||||
|
||||
|
||||
// Slots.
|
||||
for each (var slotMap:Object in root["slots"]) {
|
||||
boneName = slotMap["bone"];
|
||||
var slotName:String = slotMap["name"];
|
||||
var boneName:String = slotMap["bone"];
|
||||
boneData = skeletonData.findBone(boneName);
|
||||
if (!boneData) throw new Error("Slot bone not found: " + boneName);
|
||||
var slotData:SlotData = new SlotData(slotMap["name"], boneData);
|
||||
var slotData:SlotData = new SlotData(skeletonData.slots.length, slotName, boneData);
|
||||
|
||||
var color:String = slotMap["color"];
|
||||
if (color) {
|
||||
@ -160,8 +133,81 @@ public class SkeletonJson {
|
||||
|
||||
slotData.attachmentName = slotMap["attachment"];
|
||||
slotData.blendMode = BlendMode[slotMap["blend"] || "normal"];
|
||||
skeletonData.slots.push(slotData);
|
||||
}
|
||||
|
||||
skeletonData.slots[skeletonData.slots.length] = slotData;
|
||||
// IK constraints.
|
||||
for each (var constraintMap:Object in root["ik"]) {
|
||||
var ikConstraintData:IkConstraintData = new IkConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
var bone:BoneData = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("IK constraint bone not found: " + boneName);
|
||||
ikConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
ikConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
||||
if (!ikConstraintData.target) throw new Error("Target bone not found: " + constraintMap["target"]);
|
||||
|
||||
ikConstraintData.bendDirection = (!constraintMap.hasOwnProperty("bendPositive") || constraintMap["bendPositive"]) ? 1 : -1;
|
||||
ikConstraintData.mix = constraintMap.hasOwnProperty("mix") ? constraintMap["mix"] : 1;
|
||||
|
||||
skeletonData.ikConstraints.push(ikConstraintData);
|
||||
}
|
||||
|
||||
// Transform constraints.
|
||||
for each (constraintMap in root["transform"]) {
|
||||
var transformConstraintData:TransformConstraintData = new TransformConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
bone = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("Transform constraint bone not found: " + boneName);
|
||||
transformConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
transformConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
||||
if (!transformConstraintData.target) throw new Error("Target bone not found: " + constraintMap["target"]);
|
||||
|
||||
transformConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||
transformConstraintData.offsetX = Number(constraintMap["x"] || 0) * scale;
|
||||
transformConstraintData.offsetY = Number(constraintMap["y"] || 0) * scale;
|
||||
transformConstraintData.offsetScaleX = Number(constraintMap["scaleX"] || 0);
|
||||
transformConstraintData.offsetScaleY = Number(constraintMap["scaleY"] || 0);
|
||||
transformConstraintData.offsetShearY = Number(constraintMap["shearY"] || 0);
|
||||
|
||||
transformConstraintData.rotateMix = constraintMap.hasOwnProperty("rotateMix") ? constraintMap["rotateMix"] : 1;
|
||||
transformConstraintData.translateMix = constraintMap.hasOwnProperty("translateMix") ? constraintMap["translateMix"] : 1;
|
||||
transformConstraintData.scaleMix = constraintMap.hasOwnProperty("scaleMix") ? constraintMap["scaleMix"] : 1;
|
||||
transformConstraintData.shearMix = constraintMap.hasOwnProperty("shearMix") ? constraintMap["shearMix"] : 1;
|
||||
|
||||
skeletonData.transformConstraints.push(transformConstraintData);
|
||||
}
|
||||
|
||||
// Path constraints.
|
||||
for each (constraintMap in root["path"]) {
|
||||
var pathConstraintData:PathConstraintData = new PathConstraintData(constraintMap["name"]);
|
||||
|
||||
for each (boneName in constraintMap["bones"]) {
|
||||
bone = skeletonData.findBone(boneName);
|
||||
if (!bone) throw new Error("Path constraint bone not found: " + boneName);
|
||||
pathConstraintData.bones.push(bone);
|
||||
}
|
||||
|
||||
pathConstraintData.target = skeletonData.findSlot(constraintMap["target"]);
|
||||
if (!pathConstraintData.target) throw new Error("Path target slot not found: " + constraintMap["target"]);
|
||||
|
||||
pathConstraintData.positionMode = PositionMode[constraintMap["positionMode"] || "percent"];
|
||||
pathConstraintData.spacingMode = SpacingMode[constraintMap["spacingMode"] || "length"];
|
||||
pathConstraintData.rotateMode = RotateMode[constraintMap["rotateMode"] || "rotateMode"];
|
||||
pathConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||
pathConstraintData.position = Number(constraintMap["position"] || 0);
|
||||
if (pathConstraintData.positionMode == PositionMode.fixed) pathConstraintData.position *= scale;
|
||||
pathConstraintData.spacing = Number(constraintMap["spacing"] || 0);
|
||||
if (pathConstraintData.spacingMode == SpacingMode.length || pathConstraintData.spacingMode == SpacingMode.fixed) pathConstraintData.spacing *= scale;
|
||||
pathConstraintData.rotateMix = constraintMap.hasOwnProperty("rotateMix") ? constraintMap["rotateMix"] : 1;
|
||||
pathConstraintData.translateMix = constraintMap.hasOwnProperty("translateMix") ? constraintMap["translateMix"] : 1;
|
||||
|
||||
skeletonData.pathConstraints.push(pathConstraintData);
|
||||
}
|
||||
|
||||
// Skins.
|
||||
@ -169,11 +215,11 @@ public class SkeletonJson {
|
||||
for (var skinName:String in skins) {
|
||||
var skinMap:Object = skins[skinName];
|
||||
var skin:Skin = new Skin(skinName);
|
||||
for (var slotName:String in skinMap) {
|
||||
for (slotName in skinMap) {
|
||||
var slotIndex:int = skeletonData.findSlotIndex(slotName);
|
||||
var slotEntry:Object = skinMap[slotName];
|
||||
for (var attachmentName:String in slotEntry) {
|
||||
var attachment:Attachment = readAttachment(skin, slotIndex, attachmentName, slotEntry[attachmentName]);
|
||||
var attachment:Attachment = readAttachment(slotEntry[attachmentName], skin, slotIndex, attachmentName);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, attachmentName, attachment);
|
||||
}
|
||||
@ -184,20 +230,14 @@ public class SkeletonJson {
|
||||
}
|
||||
|
||||
// Linked meshes.
|
||||
var linkedMeshes:Vector.<LinkedMesh> = this.linkedMeshes;
|
||||
for each (var linkedMesh:LinkedMesh in linkedMeshes) {
|
||||
var parentSkin:Skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
||||
if (!parentSkin) throw new Error("Skin not found: " + linkedMesh.skin);
|
||||
var parentMesh:Attachment = parentSkin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
||||
if (!parentMesh) throw new Error("Parent mesh not found: " + linkedMesh.parent);
|
||||
if (linkedMesh.mesh is MeshAttachment) {
|
||||
var mesh:MeshAttachment = MeshAttachment(linkedMesh.mesh);
|
||||
mesh.parentMesh = MeshAttachment(parentMesh);
|
||||
mesh.updateUVs();
|
||||
} else {
|
||||
var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(linkedMesh.mesh);
|
||||
weightedMesh.parentMesh = WeightedMeshAttachment(parentMesh);
|
||||
weightedMesh.updateUVs();
|
||||
}
|
||||
linkedMesh.mesh.parentMesh = MeshAttachment(parentMesh);
|
||||
linkedMesh.mesh.updateUVs();
|
||||
}
|
||||
linkedMeshes.length = 0;
|
||||
|
||||
@ -210,33 +250,31 @@ public class SkeletonJson {
|
||||
eventData.intValue = eventMap["int"] || 0;
|
||||
eventData.floatValue = eventMap["float"] || 0;
|
||||
eventData.stringValue = eventMap["string"] || null;
|
||||
skeletonData.events[skeletonData.events.length] = eventData;
|
||||
skeletonData.events.push(eventData);
|
||||
}
|
||||
}
|
||||
|
||||
// Animations.
|
||||
var animations:Object = root["animations"];
|
||||
for (var animationName:String in animations)
|
||||
readAnimation(animationName, animations[animationName], skeletonData);
|
||||
readAnimation(animations[animationName], animationName, skeletonData);
|
||||
|
||||
return skeletonData;
|
||||
}
|
||||
|
||||
private function readAttachment (skin:Skin, slotIndex:int, name:String, map:Object) : Attachment {
|
||||
private function readAttachment (map:Object, skin:Skin, slotIndex:int, name:String) : Attachment {
|
||||
name = map["name"] || name;
|
||||
|
||||
var typeName:String = map["type"] || "region";
|
||||
if (typeName == "skinnedmesh") typeName = "weightedmesh";
|
||||
var type:AttachmentType = AttachmentType[typeName];
|
||||
var path:String = map["path"] || name;
|
||||
var typeName:String = map["type"] || "region";
|
||||
var type:AttachmentType = AttachmentType[typeName];
|
||||
|
||||
var scale:Number = this.scale;
|
||||
var color:String, vertices:Vector.<Number>;
|
||||
var color:String;
|
||||
switch (type) {
|
||||
case AttachmentType.region:
|
||||
var region:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, path);
|
||||
var region:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, map["path"] || name);
|
||||
if (!region) return null;
|
||||
region.path = path;
|
||||
region.path = map["path"] || name;
|
||||
region.x = Number(map["x"] || 0) * scale;
|
||||
region.y = Number(map["y"] || 0) * scale;
|
||||
region.scaleX = map.hasOwnProperty("scaleX") ? map["scaleX"] : 1;
|
||||
@ -255,9 +293,9 @@ public class SkeletonJson {
|
||||
return region;
|
||||
case AttachmentType.mesh:
|
||||
case AttachmentType.linkedmesh:
|
||||
var mesh:MeshAttachment = attachmentLoader.newMeshAttachment(skin, name, path);
|
||||
var mesh:MeshAttachment = attachmentLoader.newMeshAttachment(skin, name, map["path"] || name);
|
||||
if (!mesh) return null;
|
||||
mesh.path = path;
|
||||
mesh.path = map["path"] || name;
|
||||
|
||||
color = map["color"];
|
||||
if (color) {
|
||||
@ -270,78 +308,79 @@ public class SkeletonJson {
|
||||
mesh.width = Number(map["width"] || 0) * scale;
|
||||
mesh.height = Number(map["height"] || 0) * scale;
|
||||
|
||||
if (!map["parent"]) {
|
||||
mesh.vertices = getFloatArray(map, "vertices", scale);
|
||||
mesh.triangles = getUintArray(map, "triangles");
|
||||
mesh.regionUVs = getFloatArray(map, "uvs", 1);
|
||||
mesh.updateUVs();
|
||||
|
||||
mesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) mesh.edges = getIntArray(map, "edges");
|
||||
} else {
|
||||
mesh.inheritFFD = map.hasOwnProperty("ffd") ? map["ffd"] : true;
|
||||
linkedMeshes[linkedMeshes.length] = new LinkedMesh(mesh, map["skin"], slotIndex, map["parent"]);
|
||||
if (map["parent"]) {
|
||||
mesh.inheritDeform = map.hasOwnProperty("deform") ? Boolean(map["deform"]) : true;
|
||||
linkedMeshes.push(new LinkedMesh(mesh, map["skin"], slotIndex, map["parent"]));
|
||||
return mesh;
|
||||
}
|
||||
return mesh;
|
||||
case AttachmentType.weightedmesh:
|
||||
case AttachmentType.weightedlinkedmesh:
|
||||
var weightedMesh:WeightedMeshAttachment = attachmentLoader.newWeightedMeshAttachment(skin, name, path);
|
||||
if (!weightedMesh) return null;
|
||||
|
||||
var uvs:Vector.<Number> = getFloatArray(map, "uvs", 1);
|
||||
readVertices(map, mesh, uvs.length);
|
||||
mesh.triangles = getUintArray(map, "triangles");
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
|
||||
weightedMesh.path = path;
|
||||
|
||||
color = map["color"];
|
||||
if (color) {
|
||||
weightedMesh.r = toColor(color, 0);
|
||||
weightedMesh.g = toColor(color, 1);
|
||||
weightedMesh.b = toColor(color, 2);
|
||||
weightedMesh.a = toColor(color, 3);
|
||||
}
|
||||
|
||||
weightedMesh.width = Number(map["width"] || 0) * scale;
|
||||
weightedMesh.height = Number(map["height"] || 0) * scale;
|
||||
|
||||
if (!map["parent"]) {
|
||||
var uvs:Vector.<Number> = getFloatArray(map, "uvs", 1);
|
||||
vertices = getFloatArray(map, "vertices", 1);
|
||||
var weights:Vector.<Number> = new Vector.<Number>();
|
||||
var bones:Vector.<int> = new Vector.<int>();
|
||||
for (var i:int = 0, n:int = vertices.length; i < n;) {
|
||||
var boneCount:int = int(vertices[i++]);
|
||||
bones[bones.length] = boneCount;
|
||||
for (var nn:int = i + boneCount * 4; i < nn;) {
|
||||
bones[bones.length] = vertices[i];
|
||||
weights[weights.length] = vertices[i + 1] * scale;
|
||||
weights[weights.length] = vertices[i + 2] * scale;
|
||||
weights[weights.length] = vertices[i + 3];
|
||||
i += 4;
|
||||
}
|
||||
}
|
||||
weightedMesh.bones = bones;
|
||||
weightedMesh.weights = weights;
|
||||
weightedMesh.triangles = getUintArray(map, "triangles");
|
||||
weightedMesh.regionUVs = uvs;
|
||||
weightedMesh.updateUVs();
|
||||
|
||||
weightedMesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) weightedMesh.edges = getIntArray(map, "edges");
|
||||
} else {
|
||||
weightedMesh.inheritFFD = map.hasOwnProperty("ffd") ? map["ffd"] : true;
|
||||
linkedMeshes[linkedMeshes.length] = new LinkedMesh(weightedMesh, map["skin"], slotIndex, map["parent"]);
|
||||
}
|
||||
return weightedMesh;
|
||||
mesh.hullLength = int(map["hull"] || 0) * 2;
|
||||
if (map["edges"]) mesh.edges = getIntArray(map, "edges");
|
||||
return mesh;
|
||||
case AttachmentType.boundingbox:
|
||||
var box:BoundingBoxAttachment = attachmentLoader.newBoundingBoxAttachment(skin, name);
|
||||
vertices = box.vertices;
|
||||
for each (var point:Number in map["vertices"])
|
||||
vertices[vertices.length] = point * scale;
|
||||
if (!box) return null;
|
||||
readVertices(map, box, int(map["vertexCount"]) << 1);
|
||||
return box;
|
||||
case AttachmentType.path:
|
||||
var path:PathAttachment = attachmentLoader.newPathAttachment(skin, name);
|
||||
if (!path) return null;
|
||||
path.closed = map.hasOwnProperty("closed") ? Boolean(map["closed"]) : false;
|
||||
path.constantSpeed = map.hasOwnProperty("constantSpeed") ? Boolean(map["constantSpeed"]) : true;
|
||||
|
||||
var vertexCount:int = int(map["vertexCount"]);
|
||||
readVertices(map, path, vertexCount << 1);
|
||||
|
||||
var lengths:Vector.<Number> = new Vector.<Number>();
|
||||
for each (var curves:Object in map["lengths"]) {
|
||||
lengths.push(Number(curves) * scale);
|
||||
}
|
||||
path.lengths = lengths;
|
||||
return path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function readVertices(map:Object, attachment:VertexAttachment, verticesLength:int) : void {
|
||||
attachment.worldVerticesLength = verticesLength;
|
||||
var vertices:Vector.<Number> = getFloatArray(map, "vertices", 1);
|
||||
if (verticesLength == vertices.length) {
|
||||
if (scale != 1) {
|
||||
for (var i:int = 0, n:int = vertices.length; i < n; i++) {
|
||||
vertices[i] *= scale;
|
||||
}
|
||||
}
|
||||
attachment.vertices = vertices;
|
||||
return;
|
||||
}
|
||||
|
||||
var weights:Vector.<Number> = new Vector.<Number>(verticesLength * 3 * 3);
|
||||
weights.length = 0;
|
||||
var bones:Vector.<int> = new Vector.<int>(verticesLength * 3);
|
||||
bones.length = 0;
|
||||
for (i = 0, n = vertices.length; i < n;) {
|
||||
var boneCount:int = int(vertices[i++]);
|
||||
bones.push(boneCount);
|
||||
for (var nn:int = i + boneCount * 4; i < nn; i+=4) {
|
||||
bones.push(int(vertices[i]));
|
||||
weights.push(vertices[i + 1] * scale);
|
||||
weights.push(vertices[i + 2] * scale);
|
||||
weights.push(vertices[i + 3]);
|
||||
}
|
||||
}
|
||||
attachment.bones = bones;
|
||||
attachment.vertices = weights;
|
||||
}
|
||||
|
||||
private function readAnimation (name:String, map:Object, skeletonData:SkeletonData) : void {
|
||||
private function readAnimation (map:Object, name:String, skeletonData:SkeletonData) : void {
|
||||
var scale:Number = this.scale;
|
||||
var timelines:Vector.<Timeline> = new Vector.<Timeline>();
|
||||
var duration:Number = 0;
|
||||
|
||||
@ -369,11 +408,11 @@ public class SkeletonJson {
|
||||
var b:Number = toColor(color, 2);
|
||||
var a:Number = toColor(color, 3);
|
||||
colorTimeline.setFrame(frameIndex, valueMap["time"], r, g, b, a);
|
||||
readCurve(colorTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, colorTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = colorTimeline;
|
||||
duration = Math.max(duration, colorTimeline.frames[colorTimeline.frameCount * 5 - 5]);
|
||||
duration = Math.max(duration, colorTimeline.frames[(colorTimeline.frameCount - 1) * ColorTimeline.ENTRIES]);
|
||||
} else if (timelineName == "attachment") {
|
||||
var attachmentTimeline:AttachmentTimeline = new AttachmentTimeline(values.length);
|
||||
attachmentTimeline.slotIndex = slotIndex;
|
||||
@ -403,32 +442,34 @@ public class SkeletonJson {
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
rotateTimeline.setFrame(frameIndex, valueMap["time"], valueMap["angle"]);
|
||||
readCurve(rotateTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, rotateTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = rotateTimeline;
|
||||
duration = Math.max(duration, rotateTimeline.frames[rotateTimeline.frameCount * 2 - 2]);
|
||||
} else if (timelineName == "translate" || timelineName == "scale") {
|
||||
var timeline:TranslateTimeline;
|
||||
duration = Math.max(duration, rotateTimeline.frames[(rotateTimeline.frameCount - 1) * RotateTimeline.ENTRIES]);
|
||||
} else if (timelineName == "translate" || timelineName == "scale" || timelineName == "shear") {
|
||||
var translateTimeline:TranslateTimeline;
|
||||
var timelineScale:Number = 1;
|
||||
if (timelineName == "scale")
|
||||
timeline = new ScaleTimeline(values.length);
|
||||
translateTimeline = new ScaleTimeline(values.length);
|
||||
else if (timelineName == "shear")
|
||||
translateTimeline = new ShearTimeline(values.length);
|
||||
else {
|
||||
timeline = new TranslateTimeline(values.length);
|
||||
translateTimeline = new TranslateTimeline(values.length);
|
||||
timelineScale = scale;
|
||||
}
|
||||
timeline.boneIndex = boneIndex;
|
||||
translateTimeline.boneIndex = boneIndex;
|
||||
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var x:Number = Number(valueMap["x"] || 0) * timelineScale;
|
||||
var y:Number = Number(valueMap["y"] || 0) * timelineScale;
|
||||
timeline.setFrame(frameIndex, valueMap["time"], x, y);
|
||||
readCurve(timeline, frameIndex, valueMap);
|
||||
translateTimeline.setFrame(frameIndex, valueMap["time"], x, y);
|
||||
readCurve(valueMap, translateTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = timeline;
|
||||
duration = Math.max(duration, timeline.frames[timeline.frameCount * 3 - 3]);
|
||||
timelines[timelines.length] = translateTimeline;
|
||||
duration = Math.max(duration, translateTimeline.frames[(translateTimeline.frameCount - 1) * TranslateTimeline.ENTRIES]);
|
||||
} else
|
||||
throw new Error("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")");
|
||||
}
|
||||
@ -445,67 +486,133 @@ public class SkeletonJson {
|
||||
var mix:Number = valueMap.hasOwnProperty("mix") ? valueMap["mix"] : 1;
|
||||
var bendDirection:int = (!valueMap.hasOwnProperty("bendPositive") || valueMap["bendPositive"]) ? 1 : -1;
|
||||
ikTimeline.setFrame(frameIndex, valueMap["time"], mix, bendDirection);
|
||||
readCurve(ikTimeline, frameIndex, valueMap);
|
||||
readCurve(valueMap, ikTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = ikTimeline;
|
||||
duration = Math.max(duration, ikTimeline.frames[ikTimeline.frameCount * 3 - 3]);
|
||||
duration = Math.max(duration, ikTimeline.frames[(ikTimeline.frameCount - 1) * IkConstraintTimeline.ENTRIES]);
|
||||
}
|
||||
|
||||
var ffd:Object = map["ffd"];
|
||||
for (var skinName:String in ffd) {
|
||||
|
||||
var transformMap:Object = map["transform"];
|
||||
for (var transformName:String in transformMap) {
|
||||
var transformConstraint:TransformConstraintData = skeletonData.findTransformConstraint(transformName);
|
||||
values = transformMap[transformName];
|
||||
var transformTimeline:TransformConstraintTimeline = new TransformConstraintTimeline(values.length);
|
||||
transformTimeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(transformConstraint);
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var rotateMix:Number = valueMap.hasOwnProperty("rotateMix") ? valueMap["rotateMix"] : 1;
|
||||
var translateMix:Number = valueMap.hasOwnProperty("translateMix") ? valueMap["translateMix"] : 1;
|
||||
var scaleMix:Number = valueMap.hasOwnProperty("scaleMix") ? valueMap["scaleMix"] : 1;
|
||||
var shearMix:Number = valueMap.hasOwnProperty("shearMix") ? valueMap["shearMix"] : 1;
|
||||
transformTimeline.setFrame(frameIndex, valueMap["time"], rotateMix, translateMix, scaleMix, shearMix);
|
||||
readCurve(valueMap, transformTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(transformTimeline);
|
||||
duration = Math.max(duration, transformTimeline.frames[(transformTimeline.frameCount - 1) * TransformConstraintTimeline.ENTRIES]);
|
||||
}
|
||||
|
||||
// Path constraint timelines.
|
||||
var paths:Object = map["paths"];
|
||||
for (var pathName:String in paths) {
|
||||
var index:int = skeletonData.findPathConstraintIndex(pathName);
|
||||
if (index == -1) throw new Error("Path constraint not found: " + pathName);
|
||||
var data:PathConstraintData = skeletonData.pathConstraints[index];
|
||||
|
||||
var pathMap:Object = paths[pathName];
|
||||
for (timelineName in pathMap) {
|
||||
values = pathMap[timelineName];
|
||||
|
||||
if (timelineName == "position" || timelineName == "spacing") {
|
||||
var pathTimeline:PathConstraintPositionTimeline;
|
||||
timelineScale = 1;
|
||||
if (timelineName == "spacing") {
|
||||
pathTimeline = new PathConstraintSpacingTimeline(values.length);
|
||||
if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) timelineScale = scale;
|
||||
} else {
|
||||
pathTimeline = new PathConstraintPositionTimeline(values.length);
|
||||
if (data.positionMode == PositionMode.fixed) timelineScale = scale;
|
||||
}
|
||||
pathTimeline.pathConstraintIndex = index;
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var value:Number = valueMap[timelineName] || 0;
|
||||
pathTimeline.setFrame(frameIndex, valueMap["time"], value * timelineScale);
|
||||
readCurve(valueMap, pathTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(pathTimeline);
|
||||
duration = Math.max(duration,
|
||||
pathTimeline.frames[(pathTimeline.frameCount - 1) * PathConstraintPositionTimeline.ENTRIES]);
|
||||
} else if (timelineName == "mix") {
|
||||
var pathMixTimeline:PathConstraintMixTimeline = new PathConstraintMixTimeline(values.length);
|
||||
pathMixTimeline.pathConstraintIndex = index;
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
rotateMix = valueMap.hasOwnProperty("rotateMix") ? valueMap["rotateMix"] : 1;
|
||||
translateMix = valueMap.hasOwnProperty("translateMix") ? valueMap["translateMix"] : 1;
|
||||
pathMixTimeline.setFrame(frameIndex, valueMap["time"], rotateMix, translateMix);
|
||||
readCurve(valueMap, pathMixTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines.push(pathMixTimeline);
|
||||
duration = Math.max(duration,
|
||||
pathMixTimeline.frames[(pathMixTimeline.frameCount - 1) * PathConstraintMixTimeline.ENTRIES]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var deformMap:Object = map["deform"];
|
||||
for (var skinName:String in deformMap) {
|
||||
var skin:Skin = skeletonData.findSkin(skinName);
|
||||
slotMap = ffd[skinName];
|
||||
slotMap = deformMap[skinName];
|
||||
for (slotName in slotMap) {
|
||||
slotIndex = skeletonData.findSlotIndex(slotName);
|
||||
var meshMap:Object = slotMap[slotName];
|
||||
for (var meshName:String in meshMap) {
|
||||
values = meshMap[meshName];
|
||||
var ffdTimeline:FfdTimeline = new FfdTimeline(values.length);
|
||||
var attachment:Attachment = skin.getAttachment(slotIndex, meshName);
|
||||
if (!attachment) throw new Error("FFD attachment not found: " + meshName);
|
||||
ffdTimeline.slotIndex = slotIndex;
|
||||
ffdTimeline.attachment = attachment;
|
||||
var timelineMap:Object = slotMap[slotName];
|
||||
for (timelineName in timelineMap) {
|
||||
values = timelineMap[timelineName];
|
||||
|
||||
var vertexCount:int;
|
||||
if (attachment is MeshAttachment)
|
||||
vertexCount = (attachment as MeshAttachment).vertices.length;
|
||||
else
|
||||
vertexCount = (attachment as WeightedMeshAttachment).weights.length / 3 * 2;
|
||||
var attachment:VertexAttachment = skin.getAttachment(slotIndex, timelineName) as VertexAttachment;
|
||||
if (attachment == null) throw new Error("Deform attachment not found: " + timelineName);
|
||||
var weighted:Boolean = attachment.bones != null;
|
||||
var vertices:Vector.<Number> = attachment.vertices;
|
||||
var deformLength:int = weighted ? vertices.length / 3 * 2 : vertices.length;
|
||||
|
||||
var deformTimeline:DeformTimeline = new DeformTimeline(values.length);
|
||||
deformTimeline.slotIndex = slotIndex;
|
||||
deformTimeline.attachment = attachment;
|
||||
|
||||
frameIndex = 0;
|
||||
for each (valueMap in values) {
|
||||
var vertices:Vector.<Number>;
|
||||
if (!valueMap["vertices"]) {
|
||||
if (attachment is MeshAttachment)
|
||||
vertices = (attachment as MeshAttachment).vertices;
|
||||
else
|
||||
vertices = new Vector.<Number>(vertexCount, true);
|
||||
} else {
|
||||
var verticesValue:Array = valueMap["vertices"];
|
||||
vertices = new Vector.<Number>(vertexCount, true);
|
||||
var start:int = valueMap["offset"] || 0;
|
||||
var n:int = verticesValue.length;
|
||||
if (scale == 1) {
|
||||
for (i = 0; i < n; i++)
|
||||
vertices[i + start] = verticesValue[i];
|
||||
} else {
|
||||
for (i = 0; i < n; i++)
|
||||
vertices[i + start] = verticesValue[i] * scale;
|
||||
var deform:Vector.<Number>;
|
||||
var verticesValue:Object = valueMap["vertices"];
|
||||
if (verticesValue == null)
|
||||
deform = weighted ? new Vector.<Number>(deformLength, true) : vertices;
|
||||
else {
|
||||
deform = new Vector.<Number>(deformLength, true);
|
||||
var start:int = Number(valueMap["offset"] || 0);
|
||||
var temp:Vector.<Number> = getFloatArray(valueMap, "vertices", 1);
|
||||
for (i = 0; i < temp.length; i++) {
|
||||
deform[start + i] = temp[i];
|
||||
}
|
||||
if (scale != 1) {
|
||||
var n:int;
|
||||
for (i = start, n = i + temp.length; i < n; i++)
|
||||
deform[i] *= scale;
|
||||
}
|
||||
if (attachment is MeshAttachment) {
|
||||
var meshVertices:Vector.<Number> = (attachment as MeshAttachment).vertices;
|
||||
for (i = 0; i < vertexCount; i++)
|
||||
vertices[i] += meshVertices[i];
|
||||
if (!weighted) {
|
||||
for (i = 0; i < deformLength; i++)
|
||||
deform[i] += vertices[i];
|
||||
}
|
||||
}
|
||||
|
||||
ffdTimeline.setFrame(frameIndex, valueMap["time"], vertices);
|
||||
readCurve(ffdTimeline, frameIndex, valueMap);
|
||||
deformTimeline.setFrame(frameIndex, valueMap["time"], deform);
|
||||
readCurve(valueMap, deformTimeline, frameIndex);
|
||||
frameIndex++;
|
||||
}
|
||||
timelines[timelines.length] = ffdTimeline;
|
||||
duration = Math.max(duration, ffdTimeline.frames[ffdTimeline.frameCount - 1]);
|
||||
timelines[timelines.length] = deformTimeline;
|
||||
duration = Math.max(duration, deformTimeline.frames[deformTimeline.frameCount - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -567,8 +674,8 @@ public class SkeletonJson {
|
||||
skeletonData.animations[skeletonData.animations.length] = new Animation(name, timelines, duration);
|
||||
}
|
||||
|
||||
static private function readCurve (timeline:CurveTimeline, frameIndex:int, valueMap:Object) : void {
|
||||
var curve:Object = valueMap["curve"];
|
||||
static private function readCurve (map:Object, timeline:CurveTimeline, frameIndex:int) : void {
|
||||
var curve:Object = map["curve"];
|
||||
if (!curve) return;
|
||||
if (curve == "stepped")
|
||||
timeline.setStepped(frameIndex);
|
||||
@ -614,14 +721,14 @@ public class SkeletonJson {
|
||||
|
||||
}
|
||||
|
||||
import spine.attachments.Attachment;
|
||||
import spine.attachments.MeshAttachment;
|
||||
|
||||
internal class LinkedMesh {
|
||||
internal var parent:String, skin:String;
|
||||
internal var slotIndex:int;
|
||||
internal var mesh:Attachment;
|
||||
internal var mesh:MeshAttachment;
|
||||
|
||||
public function LinkedMesh (mesh:Attachment, skin:String, slotIndex:int, parent:String) {
|
||||
public function LinkedMesh (mesh:MeshAttachment, skin:String, slotIndex:int, parent:String) {
|
||||
this.mesh = mesh;
|
||||
this.skin = skin;
|
||||
this.slotIndex = slotIndex;
|
||||
|
||||
@ -86,8 +86,7 @@ public class Slot {
|
||||
return _bone._skeleton.time - _attachmentTime;
|
||||
}
|
||||
|
||||
public function setToSetupPose () : void {
|
||||
var slotIndex:int = _bone._skeleton.data.slots.indexOf(data);
|
||||
public function setToSetupPose () : void {
|
||||
r = _data.r;
|
||||
g = _data.g;
|
||||
b = _data.b;
|
||||
@ -96,7 +95,7 @@ public class Slot {
|
||||
attachment = null;
|
||||
else {
|
||||
_attachment = null;
|
||||
attachment = _bone._skeleton.getAttachmentForSlotIndex(slotIndex, data.attachmentName);
|
||||
attachment = _bone._skeleton.getAttachmentForSlotIndex(data.index, data.attachmentName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
package spine {
|
||||
|
||||
public class SlotData {
|
||||
internal var _index:int;
|
||||
internal var _name:String;
|
||||
internal var _boneData:BoneData;
|
||||
public var r:Number = 1;
|
||||
@ -41,12 +42,18 @@ public class SlotData {
|
||||
public var attachmentName:String;
|
||||
public var blendMode:BlendMode;
|
||||
|
||||
public function SlotData (name:String, boneData:BoneData) {
|
||||
public function SlotData (index:int, name:String, boneData:BoneData) {
|
||||
if (index < 0) throw new ArgumentError("index must be >= 0.");
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
if (boneData == null) throw new ArgumentError("boneData cannot be null.");
|
||||
_index = index;
|
||||
_name = name;
|
||||
_boneData = boneData;
|
||||
}
|
||||
|
||||
public function get index () : int {
|
||||
return _index;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
|
||||
40
spine-as3/spine-as3/src/spine/SpacingMode.as
Normal file
@ -0,0 +1,40 @@
|
||||
/******************************************************************************
|
||||
* 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 {
|
||||
|
||||
public class SpacingMode {
|
||||
public static const length:SpacingMode = new SpacingMode();
|
||||
public static const fixed:SpacingMode = new SpacingMode();
|
||||
public static const percent:SpacingMode = new SpacingMode();
|
||||
}
|
||||
|
||||
}
|
||||
@ -33,43 +33,97 @@ package spine {
|
||||
|
||||
public class TransformConstraint implements Updatable {
|
||||
internal var _data:TransformConstraintData;
|
||||
public var bone:Bone;
|
||||
internal var _bones:Vector.<Bone>;
|
||||
public var target:Bone;
|
||||
public var rotateMix:Number;
|
||||
public var translateMix:Number;
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var scaleMix:Number;
|
||||
public var shearMix:Number;
|
||||
internal var _temp:Vector.<Number> = new Vector.<Number>(2);
|
||||
|
||||
public function TransformConstraint (data:TransformConstraintData, skeleton:Skeleton) {
|
||||
if (data == null) throw new ArgumentError("data cannot be null.");
|
||||
if (skeleton == null) throw new ArgumentError("skeleton cannot be null.");
|
||||
_data = data;
|
||||
rotateMix = data.rotateMix;
|
||||
translateMix = data.translateMix;
|
||||
x = data.x;
|
||||
y = data.y;
|
||||
|
||||
bone = skeleton.findBone(data.bone._name);
|
||||
scaleMix = data.scaleMix;
|
||||
shearMix = data.shearMix;
|
||||
_bones = new Vector.<Bone>();
|
||||
for each (var boneData:BoneData in data.bones)
|
||||
_bones.push(skeleton.findBone(boneData.name));
|
||||
target = skeleton.findBone(data.target._name);
|
||||
}
|
||||
}
|
||||
|
||||
public function apply () : void {
|
||||
update();
|
||||
}
|
||||
|
||||
public function update () : void {
|
||||
var translateMix:Number = translateMix;
|
||||
if (translateMix > 0) {
|
||||
var local:Vector.<Number> = new Vector.<Number>(2, true);
|
||||
local[0] = x;
|
||||
local[1] = y;
|
||||
target.localToWorld(local);
|
||||
bone._worldX += (local[0] - bone._worldX) * translateMix;
|
||||
bone._worldY += (local[1] - bone._worldY) * translateMix;
|
||||
var rotateMix:Number = this.rotateMix, translateMix:Number = this.translateMix, scaleMix:Number = this.scaleMix, shearMix:Number = this.shearMix;
|
||||
var target:Bone = this.target;
|
||||
var ta:Number = target.a, tb:Number = target.b, tc:Number = target.c, td:Number = target.d;
|
||||
var bones:Vector.<Bone> = this._bones;
|
||||
for (var i:int = 0, n:int = bones.length; i < n; i++) {
|
||||
var bone:Bone = bones[i];
|
||||
|
||||
if (rotateMix > 0) {
|
||||
var a:Number = bone.a, b:Number = bone.b, c:Number = bone.c, d:Number = bone.d;
|
||||
var r:Number = Math.atan2(tc, ta) - Math.atan2(c, a) + data.offsetRotation * MathUtils.degRad;
|
||||
if (r > Math.PI)
|
||||
r -= Math.PI * 2;
|
||||
else if (r < -Math.PI) r += Math.PI * 2;
|
||||
r *= rotateMix;
|
||||
var cos:Number = Math.cos(r), sin:Number = Math.sin(r);
|
||||
bone._a = cos * a - sin * c;
|
||||
bone._b = cos * b - sin * d;
|
||||
bone._c = sin * a + cos * c;
|
||||
bone._d = sin * b + cos * d;
|
||||
}
|
||||
|
||||
if (translateMix > 0) {
|
||||
_temp[0] = data.offsetX;
|
||||
_temp[1] = data.offsetY;
|
||||
target.localToWorld(_temp);
|
||||
bone._worldX += (_temp[0] - bone.worldX) * translateMix;
|
||||
bone._worldY += (_temp[1] - bone.worldY) * translateMix;
|
||||
}
|
||||
|
||||
if (scaleMix > 0) {
|
||||
var bs:Number = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
||||
var ts:Number = Math.sqrt(ta * ta + tc * tc);
|
||||
var s:Number = bs > 0.00001 ? (bs + (ts - bs + data.offsetScaleX) * scaleMix) / bs : 0;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
bs = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
||||
ts = Math.sqrt(tb * tb + td * td);
|
||||
s = bs > 0.00001 ? (bs + (ts - bs + data.offsetScaleY) * scaleMix) / bs : 0;
|
||||
bone._b *= s;
|
||||
bone._d *= s;
|
||||
}
|
||||
|
||||
if (shearMix > 0) {
|
||||
b = bone.b, d = bone.d;
|
||||
var by:Number = Math.atan2(d, b);
|
||||
r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));
|
||||
if (r > Math.PI)
|
||||
r -= Math.PI * 2;
|
||||
else if (r < -Math.PI) r += Math.PI * 2;
|
||||
r = by + (r + data.offsetShearY * MathUtils.degRad) * shearMix;
|
||||
s = Math.sqrt(b * b + d * d);
|
||||
bone._b = Math.cos(r) * s;
|
||||
bone._d = Math.sin(r) * s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get data () : TransformConstraintData {
|
||||
return _data;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<Bone> {
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function toString () : String {
|
||||
return _data._name;
|
||||
|
||||
@ -33,16 +33,27 @@ package spine {
|
||||
|
||||
public class TransformConstraintData {
|
||||
internal var _name:String;
|
||||
public var bone:BoneData;
|
||||
internal var _bones:Vector.<BoneData> = new Vector.<BoneData>();
|
||||
public var target:BoneData;
|
||||
public var rotateMix:Number;
|
||||
public var translateMix:Number;
|
||||
public var x:Number;
|
||||
public var y:Number;
|
||||
public var scaleMix:Number;
|
||||
public var shearMix:Number;
|
||||
public var offsetRotation:Number;
|
||||
public var offsetX:Number;
|
||||
public var offsetY:Number;
|
||||
public var offsetScaleX:Number;
|
||||
public var offsetScaleY:Number;
|
||||
public var offsetShearY:Number;
|
||||
|
||||
public function TransformConstraintData (name:String) {
|
||||
if (name == null) throw new ArgumentError("name cannot be null.");
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public function get bones () : Vector.<BoneData> {;
|
||||
return _bones;
|
||||
}
|
||||
|
||||
public function get name () : String {
|
||||
return _name;
|
||||
|
||||
@ -55,14 +55,13 @@ public class AttachmentTimeline implements Timeline {
|
||||
|
||||
public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
var frames:Vector.<Number> = this.frames;
|
||||
if (time < frames[0]) {
|
||||
if (lastTime > time) apply(skeleton, lastTime, int.MAX_VALUE, null, 0);
|
||||
return;
|
||||
} else if (lastTime > time) //
|
||||
lastTime = -1;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var frameIndex:int = time >= frames[frames.length - 1] ? frames.length - 1 : Animation.binarySearch1(frames, time) - 1;
|
||||
if (frames[frameIndex] < lastTime) return;
|
||||
var frameIndex:int;
|
||||
if (time >= frames[frames.length - 1]) // Time is after last frame.
|
||||
frameIndex = frames.length - 1;
|
||||
else
|
||||
frameIndex = Animation.binarySearch(frames, time, 1) - 1;
|
||||
|
||||
var attachmentName:String = attachmentNames[frameIndex];
|
||||
skeleton.slots[slotIndex].attachment = attachmentName == null ? null : skeleton.getAttachmentForSlotIndex(slotIndex, attachmentName);
|
||||
|
||||
@ -35,11 +35,9 @@ import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
|
||||
public class ColorTimeline extends CurveTimeline {
|
||||
static private const PREV_FRAME_TIME:int = -5;
|
||||
static private const FRAME_R:int = 1;
|
||||
static private const FRAME_G:int = 2;
|
||||
static private const FRAME_B:int = 3;
|
||||
static private const FRAME_A:int = 4;
|
||||
static public const ENTRIES:int = 5;
|
||||
static internal const PREV_TIME:int = -5, PREV_R:int = -4, PREV_G:int = -3, PREV_B:int = -2, PREV_A:int = -1;
|
||||
static internal const R:int = 1, G:int = 2, B:int = 3, A:int = 4;
|
||||
|
||||
public var slotIndex:int;
|
||||
public var frames:Vector.<Number>; // time, r, g, b, a, ...
|
||||
@ -51,12 +49,12 @@ public class ColorTimeline extends CurveTimeline {
|
||||
|
||||
/** Sets the time and value of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, r:Number, g:Number, b:Number, a:Number) : void {
|
||||
frameIndex *= 5;
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = r;
|
||||
frames[int(frameIndex + 2)] = g;
|
||||
frames[int(frameIndex + 3)] = b;
|
||||
frames[int(frameIndex + 4)] = a;
|
||||
frames[int(frameIndex + R)] = r;
|
||||
frames[int(frameIndex + G)] = g;
|
||||
frames[int(frameIndex + B)] = b;
|
||||
frames[int(frameIndex + A)] = a;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
@ -64,28 +62,28 @@ public class ColorTimeline extends CurveTimeline {
|
||||
return; // Time is before first frame.
|
||||
|
||||
var r:Number, g:Number, b:Number, a:Number;
|
||||
if (time >= frames[int(frames.length - 5)]) {
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) {
|
||||
// Time is after last frame.
|
||||
var i:int = frames.length - 1;
|
||||
r = frames[int(i - 3)];
|
||||
g = frames[int(i - 2)];
|
||||
b = frames[int(i - 1)];
|
||||
a = frames[i];
|
||||
var i:int = frames.length;
|
||||
r = frames[int(i + PREV_R)];
|
||||
g = frames[int(i + PREV_G)];
|
||||
b = frames[int(i + PREV_B)];
|
||||
a = frames[int(i + PREV_A)];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 5);
|
||||
var prevFrameR:Number = frames[int(frameIndex - 4)];
|
||||
var prevFrameG:Number = frames[int(frameIndex - 3)];
|
||||
var prevFrameB:Number = frames[int(frameIndex - 2)];
|
||||
var prevFrameA:Number = frames[int(frameIndex - 1)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 5 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
r = frames[int(frame + PREV_R)];
|
||||
g = frames[int(frame + PREV_G)];
|
||||
b = frames[int(frame + PREV_B)];
|
||||
b = frames[int(frame + PREV_A)];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r = prevFrameR + (frames[int(frameIndex + FRAME_R)] - prevFrameR) * percent;
|
||||
g = prevFrameG + (frames[int(frameIndex + FRAME_G)] - prevFrameG) * percent;
|
||||
b = prevFrameB + (frames[int(frameIndex + FRAME_B)] - prevFrameB) * percent;
|
||||
a = prevFrameA + (frames[int(frameIndex + FRAME_A)] - prevFrameA) * percent;
|
||||
r += (frames[frame + R] - r) * percent;
|
||||
g += (frames[frame + G] - g) * percent;
|
||||
b += (frames[frame + B] - b) * percent;
|
||||
a += (frames[frame + A] - a) * percent;
|
||||
}
|
||||
var slot:Slot = skeleton.slots[slotIndex];
|
||||
if (alpha < 1) {
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.animation {
|
||||
import spine.MathUtils;
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
|
||||
@ -37,9 +38,8 @@ import spine.Skeleton;
|
||||
public class CurveTimeline implements Timeline {
|
||||
static private const LINEAR:Number = 0;
|
||||
static private const STEPPED:Number = 1;
|
||||
static private const BEZIER:Number = 2;
|
||||
static private const BEZIER_SEGMENTS:int = 10;
|
||||
static private const BEZIER_SIZE:int = BEZIER_SEGMENTS * 2 - 1;
|
||||
static private const BEZIER:Number = 2;
|
||||
static private const BEZIER_SIZE:int = 10 * 2 - 1;
|
||||
|
||||
private var curves:Vector.<Number>; // type, x, y, ...
|
||||
|
||||
@ -66,12 +66,10 @@ public class CurveTimeline implements Timeline {
|
||||
* cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
|
||||
* the difference between the keyframe's values. */
|
||||
public function setCurve (frameIndex:int, cx1:Number, cy1:Number, cx2:Number, cy2:Number) : void {
|
||||
var subdiv1:Number = 1 / BEZIER_SEGMENTS, subdiv2:Number = subdiv1 * subdiv1, subdiv3:Number = subdiv2 * subdiv1;
|
||||
var pre1:Number = 3 * subdiv1, pre2:Number = 3 * subdiv2, pre4:Number = 6 * subdiv2, pre5:Number = 6 * subdiv3;
|
||||
var tmp1x:Number = -cx1 * 2 + cx2, tmp1y:Number = -cy1 * 2 + cy2, tmp2x:Number = (cx1 - cx2) * 3 + 1, tmp2y:Number = (cy1 - cy2) * 3 + 1;
|
||||
var dfx:Number = cx1 * pre1 + tmp1x * pre2 + tmp2x * subdiv3, dfy:Number = cy1 * pre1 + tmp1y * pre2 + tmp2y * subdiv3;
|
||||
var ddfx:Number = tmp1x * pre4 + tmp2x * pre5, ddfy:Number = tmp1y * pre4 + tmp2y * pre5;
|
||||
var dddfx:Number = tmp2x * pre5, dddfy:Number = tmp2y * pre5;
|
||||
var tmpx:Number = (-cx1 * 2 + cx2) * 0.03, tmpy:Number = (-cy1 * 2 + cy2) * 0.03;
|
||||
var dddfx:Number = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy:Number = ((cy1 - cy2) * 3 + 1) * 0.006;
|
||||
var ddfx:Number = tmpx * 2 + dddfx, ddfy:Number = tmpy * 2 + dddfy;
|
||||
var dfx:Number = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy:Number = cy1 * 0.3 + tmpy + dddfy * 0.16666667;
|
||||
|
||||
var i:int = frameIndex * BEZIER_SIZE;
|
||||
var curves:Vector.<Number> = this.curves;
|
||||
@ -91,6 +89,7 @@ public class CurveTimeline implements Timeline {
|
||||
}
|
||||
|
||||
public function getCurvePercent (frameIndex:int, percent:Number) : Number {
|
||||
percent = MathUtils.clamp(percent, 0, 1);
|
||||
var curves:Vector.<Number> = this.curves;
|
||||
var i:int = frameIndex * BEZIER_SIZE;
|
||||
var type:Number = curves[i];
|
||||
|
||||
@ -30,19 +30,18 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.animation {
|
||||
import spine.attachments.FfdAttachment;
|
||||
import spine.attachments.VertexAttachment;
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
import spine.attachments.Attachment;
|
||||
|
||||
public class FfdTimeline extends CurveTimeline {
|
||||
public class DeformTimeline extends CurveTimeline {
|
||||
public var slotIndex:int;
|
||||
public var frames:Vector.<Number>;
|
||||
public var frameVertices:Vector.<Vector.<Number>>;
|
||||
public var attachment:Attachment;
|
||||
public var attachment:VertexAttachment;
|
||||
|
||||
public function FfdTimeline (frameCount:int) {
|
||||
public function DeformTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount, true);
|
||||
frameVertices = new Vector.<Vector.<Number>>(frameCount, true);
|
||||
@ -56,8 +55,8 @@ public class FfdTimeline extends CurveTimeline {
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
var slot:Slot = skeleton.slots[slotIndex];
|
||||
var slotAttachment:FfdAttachment = slot.attachment as FfdAttachment;
|
||||
if (!slotAttachment || !slotAttachment.applyFFD(attachment)) return;
|
||||
var slotAttachment:VertexAttachment = slot.attachment as VertexAttachment;
|
||||
if (!slotAttachment || !slotAttachment.applyDeform(attachment)) return;
|
||||
|
||||
var frames:Vector.<Number> = this.frames;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
@ -83,13 +82,11 @@ public class FfdTimeline extends CurveTimeline {
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch1(frames, time);
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex - 1)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
|
||||
var prevVertices:Vector.<Number> = frameVertices[int(frameIndex - 1)];
|
||||
var nextVertices:Vector.<Number> = frameVertices[frameIndex];
|
||||
var frame:int = Animation.binarySearch1(frames, time);
|
||||
var prevVertices:Vector.<Number> = frameVertices[int(frame - 1)];
|
||||
var nextVertices:Vector.<Number> = frameVertices[frame];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));
|
||||
|
||||
var prev:Number;
|
||||
if (alpha < 1) {
|
||||
@ -63,19 +63,19 @@ public class EventTimeline implements Timeline {
|
||||
return;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var frameIndex:int;
|
||||
var frame:int;
|
||||
if (lastTime < frames[0])
|
||||
frameIndex = 0;
|
||||
frame = 0;
|
||||
else {
|
||||
frameIndex = Animation.binarySearch1(frames, lastTime);
|
||||
var frame:Number = frames[frameIndex];
|
||||
while (frameIndex > 0) { // Fire multiple events with the same frame.
|
||||
if (frames[int(frameIndex - 1)] != frame) break;
|
||||
frameIndex--;
|
||||
frame = Animation.binarySearch1(frames, lastTime);
|
||||
var frameTime:Number = frames[frame];
|
||||
while (frame > 0) { // Fire multiple events with the same frame.
|
||||
if (frames[int(frame - 1)] != frameTime) break;
|
||||
frame--;
|
||||
}
|
||||
}
|
||||
for (; frameIndex < frameCount && time >= frames[frameIndex]; frameIndex++)
|
||||
firedEvents[firedEvents.length] = events[frameIndex];
|
||||
for (; frame < frameCount && time >= frames[frame]; frame++)
|
||||
firedEvents[firedEvents.length] = events[frame];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,48 +35,45 @@ import spine.IkConstraint;
|
||||
import spine.Skeleton;
|
||||
|
||||
public class IkConstraintTimeline extends CurveTimeline {
|
||||
static private const PREV_FRAME_TIME:int = -3;
|
||||
static private const PREV_FRAME_MIX:int = -2;
|
||||
static private const PREV_FRAME_BEND_DIRECTION:int = -1;
|
||||
static private const FRAME_MIX:int = 1;
|
||||
static public const ENTRIES:int = 3;
|
||||
static internal const PREV_TIME:int = -3, PREV_MIX:int = -2, PREV_BEND_DIRECTION:int = -1;
|
||||
static internal const MIX:int = 1, BEND_DIRECTION:int = 2;
|
||||
|
||||
public var ikConstraintIndex:int;
|
||||
public var frames:Vector.<Number>; // time, mix, bendDirection, ...
|
||||
|
||||
public function IkConstraintTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * 3, true);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time, mix and bend direction of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, mix:Number, bendDirection:int) : void {
|
||||
frameIndex *= 3;
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = mix;
|
||||
frames[int(frameIndex + 2)] = bendDirection;
|
||||
frames[int(frameIndex + MIX)] = mix;
|
||||
frames[int(frameIndex + BEND_DIRECTION)] = bendDirection;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var ikConstraint:IkConstraint = skeleton.ikConstraints[ikConstraintIndex];
|
||||
var constraint:IkConstraint = skeleton.ikConstraints[ikConstraintIndex];
|
||||
|
||||
if (time >= frames[int(frames.length - 3)]) { // Time is after last frame.
|
||||
ikConstraint.mix += (frames[int(frames.length - 2)] - ikConstraint.mix) * alpha;
|
||||
ikConstraint.bendDirection = int(frames[int(frames.length - 1)]);
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) { // Time is after last frame.
|
||||
constraint.mix += (frames[int(frames.length + PREV_MIX)] - constraint.mix) * alpha;
|
||||
constraint.bendDirection = int(frames[int(frames.length + PREV_BEND_DIRECTION)]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 3);
|
||||
var prevFrameMix:Number = frames[int(frameIndex + PREV_FRAME_MIX)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 3 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var mix:Number = frames[int(frame + PREV_MIX)];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
var mix:Number = prevFrameMix + (frames[int(frameIndex + FRAME_MIX)] - prevFrameMix) * percent;
|
||||
ikConstraint.mix += (mix - ikConstraint.mix) * alpha;
|
||||
ikConstraint.bendDirection = int(frames[int(frameIndex + PREV_FRAME_BEND_DIRECTION)]);
|
||||
constraint.mix += (mix + (frames[frame + MIX] - mix) * percent - constraint.mix) * alpha;
|
||||
constraint.bendDirection = int(frames[frame + PREV_BEND_DIRECTION]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,9 @@ package spine.animation {
|
||||
public class Listeners {
|
||||
private var _listeners:Vector.<Function> = new Vector.<Function>();
|
||||
|
||||
public function Listeners () {
|
||||
}
|
||||
|
||||
public function get listeners () : Vector.<Function> {
|
||||
return _listeners;
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
/******************************************************************************
|
||||
* 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.animation {
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
import spine.PathConstraint;
|
||||
|
||||
public class PathConstraintMixTimeline extends CurveTimeline {
|
||||
static public const ENTRIES:int = 3;
|
||||
static internal const PREV_TIME:int = -3, PREV_ROTATE:int = -2, PREV_TRANSLATE:int = -1;
|
||||
static internal const ROTATE:int = 1, TRANSLATE:int = 2;
|
||||
|
||||
public var pathConstraintIndex:int;
|
||||
|
||||
public var frames:Vector.<Number>; // time, rotate mix, translate mix, ...
|
||||
|
||||
public function PathConstraintMixTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time and mixes of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, rotateMix:Number, translateMix:Number) : void {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + ROTATE] = rotateMix;
|
||||
frames[frameIndex + TRANSLATE] = translateMix;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var constraint:PathConstraint = skeleton.pathConstraints[pathConstraintIndex];
|
||||
|
||||
if (time >= frames[frames.length - ENTRIES]) { // Time is after last frame.
|
||||
var i:int = frames.length;
|
||||
constraint.rotateMix += (frames[i + PREV_ROTATE] - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (frames[i + PREV_TRANSLATE] - constraint.translateMix) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var rotate:Number = frames[frame + PREV_ROTATE];
|
||||
var translate:Number = frames[frame + PREV_TRANSLATE];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
constraint.rotateMix += (rotate + (frames[frame + ROTATE] - rotate) * percent - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (translate + (frames[frame + TRANSLATE] - translate) * percent - constraint.translateMix)
|
||||
* alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
/******************************************************************************
|
||||
* 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.animation {
|
||||
import spine.PathConstraint;
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
|
||||
public class PathConstraintPositionTimeline extends CurveTimeline {
|
||||
static public const ENTRIES:int = 2;
|
||||
static internal const PREV_TIME:int = -2, PREV_VALUE:int = -1;
|
||||
static internal const VALUE:int = 1;
|
||||
|
||||
public var pathConstraintIndex:int;
|
||||
|
||||
public var frames:Vector.<Number>; // time, position, ...
|
||||
|
||||
public function PathConstraintPositionTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time and value of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, value:Number) : void {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + VALUE] = value;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var constraint:PathConstraint = skeleton.pathConstraints[pathConstraintIndex];
|
||||
|
||||
if (time >= frames[frames.length - ENTRIES]) { // Time is after last frame.
|
||||
var i:int = frames.length;
|
||||
constraint.position += (frames[i + PREV_VALUE] - constraint.position) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var position:Number = frames[frame + PREV_VALUE];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
constraint.position += (position + (frames[frame + VALUE] - position) * percent - constraint.position) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
* 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.animation {
|
||||
import spine.Skeleton;
|
||||
import spine.Event;
|
||||
import spine.PathConstraint;
|
||||
|
||||
public class PathConstraintSpacingTimeline extends PathConstraintPositionTimeline {
|
||||
public function PathConstraintSpacingTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var constraint:PathConstraint = skeleton.pathConstraints[pathConstraintIndex];
|
||||
|
||||
if (time >= frames[frames.length - ENTRIES]) { // Time is after last frame.
|
||||
var i:int = frames.length;
|
||||
constraint.spacing += (frames[i + PREV_VALUE] - constraint.spacing) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var spacing:Number = frames[frame + PREV_VALUE];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
constraint.spacing += (spacing + (frames[frame + VALUE] - spacing) * percent - constraint.spacing) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,8 +35,9 @@ import spine.Event;
|
||||
import spine.Skeleton;
|
||||
|
||||
public class RotateTimeline extends CurveTimeline {
|
||||
static private const PREV_FRAME_TIME:int = -2;
|
||||
static private const FRAME_VALUE:int = 1;
|
||||
static public const ENTRIES:int = 2;
|
||||
static private const PREV_TIME:int = -2, PREV_ROTATION:int = -1;
|
||||
static private const ROTATION:int = 1;
|
||||
|
||||
public var boneIndex:int;
|
||||
public var frames:Vector.<Number>; // time, value, ...
|
||||
@ -47,10 +48,10 @@ public class RotateTimeline extends CurveTimeline {
|
||||
}
|
||||
|
||||
/** Sets the time and angle of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, angle:Number) : void {
|
||||
frameIndex *= 2;
|
||||
public function setFrame (frameIndex:int, time:Number, degrees:Number) : void {
|
||||
frameIndex <<= 1;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = angle;
|
||||
frames[int(frameIndex + ROTATION)] = degrees;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
@ -58,10 +59,9 @@ public class RotateTimeline extends CurveTimeline {
|
||||
return; // Time is before first frame.
|
||||
|
||||
var bone:Bone = skeleton.bones[boneIndex];
|
||||
|
||||
var amount:Number;
|
||||
|
||||
if (time >= frames[int(frames.length - 2)]) { // Time is after last frame.
|
||||
amount = bone.data.rotation + frames[int(frames.length - 1)] - bone.rotation;
|
||||
var amount:Number = bone.data.rotation + frames[int(frames.length + PREV_ROTATION)] - bone.rotation;
|
||||
while (amount > 180)
|
||||
amount -= 360;
|
||||
while (amount < -180)
|
||||
@ -71,18 +71,17 @@ public class RotateTimeline extends CurveTimeline {
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 2);
|
||||
var prevFrameValue:Number = frames[int(frameIndex - 1)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 2 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var prevRotation:Number = frames[int(frame + PREV_ROTATION)];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
amount = frames[int(frameIndex + FRAME_VALUE)] - prevFrameValue;
|
||||
amount = frames[int(frame + ROTATION)] - prevRotation;
|
||||
while (amount > 180)
|
||||
amount -= 360;
|
||||
while (amount < -180)
|
||||
amount += 360;
|
||||
amount = bone.data.rotation + (prevFrameValue + amount * percent) - bone.rotation;
|
||||
amount = bone.data.rotation + (prevRotation + amount * percent) - bone.rotation;
|
||||
while (amount > 180)
|
||||
amount -= 360;
|
||||
while (amount < -180)
|
||||
|
||||
@ -44,22 +44,21 @@ public class ScaleTimeline extends TranslateTimeline {
|
||||
return; // Time is before first frame.
|
||||
|
||||
var bone:Bone = skeleton.bones[boneIndex];
|
||||
if (time >= frames[int(frames.length - 3)]) { // Time is after last frame.
|
||||
bone.scaleX += (bone.data.scaleX * frames[int(frames.length - 2)] - bone.scaleX) * alpha;
|
||||
bone.scaleY += (bone.data.scaleY * frames[int(frames.length - 1)] - bone.scaleY) * alpha;
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) { // Time is after last frame.
|
||||
bone.scaleX += (bone.data.scaleX * frames[int(frames.length + PREV_X)] - bone.scaleX) * alpha;
|
||||
bone.scaleY += (bone.data.scaleY * frames[int(frames.length + PREV_Y)] - bone.scaleY) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 3);
|
||||
var prevFrameX:Number = frames[int(frameIndex - 2)];
|
||||
var prevFrameY:Number = frames[int(frameIndex - 1)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 3 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var prevX:Number = frames[frame + PREV_X];
|
||||
var prevY:Number = frames[frame + PREV_Y];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
bone.scaleX += (bone.data.scaleX * (prevFrameX + (frames[int(frameIndex + FRAME_X)] - prevFrameX) * percent) - bone.scaleX) * alpha;
|
||||
bone.scaleY += (bone.data.scaleY * (prevFrameY + (frames[int(frameIndex + FRAME_Y)] - prevFrameY) * percent) - bone.scaleY) * alpha;
|
||||
bone.scaleX += (bone.data.scaleX * (prevX + (frames[frame + X] - prevX) * percent) - bone.scaleX) * alpha;
|
||||
bone.scaleY += (bone.data.scaleY * (prevY + (frames[frame + Y] - prevY) * percent) - bone.scaleY) * alpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
34
spine-as3/spine-as3/src/spine/animation/ShearTimeline.as
Normal file
@ -0,0 +1,34 @@
|
||||
package spine.animation {
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
import spine.Bone;
|
||||
|
||||
public class ShearTimeline extends TranslateTimeline {
|
||||
public function ShearTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
var frames:Vector.<Number> = this.frames;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var bone:Bone = skeleton.bones[boneIndex];
|
||||
if (time >= frames[frames.length - ENTRIES]) { // Time is after last frame.
|
||||
bone.shearX += (bone.data.shearX + frames[frames.length + PREV_X] - bone.shearX) * alpha;
|
||||
bone.shearY += (bone.data.shearY + frames[frames.length + PREV_Y] - bone.shearY) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var prevX:Number = frames[frame + PREV_X];
|
||||
var prevY:Number = frames[frame + PREV_Y];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
bone.shearX += (bone.data.shearX + (prevX + (frames[frame + X] - prevX) * percent) - bone.shearX) * alpha;
|
||||
bone.shearY += (bone.data.shearY + (prevY + (frames[frame + Y] - prevY) * percent) - bone.shearY) * alpha;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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 ? "<none>" : animation.name;
|
||||
}
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
/******************************************************************************
|
||||
* 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.animation {
|
||||
import spine.Event;
|
||||
import spine.Skeleton;
|
||||
import spine.TransformConstraint;
|
||||
|
||||
public class TransformConstraintTimeline extends CurveTimeline {
|
||||
static public const ENTRIES:int = 5;
|
||||
static internal const PREV_TIME:int = -5, PREV_ROTATE:int = -4, PREV_TRANSLATE:int = -3, PREV_SCALE:int = -2, PREV_SHEAR:int = -1;
|
||||
static internal const ROTATE:int = 1, TRANSLATE:int = 2, SCALE:int = 3, SHEAR:int = 4;
|
||||
|
||||
public var transformConstraintIndex:int;
|
||||
public var frames:Vector.<Number>; // time, rotate mix, translate mix, scale mix, shear mix, ...
|
||||
|
||||
public function TransformConstraintTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time and mixes of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, rotateMix:Number, translateMix:Number, scaleMix:Number, shearMix:Number) : void {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + ROTATE] = rotateMix;
|
||||
frames[frameIndex + TRANSLATE] = translateMix;
|
||||
frames[frameIndex + SCALE] = scaleMix;
|
||||
frames[frameIndex + SHEAR] = shearMix;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
var constraint:TransformConstraint = skeleton.transformConstraints[transformConstraintIndex];
|
||||
|
||||
if (time >= frames[frames.length - ENTRIES]) { // Time is after last frame.
|
||||
var i:int = frames.length;
|
||||
constraint.rotateMix += (frames[i + PREV_ROTATE] - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (frames[i + PREV_TRANSLATE] - constraint.translateMix) * alpha;
|
||||
constraint.scaleMix += (frames[i + PREV_SCALE] - constraint.scaleMix) * alpha;
|
||||
constraint.shearMix += (frames[i + PREV_SHEAR] - constraint.shearMix) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
var rotate:Number = frames[frame + PREV_ROTATE];
|
||||
var translate:Number = frames[frame + PREV_TRANSLATE];
|
||||
var scale:Number = frames[frame + PREV_SCALE];
|
||||
var shear:Number = frames[frame + PREV_SHEAR];
|
||||
constraint.rotateMix += (rotate + (frames[frame + ROTATE] - rotate) * percent - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (translate + (frames[frame + TRANSLATE] - translate) * percent - constraint.translateMix)
|
||||
* alpha;
|
||||
constraint.scaleMix += (scale + (frames[frame + SCALE] - scale) * percent - constraint.scaleMix) * alpha;
|
||||
constraint.shearMix += (shear + (frames[frame + SHEAR] - shear) * percent - constraint.shearMix) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,24 +35,24 @@ import spine.Event;
|
||||
import spine.Skeleton;
|
||||
|
||||
public class TranslateTimeline extends CurveTimeline {
|
||||
static internal const PREV_FRAME_TIME:int = -3;
|
||||
static internal const FRAME_X:int = 1;
|
||||
static internal const FRAME_Y:int = 2;
|
||||
static public const ENTRIES:int = 3;
|
||||
static internal const PREV_TIME:int = -3, PREV_X:int = -2, PREV_Y:int = -1;
|
||||
static internal const X:int = 1, Y:int = 2;
|
||||
|
||||
public var boneIndex:int;
|
||||
public var frames:Vector.<Number>; // time, value, value, ...
|
||||
|
||||
public function TranslateTimeline (frameCount:int) {
|
||||
super(frameCount);
|
||||
frames = new Vector.<Number>(frameCount * 3, true);
|
||||
frames = new Vector.<Number>(frameCount * ENTRIES, true);
|
||||
}
|
||||
|
||||
/** Sets the time and value of the specified keyframe. */
|
||||
public function setFrame (frameIndex:int, time:Number, x:Number, y:Number) : void {
|
||||
frameIndex *= 3;
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[int(frameIndex + 1)] = x;
|
||||
frames[int(frameIndex + 2)] = y;
|
||||
frames[int(frameIndex + X)] = x;
|
||||
frames[int(frameIndex + Y)] = y;
|
||||
}
|
||||
|
||||
override public function apply (skeleton:Skeleton, lastTime:Number, time:Number, firedEvents:Vector.<Event>, alpha:Number) : void {
|
||||
@ -61,22 +61,21 @@ public class TranslateTimeline extends CurveTimeline {
|
||||
|
||||
var bone:Bone = skeleton.bones[boneIndex];
|
||||
|
||||
if (time >= frames[int(frames.length - 3)]) { // Time is after last frame.
|
||||
bone.x += (bone.data.x + frames[int(frames.length - 2)] - bone.x) * alpha;
|
||||
bone.y += (bone.data.y + frames[int(frames.length - 1)] - bone.y) * alpha;
|
||||
if (time >= frames[int(frames.length - ENTRIES)]) { // Time is after last frame.
|
||||
bone.x += (bone.data.x + frames[int(frames.length + PREV_X)] - bone.x) * alpha;
|
||||
bone.y += (bone.data.y + frames[int(frames.length + PREV_Y)] - bone.y) * alpha;
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
var frameIndex:int = Animation.binarySearch(frames, time, 3);
|
||||
var prevFrameX:Number = frames[int(frameIndex - 2)];
|
||||
var prevFrameY:Number = frames[int(frameIndex - 1)];
|
||||
var frameTime:Number = frames[frameIndex];
|
||||
var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex + PREV_FRAME_TIME)] - frameTime);
|
||||
percent = getCurvePercent(frameIndex / 3 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent));
|
||||
var frame:int = Animation.binarySearch(frames, time, ENTRIES);
|
||||
var prevX:Number = frames[frame + PREV_X];
|
||||
var prevY:Number = frames[frame + PREV_Y];
|
||||
var frameTime:Number = frames[frame];
|
||||
var percent:Number = getCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
bone.x += (bone.data.x + prevFrameX + (frames[int(frameIndex + FRAME_X)] - prevFrameX) * percent - bone.x) * alpha;
|
||||
bone.y += (bone.data.y + prevFrameY + (frames[int(frameIndex + FRAME_Y)] - prevFrameY) * percent - bone.y) * alpha;
|
||||
bone.x += (bone.data.x + prevX + (frames[frame + X] - prevX) * percent - bone.x) * alpha;
|
||||
bone.y += (bone.data.y + prevY + (frames[frame + Y] - prevY) * percent - bone.y) * alpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,9 @@ public class AtlasPage {
|
||||
public var rendererObject:Object;
|
||||
public var width:int;
|
||||
public var height:int;
|
||||
|
||||
public function AtlasPage () {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,6 +51,9 @@ public class AtlasRegion {
|
||||
public var splits:Vector.<int>;
|
||||
public var pads:Vector.<int>;
|
||||
public var rendererObject:Object;
|
||||
|
||||
public function AtlasRegion () {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -82,32 +82,14 @@ public class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
attachment.regionOriginalHeight = region.originalHeight;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public function newWeightedMeshAttachment (skin:Skin, name:String, path:String) : WeightedMeshAttachment {
|
||||
var region:AtlasRegion = atlas.findRegion(path);
|
||||
if (region == null)
|
||||
throw new Error("Region not found in atlas: " + path + " (weighted mesh attachment: " + name + ")");
|
||||
var attachment:WeightedMeshAttachment = new WeightedMeshAttachment(name);
|
||||
attachment.rendererObject = region;
|
||||
var scaleX:Number = region.page.width / nextPOT(region.page.width);
|
||||
var scaleY:Number = region.page.height / nextPOT(region.page.height);
|
||||
attachment.regionU = region.u * scaleX;
|
||||
attachment.regionV = region.v * scaleY;
|
||||
attachment.regionU2 = region.u2 * scaleX;
|
||||
attachment.regionV2 = region.v2 * scaleY;
|
||||
attachment.regionRotate = region.rotate;
|
||||
attachment.regionOffsetX = region.offsetX;
|
||||
attachment.regionOffsetY = region.offsetY;
|
||||
attachment.regionWidth = region.width;
|
||||
attachment.regionHeight = region.height;
|
||||
attachment.regionOriginalWidth = region.originalWidth;
|
||||
attachment.regionOriginalHeight = region.originalHeight;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public function newBoundingBoxAttachment (skin:Skin, name:String) : BoundingBoxAttachment {
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
|
||||
public function newPathAttachment(skin:Skin, name:String) : PathAttachment {
|
||||
return new PathAttachment(name);
|
||||
}
|
||||
|
||||
static public function nextPOT (value:int) : int {
|
||||
value--;
|
||||
|
||||
@ -39,11 +39,11 @@ public interface AttachmentLoader {
|
||||
/** @return May be null to not load an attachment. */
|
||||
function newMeshAttachment (skin:Skin, name:String, path:String) : MeshAttachment;
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
function newWeightedMeshAttachment (skin:Skin, name:String, path:String) : WeightedMeshAttachment;
|
||||
|
||||
/** @return May be null to not load an attachment. */
|
||||
function newBoundingBoxAttachment (skin:Skin, name:String) : BoundingBoxAttachment;
|
||||
|
||||
/** @return May be null to not load an attachment */
|
||||
function newPathAttachment(skin:Skin, name:String): PathAttachment;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,10 +35,9 @@ public class AttachmentType {
|
||||
public static const region:AttachmentType = new AttachmentType(0, "region");
|
||||
public static const regionsequence:AttachmentType = new AttachmentType(1, "regionsequence");
|
||||
public static const boundingbox:AttachmentType = new AttachmentType(2, "boundingbox");
|
||||
public static const mesh:AttachmentType = new AttachmentType(3, "mesh");
|
||||
public static const weightedmesh:AttachmentType = new AttachmentType(4, "weightedmesh");
|
||||
public static const mesh:AttachmentType = new AttachmentType(3, "mesh");
|
||||
public static const linkedmesh:AttachmentType = new AttachmentType(3, "linkedmesh");
|
||||
public static const weightedlinkedmesh:AttachmentType = new AttachmentType(4, "weightedlinkedmesh");
|
||||
public static const path:AttachmentType = new AttachmentType(4, "path");
|
||||
|
||||
public var ordinal:int;
|
||||
public var name:String;
|
||||
|
||||
@ -30,31 +30,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.attachments {
|
||||
import spine.Bone;
|
||||
|
||||
public dynamic class BoundingBoxAttachment extends Attachment {
|
||||
public var vertices:Vector.<Number> = new Vector.<Number>();
|
||||
|
||||
public dynamic class BoundingBoxAttachment extends VertexAttachment {
|
||||
public function BoundingBoxAttachment (name:String) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public function computeWorldVertices (x:Number, y:Number, bone:Bone, worldVertices:Vector.<Number>) : void {
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var m00:Number = bone.a;
|
||||
var m01:Number = bone.b;
|
||||
var m10:Number = bone.c;
|
||||
var m11:Number = bone.d;
|
||||
var vertices:Vector.<Number> = this.vertices;
|
||||
for (var i:int = 0, n:int = vertices.length; i < n; i += 2) {
|
||||
var ii:int = i + 1;
|
||||
var px:Number = vertices[i];
|
||||
var py:Number = vertices[ii];
|
||||
worldVertices[i] = px * m00 + py * m01 + x;
|
||||
worldVertices[ii] = px * m10 + py * m11 + y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,21 +30,19 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.attachments {
|
||||
import spine.Slot;
|
||||
import spine.Bone;
|
||||
|
||||
public dynamic class MeshAttachment extends Attachment implements FfdAttachment {
|
||||
public var vertices:Vector.<Number>;
|
||||
public dynamic class MeshAttachment extends VertexAttachment {
|
||||
public var worldVertices:Vector.<Number>;
|
||||
public var uvs:Vector.<Number>;
|
||||
public var regionUVs:Vector.<Number>;
|
||||
public var triangles:Vector.<uint>;
|
||||
public var hullLength:int;
|
||||
public var triangles:Vector.<uint>;
|
||||
public var r:Number = 1;
|
||||
public var g:Number = 1;
|
||||
public var b:Number = 1;
|
||||
public var a:Number = 1;
|
||||
public var hullLength:int;
|
||||
private var _parentMesh:MeshAttachment;
|
||||
public var inheritFFD:Boolean;
|
||||
public var inheritDeform:Boolean;
|
||||
|
||||
public var path:String;
|
||||
public var rendererObject:Object;
|
||||
@ -86,27 +84,8 @@ public dynamic class MeshAttachment extends Attachment implements FfdAttachment
|
||||
}
|
||||
}
|
||||
|
||||
public function computeWorldVertices (x:Number, y:Number, slot:Slot, worldVertices:Vector.<Number>) : void {
|
||||
var bone:Bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var m00:Number = bone.a;
|
||||
var m01:Number = bone.b;
|
||||
var m10:Number = bone.c;
|
||||
var m11:Number = bone.d;
|
||||
var vertices:Vector.<Number> = this.vertices;
|
||||
var verticesCount:int = vertices.length;
|
||||
if (slot.attachmentVertices.length == verticesCount) vertices = slot.attachmentVertices;
|
||||
for (var i:int = 0, ii:int = 0; i < verticesCount; i += 2, ii += 2) {
|
||||
var vx:Number = vertices[i];
|
||||
var vy:Number = vertices[int(i + 1)];
|
||||
worldVertices[ii] = vx * m00 + vy * m01 + x;
|
||||
worldVertices[int(ii + 1)] = vx * m10 + vy * m11 + y;
|
||||
}
|
||||
}
|
||||
|
||||
public function applyFFD (sourceAttachment:Attachment) : Boolean {
|
||||
return this == sourceAttachment || (inheritFFD && _parentMesh == sourceAttachment);
|
||||
return this == sourceAttachment || (inheritDeform && _parentMesh == sourceAttachment);
|
||||
}
|
||||
|
||||
public function get parentMesh () : MeshAttachment {
|
||||
@ -116,7 +95,9 @@ public dynamic class MeshAttachment extends Attachment implements FfdAttachment
|
||||
public function set parentMesh (parentMesh:MeshAttachment) : void {
|
||||
_parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
bones = parentMesh.bones;
|
||||
vertices = parentMesh.vertices;
|
||||
worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
regionUVs = parentMesh.regionUVs;
|
||||
triangles = parentMesh.triangles;
|
||||
hullLength = parentMesh.hullLength;
|
||||
|
||||
@ -29,27 +29,14 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.starling {
|
||||
package spine.attachments {
|
||||
|
||||
import starling.display.Image;
|
||||
import starling.textures.Texture;
|
||||
import starling.utils.VertexData;
|
||||
public dynamic class PathAttachment extends VertexAttachment {
|
||||
public var lengths:Vector.<Number>;
|
||||
public var closed:Boolean, constantSpeed:Boolean;
|
||||
|
||||
public class SkeletonImage extends Image {
|
||||
public function SkeletonImage (texture:Texture) {
|
||||
super(texture);
|
||||
}
|
||||
|
||||
public function get vertexData () : VertexData {
|
||||
return mVertexData;
|
||||
}
|
||||
|
||||
public function updateVertices () : void {
|
||||
onVertexDataChanged();
|
||||
}
|
||||
|
||||
override public function get tinted () : Boolean {
|
||||
return true;
|
||||
public function PathAttachment (name:String) {
|
||||
super(name);
|
||||
}
|
||||
}
|
||||
|
||||
127
spine-as3/spine-as3/src/spine/attachments/VertexAttachment.as
Normal file
@ -0,0 +1,127 @@
|
||||
/******************************************************************************
|
||||
* 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.attachments {
|
||||
import spine.Bone;
|
||||
import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
|
||||
public dynamic class VertexAttachment extends Attachment {
|
||||
public var bones:Vector.<int>;
|
||||
public var vertices:Vector.<Number>;
|
||||
public var worldVerticesLength:int;
|
||||
|
||||
public function VertexAttachment (name:String) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public function computeWorldVertices (slot:Slot, worldVertices:Vector.<Number>): void {
|
||||
computeWorldVertices2(slot, 0, worldVerticesLength, worldVertices, 0);
|
||||
}
|
||||
|
||||
/** Transforms local vertices to world coordinates.
|
||||
* @param start The index of the first local vertex value to transform. Each vertex has 2 values, x and y.
|
||||
* @param count The number of world vertex values to output. Must be <= {@link #getWorldVerticesLength()} - start.
|
||||
* @param worldVertices The output world vertices. Must have a length >= offset + count.
|
||||
* @param offset The worldVertices index to begin writing values. */
|
||||
public function computeWorldVertices2 (slot:Slot, start:int, count:int, worldVertices:Vector.<Number>, offset:int): void {
|
||||
count += offset;
|
||||
var skeleton:Skeleton = slot.skeleton;
|
||||
var x:Number = skeleton.x, y:Number = skeleton.y;
|
||||
var deformArray:Vector.<Number> = slot.attachmentVertices;
|
||||
var vertices:Vector.<Number> = this.vertices;
|
||||
var bones:Vector.<int> = this.bones;
|
||||
var deform:Vector.<Number>;
|
||||
|
||||
var v:int, w:int, n:int, i:int, skip:int, b:int, f:int;
|
||||
var vx:Number, vy:Number;
|
||||
var wx:Number, wy:Number;
|
||||
var bone:Bone;
|
||||
|
||||
if (bones == null) {
|
||||
if (deformArray.length > 0) vertices = deformArray;
|
||||
bone = slot.bone;
|
||||
x += bone.worldX;
|
||||
y += bone.worldY;
|
||||
var a:Number = bone.a, bb:Number = bone.b, c:Number = bone.c, d:Number = bone.d;
|
||||
for (v = start, w = offset; w < count; v += 2, w += 2) {
|
||||
vx = vertices[v], vy = vertices[v + 1];
|
||||
worldVertices[w] = vx * a + vy * bb + x;
|
||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||
}
|
||||
return;
|
||||
}
|
||||
v = 0, skip = 0;
|
||||
for (i = 0; i < start; i += 2) {
|
||||
n = bones[v];
|
||||
v += n + 1;
|
||||
skip += n;
|
||||
}
|
||||
var skeletonBones:Vector.<Bone> = skeleton.bones;
|
||||
if (deformArray.length == 0) {
|
||||
for (w = offset, b = skip * 3; w < count; w += 2) {
|
||||
wx = x, wy = y;
|
||||
n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3) {
|
||||
bone = skeletonBones[bones[v]];
|
||||
vx = vertices[b]; vy = vertices[b + 1]; var weight:Number = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
} else {
|
||||
deform = deformArray;
|
||||
for (w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||
wx = x; wy = y;
|
||||
n = bones[v++];
|
||||
n += v;
|
||||
for (; v < n; v++, b += 3, f += 2) {
|
||||
bone = skeletonBones[bones[v]];
|
||||
vx = vertices[b] + deform[f]; vy = vertices[b + 1] + deform[f + 1]; weight = vertices[b + 2];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx;
|
||||
worldVertices[w + 1] = wy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns true if a deform originally applied to the specified attachment should be applied to this attachment. */
|
||||
public function applyDeform (sourceAttachment:VertexAttachment): Boolean {
|
||||
return this == sourceAttachment;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,156 +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.attachments {
|
||||
import spine.Slot;
|
||||
import spine.Bone;
|
||||
|
||||
public dynamic class WeightedMeshAttachment extends Attachment implements FfdAttachment {
|
||||
public var bones:Vector.<int>;
|
||||
public var weights:Vector.<Number>;
|
||||
public var uvs:Vector.<Number>;
|
||||
public var regionUVs:Vector.<Number>;
|
||||
public var triangles:Vector.<uint>;
|
||||
public var hullLength:int;
|
||||
public var r:Number = 1;
|
||||
public var g:Number = 1;
|
||||
public var b:Number = 1;
|
||||
public var a:Number = 1;
|
||||
private var _parentMesh:WeightedMeshAttachment;
|
||||
public var inheritFFD:Boolean;
|
||||
|
||||
public var path:String;
|
||||
public var rendererObject:Object;
|
||||
public var regionU:Number;
|
||||
public var regionV:Number;
|
||||
public var regionU2:Number;
|
||||
public var regionV2:Number;
|
||||
public var regionRotate:Boolean;
|
||||
public var regionOffsetX:Number; // Pixels stripped from the bottom left, unrotated.
|
||||
public var regionOffsetY:Number;
|
||||
public var regionWidth:Number; // Unrotated, stripped size.
|
||||
public var regionHeight:Number;
|
||||
public var regionOriginalWidth:Number; // Unrotated, unstripped size.
|
||||
public var regionOriginalHeight:Number;
|
||||
|
||||
// Nonessential.
|
||||
public var edges:Vector.<int>;
|
||||
public var width:Number;
|
||||
public var height:Number;
|
||||
|
||||
public function WeightedMeshAttachment (name:String) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public function updateUVs () : void {
|
||||
var width:Number = regionU2 - regionU, height:Number = regionV2 - regionV;
|
||||
var i:int, n:int = regionUVs.length;
|
||||
if (!uvs || uvs.length != n) uvs = new Vector.<Number>(n, true);
|
||||
if (regionRotate) {
|
||||
for (i = 0; i < n; i += 2) {
|
||||
uvs[i] = regionU + regionUVs[int(i + 1)] * width;
|
||||
uvs[int(i + 1)] = regionV + height - regionUVs[i] * height;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < n; i += 2) {
|
||||
uvs[i] = regionU + regionUVs[i] * width;
|
||||
uvs[int(i + 1)] = regionV + regionUVs[int(i + 1)] * height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function computeWorldVertices (x:Number, y:Number, slot:Slot, worldVertices:Vector.<Number>) : void {
|
||||
var skeletonBones:Vector.<Bone> = slot.skeleton.bones;
|
||||
var weights:Vector.<Number> = this.weights;
|
||||
var bones:Vector.<int> = this.bones;
|
||||
|
||||
var w:int = 0, v:int = 0, b:int = 0, f:int = 0, n:int = bones.length, nn:int;
|
||||
var wx:Number, wy:Number, bone:Bone, vx:Number, vy:Number, weight:Number;
|
||||
if (slot.attachmentVertices.length == 0) {
|
||||
for (; v < n; w += 2) {
|
||||
wx = 0;
|
||||
wy = 0;
|
||||
nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3) {
|
||||
bone = skeletonBones[bones[v]];
|
||||
vx = weights[b];
|
||||
vy = weights[int(b + 1)];
|
||||
weight = weights[int(b + 2)];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx + x;
|
||||
worldVertices[int(w + 1)] = wy + y;
|
||||
}
|
||||
} else {
|
||||
var ffd:Vector.<Number> = slot.attachmentVertices;
|
||||
for (; v < n; w += 2) {
|
||||
wx = 0;
|
||||
wy = 0;
|
||||
nn = bones[v++] + v;
|
||||
for (; v < nn; v++, b += 3, f += 2) {
|
||||
bone = skeletonBones[bones[v]];
|
||||
vx = weights[b] + ffd[f];
|
||||
vy = weights[int(b + 1)] + ffd[int(f + 1)];
|
||||
weight = weights[int(b + 2)];
|
||||
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
|
||||
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
|
||||
}
|
||||
worldVertices[w] = wx + x;
|
||||
worldVertices[int(w + 1)] = wy + y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function applyFFD (sourceAttachment:Attachment) : Boolean {
|
||||
return this == sourceAttachment || (inheritFFD && _parentMesh == sourceAttachment);
|
||||
}
|
||||
|
||||
public function get parentMesh () : WeightedMeshAttachment {
|
||||
return _parentMesh;
|
||||
}
|
||||
|
||||
public function set parentMesh (parentMesh:WeightedMeshAttachment) : void {
|
||||
_parentMesh = parentMesh;
|
||||
if (parentMesh != null) {
|
||||
bones = parentMesh.bones;
|
||||
weights = parentMesh.weights;
|
||||
regionUVs = parentMesh.regionUVs;
|
||||
triangles = parentMesh.triangles;
|
||||
hullLength = parentMesh.hullLength;
|
||||
edges = parentMesh.edges;
|
||||
width = parentMesh.width;
|
||||
height = parentMesh.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
# spine-starling
|
||||
|
||||
The spine-starling runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Starling](http://gamua.com/starling/). spine-starling is based on [spine-as3](https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-as3).
|
||||
The spine-starling runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Starling 2.0](http://gamua.com/starling/). spine-starling is based on [spine-as3](https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-as3).
|
||||
|
||||
## Licensing
|
||||
|
||||
@ -10,18 +10,34 @@ The Spine Runtimes are developed with the intent to be used with data exported f
|
||||
|
||||
## Spine version
|
||||
|
||||
spine-starling works with data exported from Spine 3.1.08. Updating spine-starling to [v3.2](https://github.com/EsotericSoftware/spine-runtimes/issues/586) and [v3.3](https://github.com/EsotericSoftware/spine-runtimes/issues/613) is in progress.
|
||||
spine-starling works with data exported from the latest Spine version.
|
||||
|
||||
spine-starling supports all Spine features.
|
||||
|
||||
spine-starling does not yet support loading the binary format.
|
||||
|
||||
## Setup
|
||||
# Usage
|
||||
1. Create a new Starling 2.0 project as per the [documentation].
|
||||
2. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip).
|
||||
3. Copy the sources in `spine-as3/spine-as3/src/` and `spine-starling/spine-starling/src/` into your project's source directory
|
||||
|
||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip](https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip).
|
||||
1. Using [FDT](http://fdt.powerflasher.com/), import the spine-as3 and spine-starling projects by choosing File -> Import -> Existing projects. For other IDEs you will need to create new projects and import the source.
|
||||
## Example
|
||||
The Spine AS3 example works on Windows, Linux and Mac OS X. This guide assumes you are using [FDT Free](http://fdt.powerflasher.com/) as your development environment.
|
||||
|
||||
Alternatively, the contents of the `spine-as3/src` and `spine-starling/src` directories can be copied into your project.
|
||||
1. Download [FDT free](http://fdt.powerflasher.com/buy-download/) for your operating system.
|
||||
3. Download and install Adobe Flash Player 22 with debugging support](https://www.adobe.com/support/flashplayer/debug_downloads.html#fp15)
|
||||
2. Download the latest [Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html). We assume it will be installed to some folder on your disk called `flex_sdk`.
|
||||
3. Download the latest [Adobe AIR SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)
|
||||
4. Extract the AIR SDK contents, and copy them to your `flex_sdk` folder. This will replace the Adobe AIR version shipped with Flex.
|
||||
5. Open FDT, go to `Preferences -> FDT -> Installed SDKs`
|
||||
6. Click `Add` and browse to `flex_sdk`
|
||||
7. Go to `File -> Import -> General -> Existing Projects into Workspace`
|
||||
6. Browse to `spine-as3/`. You should see both the `spine-as3` and `spine-as3-example` project in the import dialog. Click `Finish`
|
||||
7. Go to `File -> Import -> General -> Existing Projects into Workspace`
|
||||
6. Browse to `spine-starling/`. You should see both the `spine-starling` and `spine-starling-example` project in the import dialog. Click `Finish`
|
||||
8. Right click the `Main.as` file in `spine-starling-example/src/spine` in the FDT explorer and select `Debug As -> FDT SWF Application`
|
||||
|
||||
**Note**: FDT Free does not allow project dependencies. If you modify the sources of `spine-as3` or `spine-starling`, you will have to compile the project to an `.swc` and place it in `spine-starling-example/libs`.
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<AS3LibraryFolder>lib</AS3LibraryFolder>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.0.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-1.7.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
@ -3,6 +3,7 @@ com.powerflasher.fdt.core.CompilerArguments=-static-link-runtime-shared-librarie
|
||||
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.IncludeTestResources=false
|
||||
com.powerflasher.fdt.core.Language=AS3
|
||||
com.powerflasher.fdt.core.Manifests=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -13,7 +14,7 @@ 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.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.SdkName=Flex 4.6.0
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
//lib/starling-2.0.1.swc=/Applications/flash/starling/src
|
||||
eclipse.preferences.version=1
|
||||
@ -8,12 +8,15 @@
|
||||
<stringAttribute key="APP_ARGUMENTS" value=""/>
|
||||
<stringAttribute key="ARGUMENTS" value="-static-link-runtime-shared-libraries=true -target-player={playerVersion} -library-path+="{flexSDK}/frameworks/locale/en_US" -default-size=550,400"/>
|
||||
<listAttribute key="COMPILER_CONSTANTS"/>
|
||||
<stringAttribute key="COMPILER_TECHNOLOGY" value="Flex SDK"/>
|
||||
<stringAttribute key="COMPILER_TECHNOLOGY" value="ASC"/>
|
||||
<booleanAttribute key="DISABLE_COMPILE_PROCESS" value="false"/>
|
||||
<booleanAttribute key="FORCE_FRESH_COMPILATION" value="false"/>
|
||||
<booleanAttribute key="FORCE_INCLUDE_TEST_RESOURCES" value="false"/>
|
||||
<booleanAttribute key="IGNORE_SWF_LOCATION_PROBLEM" value="false"/>
|
||||
<booleanAttribute key="INCLUDE_TEST_RESOURCES" value="false"/>
|
||||
<booleanAttribute key="KILL_PREVIOUS_VIEWER" value="true"/>
|
||||
<stringAttribute key="LAUNCHER_DEPENDENCIES" value="[Self]"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/Main.as"/>
|
||||
<stringAttribute key="MAIN_CLASS" value="src/spine/examples/Main.as"/>
|
||||
<stringAttribute key="MOBILE_PRESET" value=""/>
|
||||
<booleanAttribute key="NEW_WINDOW_EACH_LAUNCH" value="false"/>
|
||||
<stringAttribute key="OUTPUT" value="bin/spine-starling-example.swf"/>
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/spine/examples/TankExample.as=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
||||
BIN
spine-starling/spine-starling-example/lib/starling-2.0.1.swc
Normal file
@ -1,5 +1,6 @@
|
||||
|
||||
goblins-mesh.png
|
||||
goblins.png
|
||||
size: 1024,128
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
|
||||
@ -1,26 +1,27 @@
|
||||
{
|
||||
"skeleton": { "hash": "P7CQ4ImK+tcAICATgSttlZ5HOSM", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "root" },
|
||||
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
|
||||
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
|
||||
{ "name": "torso", "parent": "hip", "length": 85.82, "rotation": 93.92, "x": -6.42, "y": 1.97 },
|
||||
{ "name": "neck", "parent": "torso", "length": 18.38, "rotation": -1.51, "x": 81.67, "y": -6.34 },
|
||||
{ "name": "head", "parent": "neck", "length": 68.28, "rotation": -13.92, "x": 20.93, "y": 11.59 },
|
||||
{ "name": "left shoulder", "parent": "torso", "length": 35.43, "rotation": -156.96, "x": 74.04, "y": -20.38 },
|
||||
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "rotation": 28.16, "x": 37.85, "y": -2.34 },
|
||||
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "rotation": -89.09, "x": 14.45, "y": 2.81 },
|
||||
{ "name": "left lower leg", "parent": "left upper leg", "length": 49.89, "rotation": -16.65, "x": 56.34, "y": 0.98 },
|
||||
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "rotation": 102.43, "x": 58.94, "y": -7.61 },
|
||||
{ "name": "left hand", "parent": "left arm", "length": 11.52, "rotation": 2.7, "x": 35.62, "y": 0.07 },
|
||||
{ "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 },
|
||||
{ "name": "right upper leg", "parent": "hip", "length": 42.45, "x": -20.07, "y": -6.83, "rotation": -97.49 },
|
||||
{ "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 93.92 },
|
||||
{ "name": "left lower leg", "parent": "left upper leg", "length": 49.89, "x": 56.34, "y": 0.98, "rotation": -16.65 },
|
||||
{ "name": "left shoulder", "parent": "torso", "length": 35.43, "x": 74.04, "y": -20.38, "rotation": -156.96 },
|
||||
{ "name": "neck", "parent": "torso", "length": 18.38, "x": 81.67, "y": -6.34, "rotation": -1.51 },
|
||||
{ "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 42.99, "y": -0.61, "rotation": -14.34 },
|
||||
{ "name": "right shoulder", "parent": "torso", "length": 37.24, "x": 76.02, "y": 18.14, "rotation": 133.88 },
|
||||
{ "name": "head", "parent": "neck", "length": 68.28, "x": 20.93, "y": 11.59, "rotation": -13.92 },
|
||||
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 37.85, "y": -2.34, "rotation": 28.16 },
|
||||
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 58.94, "y": -7.61, "rotation": 102.43 },
|
||||
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 37.6, "y": 0.31, "rotation": 36.32 },
|
||||
{ "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
|
||||
{ "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
|
||||
{ "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
|
||||
{ "name": "spear1", "parent": "left hand", "length": 65.06, "x": 0.48, "y": 17.03, "rotation": 102.43 },
|
||||
{ "name": "spear2", "parent": "spear1", "length": 61.41, "x": 65.05, "y": 0.04, "rotation": 0.9 },
|
||||
{ "name": "spear3", "parent": "spear2", "length": 76.79, "x": 61.88, "y": 0.57, "rotation": -0.9 }
|
||||
{ "name": "right shoulder", "parent": "torso", "length": 37.24, "rotation": 133.88, "x": 76.02, "y": 18.14 },
|
||||
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "rotation": 36.32, "x": 37.6, "y": 0.31 },
|
||||
{ "name": "right upper leg", "parent": "hip", "length": 42.45, "rotation": -97.49, "x": -20.07, "y": -6.83 },
|
||||
{ "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "rotation": -14.34, "x": 42.99, "y": -0.61 },
|
||||
{ "name": "right foot", "parent": "right lower leg", "length": 45.45, "rotation": 110.3, "x": 64.88, "y": 0.04 },
|
||||
{ "name": "right hand", "parent": "right arm", "length": 15.32, "rotation": 2.35, "x": 36.9, "y": 0.34 },
|
||||
{ "name": "spear1", "parent": "left hand", "length": 65.06, "rotation": 102.43, "x": 0.48, "y": 17.03 },
|
||||
{ "name": "spear2", "parent": "spear1", "length": 61.41, "rotation": 0.9, "x": 65.05, "y": 0.04 },
|
||||
{ "name": "spear3", "parent": "spear2", "length": 76.79, "rotation": -0.9, "x": 61.88, "y": 0.57 }
|
||||
],
|
||||
"slots": [
|
||||
{ "name": "left shoulder", "bone": "left shoulder", "attachment": "left shoulder" },
|
||||
@ -52,12 +53,12 @@
|
||||
"left hand item": {
|
||||
"dagger": { "x": 7.88, "y": -23.45, "rotation": 10.47, "width": 26, "height": 108 },
|
||||
"spear": {
|
||||
"type": "skinnedmesh",
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.11236, 0.77096, 0.13278, 0.76608, 0.21781, 0.75642, 0.386, 0.74723, 0.54607, 0.72117, 1, 0.28838, 1, 0.24208, 0.54327, 0.22589, 0.38361, 0.2089, 0.21605, 0.20043, 0.13242, 0, 0.11519, 0.4527, 0, 0.58399, 0 ],
|
||||
"triangles": [ 4, 7, 3, 6, 7, 4, 5, 6, 4, 10, 11, 12, 1, 13, 0, 12, 13, 1, 10, 12, 1, 9, 10, 1, 2, 9, 1, 8, 9, 2, 3, 8, 2, 7, 8, 3 ],
|
||||
"vertices": [ 1, 20, 38.54, -10.88, 1, 1, 20, 30.97, -5.93, 1, 2, 19, 61.48, -5.58, 0.51, 20, -0.31, -6.16, 0.48, 2, 18, 64.73, -5.03, 0.5, 19, -0.4, -5.06, 0.49, 1, 16, 4.56, 23.91, 1, 1, 16, 41.7, -138.95, 1, 1, 16, 32.42, -141.1, 1, 1, 16, -6.49, 22.4, 1, 2, 18, 65.48, 6.64, 0.5, 19, 0.53, 6.59, 0.49, 2, 19, 62.18, 6.66, 0.51, 20, 0.2, 6.09, 0.48, 1, 20, 30.96, 6.61, 1, 1, 20, 37.26, 11.09, 1, 1, 20, 79.75, 1.59, 1, 1, 20, 79.78, -1.29, 1 ],
|
||||
"edges": [ 24, 22, 22, 20, 10, 12, 2, 0, 24, 26, 0, 26, 8, 10, 12, 14, 6, 8, 14, 16, 2, 4, 4, 6, 16, 18, 18, 20, 20, 2 ],
|
||||
"vertices": [ 1, 20, 38.54, -10.88, 1, 1, 20, 30.97, -5.93, 1, 2, 19, 61.48, -5.58, 0.5116, 20, -0.31, -6.16, 0.48839, 2, 18, 64.73, -5.03, 0.50272, 19, -0.4, -5.06, 0.49728, 1, 10, 4.56, 23.91, 1, 1, 10, 41.7, -138.95, 1, 1, 10, 32.41999, -141.1, 1, 1, 10, -6.49, 22.4, 1, 2, 18, 65.48, 6.64, 0.50272, 19, 0.52999, 6.59, 0.49728, 2, 19, 62.18, 6.66, 0.5116, 20, 0.2, 6.09, 0.48839, 1, 20, 30.96, 6.61, 1, 1, 20, 37.25999, 11.09, 1, 1, 20, 79.75, 1.59, 1, 1, 20, 79.78, -1.29, 1 ],
|
||||
"hull": 14,
|
||||
"edges": [ 24, 22, 22, 20, 10, 12, 2, 0, 24, 26, 0, 26, 8, 10, 12, 14, 6, 8, 14, 16, 2, 4, 4, 6, 16, 18, 18, 20, 20, 2 ],
|
||||
"width": 22,
|
||||
"height": 368
|
||||
}
|
||||
@ -66,10 +67,10 @@
|
||||
"dagger": {
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.78091, 0.38453, 1, 0.38405, 1, 0.44881, 0.73953, 0.4687, 0.74641, 0.81344, 0.34022, 1, 0.15434, 1, 0.11303, 0.78858, 0.23007, 0.47367, 0, 0.45047, 0, 0.38621, 0.22367, 0.38573, 0.24384, 0, 1, 0 ],
|
||||
"triangles": [ 5, 7, 8, 4, 8, 3, 4, 5, 8, 5, 6, 7, 9, 11, 8, 8, 11, 3, 3, 0, 2, 3, 11, 0, 9, 10, 11, 0, 1, 2, 11, 12, 0, 0, 12, 13 ],
|
||||
"triangles": [ 0, 12, 13, 11, 12, 0, 0, 1, 2, 9, 10, 11, 3, 11, 0, 3, 0, 2, 8, 11, 3, 9, 11, 8, 5, 6, 7, 4, 5, 8, 4, 8, 3, 5, 7, 8 ],
|
||||
"vertices": [ 15.49, -12.82, 21.13, -13.57, 20.16, -20.49, 13.15, -21.67, 8.13, -58.56, -5.13, -77.04, -9.92, -76.36, -7.79, -53.6, -0.03, -20.36, -5.6, -17.04, -4.63, -10.17, 1.12, -10.93, 7.46, 30.24, 26.93, 27.49 ],
|
||||
"edges": [ 22, 20, 24, 26, 22, 24, 2, 0, 0, 22, 0, 26, 12, 14, 14, 16, 18, 20, 16, 18, 2, 4, 4, 6, 6, 8, 10, 12, 8, 10 ],
|
||||
"hull": 14,
|
||||
"edges": [ 22, 20, 24, 26, 22, 24, 2, 0, 0, 22, 0, 26, 12, 14, 14, 16, 18, 20, 16, 18, 2, 4, 4, 6, 6, 8, 10, 12, 8, 10 ],
|
||||
"width": 26,
|
||||
"height": 108
|
||||
}
|
||||
@ -88,9 +89,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 0, 0.60494, 0.14172, 0.5145, 0.24218, 0.55229, 0.32667, 0.67806, 0.37969, 0.79352, 0.53505, 0.93014, 0.86056, 1, 0.94071, 0.94169, 0.92098, 0.69923, 0.9888, 0.65497, 0.99003, 0.51643, 0.89632, 0.43561, 0.94487, 0.41916, 1, 0.39713, 1, 0.2836, 0.94017, 0.27027, 0.87906, 0.25666, 0.80754, 0.16044, 0.66698, 0.01997, 0.4734, 0.01805, 0.29215, 0.19893, 0.25392, 0.31823, 0.09117, 0.324, 0, 0.44331, 0.43271, 0.69153, 0.466, 0.47794, 0.35996, 0.31246, 0.73473, 0.68593, 0.72215, 0.57425, 0.88179, 0.5583, 0.80267, 0.51015 ],
|
||||
"triangles": [ 5, 27, 6, 7, 27, 8, 7, 6, 27, 4, 24, 5, 5, 24, 27, 4, 3, 24, 27, 29, 8, 8, 29, 9, 24, 28, 27, 24, 25, 28, 24, 3, 25, 29, 28, 30, 29, 27, 28, 25, 2, 26, 25, 3, 2, 9, 29, 10, 0, 23, 1, 28, 25, 30, 29, 11, 10, 29, 30, 11, 2, 21, 26, 2, 1, 21, 23, 22, 1, 1, 22, 21, 30, 16, 11, 30, 17, 16, 30, 25, 17, 17, 26, 18, 18, 26, 19, 26, 17, 25, 11, 15, 12, 11, 16, 15, 12, 15, 13, 15, 14, 13, 21, 20, 26, 26, 20, 19 ],
|
||||
"vertices": [ 14.56, 50.42, 23.12, 35.47, 17.46, 26.36, 11.57, 16.86, 3.74, 11.71, -5.89, -3.91, -11.83, -37.23, -8.31, -45.63, 7.75, -44.24, 10.39, -51.33, 19.52, -51.82, 25.21, -43.15, 26.12, -47.43, 27.35, -53.16, 34.84, -53.46, 35.96, -47.33, 37.11, -41.08, 43.75, -33.97, 53.58, -19.87, 54.5, 0.03, 43.31, 19.16, 35.6, 23.41, 35.89, 40.17, 28.39, 49.87, 10.25, 5.99, 24.2, 2, 35.55, 12.48, 9.39, -25.1, 16.8, -24.31, 17.2, -40.65, 20.68, -33.02 ],
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 26, 28, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 0, 46, 6, 48, 48, 50, 50, 52, 52, 42, 2, 4, 4, 6, 4, 52, 2, 44, 22, 32, 22, 24, 24, 26, 28, 30, 30, 32, 24, 30, 16, 54, 54, 56, 20, 58, 58, 54, 16, 58, 22, 60, 60, 56, 58, 60 ],
|
||||
"vertices": [ 14.56, 50.42, 23.12, 35.47, 17.45999, 26.36, 11.57, 16.86, 3.74, 11.71, -5.89, -3.91, -11.83, -37.23, -8.31, -45.63, 7.75, -44.24, 10.39, -51.33, 19.52, -51.82, 25.21, -43.15, 26.12, -47.43, 27.35, -53.16, 34.84, -53.46, 35.96, -47.33, 37.11, -41.08, 43.75, -33.97, 53.58, -19.87, 54.5, 0.03, 43.31, 19.16, 35.59999, 23.41, 35.89, 40.16999, 28.39, 49.87, 10.25, 5.99, 24.2, 2, 35.55, 12.48, 9.39, -25.1, 16.79999, -24.31, 17.2, -40.65, 20.68, -33.02 ],
|
||||
"hull": 24,
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 26, 28, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 0, 46, 6, 48, 48, 50, 50, 52, 52, 42, 2, 4, 4, 6, 4, 52, 2, 44, 22, 32, 22, 24, 24, 26, 28, 30, 30, 32, 24, 30, 16, 54, 54, 56, 20, 58, 58, 54, 16, 58, 22, 60, 60, 56, 58, 60 ],
|
||||
"width": 103,
|
||||
"height": 66
|
||||
}
|
||||
@ -101,9 +102,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.68992, 0.29284, 1, 0.46364, 1, 0.74643, 0.84089, 1, 0.66344, 1, 0.33765, 0.64284, 0, 0.44124, 0, 0, 0.34295, 0 ],
|
||||
"triangles": [ 3, 4, 2, 4, 5, 2, 5, 0, 2, 0, 1, 2, 0, 5, 8, 5, 6, 8, 6, 7, 8 ],
|
||||
"vertices": [ 18.6, 8.81, 32.19, 10.31, 38.02, 1.62, 38.08, -9.63, 32.31, -13.49, 14.37, -9.62, -0.75, -10.78, -9.84, 2.77, 1.29, 10.25 ],
|
||||
"edges": [ 14, 16, 16, 0, 0, 2, 2, 4, 6, 4, 6, 8, 8, 10, 12, 14, 10, 12 ],
|
||||
"vertices": [ 18.6, 8.81, 32.18999, 10.31, 38.02, 1.62, 38.08, -9.63, 32.31, -13.49, 14.37, -9.62, -0.75, -10.78, -9.84, 2.77, 1.29, 10.25 ],
|
||||
"hull": 9,
|
||||
"edges": [ 14, 16, 16, 0, 0, 2, 2, 4, 6, 4, 6, 8, 8, 10, 12, 14, 10, 12 ],
|
||||
"width": 37,
|
||||
"height": 35
|
||||
}
|
||||
@ -113,10 +114,10 @@
|
||||
"name": "goblin/left-foot",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.15733, 0.31873, 0.08195, 0.78502, 0.15884, 0.99366, 0.41633, 0.96804, 0.68822, 0.97636, 1, 0.96388, 0.99385, 0.73501, 0.85294, 0.51862, 0.61479, 0.31056, 0.46991, 0, 0.48032, 0.75604, 0.75994, 0.77706 ],
|
||||
"triangles": [ 2, 1, 3, 3, 10, 4, 4, 11, 5, 4, 10, 11, 3, 1, 10, 11, 6, 5, 1, 0, 10, 11, 7, 6, 11, 10, 7, 10, 8, 7, 10, 0, 8, 0, 9, 8 ],
|
||||
"triangles": [ 0, 9, 8, 10, 0, 8, 10, 8, 7, 11, 10, 7, 11, 7, 6, 1, 0, 10, 11, 6, 5, 3, 1, 10, 4, 10, 11, 4, 11, 5, 3, 10, 4, 2, 1, 3 ],
|
||||
"vertices": [ 2.28, 13.07, -1.76, -1.64, 3.59, -7.8, 20.25, -6.04, 37.91, -5.27, 58.12, -3.71, 57.31, 3.34, 47.78, 9.51, 31.95, 15.05, 21.99, 24.11, 24.03, 0.75, 42.21, 1.16 ],
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18, 6, 20, 20, 16, 2, 20, 8, 22, 22, 14, 20, 22, 22, 10 ],
|
||||
"hull": 10,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18, 6, 20, 20, 16, 2, 20, 8, 22, 22, 14, 20, 22, 22, 10 ],
|
||||
"width": 65,
|
||||
"height": 31
|
||||
}
|
||||
@ -126,10 +127,10 @@
|
||||
"name": "goblin/left-hand",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.518, 0.12578, 1, 0.16285, 0.99788, 0.50578, 0.69745, 1, 0.37445, 1, 0, 0.80051, 0, 0.42792, 0.17601, 0, 0.43567, 0 ],
|
||||
"triangles": [ 2, 3, 0, 4, 5, 0, 3, 4, 0, 0, 7, 8, 6, 7, 0, 0, 5, 6, 2, 0, 1 ],
|
||||
"vertices": [ -3.11, 15.42, 10.83, 22.27, 15.5, 14.55, 18.35, -8.96, 9.48, -14.32, -4.58, -14.3, -11.63, -2.63, -14.89, 13.68, -7.75, 17.99 ],
|
||||
"edges": [ 16, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 14, 16, 12, 14 ],
|
||||
"triangles": [ 2, 0, 1, 0, 5, 6, 6, 7, 0, 0, 7, 8, 3, 4, 0, 4, 5, 0, 2, 3, 0 ],
|
||||
"vertices": [ -3.11, 15.42, 10.83, 22.27, 15.5, 14.55, 18.35, -8.96, 9.47999, -14.32, -4.58, -14.3, -11.63, -2.63, -14.89, 13.68, -7.75, 17.99 ],
|
||||
"hull": 9,
|
||||
"edges": [ 16, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 14, 16, 12, 14 ],
|
||||
"width": 36,
|
||||
"height": 41
|
||||
}
|
||||
@ -139,10 +140,10 @@
|
||||
"name": "goblin/left-lower-leg",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.95508, 0.20749, 0.81927, 0.65213, 0.94754, 0.77308, 0.67842, 0.97346, 0.46463, 1, 0.26845, 1, 0.04963, 0.90706, 0.2106, 0.60115, 0.07478, 0.40195, 0.18545, 0, 0.28857, 0 ],
|
||||
"triangles": [ 1, 3, 4, 7, 4, 5, 5, 6, 7, 3, 1, 2, 1, 4, 7, 0, 1, 10, 7, 8, 10, 1, 7, 10, 10, 8, 9 ],
|
||||
"vertices": [ -0.19, 6.82, 30.97, 10.96, 37.97, 17.33, 53.88, 12.6, 57.58, 6.31, 59.34, 0.08, 55.04, -8.63, 32.99, -9.33, 20.79, -17.43, -7.27, -21.56, -8.19, -18.29 ],
|
||||
"edges": [ 20, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 18, 20, 16, 18 ],
|
||||
"triangles": [ 10, 8, 9, 1, 7, 10, 7, 8, 10, 0, 1, 10, 1, 4, 7, 3, 1, 2, 5, 6, 7, 7, 4, 5, 1, 3, 4 ],
|
||||
"vertices": [ -0.19, 6.82, 30.97, 10.96, 37.97, 17.33, 53.88, 12.6, 57.58, 6.31, 59.34, 0.08, 55.04, -8.63, 32.99, -9.33, 20.79, -17.43, -7.27, -21.56, -8.18999, -18.29 ],
|
||||
"hull": 11,
|
||||
"edges": [ 20, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 18, 20, 16, 18 ],
|
||||
"width": 33,
|
||||
"height": 70
|
||||
}
|
||||
@ -153,9 +154,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.7377, 0.40692, 1, 0.75237, 1, 1, 0.62046, 1, 0.26184, 0.56601, 0, 0.29783, 0, 0, 0.44115, 0 ],
|
||||
"triangles": [ 3, 1, 2, 3, 0, 1, 3, 4, 0, 4, 7, 0, 4, 5, 7, 5, 6, 7 ],
|
||||
"vertices": [ 15.18, 5.74, 32.17, 5.32, 41.79, 0.21, 36.63, -9.5, 14.88, -9.72, 0.9, -10.89, -10.66, -4.74, -4.66, 6.54 ],
|
||||
"edges": [ 12, 14, 14, 0, 4, 2, 0, 2, 4, 6, 6, 8, 10, 12, 8, 10 ],
|
||||
"vertices": [ 15.18, 5.74, 32.16999, 5.32, 41.79, 0.21, 36.63, -9.5, 14.88, -9.72, 0.9, -10.89, -10.66, -4.73999, -4.66, 6.54 ],
|
||||
"hull": 8,
|
||||
"edges": [ 12, 14, 14, 0, 4, 2, 0, 2, 4, 6, 6, 8, 10, 12, 8, 10 ],
|
||||
"width": 29,
|
||||
"height": 44
|
||||
}
|
||||
@ -165,10 +166,10 @@
|
||||
"name": "goblin/left-upper-leg",
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.12167, 1, 0.54873, 0.91067, 0.78907, 0.76567, 1, 0.3087, 0.9579, 0, 0.68777, 0, 0.219, 0.51961, 0, 0.87552, 0 ],
|
||||
"triangles": [ 3, 4, 2, 2, 4, 1, 1, 4, 7, 4, 5, 7, 0, 1, 7, 5, 6, 7, 7, 8, 0 ],
|
||||
"triangles": [ 7, 8, 0, 5, 6, 7, 0, 1, 7, 4, 5, 7, 1, 4, 7, 2, 4, 1, 3, 4, 2 ],
|
||||
"vertices": [ 2.33, 13.06, 33.5, 12.57, 51, 9.34, 66.32, 4.31, 63, -10.71, 43.13, -20.58, 8.91, -20.04, -6.79, -2.64, -6.61, 9.1 ],
|
||||
"edges": [ 10, 8, 8, 6, 6, 4, 4, 2, 10, 12, 12, 14, 14, 16, 2, 0, 16, 0 ],
|
||||
"hull": 9,
|
||||
"edges": [ 10, 8, 8, 6, 6, 4, 4, 2, 10, 12, 12, 14, 14, 16, 2, 0, 16, 0 ],
|
||||
"width": 33,
|
||||
"height": 73
|
||||
}
|
||||
@ -179,9 +180,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.81967, 0.27365, 0.92101, 0.82048, 0.47134, 1, 0.15679, 0.9354, 0, 0.7556, 0.19268, 0.51833, 0.15468, 0.35706, 0, 0.21989, 0.13568, 0, 0.68878, 0, 0.70145, 0.53872 ],
|
||||
"triangles": [ 3, 5, 2, 2, 10, 1, 2, 5, 10, 3, 4, 5, 10, 0, 1, 0, 10, 6, 10, 5, 6, 7, 8, 6, 6, 9, 0, 6, 8, 9 ],
|
||||
"vertices": [ 18.62, -11.65, -3.98, -13.85, -10.28, 2.76, -6.91, 13.89, 0.8, 19.05, 10.06, 11.51, 16.74, 12.45, 22.71, 17.64, 31.4, 12.19, 30.12, -7.67, 8.05, -6.71 ],
|
||||
"edges": [ 14, 12, 12, 10, 10, 8, 8, 6, 6, 4, 4, 2, 2, 20, 20, 0, 0, 18, 16, 18, 14, 16, 0, 2 ],
|
||||
"vertices": [ 18.62, -11.65, -3.98, -13.85, -10.28, 2.76, -6.91, 13.89, 0.8, 19.04999, 10.06, 11.51, 16.74, 12.45, 22.71, 17.64, 31.4, 12.19, 30.12, -7.67, 8.05, -6.71 ],
|
||||
"hull": 10,
|
||||
"edges": [ 14, 12, 12, 10, 10, 8, 8, 6, 6, 4, 4, 2, 2, 20, 20, 0, 0, 18, 16, 18, 14, 16, 0, 2 ],
|
||||
"width": 36,
|
||||
"height": 41
|
||||
}
|
||||
@ -191,10 +192,10 @@
|
||||
"name": "goblin/pelvis",
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 1, 0, 1, 0, 0, 1, 0 ],
|
||||
"triangles": [ 1, 3, 0, 1, 2, 3 ],
|
||||
"triangles": [ 1, 2, 3, 1, 3, 0 ],
|
||||
"vertices": [ 25.38, -20.73, -36.61, -20.73, -36.61, 22.26, 25.38, 22.26 ],
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 0, 6 ],
|
||||
"hull": 4,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 0, 6 ],
|
||||
"width": 62,
|
||||
"height": 43
|
||||
}
|
||||
@ -205,9 +206,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.09223, 1, 0.8501, 0.72058, 1, 0.24384, 1, 0, 0.86558, 0.20822, 0.10919, 0.50903, 0, 0.85342, 0 ],
|
||||
"triangles": [ 1, 2, 6, 6, 2, 5, 1, 6, 0, 4, 5, 3, 2, 3, 5, 6, 7, 0 ],
|
||||
"vertices": [ -4.75, 8.89, 33.03, 11.74, 40.99, 5.89, 41.81, -5.03, 35.53, -11.13, -2.53, -9.2, -8.5, -2.71, -9.09, 5.18 ],
|
||||
"edges": [ 8, 6, 4, 6, 4, 2, 12, 14, 2, 0, 14, 0, 10, 12, 8, 10 ],
|
||||
"vertices": [ -4.75, 8.89, 33.03, 11.74, 40.99, 5.89, 41.81, -5.03, 35.53, -11.13, -2.53, -9.2, -8.5, -2.71, -9.09, 5.17999 ],
|
||||
"hull": 8,
|
||||
"edges": [ 8, 6, 4, 6, 4, 2, 12, 14, 2, 0, 14, 0, 10, 12, 8, 10 ],
|
||||
"width": 23,
|
||||
"height": 50
|
||||
}
|
||||
@ -217,10 +218,10 @@
|
||||
"name": "goblin/right-foot",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.40851, 0.0047, 0.59087, 0.33404, 0.75959, 0.48311, 0.88907, 0.59751, 0.97532, 0.89391, 0.90385, 1, 0.6722, 1, 0.38633, 1, 0.08074, 1, 0, 0.88921, 0, 0.65984, 0, 0.46577, 0.0906, 0.0988, 0.305, 0, 0.47461, 0.71257, 0.715, 0.74681 ],
|
||||
"triangles": [ 4, 5, 15, 7, 14, 6, 5, 6, 15, 6, 14, 15, 14, 7, 9, 7, 8, 9, 15, 3, 4, 9, 10, 14, 15, 2, 3, 15, 14, 2, 14, 10, 1, 12, 1, 11, 1, 12, 13, 14, 1, 2, 1, 13, 0, 1, 10, 11 ],
|
||||
"triangles": [ 1, 10, 11, 1, 13, 0, 14, 1, 2, 1, 12, 13, 12, 1, 11, 14, 10, 1, 15, 14, 2, 15, 2, 3, 9, 10, 14, 15, 3, 4, 7, 8, 9, 14, 7, 9, 6, 14, 15, 5, 6, 15, 7, 14, 6, 4, 5, 15 ],
|
||||
"vertices": [ 17.36, 25.99, 29.13, 15.44, 39.89, 10.8, 48.14, 7.24, 53.84, -2.38, 49.43, -6, 34.84, -6.39, 16.84, -6.87, -2.4, -7.38, -7.58, -3.86, -7.78, 3.7, -7.95, 10.1, -2.57, 22.36, 10.84, 25.97, 22.14, 2.75, 37.31, 2.03 ],
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 16, 18, 22, 24, 24, 26, 0, 26, 10, 12, 2, 4, 4, 6, 12, 14, 14, 16, 18, 20, 20, 22, 2, 28, 28, 14, 20, 28, 4, 30, 30, 12, 28, 30, 30, 8 ],
|
||||
"hull": 14,
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 16, 18, 22, 24, 24, 26, 0, 26, 10, 12, 2, 4, 4, 6, 12, 14, 14, 16, 18, 20, 20, 22, 2, 28, 28, 14, 20, 28, 4, 30, 30, 12, 28, 30, 30, 8 ],
|
||||
"width": 63,
|
||||
"height": 33
|
||||
}
|
||||
@ -230,10 +231,10 @@
|
||||
"name": "goblin/right-hand",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.17957, 0, 0, 0.44772, 0, 0.79734, 0.20057, 0.94264, 0.55057, 1, 0.8539, 1, 0.89823, 0.82004, 0.8259, 0.74285, 0.84223, 0.49993, 0.96356, 0.34102, 0.66023, 0 ],
|
||||
"triangles": [ 4, 7, 5, 5, 7, 6, 4, 3, 7, 3, 2, 8, 7, 3, 8, 8, 1, 10, 8, 2, 1, 0, 10, 1, 8, 10, 9 ],
|
||||
"vertices": [ -10.82, -9.45, 5.95, -15.34, 18.88, -14.9, 24, -7.5, 25.69, 5.16, 25.31, 16.07, 18.61, 17.44, 15.84, 14.74, 6.84, 15.02, 0.81, 19.18, -11.41, 7.83 ],
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 0, 20 ],
|
||||
"triangles": [ 8, 10, 9, 0, 10, 1, 8, 2, 1, 8, 1, 10, 7, 3, 8, 3, 2, 8, 4, 3, 7, 5, 7, 6, 4, 7, 5 ],
|
||||
"vertices": [ -10.82, -9.45, 5.95, -15.34, 18.87999, -14.9, 24, -7.5, 25.69, 5.16, 25.31, 16.07, 18.61, 17.44, 15.84, 14.74, 6.84, 15.02, 0.81, 19.18, -11.41, 7.83 ],
|
||||
"hull": 11,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 0, 20 ],
|
||||
"width": 36,
|
||||
"height": 37
|
||||
}
|
||||
@ -243,10 +244,10 @@
|
||||
"name": "goblin/right-hand",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.88538, 0.22262, 0.76167, 0.3594, 0.75088, 0.78308, 0.95326, 0.84981, 1, 0.60302 ],
|
||||
"triangles": [ 3, 2, 4, 2, 1, 4, 1, 0, 4 ],
|
||||
"triangles": [ 1, 0, 4, 2, 1, 4, 3, 2, 4 ],
|
||||
"vertices": [ -2.82, 15.97, 2.4, 11.71, 18.08, 11.9, 20.27, 19.27, 11.09, 20.62 ],
|
||||
"edges": [ 2, 4, 4, 6, 6, 8, 2, 0, 0, 8 ],
|
||||
"hull": 5,
|
||||
"edges": [ 2, 4, 4, 6, 6, 8, 2, 0, 0, 8 ],
|
||||
"width": 36,
|
||||
"height": 37
|
||||
}
|
||||
@ -256,10 +257,10 @@
|
||||
"name": "goblin/right-lower-leg",
|
||||
"type": "mesh",
|
||||
"uvs": [ 1, 0.27261, 0.81312, 0.52592, 0.79587, 0.71795, 0.95544, 0.80988, 0.85193, 0.95493, 0.47241, 1, 0.14033, 1, 0, 0.8773, 0.14896, 0.67914, 0.1619, 0.30325, 0.60611, 0 ],
|
||||
"triangles": [ 4, 5, 2, 2, 5, 8, 5, 6, 8, 6, 7, 8, 4, 2, 3, 2, 8, 1, 8, 9, 1, 9, 10, 1, 1, 10, 0 ],
|
||||
"vertices": [ 6.26, 8.46, 23.32, 8.04, 37.1, 12.89, 41.45, 20.82, 53.07, 21.46, 61.33, 10.06, 65.77, -1.03, 58.99, -9.19, 43.02, -9.81, 16.33, -20, -12.79, -9.26 ],
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 20, 18, 20 ],
|
||||
"triangles": [ 1, 10, 0, 9, 10, 1, 8, 9, 1, 2, 8, 1, 4, 2, 3, 6, 7, 8, 5, 6, 8, 2, 5, 8, 4, 5, 2 ],
|
||||
"vertices": [ 6.26, 8.46, 23.32, 8.04, 37.09999, 12.89, 41.45, 20.82, 53.07, 21.46, 61.33, 10.06, 65.76999, -1.03, 58.99, -9.18999, 43.02, -9.81, 16.33, -20, -12.79, -9.26 ],
|
||||
"hull": 11,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 20, 18, 20 ],
|
||||
"width": 36,
|
||||
"height": 76
|
||||
}
|
||||
@ -271,8 +272,8 @@
|
||||
"uvs": [ 0.62008, 0.03708, 0.92131, 0.09048, 1, 0.38319, 0.72049, 0.6937, 0.31656, 1, 0, 1, 0, 0.75106, 0.28233, 0.49988 ],
|
||||
"triangles": [ 4, 6, 7, 4, 7, 3, 4, 5, 6, 7, 0, 3, 2, 0, 1, 2, 3, 0 ],
|
||||
"vertices": [ -3.17, -11.05, -9, -0.57, -1.01, 10.33, 16.69, 11.17, 37.41, 8.2, 45.45, -1.16, 36.95, -8.46, 21.2, -7.47 ],
|
||||
"edges": [ 10, 12, 12, 14, 14, 0, 0, 2, 2, 4, 4, 6, 8, 10, 6, 8 ],
|
||||
"hull": 8,
|
||||
"edges": [ 10, 12, 12, 14, 14, 0, 0, 2, 2, 4, 4, 6, 8, 10, 6, 8 ],
|
||||
"width": 39,
|
||||
"height": 45
|
||||
}
|
||||
@ -282,10 +283,10 @@
|
||||
"name": "goblin/right-upper-leg",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.27018, 0, 0.11618, 0.18177, 0, 0.70688, 0, 0.89577, 0.26668, 1, 0.48718, 1, 0.67618, 0.83532, 1, 0.5161, 1, 0.25543, 0.74618, 0.0571 ],
|
||||
"triangles": [ 5, 4, 6, 6, 4, 2, 4, 3, 2, 2, 1, 6, 6, 1, 9, 6, 9, 7, 9, 1, 0, 9, 8, 7 ],
|
||||
"vertices": [ -9.85, -10.37, 2.17, -14.07, 35.49, -13.66, 47.29, -12.11, 52.61, -2.26, 51.63, 5.16, 40.51, 10.18, 19.13, 18.47, 2.85, 16.32, -8.4, 6.14 ],
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18 ],
|
||||
"triangles": [ 9, 8, 7, 9, 1, 0, 6, 9, 7, 6, 1, 9, 2, 1, 6, 4, 3, 2, 6, 4, 2, 5, 4, 6 ],
|
||||
"vertices": [ -9.85, -10.37, 2.17, -14.07, 35.49, -13.66, 47.29, -12.11, 52.61, -2.26, 51.63, 5.16, 40.50999, 10.18, 19.12999, 18.46999, 2.85, 16.32, -8.39999, 6.14 ],
|
||||
"hull": 10,
|
||||
"edges": [ 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18 ],
|
||||
"width": 34,
|
||||
"height": 63
|
||||
}
|
||||
@ -296,9 +297,9 @@
|
||||
"type": "mesh",
|
||||
"uvs": [ 0, 0.33287, 0.15945, 0.46488, 0.15761, 0.60314, 0.15502, 0.79806, 0.32807, 0.93478, 0.6875, 1, 0.80731, 1, 1, 0.77763, 1, 0.66147, 1, 0.56703, 0.93207, 0.4771, 0.86944, 0.39416, 0.83837, 0.226, 0.68085, 0, 0.14836, 0, 0, 0.07199, 0.78734, 0.86249, 0.43679, 0.79649, 0.76738, 0.61733, 0.44345, 0.58747, 0.54329, 0.38316, 0.77692, 0.73446, 0.66478, 0.51012 ],
|
||||
"triangles": [ 5, 16, 6, 6, 16, 7, 4, 17, 5, 5, 17, 16, 4, 3, 17, 17, 21, 16, 16, 21, 7, 3, 2, 17, 21, 19, 18, 21, 17, 19, 17, 2, 19, 21, 8, 7, 21, 18, 8, 18, 9, 8, 19, 22, 18, 18, 10, 9, 18, 22, 10, 2, 1, 19, 19, 20, 22, 19, 1, 20, 22, 11, 10, 22, 20, 11, 20, 1, 14, 20, 12, 11, 1, 0, 14, 20, 13, 12, 20, 14, 13, 0, 15, 14 ],
|
||||
"vertices": [ 56.93, 27.95, 43.37, 18.23, 30.16, 19.5, 11.53, 21.28, -2.55, 10.69, -10.89, -13.12, -11.59, -21.23, 8.54, -36.12, 19.65, -37.08, 28.68, -37.86, 37.68, -34, 45.98, -30.44, 56.4, -29.07, 84.78, -20.92, 87.9, 15.15, 81.88, 25.79, 1.67, -21.01, 10.03, 2.18, 25.23, -18.25, 29.98, 0, 48.54, -8.39, 13.98, -21.36, 35.9, -15.6 ],
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 10, 12, 12, 14, 22, 24, 24, 26, 26, 28, 28, 30, 0, 30, 14, 32, 32, 34, 34, 6, 18, 36, 36, 38, 2, 4, 4, 6, 38, 4, 2, 40, 40, 22, 40, 38, 38, 34, 32, 10, 34, 8, 40, 28, 14, 16, 16, 18, 32, 42, 42, 36, 16, 42, 42, 34, 18, 20, 20, 22, 36, 44, 44, 40, 20, 44 ],
|
||||
"vertices": [ 56.93, 27.95, 43.37, 18.23, 30.16, 19.5, 11.53, 21.28, -2.55, 10.69, -10.89, -13.12, -11.59, -21.23, 8.54, -36.12, 19.65, -37.08, 28.68, -37.86, 37.68, -34, 45.98, -30.44, 56.4, -29.07, 84.78, -20.92, 87.9, 15.15, 81.87999, 25.79, 1.67, -21.01, 10.03, 2.18, 25.23, -18.25, 29.98, 0, 48.54, -8.39, 13.98, -21.36, 35.9, -15.6 ],
|
||||
"hull": 16,
|
||||
"edges": [ 0, 2, 6, 8, 8, 10, 10, 12, 12, 14, 22, 24, 24, 26, 26, 28, 28, 30, 0, 30, 14, 32, 32, 34, 34, 6, 18, 36, 36, 38, 2, 4, 4, 6, 38, 4, 2, 40, 40, 22, 40, 38, 38, 34, 32, 10, 34, 8, 40, 28, 14, 16, 16, 18, 32, 42, 42, 36, 16, 42, 42, 34, 18, 20, 20, 22, 36, 44, 44, 40, 20, 44 ],
|
||||
"width": 68,
|
||||
"height": 96
|
||||
}
|
||||
@ -308,10 +309,10 @@
|
||||
"name": "goblin/undie-straps",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0.36097, 0.44959, 0.66297, 0.60591, 1, 0.19486, 1, 0.57117, 0.75897, 1, 0.38697, 1, 0, 0.26433, 0, 0, 0.12497, 0 ],
|
||||
"triangles": [ 5, 1, 4, 4, 1, 3, 6, 0, 5, 5, 0, 1, 3, 1, 2, 6, 8, 0, 6, 7, 8 ],
|
||||
"vertices": [ -10.56, 12.87, 6.53, 9.9, 25.62, 17.71, 25.62, 10.56, 11.97, 2.41, -9.09, 2.41, -31, 16.39, -31, 21.41, -23.92, 21.41 ],
|
||||
"edges": [ 14, 16, 16, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 12, 14, 10, 12, 0, 10, 2, 8 ],
|
||||
"triangles": [ 6, 7, 8, 6, 8, 0, 3, 1, 2, 5, 0, 1, 6, 0, 5, 4, 1, 3, 5, 1, 4 ],
|
||||
"vertices": [ -10.56, 12.87, 6.53, 9.89999, 25.62, 17.70999, 25.62, 10.56, 11.97, 2.41, -9.09, 2.41, -31, 16.39, -31, 21.41, -23.92, 21.41 ],
|
||||
"hull": 9,
|
||||
"edges": [ 14, 16, 16, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 12, 14, 10, 12, 0, 10, 2, 8 ],
|
||||
"width": 55,
|
||||
"height": 19
|
||||
}
|
||||
@ -321,10 +322,10 @@
|
||||
"name": "goblin/undies",
|
||||
"type": "mesh",
|
||||
"uvs": [ 0, 0.32029, 0.14893, 0.59457, 0.22437, 1, 0.35909, 1, 0.50998, 1, 0.79559, 0.58453, 0.9842, 0.28015, 1, 0.00588, 0.46957, 0.17646, 0, 0.03933, 0.48843, 0.59122, 0.48114, 0.43099 ],
|
||||
"triangles": [ 3, 10, 4, 4, 10, 5, 10, 3, 1, 3, 2, 1, 1, 11, 10, 1, 0, 11, 10, 11, 5, 5, 11, 6, 0, 8, 11, 11, 8, 6, 0, 9, 8, 6, 8, 7 ],
|
||||
"vertices": [ -13.22, 5.56, -8, -2.47, -5.49, -14.27, -0.64, -14.36, 4.78, -14.45, 15.27, -2.59, 22.22, 6.11, 22.92, 14.05, 3.75, 9.44, -13.08, 13.71, 4.21, -2.59, 4.03, 2.05 ],
|
||||
"edges": [ 0, 2, 2, 4, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18, 4, 6, 6, 8, 6, 20, 16, 22, 22, 20, 0, 22, 22, 12, 2, 20, 20, 10 ],
|
||||
"triangles": [ 6, 8, 7, 0, 9, 8, 11, 8, 6, 0, 8, 11, 5, 11, 6, 10, 11, 5, 1, 0, 11, 1, 11, 10, 3, 2, 1, 10, 3, 1, 4, 10, 5, 3, 10, 4 ],
|
||||
"vertices": [ -13.22, 5.56, -8, -2.47, -5.49, -14.27, -0.64, -14.36, 4.78, -14.45, 15.27, -2.58999, 22.22, 6.11, 22.92, 14.05, 3.75, 9.43999, -13.08, 13.71, 4.21, -2.58999, 4.03, 2.05 ],
|
||||
"hull": 10,
|
||||
"edges": [ 0, 2, 2, 4, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 0, 18, 4, 6, 6, 8, 6, 20, 16, 22, 22, 20, 0, 22, 22, 12, 2, 20, 20, 10 ],
|
||||
"width": 36,
|
||||
"height": 29
|
||||
}
|
||||
@ -757,7 +758,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"ffd": {
|
||||
"deform": {
|
||||
"default": {
|
||||
"left hand item": {
|
||||
"spear": [
|
||||
@ -769,19 +770,19 @@
|
||||
{
|
||||
"time": 0,
|
||||
"offset": 26,
|
||||
"vertices": [ 2.34, 0.14 ],
|
||||
"vertices": [ 2.34754, 0.14469 ],
|
||||
"curve": [ 0.25, 0, 0.75, 1 ]
|
||||
},
|
||||
{
|
||||
"time": 0.5,
|
||||
"offset": 8,
|
||||
"vertices": [ -1.19, 4.31, 0.07, 6.41, 1.66, 6.18, 1.75, 3.59 ],
|
||||
"vertices": [ -1.19415, 4.31531, 0.07279, 6.41351, 1.66048, 6.18882, 1.75232, 3.59555 ],
|
||||
"curve": [ 0.25, 0, 0.75, 1 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"offset": 26,
|
||||
"vertices": [ 2.34, 0.14 ]
|
||||
"vertices": [ 2.34754, 0.14469 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -795,22 +796,22 @@
|
||||
},
|
||||
{
|
||||
"time": 0.2,
|
||||
"vertices": [ -10.97, -6.68, -4.68, -2.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.08, 0.08, -1.08, 0.08, -1.08, 0.08, 0, 0, -2.22, 2.66, -4.83, 2.7, -5.7, -0.51, -3.15, -1.61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6.64, 0.81, -11.82, -1.34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.08, 0.08 ],
|
||||
"vertices": [ -10.97826, -6.68962, -4.68015, -2.46175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.08534, 0.08391, -1.08534, 0.08391, -1.08534, 0.08391, 0, 0, -2.22324, 2.66465, -4.83295, 2.70084, -5.70553, -0.51941, -3.15962, -1.61501, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6.64741, 0.81612, -11.82285, -1.34955, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.08534, 0.08391 ],
|
||||
"curve": [ 0.25, 0, 0.75, 1 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3666,
|
||||
"vertices": [ 10.69, 4.05, 3.66, 1.85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.47, 0.09, 1.47, 0.09, 1.47, 0.09, 0, 0, 2.69, -0.22, 3.77, 0.11, 3.68, 1.55, 2.49, 1.65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.45, -3.91, 9.19, -1.66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.47, 0.09 ],
|
||||
"vertices": [ 10.69275, 4.05949, 3.66373, 1.85426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.47305, 0.09017, 1.47305, 0.09017, 1.47305, 0.09017, 0, 0, 2.69652, -0.22738, 3.77135, 0.11417, 3.6893, 1.55352, 2.49594, 1.65501, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.4588, -3.9113, 9.19593, -1.66854, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.47305, 0.09017 ],
|
||||
"curve": [ 0.621, 0, 0.75, 1 ]
|
||||
},
|
||||
{
|
||||
"time": 0.7,
|
||||
"vertices": [ -10.97, -6.68, -4.68, -2.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.17, -0.17, -1.17, -0.17, -1.17, -0.17, 0, 0, -2.22, 2.66, -4.83, 2.7, -5.7, -0.51, -3.15, -1.61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6.64, 0.81, -11.82, -1.34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.17, -0.17 ],
|
||||
"vertices": [ -10.97826, -6.68962, -4.68015, -2.46175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.1755, -0.17183, -1.1755, -0.17182, -1.1755, -0.17183, 0, 0, -2.22324, 2.66465, -4.83295, 2.70084, -5.70553, -0.51941, -3.15962, -1.61501, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6.64741, 0.81612, -11.82285, -1.34955, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.1755, -0.17183 ],
|
||||
"curve": [ 0.25, 0, 0.75, 1 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8666,
|
||||
"vertices": [ 10.69, 4.05, 3.66, 1.85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.38, 0.08, 0.38, 0.08, 0.38, 0.08, 0, 0, 2.69, -0.22, 3.77, 0.11, 3.68, 1.55, 2.49, 1.65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.45, -3.91, 9.19, -1.66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.38, 0.08 ],
|
||||
"vertices": [ 10.69275, 4.05949, 3.66373, 1.85426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.38687, 0.08446, 0.38687, 0.08446, 0.38687, 0.08446, 0, 0, 2.69652, -0.22738, 3.77135, 0.11417, 3.6893, 1.55352, 2.49594, 1.65501, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.4588, -3.9113, 9.19593, -1.66854, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.38687, 0.08446 ],
|
||||
"curve": [ 0.25, 0, 0.75, 1 ]
|
||||
},
|
||||
{ "time": 1 }
|
||||
@ -821,35 +822,35 @@
|
||||
{
|
||||
"time": 0,
|
||||
"offset": 8,
|
||||
"vertices": [ 3.69, 2.37, -7.16, 18.79, -12.78, 14.77, -12.75, 6.5, -3.13, 1.98, -0.44, 0.36, 0, 0, -3.8, 2.98 ]
|
||||
"vertices": [ 3.69298, 2.37572, -7.16969, 18.79732, -12.78161, 14.7778, -12.75775, 6.50514, -3.13475, 1.98906, -0.44401, 0.36629, 0, 0, -3.80085, 2.98474 ]
|
||||
},
|
||||
{ "time": 0.1333 },
|
||||
{
|
||||
"time": 0.2333,
|
||||
"offset": 8,
|
||||
"vertices": [ -3.96, -2.34, -5.8, -12.47, -2.23, -12.99, 2.02, -9.1, 0, 0, 0, 0, 0, 0, -1.35, -5.28 ]
|
||||
"vertices": [ -3.96072, -2.34594, -5.80445, -12.47629, -2.23129, -12.99037, 2.02941, -9.1036, 0, 0, 0, 0, 0, 0, -1.35254, -5.2883 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3666,
|
||||
"offset": 8,
|
||||
"vertices": [ 0.66, 0.33, 0.33, 2.69, -0.48, 2.54, -1.13, 1.38, 0, 0, 0, 0, 0, 0, -0.11, 0.79 ]
|
||||
"vertices": [ 0.66504, 0.33548, 0.33902, 2.69014, -0.4817, 2.54524, -1.13592, 1.38562, 0, 0, 0, 0, 0, 0, -0.11907, 0.79273 ]
|
||||
},
|
||||
{ "time": 0.5, "curve": "stepped" },
|
||||
{ "time": 0.6333 },
|
||||
{
|
||||
"time": 0.7333,
|
||||
"offset": 8,
|
||||
"vertices": [ -2.97, 9.4, -6.91, 19.92, -10.55, 18.41, -12.37, 12.38, -4.72, 6.3, 0, 0, -1.48, 4.88, -7.06, 10.7 ]
|
||||
"vertices": [ -2.97737, 9.40254, -6.91661, 19.92794, -10.55287, 18.41085, -12.37161, 12.38473, -4.72606, 6.30798, 0, 0, -1.48902, 4.88944, -7.06773, 10.70101 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8333,
|
||||
"offset": 6,
|
||||
"vertices": [ 1.05, 1.56, -2.52, 7.99, -5.52, 17.14, -8.93, 15.79, -10.73, 10.22, -4.23, 5.36, 0, 0, 0, 0, -5.83, 8.55 ]
|
||||
"vertices": [ 1.05318, 1.56361, -2.52722, 7.9974, -5.5203, 17.14136, -8.93317, 15.79635, -10.73747, 10.22055, -4.23801, 5.36992, 0, 0, 0, 0, -5.83147, 8.55531 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"offset": 8,
|
||||
"vertices": [ 3.69, 2.37, -7.16, 18.79, -12.78, 14.77, -12.75, 6.5, -3.13, 1.98, -0.44, 0.36, 0, 0, -3.8, 2.98 ]
|
||||
"vertices": [ 3.69298, 2.37572, -7.16969, 18.79732, -12.78161, 14.7778, -12.75775, 6.50514, -3.13475, 1.98906, -0.44401, 0.36629, 0, 0, -3.80085, 2.98474 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -859,22 +860,22 @@
|
||||
{
|
||||
"time": 0.1333,
|
||||
"offset": 6,
|
||||
"vertices": [ -0.68, -4.13 ]
|
||||
"vertices": [ -0.68989, -4.13283 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3333,
|
||||
"offset": 6,
|
||||
"vertices": [ -1.04, -3.1 ]
|
||||
"vertices": [ -1.04945, -3.10476 ]
|
||||
},
|
||||
{
|
||||
"time": 0.7,
|
||||
"offset": 6,
|
||||
"vertices": [ -1.42, -6.3 ]
|
||||
"vertices": [ -1.4245, -6.30616 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8666,
|
||||
"offset": 6,
|
||||
"vertices": [ -1.13, -1.79 ]
|
||||
"vertices": [ -1.13541, -1.79035 ]
|
||||
},
|
||||
{ "time": 1 }
|
||||
]
|
||||
@ -885,38 +886,38 @@
|
||||
{
|
||||
"time": 0.1333,
|
||||
"offset": 2,
|
||||
"vertices": [ -2.81, 2.63, -2.35, 3.89, -1.99, 4.86, -0.93, 5.57, -0.48, 5.09, -0.34, 3.42, -0.17, 1.36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.31, 1.91, -1.32, 3.65 ]
|
||||
"vertices": [ -2.81258, 2.63114, -2.35238, 3.89441, -1.99921, 4.8639, -0.93273, 5.57982, -0.48886, 5.09854, -0.34812, 3.42912, -0.17445, 1.36898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.31305, 1.91371, -1.32986, 3.65703 ]
|
||||
},
|
||||
{
|
||||
"time": 0.2333,
|
||||
"offset": 2,
|
||||
"vertices": [ -6.39, 6.41, -7.74, 8.27, -7.02, 11.35, -4.03, 13.93, -2.5, 12.62, -1.46, 7.58, -0.17, 1.36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3.84, 2.61, -4.53, 7.92 ]
|
||||
"vertices": [ -6.39088, 6.41245, -7.74575, 8.27191, -7.02471, 11.35894, -4.0347, 13.93454, -2.50399, 12.62962, -1.46124, 7.58915, -0.17445, 1.36898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3.84765, 2.61215, -4.53955, 7.92357 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3,
|
||||
"offset": 2,
|
||||
"vertices": [ -8.27, 6.68, -9.29, 10.13, -8.62, 14.71, -4.58, 18.81, -2.2, 17.1, -0.07, 9.9, 2.54, 1.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.94, 2.38, -4.59, 10.01 ]
|
||||
"vertices": [ -8.27184, 6.68821, -9.29764, 10.13797, -8.62231, 14.71339, -4.58629, 18.81939, -2.20304, 17.10709, -0.07794, 9.9046, 2.54451, 1.01642, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.94624, 2.38007, -4.59398, 10.01888 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3666,
|
||||
"offset": 2,
|
||||
"vertices": [ -10.47, 9.44, -13.36, 12.4, -14.32, 16.94, -9.24, 23.55, -5.51, 21.51, -1.19, 11.53, 2.54, 1.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4.14, 2.29, -6.63, 11.37 ]
|
||||
"vertices": [ -10.47683, 9.44175, -13.36882, 12.40982, -14.32568, 16.94392, -9.24462, 23.55674, -5.51711, 21.51377, -1.19581, 11.53192, 2.54451, 1.01642, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4.14847, 2.29389, -6.63418, 11.37127 ]
|
||||
},
|
||||
{
|
||||
"time": 0.5,
|
||||
"offset": 2,
|
||||
"vertices": [ -5.42, 4.36, -10.59, 7.04, -11.64, 11.55, -6.19, 20.12, -1.45, 18.05, 4.86, 6.41, 2.81, 0.27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.96, 4.94 ]
|
||||
"vertices": [ -5.42473, 4.36854, -10.59004, 7.04468, -11.64251, 11.55845, -6.19665, 20.12805, -1.45497, 18.05411, 4.86619, 6.41678, 2.81462, 0.27601, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.96412, 4.94829 ]
|
||||
},
|
||||
{ "time": 0.6333 },
|
||||
{
|
||||
"time": 0.7333,
|
||||
"offset": 4,
|
||||
"vertices": [ 1.31, -6.84, -0.87, -12.54, -5.98, -14.08, -7.15, -11.63, -5.67, -4.83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.06, -6.93 ]
|
||||
"vertices": [ 1.31462, -6.84099, -0.87905, -12.54479, -5.9851, -14.08367, -7.15892, -11.63193, -5.6792, -4.83544, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.06163, -6.93844 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8,
|
||||
"offset": 4,
|
||||
"vertices": [ 0.65, -3.42, -0.43, -6.27, -2.99, -7.04, -3.57, -5.81, -2.83, -2.41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.79, -1.28, 0, 0, 0, 0, -1.03, -3.46 ]
|
||||
"vertices": [ 0.65731, -3.42049, -0.43952, -6.27239, -2.99255, -7.04183, -3.57946, -5.81596, -2.83959, -2.41772, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.79687, -1.2802, 0, 0, 0, 0, -1.03081, -3.46922 ]
|
||||
},
|
||||
{ "time": 0.8666 }
|
||||
]
|
||||
@ -926,13 +927,13 @@
|
||||
{
|
||||
"time": 0,
|
||||
"offset": 4,
|
||||
"vertices": [ -1.48, 0.34, 0, 0, 1.31, 0.08, 1.6, 0.09, 0.13, 0.15, 0, 0, 0, 0, -0.72, -0.04 ]
|
||||
"vertices": [ -1.48416, 0.34736, 0, 0, 1.31152, 0.08085, 1.60295, 0.09881, 0.13673, 0.1547, 0, 0, 0, 0, -0.72862, -0.0449 ]
|
||||
},
|
||||
{ "time": 0.5 },
|
||||
{
|
||||
"time": 1,
|
||||
"offset": 4,
|
||||
"vertices": [ -1.48, 0.34, 0, 0, 1.31, 0.08, 1.6, 0.09, 0.13, 0.15, 0, 0, 0, 0, -0.72, -0.04 ]
|
||||
"vertices": [ -1.48416, 0.34736, 0, 0, 1.31152, 0.08085, 1.60295, 0.09881, 0.13673, 0.1547, 0, 0, 0, 0, -0.72862, -0.0449 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -942,7 +943,7 @@
|
||||
{
|
||||
"time": 0.6,
|
||||
"offset": 6,
|
||||
"vertices": [ 1.8, -1.56 ]
|
||||
"vertices": [ 1.80396, -1.56552 ]
|
||||
},
|
||||
{ "time": 1 }
|
||||
]
|
||||
@ -951,17 +952,17 @@
|
||||
"right upper leg": [
|
||||
{
|
||||
"time": 0,
|
||||
"vertices": [ -6.03, -1.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.34, -1.93, -1.86, -5.05, -2.5, -3.09 ]
|
||||
"vertices": [ -6.03856, -1.46324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.34684, -1.93101, -1.86047, -5.05265, -2.5014, -3.09984 ]
|
||||
},
|
||||
{ "time": 0.3333 },
|
||||
{
|
||||
"time": 0.8666,
|
||||
"offset": 14,
|
||||
"vertices": [ 0.13, -2.35, -1.33, -5.99, -1.35, -4.43 ]
|
||||
"vertices": [ 0.13424, -2.35377, -1.33317, -5.99572, -1.35861, -4.43323 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"vertices": [ -6.03, -1.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.34, -1.93, -1.86, -5.05, -2.5, -3.09 ]
|
||||
"vertices": [ -6.03856, -1.46324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.34684, -1.93101, -1.86047, -5.05265, -2.5014, -3.09984 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -970,37 +971,37 @@
|
||||
{
|
||||
"time": 0,
|
||||
"offset": 14,
|
||||
"vertices": [ -1.48, -0.24, -2.72, -2.15, -0.51, -3.39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.09, -2.61, 0, 0, 0.57, -1.24, 0, 0, 0, 0, -2.11, -3.29 ]
|
||||
"vertices": [ -1.48952, -0.24021, -2.72312, -2.15489, -0.51183, -3.39752, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0964, -2.61458, 0, 0, 0.57686, -1.24874, 0, 0, 0, 0, -2.11251, -3.29932 ]
|
||||
},
|
||||
{
|
||||
"time": 0.1333,
|
||||
"offset": 14,
|
||||
"vertices": [ 1.31, -0.59, -0.97, -1.62, 0.74, -0.61, -1.44, 1.97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65, -3.95, 0, 0, -1.46, -0.31, 0, 0, 0, 0, -3.31, -3.55, -2.56, 0.29 ]
|
||||
"vertices": [ 1.31318, -0.59727, -0.97944, -1.62934, 0.74861, -0.6123, -1.44598, 1.97515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65701, -3.95221, 0, 0, -1.46987, -0.31373, 0, 0, 0, 0, -3.31756, -3.5535, -2.56329, 0.29673 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3,
|
||||
"offset": 14,
|
||||
"vertices": [ 6.03, -3.13, 7.55, -1.38, 6.79, 0.31, 4.23, 1.14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.07, -5.16, 0, 0, 4, 0.27, 0, 0, 0, 0, 3.43, -3.52 ]
|
||||
"vertices": [ 6.03761, -3.13561, 7.55475, -1.38111, 6.79747, 0.31171, 4.23503, 1.14012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.07575, -5.16824, 0, 0, 4.0041, 0.27245, 0, 0, 0, 0, 3.4376, -3.52286 ]
|
||||
},
|
||||
{
|
||||
"time": 0.5,
|
||||
"offset": 14,
|
||||
"vertices": [ 2.25, -0.87, 2.57, -0.56, 3.17, -0.57, 1.48, 0.99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.22, -4.43, 0, 0, 1.48, 0.01, 0, 0, 0, 0, 0.31, -3.28, -1.53, 0.17 ]
|
||||
"vertices": [ 2.25942, -0.87202, 2.575, -0.56861, 3.17112, -0.57003, 1.48704, 0.9924, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.22451, -4.43862, 0, 0, 1.48691, 0.01586, 0, 0, 0, 0, 0.31388, -3.28095, -1.53797, 0.17803 ]
|
||||
},
|
||||
{
|
||||
"time": 0.6333,
|
||||
"offset": 14,
|
||||
"vertices": [ 0.75, -1.51, -0.97, -1.62, 0.74, -0.61, -1.44, 1.97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65, -3.95, 0, 0, -1.46, -0.31, 0, 0, 0, 0, -3.31, -3.55, -2.56, 0.29 ]
|
||||
"vertices": [ 0.75002, -1.51701, -0.97944, -1.62934, 0.74861, -0.6123, -1.44598, 1.97515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.65701, -3.95221, 0, 0, -1.46987, -0.31373, 0, 0, 0, 0, -3.31756, -3.5535, -2.56329, 0.29673 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8666,
|
||||
"offset": 14,
|
||||
"vertices": [ 0.62, -1.26, 0.38, -2.2, 3.25, -0.5, 2.41, 2.39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.66, -3.1, 0, 0, 2.3, -1.15, 0, 0, 0, 0, -0.07, -3.63, -0.93, 0.1 ]
|
||||
"vertices": [ 0.62202, -1.26262, 0.38489, -2.20701, 3.25048, -0.50042, 2.41108, 2.39315, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6639, -3.10099, 0, 0, 2.30655, -1.15196, 0, 0, 0, 0, -0.07676, -3.63497, -0.9321, 0.1079 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"offset": 14,
|
||||
"vertices": [ -1.48, -0.24, -2.72, -2.15, -0.51, -3.39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.09, -2.61, 0, 0, 0.57, -1.24, 0, 0, 0, 0, -2.11, -3.29 ]
|
||||
"vertices": [ -1.48952, -0.24021, -2.72312, -2.15489, -0.51183, -3.39752, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0964, -2.61458, 0, 0, 0.57686, -1.24874, 0, 0, 0, 0, -2.11251, -3.29932 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1009,32 +1010,32 @@
|
||||
{
|
||||
"time": 0,
|
||||
"offset": 2,
|
||||
"vertices": [ -1.77, 0.54, -0.96, -1.03, -0.39, -0.24, -1.77, 0.54 ]
|
||||
"vertices": [ -1.77696, 0.54759, -0.96145, -1.03793, -0.39148, -0.24071, -1.77696, 0.54759 ]
|
||||
},
|
||||
{
|
||||
"time": 0.1333,
|
||||
"offset": 2,
|
||||
"vertices": [ -2.25, -1.03, -1.49, -4.23, -0.74, -2.84, -1.9, 0.54 ]
|
||||
"vertices": [ -2.25683, -1.03177, -1.49719, -4.23861, -0.74469, -2.84906, -1.90072, 0.54477 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3333,
|
||||
"offset": 2,
|
||||
"vertices": [ -2.37, -0.05, -0.49, 0.19, -0.9, 1.16, -1.6, 2.7, 0.96, 0.8 ]
|
||||
"vertices": [ -2.37974, -0.05431, -0.49433, 0.19436, -0.90861, 1.16519, -1.60956, 2.70798, 0.96186, 0.80615 ]
|
||||
},
|
||||
{
|
||||
"time": 0.7,
|
||||
"offset": 2,
|
||||
"vertices": [ -0.91, -2.76, -0.62, -3.63, -0.84, -2.26, -2.56, 0.52 ]
|
||||
"vertices": [ -0.91714, -2.76567, -0.62214, -3.63489, -0.8494, -2.26772, -2.56076, 0.5297 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8666,
|
||||
"offset": 2,
|
||||
"vertices": [ -2.56, 0.52, -1.58, 0.32, -1.38, 0.32, -2.56, 0.52 ]
|
||||
"vertices": [ -2.56076, 0.5297, -1.58064, 0.32031, -1.3847, 0.32476, -2.56076, 0.5297 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"offset": 2,
|
||||
"vertices": [ -1.77, 0.54, -0.8, 0.53, -0.8, 0.53, -1.77, 0.54 ]
|
||||
"vertices": [ -1.77696, 0.54759, -0.80128, 0.53413, -0.80128, 0.53413, -1.77696, 0.54759 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1042,35 +1043,35 @@
|
||||
"undies": [
|
||||
{
|
||||
"time": 0,
|
||||
"vertices": [ 0.43, 0.72, 10.6, -0.11, 2.29, 0, 2.29, 0, 2.29, 0, 0.58, 0.24, -2.4, -0.65, -2.27, -0.77, 2.29, 0, 0.58, -0.48, 4.98, -0.11, 6.5, -0.23 ]
|
||||
"vertices": [ 0.43098, 0.722, 10.60295, -0.11699, 2.29598, 0, 2.29598, 0, 2.29598, 0, 0.58798, 0.24399, -2.40018, -0.65335, -2.2782, -0.77533, 2.29598, 0, 0.58798, -0.48799, 4.98697, -0.11699, 6.50796, -0.23399 ]
|
||||
},
|
||||
{
|
||||
"time": 0.1333,
|
||||
"vertices": [ 0.72, 0.43, 7.2, -0.16, 1.37, 0, 1.37, 0, 1.37, 0, 1.25, 0.04, -0.99, -2.95, -1.37, -3.07, 1.37, 0, 0.35, -0.29, 2.99, -0.07, 3.9, -0.14 ]
|
||||
"vertices": [ 0.72659, 0.43319, 7.20416, -0.1638, 1.37759, 0, 1.37759, 0, 1.37759, 0, 1.25279, 0.0464, -0.99861, -2.95085, -1.37542, -3.07404, 1.37759, 0, 0.35279, -0.29279, 2.99218, -0.07019, 3.90478, -0.14039 ]
|
||||
},
|
||||
{
|
||||
"time": 0.3333,
|
||||
"vertices": [ 1.16, 0, 2.1, -0.23, 0, 0, 0, 0, 0, 0, 2.24, -0.24, -0.43, 0.6, -1.55, 0.48 ]
|
||||
"vertices": [ 1.16999, 0, 2.10599, -0.234, 0, 0, 0, 0, 0, 0, 2.24999, -0.24999, -0.4344, 0.60551, -1.55939, 0.48051 ]
|
||||
},
|
||||
{
|
||||
"time": 0.5333,
|
||||
"vertices": [ 1.16, 0, -0.23, -0.93, -2.92, 0.35, 0, 0, 0, 0, 0.49, -0.24, -0.64, -2.07, -0.64, -2.07 ]
|
||||
"vertices": [ 1.16999, 0, -0.234, -0.93599, -2.92499, 0.35099, 0, 0, 0, 0, 0.49999, -0.24999, -0.64078, -2.07914, -0.64078, -2.07914 ]
|
||||
},
|
||||
{
|
||||
"time": 0.7,
|
||||
"vertices": [ 1.86, -0.11, 4.66, -0.09, -1.76, 0.21, 0, 0, -0.56, 0.32, -1.13, -1.15, -2.19, -3.47, -1.29, -3.47, 0, 0, 0, 0, 1.58, -0.04, 2.65, 0.16 ]
|
||||
"vertices": [ 1.8627, -0.11514, 4.66326, -0.09099, -1.76428, 0.21171, 0, 0, -0.56832, 0.32832, -1.13833, -1.1511, -2.19996, -3.47068, -1.29718, -3.47068, 0, 0, 0, 0, 1.58785, -0.04642, 2.65941, 0.16714 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8333,
|
||||
"vertices": [ 2.41, -0.2, 8.58, 0.58, -0.83, 0.1, 0, 0, -1.02, 0.59, -2.44, -1.87, -1.62, 0, 0, 0, 0, 0, 0, 0, 2.85, -0.08, 4.78, 0.3 ]
|
||||
"vertices": [ 2.41687, -0.20725, 8.58108, 0.585, -0.83571, 0.10028, 0, 0, -1.02299, 0.59098, -2.44899, -1.872, -1.62499, 0, 0, 0, 0, 0, 0, 0, 2.85813, -0.08356, 4.78695, 0.30086 ]
|
||||
},
|
||||
{
|
||||
"time": 0.8666,
|
||||
"vertices": [ 2.01, -0.02, 8.98, 0.44, -0.2, 0.08, 0.45, 0, -0.35, 0.47, -1.84, -1.44, -0.79, 1.26, 0.53, 1.23, 0.45, 0, 0.11, -0.09, 3.28, -0.09, 5.13, 0.19 ]
|
||||
"vertices": [ 2.01969, -0.0214, 8.98545, 0.4446, -0.20937, 0.08022, 0.45919, 0, -0.35919, 0.47279, -1.84159, -1.4488, -0.79153, 1.2642, 0.53285, 1.23981, 0.45919, 0, 0.11759, -0.09759, 3.2839, -0.09025, 5.13115, 0.19388 ]
|
||||
},
|
||||
{
|
||||
"time": 1,
|
||||
"vertices": [ 0.43, 0.72, 10.6, -0.11, 2.29, 0, 2.29, 0, 2.29, 0, 0.58, 0.24, -2.4, -0.65, -2.27, -0.77, 2.29, 0, 0.58, -0.48, 4.98, -0.11, 6.5, -0.23 ]
|
||||
"vertices": [ 0.43098, 0.722, 10.60295, -0.11699, 2.29598, 0, 2.29598, 0, 2.29598, 0, 0.58798, 0.24399, -2.40018, -0.65335, -2.2782, -0.77533, 2.29598, 0, 0.58798, -0.48799, 4.98697, -0.11699, 6.50796, -0.23399 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 217 KiB After Width: | Height: | Size: 206 KiB |
@ -1,26 +1,26 @@
|
||||
|
||||
raptor.png
|
||||
size: 1022,1022
|
||||
size: 1024,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
back_arm
|
||||
rotate: false
|
||||
xy: 410, 545
|
||||
rotate: true
|
||||
xy: 140, 191
|
||||
size: 46, 29
|
||||
orig: 46, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_bracer
|
||||
rotate: false
|
||||
xy: 540, 548
|
||||
rotate: true
|
||||
xy: 167, 317
|
||||
size: 39, 28
|
||||
orig: 39, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
back_hand
|
||||
rotate: true
|
||||
xy: 504, 538
|
||||
rotate: false
|
||||
xy: 167, 358
|
||||
size: 36, 34
|
||||
orig: 36, 34
|
||||
offset: 0, 0
|
||||
@ -34,49 +34,63 @@ back_knee
|
||||
index: -1
|
||||
back_thigh
|
||||
rotate: true
|
||||
xy: 140, 247
|
||||
xy: 167, 437
|
||||
size: 39, 24
|
||||
orig: 39, 24
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eyes_open
|
||||
eyes_closed
|
||||
rotate: true
|
||||
xy: 2, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eyes_open
|
||||
rotate: true
|
||||
xy: 49, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eyes_surprised
|
||||
rotate: true
|
||||
xy: 96, 2
|
||||
size: 47, 45
|
||||
orig: 47, 45
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_arm
|
||||
rotate: false
|
||||
xy: 360, 544
|
||||
xy: 419, 544
|
||||
size: 48, 30
|
||||
orig: 48, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 538, 578
|
||||
xy: 880, 695
|
||||
size: 41, 29
|
||||
orig: 41, 29
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_hand
|
||||
rotate: false
|
||||
xy: 538, 609
|
||||
rotate: true
|
||||
xy: 167, 394
|
||||
size: 41, 38
|
||||
orig: 41, 38
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_open_hand
|
||||
rotate: false
|
||||
xy: 894, 782
|
||||
xy: 880, 726
|
||||
size: 43, 44
|
||||
orig: 43, 44
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_thigh
|
||||
rotate: false
|
||||
xy: 942, 849
|
||||
xy: 360, 545
|
||||
size: 57, 29
|
||||
orig: 57, 29
|
||||
offset: 0, 0
|
||||
@ -109,16 +123,30 @@ lower_leg
|
||||
orig: 73, 98
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_grind
|
||||
rotate: false
|
||||
xy: 469, 544
|
||||
size: 47, 30
|
||||
orig: 47, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_oooo
|
||||
rotate: true
|
||||
xy: 894, 772
|
||||
size: 105, 30
|
||||
orig: 105, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_smile
|
||||
rotate: true
|
||||
xy: 49, 2
|
||||
xy: 140, 239
|
||||
size: 47, 30
|
||||
orig: 47, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
neck
|
||||
rotate: true
|
||||
xy: 1001, 860
|
||||
xy: 538, 577
|
||||
size: 18, 21
|
||||
orig: 18, 21
|
||||
offset: 0, 0
|
||||
@ -215,22 +243,22 @@ raptor_tongue
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_back
|
||||
rotate: false
|
||||
xy: 458, 539
|
||||
rotate: true
|
||||
xy: 140, 145
|
||||
size: 44, 35
|
||||
orig: 44, 35
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_front
|
||||
rotate: true
|
||||
xy: 81, 4
|
||||
rotate: false
|
||||
xy: 538, 597
|
||||
size: 45, 50
|
||||
orig: 45, 50
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
stirrup_strap
|
||||
rotate: true
|
||||
xy: 894, 828
|
||||
rotate: false
|
||||
xy: 350, 497
|
||||
size: 49, 46
|
||||
orig: 49, 46
|
||||
offset: 0, 0
|
||||
|
||||
|
Before Width: | Height: | Size: 550 KiB After Width: | Height: | Size: 495 KiB |
@ -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;
|
||||
@ -65,7 +65,7 @@ public class GoblinsExample extends Sprite {
|
||||
private var skeleton:SkeletonAnimation;
|
||||
|
||||
public function GoblinsExample () {
|
||||
var useStarlingAtlas:Boolean = true;
|
||||
var useStarlingAtlas:Boolean = false;
|
||||
|
||||
var attachmentLoader:AttachmentLoader;
|
||||
if (useStarlingAtlas) {
|
||||
@ -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";
|
||||
@ -29,7 +29,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
package spine {
|
||||
package spine.examples {
|
||||
|
||||
import flash.display.Sprite;
|
||||
|
||||
@ -41,13 +41,15 @@ public class Main extends Sprite {
|
||||
|
||||
public function Main () {
|
||||
var example:Class;
|
||||
//example = SpineboyExample;
|
||||
//example = GoblinsExample;
|
||||
example = RaptorExample;
|
||||
// example = SpineboyExample;
|
||||
// example = GoblinsExample;
|
||||
// example = RaptorExample;
|
||||
example = TankExample;
|
||||
|
||||
_starling = new Starling(example, stage);
|
||||
_starling.enableErrorChecking = true;
|
||||
_starling.showStats = true;
|
||||
_starling.skipUnchangedFrames = false;
|
||||
_starling.start();
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
@ -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;
|
||||
|
||||
@ -85,6 +86,7 @@ public class SpineboyExample extends Sprite {
|
||||
+ event.data.name + ": " + event.intValue + ", " + event.floatValue + ", " + event.stringValue);
|
||||
});
|
||||
|
||||
skeleton.skeleton.setToSetupPose();
|
||||
skeleton.state.setAnimationByName(0, "run", true);
|
||||
skeleton.state.addAnimationByName(0, "jump", false, 3);
|
||||
skeleton.state.addAnimationByName(0, "run", true, 0);
|
||||
@ -0,0 +1,73 @@
|
||||
/******************************************************************************
|
||||
* 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.examples {
|
||||
import spine.atlas.Atlas;
|
||||
import spine.*;
|
||||
import spine.attachments.AtlasAttachmentLoader;
|
||||
import spine.attachments.AttachmentLoader;
|
||||
import spine.starling.SkeletonAnimation;
|
||||
import spine.starling.StarlingTextureLoader;
|
||||
|
||||
import starling.core.Starling;
|
||||
import starling.display.Sprite;
|
||||
|
||||
public class TankExample extends Sprite {
|
||||
[Embed(source = "/tank.json", mimeType = "application/octet-stream")]
|
||||
static public const TankJson:Class;
|
||||
|
||||
[Embed(source = "/tank.atlas", mimeType = "application/octet-stream")]
|
||||
static public const TankAtlas:Class;
|
||||
|
||||
[Embed(source = "/tank.png")]
|
||||
static public const TankAtlasTexture:Class;
|
||||
|
||||
private var skeleton:SkeletonAnimation;
|
||||
|
||||
public function TankExample () {
|
||||
var attachmentLoader:AttachmentLoader;
|
||||
var spineAtlas:Atlas = new Atlas(new TankAtlas(), new StarlingTextureLoader(new TankAtlasTexture()));
|
||||
attachmentLoader = new AtlasAttachmentLoader(spineAtlas);
|
||||
|
||||
var json:SkeletonJson = new SkeletonJson(attachmentLoader);
|
||||
json.scale = 0.5;
|
||||
var skeletonData:SkeletonData = json.readSkeletonData(new TankJson());
|
||||
|
||||
skeleton = new SkeletonAnimation(skeletonData);
|
||||
skeleton.x = 400;
|
||||
skeleton.y = 560;
|
||||
skeleton.state.setAnimationByName(0, "drive", true);
|
||||
|
||||
addChild(skeleton);
|
||||
Starling.juggler.add(skeleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,194 +1,216 @@
|
||||
|
||||
spineboy.png
|
||||
size: 1024,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
eye_indifferent
|
||||
rotate: true
|
||||
xy: 389, 5
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
xy: 648, 629
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
eye_surprised
|
||||
rotate: false
|
||||
xy: 580, 34
|
||||
size: 56, 53
|
||||
orig: 56, 53
|
||||
rotate: true
|
||||
xy: 233, 179
|
||||
size: 93, 89
|
||||
orig: 93, 89
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_bracer
|
||||
rotate: false
|
||||
xy: 732, 85
|
||||
size: 35, 48
|
||||
orig: 35, 48
|
||||
xy: 245, 2
|
||||
size: 58, 80
|
||||
orig: 58, 80
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_closed
|
||||
rotate: false
|
||||
xy: 556, 91
|
||||
size: 45, 49
|
||||
orig: 45, 49
|
||||
xy: 168, 45
|
||||
size: 75, 82
|
||||
orig: 75, 82
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_fist_open
|
||||
rotate: false
|
||||
xy: 668, 32
|
||||
size: 52, 52
|
||||
orig: 52, 52
|
||||
xy: 844, 646
|
||||
size: 86, 87
|
||||
orig: 86, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot
|
||||
rotate: false
|
||||
xy: 924, 201
|
||||
size: 76, 41
|
||||
orig: 76, 41
|
||||
rotate: true
|
||||
xy: 310, 326
|
||||
size: 126, 69
|
||||
orig: 126, 69
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend1
|
||||
rotate: false
|
||||
xy: 845, 200
|
||||
size: 77, 42
|
||||
orig: 77, 42
|
||||
rotate: true
|
||||
xy: 951, 894
|
||||
size: 128, 70
|
||||
orig: 128, 70
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 186
|
||||
size: 65, 56
|
||||
orig: 65, 56
|
||||
xy: 2, 33
|
||||
size: 108, 93
|
||||
orig: 108, 93
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_shin
|
||||
rotate: true
|
||||
xy: 444, 91
|
||||
size: 49, 110
|
||||
orig: 49, 110
|
||||
xy: 739, 735
|
||||
size: 82, 184
|
||||
orig: 82, 184
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_thigh
|
||||
rotate: true
|
||||
xy: 603, 89
|
||||
size: 29, 67
|
||||
orig: 29, 67
|
||||
rotate: false
|
||||
xy: 381, 340
|
||||
size: 48, 112
|
||||
orig: 48, 112
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
front_upper_arm
|
||||
rotate: true
|
||||
xy: 672, 86
|
||||
size: 32, 58
|
||||
orig: 32, 58
|
||||
rotate: false
|
||||
xy: 112, 29
|
||||
size: 54, 97
|
||||
orig: 54, 97
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
goggles
|
||||
rotate: false
|
||||
xy: 444, 142
|
||||
size: 157, 100
|
||||
orig: 157, 100
|
||||
xy: 156, 454
|
||||
size: 261, 166
|
||||
orig: 261, 166
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gun
|
||||
rotate: false
|
||||
xy: 603, 120
|
||||
size: 126, 122
|
||||
orig: 126, 122
|
||||
xy: 739, 819
|
||||
size: 210, 203
|
||||
orig: 210, 203
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
head
|
||||
rotate: false
|
||||
xy: 279, 63
|
||||
size: 163, 179
|
||||
orig: 163, 179
|
||||
xy: 466, 724
|
||||
size: 271, 298
|
||||
orig: 271, 298
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_board
|
||||
rotate: true
|
||||
xy: 2, 128
|
||||
size: 492, 152
|
||||
orig: 492, 152
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverboard_thruster
|
||||
rotate: false
|
||||
xy: 602, 558
|
||||
size: 60, 64
|
||||
orig: 60, 64
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
hoverglow_small
|
||||
rotate: true
|
||||
xy: 156, 178
|
||||
size: 274, 75
|
||||
orig: 274, 75
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_grind
|
||||
rotate: false
|
||||
xy: 845, 163
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 951, 799
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_oooo
|
||||
rotate: false
|
||||
xy: 842, 126
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
rotate: true
|
||||
xy: 245, 84
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
mouth_smile
|
||||
rotate: false
|
||||
xy: 769, 97
|
||||
size: 56, 35
|
||||
orig: 56, 35
|
||||
xy: 925, 738
|
||||
size: 93, 59
|
||||
orig: 93, 59
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
muzzle
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 275, 240
|
||||
orig: 277, 240
|
||||
xy: 2, 622
|
||||
size: 462, 400
|
||||
orig: 462, 400
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
neck
|
||||
rotate: false
|
||||
xy: 903, 173
|
||||
size: 22, 25
|
||||
orig: 22, 25
|
||||
xy: 168, 2
|
||||
size: 36, 41
|
||||
orig: 36, 41
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_bracer
|
||||
rotate: false
|
||||
xy: 722, 40
|
||||
size: 34, 43
|
||||
orig: 34, 43
|
||||
xy: 932, 664
|
||||
size: 56, 72
|
||||
orig: 56, 72
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot
|
||||
rotate: false
|
||||
xy: 444, 11
|
||||
size: 68, 36
|
||||
orig: 68, 36
|
||||
xy: 487, 562
|
||||
size: 113, 60
|
||||
orig: 113, 60
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend1
|
||||
rotate: false
|
||||
xy: 444, 49
|
||||
size: 70, 40
|
||||
orig: 70, 40
|
||||
rotate: true
|
||||
xy: 419, 503
|
||||
size: 117, 66
|
||||
orig: 117, 66
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_foot_bend2
|
||||
rotate: false
|
||||
xy: 778, 134
|
||||
size: 62, 50
|
||||
orig: 62, 50
|
||||
xy: 739, 650
|
||||
size: 103, 83
|
||||
orig: 103, 83
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_shin
|
||||
rotate: false
|
||||
xy: 731, 135
|
||||
size: 45, 107
|
||||
orig: 45, 107
|
||||
xy: 233, 274
|
||||
size: 75, 178
|
||||
orig: 75, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_thigh
|
||||
rotate: true
|
||||
xy: 516, 50
|
||||
size: 39, 62
|
||||
orig: 39, 62
|
||||
xy: 487, 495
|
||||
size: 65, 104
|
||||
orig: 65, 104
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
rear_upper_arm
|
||||
rotate: false
|
||||
xy: 638, 35
|
||||
size: 28, 52
|
||||
orig: 28, 52
|
||||
rotate: true
|
||||
xy: 156, 129
|
||||
size: 47, 87
|
||||
orig: 47, 87
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
torso
|
||||
rotate: true
|
||||
xy: 279, 2
|
||||
size: 59, 108
|
||||
orig: 59, 108
|
||||
xy: 466, 624
|
||||
size: 98, 180
|
||||
orig: 98, 180
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
|
||||
@ -1,39 +1,31 @@
|
||||
{
|
||||
"skeleton": { "hash": "rPoYyBLFG6F0CGZ5wsUEBKDJU9U", "spine": "3.4.00", "width": 0, "height": 0, "images": "./images/" },
|
||||
"bones": [
|
||||
{ "name": "hip", "y": 247.47 },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "x": -17.45, "y": -11.64, "rotation": -95.51, "color": "00ff04ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "x": 8.91, "y": -5.62, "rotation": -72.54, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "x": -1.61, "y": 4.9, "rotation": 103.82, "color": "e0da19ff" },
|
||||
{
|
||||
"name": "front_shin",
|
||||
"parent": "front_thigh",
|
||||
"length": 128.76,
|
||||
"x": 78.69,
|
||||
"y": 1.6,
|
||||
"rotation": -2.21,
|
||||
"inheritScale": false,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "x": 103.75, "y": 19.32, "rotation": 168.37, "color": "00ff04ff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "x": 127.49, "y": -0.3, "rotation": -31.53, "color": "e0da19ff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "x": 86.1, "y": -1.32, "rotation": -19.83, "color": "ff000dff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "x": 92.35, "y": -19.22, "rotation": -169.55, "color": "ff000dff" },
|
||||
{ "name": "torso", "parent": "hip", "length": 127.55, "rotation": 103.82, "x": -1.61, "y": 4.9, "color": "e0da19ff" },
|
||||
{ "name": "front_upper_arm", "parent": "torso", "length": 69.45, "rotation": 168.37, "x": 103.75, "y": 19.32, "color": "00ff04ff" },
|
||||
{
|
||||
"name": "front_bracer",
|
||||
"parent": "front_upper_arm",
|
||||
"length": 40.57,
|
||||
"rotation": 18.29,
|
||||
"x": 68.8,
|
||||
"y": -0.68,
|
||||
"rotation": 18.29,
|
||||
"color": "00ff04ff"
|
||||
},
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "x": 128.75, "y": -0.33, "rotation": 77.9, "color": "00ff04ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "x": 27.66, "y": -0.25, "rotation": 23.18, "color": "e0da19ff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "x": 51.35, "rotation": 23.15, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "x": 121.45, "y": -0.75, "rotation": 69.3, "color": "ff000dff" },
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "x": 40.56, "y": 0.19, "rotation": 12.43, "color": "00ff04ff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "x": 34.42, "y": -0.45, "rotation": 5.34, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "x": 201.04, "y": 52.13, "rotation": 6.83, "color": "ff000dff" }
|
||||
{ "name": "front_fist", "parent": "front_bracer", "length": 65.38, "rotation": 12.43, "x": 40.56, "y": 0.19, "color": "00ff04ff" },
|
||||
{ "name": "front_thigh", "parent": "hip", "length": 74.8, "rotation": -95.51, "x": -17.45, "y": -11.64, "color": "00ff04ff" },
|
||||
{ "name": "front_shin", "parent": "front_thigh", "length": 128.76, "rotation": -2.21, "x": 78.69, "y": 1.6, "color": "00ff04ff" },
|
||||
{ "name": "front_foot", "parent": "front_shin", "length": 91.34, "rotation": 77.9, "x": 128.75, "y": -0.33, "color": "00ff04ff" },
|
||||
{ "name": "rear_upper_arm", "parent": "torso", "length": 51.93, "rotation": -169.55, "x": 92.35, "y": -19.22, "color": "ff000dff" },
|
||||
{ "name": "rear_bracer", "parent": "rear_upper_arm", "length": 34.55, "rotation": 23.15, "x": 51.35, "color": "ff000dff" },
|
||||
{ "name": "gun", "parent": "rear_bracer", "length": 43.1, "rotation": 5.34, "x": 34.42, "y": -0.45, "color": "ff000dff" },
|
||||
{ "name": "gunTip", "parent": "gun", "rotation": 6.83, "x": 201.04, "y": 52.13, "color": "ff000dff" },
|
||||
{ "name": "neck", "parent": "torso", "length": 25.45, "rotation": -31.53, "x": 127.49, "y": -0.3, "color": "e0da19ff" },
|
||||
{ "name": "head", "parent": "neck", "length": 263.57, "rotation": 23.18, "x": 27.66, "y": -0.25, "color": "e0da19ff" },
|
||||
{ "name": "rear_thigh", "parent": "hip", "length": 85.71, "rotation": -72.54, "x": 8.91, "y": -5.62, "color": "ff000dff" },
|
||||
{ "name": "rear_shin", "parent": "rear_thigh", "length": 121.87, "rotation": -19.83, "x": 86.1, "y": -1.32, "color": "ff000dff" },
|
||||
{ "name": "rear_foot", "parent": "rear_shin", "length": 82.57, "rotation": 69.3, "x": 121.45, "y": -0.75, "color": "ff000dff" }
|
||||
],
|
||||
"slots": [
|
||||
{ "name": "rear_upper_arm", "bone": "rear_upper_arm", "attachment": "rear_upper_arm" },
|
||||
@ -54,7 +46,7 @@
|
||||
{ "name": "goggles", "bone": "head", "attachment": "goggles" },
|
||||
{ "name": "front_bracer", "bone": "front_bracer", "attachment": "front_bracer" },
|
||||
{ "name": "front_fist", "bone": "front_fist", "attachment": "front_fist_closed" },
|
||||
{ "name": "muzzle", "bone": "gunTip", "additive": true },
|
||||
{ "name": "muzzle", "bone": "gunTip", "blend": "additive" },
|
||||
{ "name": "head-bb", "bone": "head" }
|
||||
],
|
||||
"skins": {
|
||||
@ -96,7 +88,8 @@
|
||||
"head-bb": {
|
||||
"head": {
|
||||
"type": "boundingbox",
|
||||
"vertices": [ -19.143097, -70.30209, 40.80313, -118.074234, 257.77155, -115.61827, 285.16193, 57.18005, 120.77191, 164.95125, -5.067627, 76.94907 ]
|
||||
"vertexCount": 6,
|
||||
"vertices": [ -19.14, -70.3, 40.8, -118.07, 257.77, -115.61, 285.16, 57.18, 120.77, 164.95, -5.06, 76.94 ]
|
||||
}
|
||||
},
|
||||
"mouth": {
|
||||
@ -1832,10 +1825,6 @@
|
||||
]
|
||||
},
|
||||
"muzzle": {
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
],
|
||||
"color": [
|
||||
{
|
||||
"time": 0.1333,
|
||||
@ -1848,6 +1837,10 @@
|
||||
"curve": [ 0.821, 0, 0.909, 0.89 ]
|
||||
},
|
||||
{ "time": 0.2666, "color": "ffffff00" }
|
||||
],
|
||||
"attachment": [
|
||||
{ "time": 0.1333, "name": "muzzle" },
|
||||
{ "time": 0.2666, "name": null }
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -2015,7 +2008,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"draworder": [
|
||||
"drawOrder": [
|
||||
{
|
||||
"time": 0.6666,
|
||||
"offsets": [
|
||||
|
||||
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 678 KiB |
125
spine-starling/spine-starling-example/src/tank.atlas
Normal file
@ -0,0 +1,125 @@
|
||||
|
||||
tank.png
|
||||
size: 2048,1024
|
||||
format: RGBA8888
|
||||
filter: Linear,Linear
|
||||
repeat: none
|
||||
images/antenna
|
||||
rotate: true
|
||||
xy: 1295, 683
|
||||
size: 22, 303
|
||||
orig: 22, 303
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/cannon
|
||||
rotate: false
|
||||
xy: 2, 93
|
||||
size: 931, 58
|
||||
orig: 931, 58
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/cannonConnector
|
||||
rotate: true
|
||||
xy: 1676, 455
|
||||
size: 112, 135
|
||||
orig: 112, 135
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/guntower
|
||||
rotate: false
|
||||
xy: 1295, 707
|
||||
size: 730, 289
|
||||
orig: 730, 289
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/machinegun
|
||||
rotate: false
|
||||
xy: 2, 34
|
||||
size: 331, 57
|
||||
orig: 331, 57
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/machinegun-mount
|
||||
rotate: false
|
||||
xy: 1952, 609
|
||||
size: 72, 96
|
||||
orig: 72, 96
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/rock
|
||||
rotate: false
|
||||
xy: 935, 96
|
||||
size: 252, 55
|
||||
orig: 252, 55
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/tankBottom
|
||||
rotate: false
|
||||
xy: 2, 377
|
||||
size: 1285, 276
|
||||
orig: 1285, 276
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/tankBottom-shadow
|
||||
rotate: false
|
||||
xy: 2, 655
|
||||
size: 1291, 341
|
||||
orig: 1291, 341
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/tankTop
|
||||
rotate: false
|
||||
xy: 2, 153
|
||||
size: 1407, 222
|
||||
orig: 1407, 222
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/tread
|
||||
rotate: false
|
||||
xy: 2, 2
|
||||
size: 96, 30
|
||||
orig: 96, 30
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/tread-inside
|
||||
rotate: false
|
||||
xy: 335, 63
|
||||
size: 25, 28
|
||||
orig: 25, 28
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/wheel-big
|
||||
rotate: false
|
||||
xy: 1295, 490
|
||||
size: 191, 191
|
||||
orig: 191, 191
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/wheel-big-overlay
|
||||
rotate: false
|
||||
xy: 1488, 495
|
||||
size: 186, 186
|
||||
orig: 186, 186
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/wheel-mid
|
||||
rotate: false
|
||||
xy: 1676, 569
|
||||
size: 136, 136
|
||||
orig: 136, 136
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/wheel-mid-overlay
|
||||
rotate: false
|
||||
xy: 1814, 569
|
||||
size: 136, 136
|
||||
orig: 136, 136
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
images/wheel-small
|
||||
rotate: false
|
||||
xy: 1813, 496
|
||||
size: 71, 71
|
||||
orig: 71, 71
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
1899
spine-starling/spine-starling-example/src/tank.json
Normal file
BIN
spine-starling/spine-starling-example/src/tank.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
@ -1,8 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<AS3Classpath>
|
||||
<AS3LibraryFolder>lib</AS3LibraryFolder>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-1.7.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.0.1.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/airglobal.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/textLayout.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/osmf.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/authoringsupport.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/core.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/aircore.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/applicationupdater.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/applicationupdater_ui.swc</AS3Classpath>
|
||||
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/air/servicemonitor.swc</AS3Classpath>
|
||||
</AS3Classpath>
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
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=
|
||||
com.powerflasher.fdt.core.PassClasspath=true
|
||||
@ -12,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.PlayerVersion=11.1
|
||||
com.powerflasher.fdt.core.ProjectTypeHint=Web
|
||||
com.powerflasher.fdt.core.Runtime=Flash_Player
|
||||
com.powerflasher.fdt.core.PlatformType=AIR
|
||||
com.powerflasher.fdt.core.PlayerVersion=22.0
|
||||
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
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<exclude>
|
||||
<resource>SDK:frameworks/libs/air/aircore.swc</resource>
|
||||
<resource>SDK:frameworks/libs/air/airglobal.swc</resource>
|
||||
<resource>SDK:frameworks/libs/air/applicationupdater.swc</resource>
|
||||
<resource>SDK:frameworks/libs/air/applicationupdater_ui.swc</resource>
|
||||
<resource>SDK:frameworks/libs/air/servicemonitor.swc</resource>
|
||||
<resource>SDK:frameworks/libs/authoringsupport.swc</resource>
|
||||
<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>
|
||||
|
||||
@ -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/<project>=UTF-8
|
||||
|
||||
BIN
spine-starling/spine-starling/lib/starling-2.0.1.swc
Normal file
@ -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.<Number> = new <Number>[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.<Number> = new <Number>[];
|
||||
private var _verticesBuffer:VertexBuffer3D;
|
||||
|
||||
private var _trianglesCount:int;
|
||||
private var _triangles:Vector.<uint> = new <uint>[];
|
||||
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.<Number>, vl:int, uvs:Vector.<Number>, triangles:Vector.<uint>,
|
||||
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.<uint> = _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.<Number> = _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.<Number> = new <Number>[]; // 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.<uint> = new <uint>[]; // 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
/******************************************************************************
|
||||
* 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 starling.textures.Texture;
|
||||
import starling.styles.MeshStyle;
|
||||
import starling.rendering.IndexData;
|
||||
import starling.rendering.VertexData;
|
||||
import starling.display.Mesh;
|
||||
|
||||
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 getIndexData(): IndexData {
|
||||
return this.indexData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -38,14 +38,15 @@ import spine.atlas.AtlasRegion;
|
||||
import spine.attachments.Attachment;
|
||||
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 +55,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.<Number> = new Vector.<Number>(8);
|
||||
static private var _quadTriangles:Vector.<uint> = new <uint>[0, 1, 2, 2, 3, 0];
|
||||
static private var _tempVertices:Vector.<Number> = new Vector.<Number>(8);
|
||||
static internal var blendModes:Vector.<String> = new <String>[
|
||||
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.<Number> = _tempVertices;
|
||||
var drawOrder:Vector.<Slot> = 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.<Number>, triangles:Vector.<uint>;
|
||||
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 +79,100 @@ public class SkeletonSprite extends DisplayObject {
|
||||
var y:Number = skeleton.y;
|
||||
var drawOrder:Vector.<Slot> = skeleton.drawOrder;
|
||||
var worldVertices:Vector.<Number> = _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.<uint>, vertexData:VertexData;
|
||||
var uvs: Vector.<Number>;
|
||||
|
||||
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.worldVerticesLength;
|
||||
verticesCount = verticesLength >> 1;
|
||||
if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
|
||||
meshAttachment.computeWorldVertices(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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
@ -237,14 +189,9 @@ public class SkeletonSprite extends DisplayObject {
|
||||
region.computeWorldVertices(0, 0, slot.bone, worldVertices);
|
||||
} else if (attachment is MeshAttachment) {
|
||||
var mesh:MeshAttachment = MeshAttachment(attachment);
|
||||
verticesLength = mesh.vertices.length;
|
||||
verticesLength = mesh.worldVerticesLength;
|
||||
if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
|
||||
mesh.computeWorldVertices(0, 0, slot, worldVertices);
|
||||
} else if (attachment is WeightedMeshAttachment) {
|
||||
var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(attachment);
|
||||
verticesLength = weightedMesh.uvs.length;
|
||||
if (worldVertices.length < verticesLength) worldVertices.length = verticesLength;
|
||||
weightedMesh.computeWorldVertices(0, 0, slot, worldVertices);
|
||||
mesh.computeWorldVertices(slot, worldVertices);
|
||||
} else
|
||||
continue;
|
||||
for (var ii:int = 0; ii < verticesLength; ii += 2) {
|
||||
@ -298,8 +245,7 @@ public class SkeletonSprite extends DisplayObject {
|
||||
}
|
||||
|
||||
public function set smoothing (smoothing:String) : void {
|
||||
_smoothing = smoothing;
|
||||
if (_polygonBatch) _polygonBatch.smoothing = _smoothing;
|
||||
_smoothing = smoothing;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,13 +30,14 @@
|
||||
*****************************************************************************/
|
||||
|
||||
package spine.starling {
|
||||
import spine.attachments.PathAttachment;
|
||||
import starling.display.Image;
|
||||
import spine.Bone;
|
||||
import spine.Skin;
|
||||
import spine.attachments.AttachmentLoader;
|
||||
import spine.attachments.BoundingBoxAttachment;
|
||||
import spine.attachments.MeshAttachment;
|
||||
import spine.attachments.RegionAttachment;
|
||||
import spine.attachments.WeightedMeshAttachment;
|
||||
|
||||
import starling.textures.SubTexture;
|
||||
import starling.textures.Texture;
|
||||
@ -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,37 +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.
|
||||
var subTexture:SubTexture = texture as SubTexture;
|
||||
if (subTexture) {
|
||||
var root:Texture = subTexture.root;
|
||||
var rectRegion:Rectangle = atlas.getRegion(path);
|
||||
attachment.regionU = rectRegion.x / root.width;
|
||||
attachment.regionV = rectRegion.y / root.height;
|
||||
attachment.regionU2 = (rectRegion.x + subTexture.width) / root.width;
|
||||
attachment.regionV2 = (rectRegion.y + subTexture.height) / root.height;
|
||||
} else {
|
||||
attachment.regionU = 0;
|
||||
attachment.regionV = 1;
|
||||
attachment.regionU2 = 1;
|
||||
attachment.regionV2 = 0;
|
||||
}
|
||||
var frame:Rectangle = texture.frame;
|
||||
attachment.regionOffsetX = frame ? -frame.x : 0;
|
||||
attachment.regionOffsetY = frame ? -frame.y : 0;
|
||||
attachment.regionWidth = texture.width;
|
||||
attachment.regionHeight = texture.height;
|
||||
attachment.regionOriginalWidth = frame ? frame.width : texture.width;
|
||||
attachment.regionOriginalHeight = frame ? frame.height : texture.height;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public function newWeightedMeshAttachment (skin:Skin, name:String, path:String) : WeightedMeshAttachment {
|
||||
var texture:Texture = atlas.getTexture(path);
|
||||
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 +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;
|
||||
@ -148,6 +120,10 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader {
|
||||
public function newBoundingBoxAttachment (skin:Skin, name:String) : BoundingBoxAttachment {
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
|
||||
public function newPathAttachment (skin:Skin, name:String) : PathAttachment {
|
||||
return new PathAttachment(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||