mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
715578983c
Binary file not shown.
@ -198,7 +198,7 @@ public class SkeletonJson {
|
|||||||
|
|
||||||
pathConstraintData.positionMode = PositionMode[constraintMap["positionMode"] || "percent"];
|
pathConstraintData.positionMode = PositionMode[constraintMap["positionMode"] || "percent"];
|
||||||
pathConstraintData.spacingMode = SpacingMode[constraintMap["spacingMode"] || "length"];
|
pathConstraintData.spacingMode = SpacingMode[constraintMap["spacingMode"] || "length"];
|
||||||
pathConstraintData.rotateMode = RotateMode[constraintMap["rotateMode"] || "rotateMode"];
|
pathConstraintData.rotateMode = RotateMode[constraintMap["rotateMode"] || "tangent"];
|
||||||
pathConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
pathConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||||
pathConstraintData.position = Number(constraintMap["position"] || 0);
|
pathConstraintData.position = Number(constraintMap["position"] || 0);
|
||||||
if (pathConstraintData.positionMode == PositionMode.fixed) pathConstraintData.position *= scale;
|
if (pathConstraintData.positionMode == PositionMode.fixed) pathConstraintData.position *= scale;
|
||||||
|
|||||||
@ -208,11 +208,11 @@ spAtlas* spAtlas_create (const char* begin, int length, const char* dir, void* r
|
|||||||
page->height = toInt(tuple + 1);
|
page->height = toInt(tuple + 1);
|
||||||
if (!readTuple(&begin, end, tuple)) return abortAtlas(self);
|
if (!readTuple(&begin, end, tuple)) return abortAtlas(self);
|
||||||
}
|
}
|
||||||
page->format = (spAtlasFormat)indexOf(formatNames, 7, tuple);
|
page->format = (spAtlasFormat)indexOf(formatNames, 8, tuple);
|
||||||
|
|
||||||
if (!readTuple(&begin, end, tuple)) return abortAtlas(self);
|
if (!readTuple(&begin, end, tuple)) return abortAtlas(self);
|
||||||
page->minFilter = (spAtlasFilter)indexOf(textureFilterNames, 7, tuple);
|
page->minFilter = (spAtlasFilter)indexOf(textureFilterNames, 8, tuple);
|
||||||
page->magFilter = (spAtlasFilter)indexOf(textureFilterNames, 7, tuple + 1);
|
page->magFilter = (spAtlasFilter)indexOf(textureFilterNames, 8, tuple + 1);
|
||||||
|
|
||||||
if (!readValue(&begin, end, &str)) return abortAtlas(self);
|
if (!readValue(&begin, end, &str)) return abortAtlas(self);
|
||||||
|
|
||||||
|
|||||||
@ -72,8 +72,13 @@ spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spSkeletonBinary_dispose (spSkeletonBinary* self) {
|
void spSkeletonBinary_dispose (spSkeletonBinary* self) {
|
||||||
|
int i;
|
||||||
_spSkeletonBinary* internal = SUB_CAST(_spSkeletonBinary, self);
|
_spSkeletonBinary* internal = SUB_CAST(_spSkeletonBinary, self);
|
||||||
if (internal->ownsLoader) spAttachmentLoader_dispose(self->attachmentLoader);
|
if (internal->ownsLoader) spAttachmentLoader_dispose(self->attachmentLoader);
|
||||||
|
for (i = 0; i < internal->linkedMeshCount; ++i) {
|
||||||
|
FREE(internal->linkedMeshes[i].parent);
|
||||||
|
FREE(internal->linkedMeshes[i].skin);
|
||||||
|
}
|
||||||
FREE(internal->linkedMeshes);
|
FREE(internal->linkedMeshes);
|
||||||
FREE(self->error);
|
FREE(self->error);
|
||||||
FREE(self);
|
FREE(self);
|
||||||
@ -659,7 +664,7 @@ spAttachment* spSkeletonBinary_readAttachment(spSkeletonBinary* self, _dataInput
|
|||||||
int freeName = name != 0;
|
int freeName = name != 0;
|
||||||
if (!name) {
|
if (!name) {
|
||||||
freeName = 0;
|
freeName = 0;
|
||||||
MALLOC_STR(name, attachmentName);
|
name = attachmentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = (spAttachmentType)readByte(input);
|
type = (spAttachmentType)readByte(input);
|
||||||
@ -1011,7 +1016,9 @@ spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const
|
|||||||
skeletonData->animationsCount = readVarint(input, 1);
|
skeletonData->animationsCount = readVarint(input, 1);
|
||||||
skeletonData->animations = MALLOC(spAnimation*, skeletonData->animationsCount);
|
skeletonData->animations = MALLOC(spAnimation*, skeletonData->animationsCount);
|
||||||
for (i = 0; i < skeletonData->animationsCount; ++i) {
|
for (i = 0; i < skeletonData->animationsCount; ++i) {
|
||||||
spAnimation* animation = _spSkeletonBinary_readAnimation(self, readString(input), input, skeletonData);
|
const char* name = readString(input);
|
||||||
|
spAnimation* animation = _spSkeletonBinary_readAnimation(self, name, input, skeletonData);
|
||||||
|
FREE(name);
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
FREE(input);
|
FREE(input);
|
||||||
spSkeletonData_dispose(skeletonData);
|
spSkeletonData_dispose(skeletonData);
|
||||||
|
|||||||
@ -37,6 +37,10 @@
|
|||||||
#include <spine/AtlasAttachmentLoader.h>
|
#include <spine/AtlasAttachmentLoader.h>
|
||||||
#include <spine/Animation.h>
|
#include <spine/Animation.h>
|
||||||
|
|
||||||
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
|
||||||
|
#define strdup _strdup
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char* parent;
|
const char* parent;
|
||||||
const char* skin;
|
const char* skin;
|
||||||
@ -569,11 +573,18 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
|
|||||||
CONST_CAST(char*, self->error) = 0;
|
CONST_CAST(char*, self->error) = 0;
|
||||||
internal->linkedMeshCount = 0;
|
internal->linkedMeshCount = 0;
|
||||||
|
|
||||||
|
#ifndef __ANDROID__
|
||||||
oldLocale = strdup(setlocale(LC_NUMERIC, NULL));
|
oldLocale = strdup(setlocale(LC_NUMERIC, NULL));
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
|
#endif
|
||||||
|
|
||||||
root = Json_create(json);
|
root = Json_create(json);
|
||||||
|
|
||||||
|
#ifndef __ANDROID__
|
||||||
setlocale(LC_NUMERIC, oldLocale);
|
setlocale(LC_NUMERIC, oldLocale);
|
||||||
free(oldLocale);
|
free(oldLocale);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!root) {
|
if (!root) {
|
||||||
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
|
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Scene* GoblinsExample::scene () {
|
|||||||
bool GoblinsExample::init () {
|
bool GoblinsExample::init () {
|
||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithFile("goblins-mesh.json", "goblins.atlas", 1.5f);
|
skeletonNode = SkeletonAnimation::createWithJsonFile("goblins-mesh.json", "goblins.atlas", 1.5f);
|
||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "walk", true);
|
||||||
skeletonNode->setSkin("goblin");
|
skeletonNode->setSkin("goblin");
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Scene* RaptorExample::scene () {
|
|||||||
bool RaptorExample::init () {
|
bool RaptorExample::init () {
|
||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithFile("raptor.json", "raptor.atlas", 0.5f);
|
skeletonNode = SkeletonAnimation::createWithJsonFile("raptor.json", "raptor.atlas", 0.5f);
|
||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "walk", true);
|
||||||
skeletonNode->setAnimation(1, "empty", false);
|
skeletonNode->setAnimation(1, "empty", false);
|
||||||
skeletonNode->addAnimation(1, "gungrab", false, 2);
|
skeletonNode->addAnimation(1, "gungrab", false, 2);
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Scene* SpineboyExample::scene () {
|
|||||||
bool SpineboyExample::init () {
|
bool SpineboyExample::init () {
|
||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithFile("spineboy.json", "spineboy.atlas", 0.6f);
|
skeletonNode = SkeletonAnimation::createWithJsonFile("spineboy.json", "spineboy.atlas", 0.6f);
|
||||||
|
|
||||||
skeletonNode->setStartListener( [this] (int trackIndex) {
|
skeletonNode->setStartListener( [this] (int trackIndex) {
|
||||||
spTrackEntry* entry = spAnimationState_getCurrent(skeletonNode->getState(), trackIndex);
|
spTrackEntry* entry = spAnimationState_getCurrent(skeletonNode->getState(), trackIndex);
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Scene* TankExample::scene () {
|
|||||||
bool TankExample::init () {
|
bool TankExample::init () {
|
||||||
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
if (!LayerColor::initWithColor(Color4B(128, 128, 128, 255))) return false;
|
||||||
|
|
||||||
skeletonNode = SkeletonAnimation::createWithFile("tank.json", "tank.atlas", 0.5f);
|
skeletonNode = SkeletonAnimation::createWithJsonFile("tank.json", "tank.atlas", 0.5f);
|
||||||
skeletonNode->setAnimation(0, "drive", true);
|
skeletonNode->setAnimation(0, "drive", true);
|
||||||
|
|
||||||
skeletonNode->setPosition(Vec2(_contentSize.width / 2 + 400, 20));
|
skeletonNode->setPosition(Vec2(_contentSize.width / 2 + 400, 20));
|
||||||
|
|||||||
@ -46,6 +46,8 @@
|
|||||||
521A8E6519F0C34300D177D7 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6319F0C34300D177D7 /* Default-736h@3x.png */; };
|
521A8E6519F0C34300D177D7 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6319F0C34300D177D7 /* Default-736h@3x.png */; };
|
||||||
52B47A471A53D09C004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A461A53D09B004E4C60 /* Security.framework */; };
|
52B47A471A53D09C004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A461A53D09B004E4C60 /* Security.framework */; };
|
||||||
7602C5551D7DAA1300C7C674 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7602C5541D7DAA1300C7C674 /* CoreText.framework */; };
|
7602C5551D7DAA1300C7C674 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7602C5541D7DAA1300C7C674 /* CoreText.framework */; };
|
||||||
|
765B3E181DA283F90071C974 /* SkeletonBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = 765B3E171DA283F90071C974 /* SkeletonBinary.c */; };
|
||||||
|
765B3E191DA284060071C974 /* SkeletonBinary.c in Sources */ = {isa = PBXBuildFile; fileRef = 765B3E171DA283F90071C974 /* SkeletonBinary.c */; };
|
||||||
76AAA3C01D180F7C00C54FCB /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */; };
|
76AAA3C01D180F7C00C54FCB /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */; };
|
||||||
76AAA3C11D180F7C00C54FCB /* BatchingExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B61D180F7C00C54FCB /* BatchingExample.cpp */; };
|
76AAA3C11D180F7C00C54FCB /* BatchingExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B61D180F7C00C54FCB /* BatchingExample.cpp */; };
|
||||||
76AAA3C21D180F7C00C54FCB /* GoblinsExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B81D180F7C00C54FCB /* GoblinsExample.cpp */; };
|
76AAA3C21D180F7C00C54FCB /* GoblinsExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76AAA3B81D180F7C00C54FCB /* GoblinsExample.cpp */; };
|
||||||
@ -244,6 +246,8 @@
|
|||||||
521A8E6319F0C34300D177D7 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
|
521A8E6319F0C34300D177D7 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
|
||||||
52B47A461A53D09B004E4C60 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
|
52B47A461A53D09B004E4C60 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
7602C5541D7DAA1300C7C674 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; };
|
7602C5541D7DAA1300C7C674 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
765B3E161DA283F90071C974 /* kvec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kvec.h; path = "../../../spine-c/src/spine/kvec.h"; sourceTree = "<group>"; };
|
||||||
|
765B3E171DA283F90071C974 /* SkeletonBinary.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SkeletonBinary.c; path = "../../../spine-c/src/spine/SkeletonBinary.c"; sourceTree = "<group>"; };
|
||||||
76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
|
76AAA3B31D180F7C00C54FCB /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
|
||||||
76AAA3B41D180F7C00C54FCB /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
76AAA3B41D180F7C00C54FCB /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
76AAA3B51D180F7C00C54FCB /* AppMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppMacros.h; sourceTree = "<group>"; };
|
76AAA3B51D180F7C00C54FCB /* AppMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppMacros.h; sourceTree = "<group>"; };
|
||||||
@ -519,6 +523,8 @@
|
|||||||
76AAA3B21D180F7300C54FCB /* spine */ = {
|
76AAA3B21D180F7300C54FCB /* spine */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
765B3E161DA283F90071C974 /* kvec.h */,
|
||||||
|
765B3E171DA283F90071C974 /* SkeletonBinary.c */,
|
||||||
76F5BCF41D2BB57F005917E5 /* Animation.c */,
|
76F5BCF41D2BB57F005917E5 /* Animation.c */,
|
||||||
76F5BCF51D2BB57F005917E5 /* AnimationState.c */,
|
76F5BCF51D2BB57F005917E5 /* AnimationState.c */,
|
||||||
76F5BCF61D2BB57F005917E5 /* AnimationStateData.c */,
|
76F5BCF61D2BB57F005917E5 /* AnimationStateData.c */,
|
||||||
@ -741,6 +747,7 @@
|
|||||||
76F5BD201D2BB57F005917E5 /* extension.c in Sources */,
|
76F5BD201D2BB57F005917E5 /* extension.c in Sources */,
|
||||||
76AAA3C01D180F7C00C54FCB /* AppDelegate.cpp in Sources */,
|
76AAA3C01D180F7C00C54FCB /* AppDelegate.cpp in Sources */,
|
||||||
76AAA3C41D180F7C00C54FCB /* SimpleCommand.cpp in Sources */,
|
76AAA3C41D180F7C00C54FCB /* SimpleCommand.cpp in Sources */,
|
||||||
|
765B3E181DA283F90071C974 /* SkeletonBinary.c in Sources */,
|
||||||
76F5BD261D2BB57F005917E5 /* PathConstraint.c in Sources */,
|
76F5BD261D2BB57F005917E5 /* PathConstraint.c in Sources */,
|
||||||
503AE10017EB989F00D1A890 /* AppController.mm in Sources */,
|
503AE10017EB989F00D1A890 /* AppController.mm in Sources */,
|
||||||
76AAA40E1D18106000C54FCB /* SkeletonAnimation.cpp in Sources */,
|
76AAA40E1D18106000C54FCB /* SkeletonAnimation.cpp in Sources */,
|
||||||
@ -768,6 +775,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
765B3E191DA284060071C974 /* SkeletonBinary.c in Sources */,
|
||||||
76F5BD561D2BD7EF005917E5 /* TankExample.cpp in Sources */,
|
76F5BD561D2BD7EF005917E5 /* TankExample.cpp in Sources */,
|
||||||
76F5BD571D2BD7EF005917E5 /* TankExample.h in Sources */,
|
76F5BD571D2BD7EF005917E5 /* TankExample.h in Sources */,
|
||||||
76F5BD331D2BD4A9005917E5 /* Animation.c in Sources */,
|
76F5BD331D2BD4A9005917E5 /* Animation.c in Sources */,
|
||||||
|
|||||||
@ -72,24 +72,46 @@ void disposeTrackEntry (spTrackEntry* entry) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
SkeletonAnimation* SkeletonAnimation::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
SkeletonAnimation* SkeletonAnimation::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
||||||
SkeletonAnimation* node = new SkeletonAnimation(skeletonData, ownsSkeletonData);
|
SkeletonAnimation* node = new SkeletonAnimation();
|
||||||
|
node->initWithData(skeletonData, ownsSkeletonData);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonAnimation* SkeletonAnimation::createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale) {
|
||||||
SkeletonAnimation* node = new SkeletonAnimation(skeletonDataFile, atlas, scale);
|
SkeletonAnimation* node = new SkeletonAnimation();
|
||||||
|
node->initWithJsonFile(skeletonJsonFile, atlas, scale);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonAnimation* SkeletonAnimation::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale) {
|
||||||
SkeletonAnimation* node = new SkeletonAnimation(skeletonDataFile, atlasFile, scale);
|
SkeletonAnimation* node = new SkeletonAnimation();
|
||||||
|
spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
||||||
|
node->initWithJsonFile(skeletonJsonFile, atlas, scale);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, spAtlas* atlas, float scale) {
|
||||||
|
SkeletonAnimation* node = new SkeletonAnimation();
|
||||||
|
node->initWithBinaryFile(skeletonBinaryFile, atlas, scale);
|
||||||
|
node->autorelease();
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale) {
|
||||||
|
SkeletonAnimation* node = new SkeletonAnimation();
|
||||||
|
spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
||||||
|
node->initWithBinaryFile(skeletonBinaryFile, atlas, scale);
|
||||||
|
node->autorelease();
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SkeletonAnimation::initialize () {
|
void SkeletonAnimation::initialize () {
|
||||||
|
super::initialize();
|
||||||
|
|
||||||
_ownsAnimationStateData = true;
|
_ownsAnimationStateData = true;
|
||||||
_state = spAnimationState_create(spAnimationStateData_create(_skeleton->data));
|
_state = spAnimationState_create(spAnimationStateData_create(_skeleton->data));
|
||||||
_state->rendererObject = this;
|
_state->rendererObject = this;
|
||||||
@ -103,21 +125,6 @@ SkeletonAnimation::SkeletonAnimation ()
|
|||||||
: SkeletonRenderer() {
|
: SkeletonRenderer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonAnimation::SkeletonAnimation (spSkeletonData *skeletonData, bool ownsSkeletonData)
|
|
||||||
: SkeletonRenderer(skeletonData, ownsSkeletonData) {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonAnimation::SkeletonAnimation (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
|
|
||||||
: SkeletonRenderer(skeletonDataFile, atlas, scale) {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonAnimation::SkeletonAnimation (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
|
||||||
: SkeletonRenderer(skeletonDataFile, atlasFile, scale) {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonAnimation::~SkeletonAnimation () {
|
SkeletonAnimation::~SkeletonAnimation () {
|
||||||
if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data);
|
if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data);
|
||||||
spAnimationState_dispose(_state);
|
spAnimationState_dispose(_state);
|
||||||
|
|||||||
@ -49,10 +49,23 @@ class SkeletonAnimation: public SkeletonRenderer {
|
|||||||
public:
|
public:
|
||||||
CREATE_FUNC(SkeletonAnimation);
|
CREATE_FUNC(SkeletonAnimation);
|
||||||
static SkeletonAnimation* createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
static SkeletonAnimation* createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
||||||
static SkeletonAnimation* createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
static SkeletonAnimation* createWithJsonFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale = 1);
|
||||||
static SkeletonAnimation* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
static SkeletonAnimation* createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
static SkeletonAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, spAtlas* atlas, float scale = 1);
|
||||||
|
static SkeletonAnimation* createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
|
||||||
virtual void update (float deltaTime);
|
// Use createWithJsonFile instead
|
||||||
|
CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale = 1)
|
||||||
|
{
|
||||||
|
return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlas, scale);
|
||||||
|
}
|
||||||
|
// Use createWithJsonFile instead
|
||||||
|
CC_DEPRECATED_ATTRIBUTE static SkeletonAnimation* createWithile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale = 1)
|
||||||
|
{
|
||||||
|
return SkeletonAnimation::createWithJsonFile(skeletonJsonFile, atlasFile, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void update (float deltaTime) override;
|
||||||
|
|
||||||
void setAnimationStateData (spAnimationStateData* stateData);
|
void setAnimationStateData (spAnimationStateData* stateData);
|
||||||
void setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration);
|
void setMix (const std::string& fromAnimation, const std::string& toAnimation, float duration);
|
||||||
@ -81,11 +94,8 @@ public:
|
|||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
SkeletonAnimation ();
|
SkeletonAnimation ();
|
||||||
SkeletonAnimation (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
|
||||||
SkeletonAnimation (const std::string&skeletonDataFile, spAtlas* atlas, float scale = 1);
|
|
||||||
SkeletonAnimation (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
|
||||||
virtual ~SkeletonAnimation ();
|
virtual ~SkeletonAnimation ();
|
||||||
void initialize ();
|
virtual void initialize () override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
spAnimationState* _state;
|
spAnimationState* _state;
|
||||||
|
|||||||
@ -81,7 +81,13 @@ namespace spine {
|
|||||||
void SkeletonBatch::addCommand (cocos2d::Renderer* renderer, float globalZOrder, GLuint textureID, GLProgramState* glProgramState,
|
void SkeletonBatch::addCommand (cocos2d::Renderer* renderer, float globalZOrder, GLuint textureID, GLProgramState* glProgramState,
|
||||||
BlendFunc blendFunc, const TrianglesCommand::Triangles& triangles, const Mat4& transform, uint32_t transformFlags
|
BlendFunc blendFunc, const TrianglesCommand::Triangles& triangles, const Mat4& transform, uint32_t transformFlags
|
||||||
) {
|
) {
|
||||||
_command->triangles->verts = triangles.verts;
|
if (_command->triangles->verts) {
|
||||||
|
free(_command->triangles->verts);
|
||||||
|
_command->triangles->verts = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
_command->triangles->verts = (V3F_C4B_T2F *)malloc(sizeof(V3F_C4B_T2F) * triangles.vertCount);
|
||||||
|
memcpy(_command->triangles->verts, triangles.verts, sizeof(V3F_C4B_T2F) * triangles.vertCount);
|
||||||
|
|
||||||
_command->triangles->vertCount = triangles.vertCount;
|
_command->triangles->vertCount = triangles.vertCount;
|
||||||
_command->triangles->indexCount = triangles.indexCount;
|
_command->triangles->indexCount = triangles.indexCount;
|
||||||
@ -102,6 +108,9 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkeletonBatch::Command::~Command () {
|
SkeletonBatch::Command::~Command () {
|
||||||
|
if (triangles->verts) {
|
||||||
|
free(triangles->verts);
|
||||||
|
}
|
||||||
delete triangles;
|
delete triangles;
|
||||||
delete trianglesCommand;
|
delete trianglesCommand;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,12 +85,12 @@ SkeletonRenderer::SkeletonRenderer (spSkeletonData *skeletonData, bool ownsSkele
|
|||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
|
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _timeScale(1) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _timeScale(1) {
|
||||||
initWithFile(skeletonDataFile, atlas, scale);
|
initWithJsonFile(skeletonDataFile, atlas, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _timeScale(1) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _debugSlots(false), _debugBones(false), _timeScale(1) {
|
||||||
initWithFile(skeletonDataFile, atlasFile, scale);
|
initWithJsonFile(skeletonDataFile, atlasFile, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::~SkeletonRenderer () {
|
SkeletonRenderer::~SkeletonRenderer () {
|
||||||
@ -98,7 +98,7 @@ SkeletonRenderer::~SkeletonRenderer () {
|
|||||||
spSkeleton_dispose(_skeleton);
|
spSkeleton_dispose(_skeleton);
|
||||||
if (_atlas) spAtlas_dispose(_atlas);
|
if (_atlas) spAtlas_dispose(_atlas);
|
||||||
if (_attachmentLoader) spAttachmentLoader_dispose(_attachmentLoader);
|
if (_attachmentLoader) spAttachmentLoader_dispose(_attachmentLoader);
|
||||||
delete _worldVertices;
|
delete [] _worldVertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
||||||
@ -107,7 +107,7 @@ void SkeletonRenderer::initWithData (spSkeletonData* skeletonData, bool ownsSkel
|
|||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||||
_atlas = atlas;
|
_atlas = atlas;
|
||||||
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void SkeletonRenderer::initWithFile (const std::string& skeletonDataFile, spAtla
|
|||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||||
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
||||||
CCASSERT(_atlas, "Error reading atlas file.");
|
CCASSERT(_atlas, "Error reading atlas file.");
|
||||||
|
|
||||||
@ -139,6 +139,38 @@ void SkeletonRenderer::initWithFile (const std::string& skeletonDataFile, const
|
|||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
||||||
|
_atlas = atlas;
|
||||||
|
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
||||||
|
|
||||||
|
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
|
||||||
|
binary->scale = scale;
|
||||||
|
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
|
||||||
|
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
|
||||||
|
spSkeletonBinary_dispose(binary);
|
||||||
|
|
||||||
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||||
|
_atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
||||||
|
CCASSERT(_atlas, "Error reading atlas file.");
|
||||||
|
|
||||||
|
_attachmentLoader = SUPER(Cocos2dAttachmentLoader_create(_atlas));
|
||||||
|
|
||||||
|
spSkeletonBinary* binary = spSkeletonBinary_createWithLoader(_attachmentLoader);
|
||||||
|
binary->scale = scale;
|
||||||
|
spSkeletonData* skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, skeletonDataFile.c_str());
|
||||||
|
CCASSERT(skeletonData, binary->error ? binary->error : "Error reading skeleton data file.");
|
||||||
|
spSkeletonBinary_dispose(binary);
|
||||||
|
|
||||||
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SkeletonRenderer::update (float deltaTime) {
|
void SkeletonRenderer::update (float deltaTime) {
|
||||||
spSkeleton_update(_skeleton, deltaTime * _timeScale);
|
spSkeleton_update(_skeleton, deltaTime * _timeScale);
|
||||||
|
|||||||
@ -108,10 +108,12 @@ CC_CONSTRUCTOR_ACCESS:
|
|||||||
virtual ~SkeletonRenderer ();
|
virtual ~SkeletonRenderer ();
|
||||||
|
|
||||||
void initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
void initWithData (spSkeletonData* skeletonData, bool ownsSkeletonData = false);
|
||||||
void initWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
void initWithJsonFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
||||||
void initWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
void initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
void initWithBinaryFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale = 1);
|
||||||
|
void initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
|
||||||
void initialize ();
|
virtual void initialize ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
void setSkeletonData (spSkeletonData* skeletonData, bool ownsSkeletonData);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
262
spine-ts/build/spine-all.d.ts
vendored
262
spine-ts/build/spine-all.d.ts
vendored
@ -322,6 +322,135 @@ declare module spine {
|
|||||||
getMix(from: Animation, to: Animation): number;
|
getMix(from: Animation, to: Animation): number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare module spine {
|
||||||
|
abstract class Attachment {
|
||||||
|
name: string;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
abstract class VertexAttachment extends Attachment {
|
||||||
|
bones: Array<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
worldVerticesLength: number;
|
||||||
|
constructor(name: string);
|
||||||
|
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||||
|
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
interface AttachmentLoader {
|
||||||
|
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||||
|
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||||
|
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||||
|
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
enum AttachmentType {
|
||||||
|
Region = 0,
|
||||||
|
BoundingBox = 1,
|
||||||
|
Mesh = 2,
|
||||||
|
LinkedMesh = 3,
|
||||||
|
Path = 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class BoundingBoxAttachment extends VertexAttachment {
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class MeshAttachment extends VertexAttachment {
|
||||||
|
region: TextureRegion;
|
||||||
|
path: string;
|
||||||
|
regionUVs: ArrayLike<number>;
|
||||||
|
worldVertices: ArrayLike<number>;
|
||||||
|
triangles: Array<number>;
|
||||||
|
color: Color;
|
||||||
|
hullLength: number;
|
||||||
|
private parentMesh;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
updateUVs(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
getParentMesh(): MeshAttachment;
|
||||||
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class PathAttachment extends VertexAttachment {
|
||||||
|
lengths: Array<number>;
|
||||||
|
closed: boolean;
|
||||||
|
constantSpeed: boolean;
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class RegionAttachment extends Attachment {
|
||||||
|
static OX1: number;
|
||||||
|
static OY1: number;
|
||||||
|
static OX2: number;
|
||||||
|
static OY2: number;
|
||||||
|
static OX3: number;
|
||||||
|
static OY3: number;
|
||||||
|
static OX4: number;
|
||||||
|
static OY4: number;
|
||||||
|
static X1: number;
|
||||||
|
static Y1: number;
|
||||||
|
static C1R: number;
|
||||||
|
static C1G: number;
|
||||||
|
static C1B: number;
|
||||||
|
static C1A: number;
|
||||||
|
static U1: number;
|
||||||
|
static V1: number;
|
||||||
|
static X2: number;
|
||||||
|
static Y2: number;
|
||||||
|
static C2R: number;
|
||||||
|
static C2G: number;
|
||||||
|
static C2B: number;
|
||||||
|
static C2A: number;
|
||||||
|
static U2: number;
|
||||||
|
static V2: number;
|
||||||
|
static X3: number;
|
||||||
|
static Y3: number;
|
||||||
|
static C3R: number;
|
||||||
|
static C3G: number;
|
||||||
|
static C3B: number;
|
||||||
|
static C3A: number;
|
||||||
|
static U3: number;
|
||||||
|
static V3: number;
|
||||||
|
static X4: number;
|
||||||
|
static Y4: number;
|
||||||
|
static C4R: number;
|
||||||
|
static C4G: number;
|
||||||
|
static C4B: number;
|
||||||
|
static C4A: number;
|
||||||
|
static U4: number;
|
||||||
|
static V4: number;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
scaleX: number;
|
||||||
|
scaleY: number;
|
||||||
|
rotation: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: Color;
|
||||||
|
path: string;
|
||||||
|
rendererObject: any;
|
||||||
|
region: TextureRegion;
|
||||||
|
offset: ArrayLike<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
setRegion(region: TextureRegion): void;
|
||||||
|
updateOffset(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
enum BlendMode {
|
enum BlendMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
@ -783,7 +912,7 @@ declare module spine {
|
|||||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||||
static newFloatArray(size: number): ArrayLike<number>;
|
static newFloatArray(size: number): ArrayLike<number>;
|
||||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||||
}
|
}
|
||||||
class DebugUtils {
|
class DebugUtils {
|
||||||
static logBones(skeleton: Skeleton): void;
|
static logBones(skeleton: Skeleton): void;
|
||||||
@ -815,134 +944,9 @@ declare module spine {
|
|||||||
private frameTime;
|
private frameTime;
|
||||||
update(): void;
|
update(): void;
|
||||||
}
|
}
|
||||||
}
|
interface ArrayLike<T> {
|
||||||
declare module spine {
|
length: number;
|
||||||
abstract class Attachment {
|
[n: number]: T;
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
abstract class VertexAttachment extends Attachment {
|
|
||||||
bones: Array<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
worldVerticesLength: number;
|
|
||||||
constructor(name: string);
|
|
||||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
|
||||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
interface AttachmentLoader {
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
enum AttachmentType {
|
|
||||||
Region = 0,
|
|
||||||
BoundingBox = 1,
|
|
||||||
Mesh = 2,
|
|
||||||
LinkedMesh = 3,
|
|
||||||
Path = 4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class BoundingBoxAttachment extends VertexAttachment {
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class MeshAttachment extends VertexAttachment {
|
|
||||||
region: TextureRegion;
|
|
||||||
path: string;
|
|
||||||
regionUVs: ArrayLike<number>;
|
|
||||||
worldVertices: ArrayLike<number>;
|
|
||||||
triangles: Array<number>;
|
|
||||||
color: Color;
|
|
||||||
hullLength: number;
|
|
||||||
private parentMesh;
|
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
updateUVs(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class PathAttachment extends VertexAttachment {
|
|
||||||
lengths: Array<number>;
|
|
||||||
closed: boolean;
|
|
||||||
constantSpeed: boolean;
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class RegionAttachment extends Attachment {
|
|
||||||
static OX1: number;
|
|
||||||
static OY1: number;
|
|
||||||
static OX2: number;
|
|
||||||
static OY2: number;
|
|
||||||
static OX3: number;
|
|
||||||
static OY3: number;
|
|
||||||
static OX4: number;
|
|
||||||
static OY4: number;
|
|
||||||
static X1: number;
|
|
||||||
static Y1: number;
|
|
||||||
static C1R: number;
|
|
||||||
static C1G: number;
|
|
||||||
static C1B: number;
|
|
||||||
static C1A: number;
|
|
||||||
static U1: number;
|
|
||||||
static V1: number;
|
|
||||||
static X2: number;
|
|
||||||
static Y2: number;
|
|
||||||
static C2R: number;
|
|
||||||
static C2G: number;
|
|
||||||
static C2B: number;
|
|
||||||
static C2A: number;
|
|
||||||
static U2: number;
|
|
||||||
static V2: number;
|
|
||||||
static X3: number;
|
|
||||||
static Y3: number;
|
|
||||||
static C3R: number;
|
|
||||||
static C3G: number;
|
|
||||||
static C3B: number;
|
|
||||||
static C3A: number;
|
|
||||||
static U3: number;
|
|
||||||
static V3: number;
|
|
||||||
static X4: number;
|
|
||||||
static Y4: number;
|
|
||||||
static C4R: number;
|
|
||||||
static C4G: number;
|
|
||||||
static C4B: number;
|
|
||||||
static C4A: number;
|
|
||||||
static U4: number;
|
|
||||||
static V4: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
rotation: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
color: Color;
|
|
||||||
path: string;
|
|
||||||
rendererObject: any;
|
|
||||||
region: TextureRegion;
|
|
||||||
offset: ArrayLike<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
setRegion(region: TextureRegion): void;
|
|
||||||
updateOffset(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine.threejs {
|
declare module spine.threejs {
|
||||||
|
|||||||
@ -1117,16 +1117,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
var event_1 = events[ii];
|
var event_1 = events[ii];
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.event != null)
|
||||||
current.listener.event(i, event_1);
|
current.listener.event(i, event_1);
|
||||||
for (var iii = 0; iii < listenerCount; iii++)
|
for (var iii = 0; iii < listenerCount; iii++)
|
||||||
|
if (this.listeners[iii].event)
|
||||||
this.listeners[iii].event(i, event_1);
|
this.listeners[iii].event(i, event_1);
|
||||||
}
|
}
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
var count = spine.MathUtils.toInt(time / endTime);
|
var count = spine.MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.complete)
|
||||||
current.listener.complete(i, count);
|
current.listener.complete(i, count);
|
||||||
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
|
if (this.listeners[ii].complete)
|
||||||
this.listeners[ii].complete(i, count);
|
this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -1143,9 +1145,10 @@ var spine;
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (current == null)
|
if (current == null)
|
||||||
return;
|
return;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(trackIndex);
|
current.listener.end(trackIndex);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(trackIndex);
|
this.listeners[i].end(trackIndex);
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
this.freeAll(current);
|
this.freeAll(current);
|
||||||
@ -1168,9 +1171,10 @@ var spine;
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
var previous = current.previous;
|
var previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(index);
|
current.listener.end(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(index);
|
this.listeners[i].end(index);
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -1184,9 +1188,10 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
if (entry.listener != null)
|
if (entry.listener != null && entry.listener.start != null)
|
||||||
entry.listener.start(index);
|
entry.listener.start(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].start)
|
||||||
this.listeners[i].start(index);
|
this.listeners[i].start(index);
|
||||||
};
|
};
|
||||||
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
||||||
@ -1334,6 +1339,423 @@ var spine;
|
|||||||
spine.AnimationStateData = AnimationStateData;
|
spine.AnimationStateData = AnimationStateData;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var Attachment = (function () {
|
||||||
|
function Attachment(name) {
|
||||||
|
if (name == null)
|
||||||
|
throw new Error("name cannot be null.");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
return Attachment;
|
||||||
|
}());
|
||||||
|
spine.Attachment = Attachment;
|
||||||
|
var VertexAttachment = (function (_super) {
|
||||||
|
__extends(VertexAttachment, _super);
|
||||||
|
function VertexAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.worldVerticesLength = 0;
|
||||||
|
}
|
||||||
|
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||||
|
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||||
|
count += offset;
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||||
|
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var v = 0, skip = 0;
|
||||||
|
for (var i = 0; i < start; i += 2) {
|
||||||
|
var n = bones[v];
|
||||||
|
v += n + 1;
|
||||||
|
skip += n;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment;
|
||||||
|
};
|
||||||
|
return VertexAttachment;
|
||||||
|
}(Attachment));
|
||||||
|
spine.VertexAttachment = VertexAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
(function (AttachmentType) {
|
||||||
|
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||||
|
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||||
|
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||||
|
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||||
|
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||||
|
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||||
|
var AttachmentType = spine.AttachmentType;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var BoundingBoxAttachment = (function (_super) {
|
||||||
|
__extends(BoundingBoxAttachment, _super);
|
||||||
|
function BoundingBoxAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return BoundingBoxAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var MeshAttachment = (function (_super) {
|
||||||
|
__extends(MeshAttachment, _super);
|
||||||
|
function MeshAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.inheritDeform = false;
|
||||||
|
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
MeshAttachment.prototype.updateUVs = function () {
|
||||||
|
var regionUVs = this.regionUVs;
|
||||||
|
var verticesLength = regionUVs.length;
|
||||||
|
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||||
|
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||||
|
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||||
|
var u = 0, v = 0, width = 0, height = 0;
|
||||||
|
if (this.region == null) {
|
||||||
|
u = v = 0;
|
||||||
|
width = height = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = this.region.u;
|
||||||
|
v = this.region.v;
|
||||||
|
width = this.region.u2 - u;
|
||||||
|
height = this.region.v2 - v;
|
||||||
|
}
|
||||||
|
if (this.region.rotate) {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||||
|
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||||
|
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
var verticesLength = vertices.length;
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||||
|
var vx = vertices[v], vy = vertices[v + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
|
return this.parentMesh;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
if (parentMesh != null) {
|
||||||
|
this.bones = parentMesh.bones;
|
||||||
|
this.vertices = parentMesh.vertices;
|
||||||
|
this.regionUVs = parentMesh.regionUVs;
|
||||||
|
this.triangles = parentMesh.triangles;
|
||||||
|
this.hullLength = parentMesh.hullLength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return MeshAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.MeshAttachment = MeshAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var PathAttachment = (function (_super) {
|
||||||
|
__extends(PathAttachment, _super);
|
||||||
|
function PathAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.closed = false;
|
||||||
|
this.constantSpeed = false;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return PathAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.PathAttachment = PathAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var RegionAttachment = (function (_super) {
|
||||||
|
__extends(RegionAttachment, _super);
|
||||||
|
function RegionAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.x = 0;
|
||||||
|
this.y = 0;
|
||||||
|
this.scaleX = 1;
|
||||||
|
this.scaleY = 1;
|
||||||
|
this.rotation = 0;
|
||||||
|
this.width = 0;
|
||||||
|
this.height = 0;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.offset = spine.Utils.newFloatArray(8);
|
||||||
|
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||||
|
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
RegionAttachment.prototype.setRegion = function (region) {
|
||||||
|
var vertices = this.vertices;
|
||||||
|
if (region.rotate) {
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v2;
|
||||||
|
vertices[RegionAttachment.U3] = region.u;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v;
|
||||||
|
vertices[RegionAttachment.U1] = region.u2;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertices[RegionAttachment.U1] = region.u;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v;
|
||||||
|
vertices[RegionAttachment.U3] = region.u2;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
|
}
|
||||||
|
this.region = region;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateOffset = function () {
|
||||||
|
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||||
|
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||||
|
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||||
|
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||||
|
var localX2 = localX + this.region.width * regionScaleX;
|
||||||
|
var localY2 = localY + this.region.height * regionScaleY;
|
||||||
|
var radians = this.rotation * Math.PI / 180;
|
||||||
|
var cos = Math.cos(radians);
|
||||||
|
var sin = Math.sin(radians);
|
||||||
|
var localXCos = localX * cos + this.x;
|
||||||
|
var localXSin = localX * sin;
|
||||||
|
var localYCos = localY * cos + this.y;
|
||||||
|
var localYSin = localY * sin;
|
||||||
|
var localX2Cos = localX2 * cos + this.x;
|
||||||
|
var localX2Sin = localX2 * sin;
|
||||||
|
var localY2Cos = localY2 * cos + this.y;
|
||||||
|
var localY2Sin = localY2 * sin;
|
||||||
|
var offset = this.offset;
|
||||||
|
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||||
|
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||||
|
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||||
|
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||||
|
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||||
|
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color;
|
||||||
|
var slotColor = slot.color;
|
||||||
|
var regionColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var offset = this.offset;
|
||||||
|
var bone = slot.bone;
|
||||||
|
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
var offsetX = 0, offsetY = 0;
|
||||||
|
offsetX = offset[RegionAttachment.OX1];
|
||||||
|
offsetY = offset[RegionAttachment.OY1];
|
||||||
|
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX2];
|
||||||
|
offsetY = offset[RegionAttachment.OY2];
|
||||||
|
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX3];
|
||||||
|
offsetY = offset[RegionAttachment.OY3];
|
||||||
|
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX4];
|
||||||
|
offsetY = offset[RegionAttachment.OY4];
|
||||||
|
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
return vertices;
|
||||||
|
};
|
||||||
|
RegionAttachment.OX1 = 0;
|
||||||
|
RegionAttachment.OY1 = 1;
|
||||||
|
RegionAttachment.OX2 = 2;
|
||||||
|
RegionAttachment.OY2 = 3;
|
||||||
|
RegionAttachment.OX3 = 4;
|
||||||
|
RegionAttachment.OY3 = 5;
|
||||||
|
RegionAttachment.OX4 = 6;
|
||||||
|
RegionAttachment.OY4 = 7;
|
||||||
|
RegionAttachment.X1 = 0;
|
||||||
|
RegionAttachment.Y1 = 1;
|
||||||
|
RegionAttachment.C1R = 2;
|
||||||
|
RegionAttachment.C1G = 3;
|
||||||
|
RegionAttachment.C1B = 4;
|
||||||
|
RegionAttachment.C1A = 5;
|
||||||
|
RegionAttachment.U1 = 6;
|
||||||
|
RegionAttachment.V1 = 7;
|
||||||
|
RegionAttachment.X2 = 8;
|
||||||
|
RegionAttachment.Y2 = 9;
|
||||||
|
RegionAttachment.C2R = 10;
|
||||||
|
RegionAttachment.C2G = 11;
|
||||||
|
RegionAttachment.C2B = 12;
|
||||||
|
RegionAttachment.C2A = 13;
|
||||||
|
RegionAttachment.U2 = 14;
|
||||||
|
RegionAttachment.V2 = 15;
|
||||||
|
RegionAttachment.X3 = 16;
|
||||||
|
RegionAttachment.Y3 = 17;
|
||||||
|
RegionAttachment.C3R = 18;
|
||||||
|
RegionAttachment.C3G = 19;
|
||||||
|
RegionAttachment.C3B = 20;
|
||||||
|
RegionAttachment.C3A = 21;
|
||||||
|
RegionAttachment.U3 = 22;
|
||||||
|
RegionAttachment.V3 = 23;
|
||||||
|
RegionAttachment.X4 = 24;
|
||||||
|
RegionAttachment.Y4 = 25;
|
||||||
|
RegionAttachment.C4R = 26;
|
||||||
|
RegionAttachment.C4G = 27;
|
||||||
|
RegionAttachment.C4B = 28;
|
||||||
|
RegionAttachment.C4A = 29;
|
||||||
|
RegionAttachment.U4 = 30;
|
||||||
|
RegionAttachment.V4 = 31;
|
||||||
|
return RegionAttachment;
|
||||||
|
}(spine.Attachment));
|
||||||
|
spine.RegionAttachment = RegionAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
(function (BlendMode) {
|
(function (BlendMode) {
|
||||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||||
@ -3726,7 +4148,7 @@ var spine;
|
|||||||
for (var key in dictionary) {
|
for (var key in dictionary) {
|
||||||
var skinAttachment = dictionary[key];
|
var skinAttachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
var attachment = this.getAttachment(slotIndex, name);
|
var attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null)
|
if (attachment != null)
|
||||||
slot.setAttachment(attachment);
|
slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
@ -3970,7 +4392,6 @@ var spine;
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
var attachment = new spine.RegionAttachment(name);
|
var attachment = new spine.RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
};
|
};
|
||||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||||
@ -4340,422 +4761,6 @@ var spine;
|
|||||||
spine.TimeKeeper = TimeKeeper;
|
spine.TimeKeeper = TimeKeeper;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
(function (spine) {
|
|
||||||
var Attachment = (function () {
|
|
||||||
function Attachment(name) {
|
|
||||||
if (name == null)
|
|
||||||
throw new Error("name cannot be null.");
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
return Attachment;
|
|
||||||
}());
|
|
||||||
spine.Attachment = Attachment;
|
|
||||||
var VertexAttachment = (function (_super) {
|
|
||||||
__extends(VertexAttachment, _super);
|
|
||||||
function VertexAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.worldVerticesLength = 0;
|
|
||||||
}
|
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
|
||||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
|
||||||
count += offset;
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
|
||||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var v = 0, skip = 0;
|
|
||||||
for (var i = 0; i < start; i += 2) {
|
|
||||||
var n = bones[v];
|
|
||||||
v += n + 1;
|
|
||||||
skip += n;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
return VertexAttachment;
|
|
||||||
}(Attachment));
|
|
||||||
spine.VertexAttachment = VertexAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
(function (AttachmentType) {
|
|
||||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
|
||||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
|
||||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
|
||||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
|
||||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
|
||||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
|
||||||
var AttachmentType = spine.AttachmentType;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var BoundingBoxAttachment = (function (_super) {
|
|
||||||
__extends(BoundingBoxAttachment, _super);
|
|
||||||
function BoundingBoxAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return BoundingBoxAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var MeshAttachment = (function (_super) {
|
|
||||||
__extends(MeshAttachment, _super);
|
|
||||||
function MeshAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.inheritDeform = false;
|
|
||||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
MeshAttachment.prototype.updateUVs = function () {
|
|
||||||
var regionUVs = this.regionUVs;
|
|
||||||
var verticesLength = regionUVs.length;
|
|
||||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
|
||||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
|
||||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
|
||||||
var u = 0, v = 0, width = 0, height = 0;
|
|
||||||
if (this.region == null) {
|
|
||||||
u = v = 0;
|
|
||||||
width = height = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u = this.region.u;
|
|
||||||
v = this.region.v;
|
|
||||||
width = this.region.u2 - u;
|
|
||||||
height = this.region.v2 - v;
|
|
||||||
}
|
|
||||||
if (this.region.rotate) {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
|
||||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
|
||||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
var verticesLength = vertices.length;
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
|
||||||
var vx = vertices[v], vy = vertices[v + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
|
||||||
return this.parentMesh;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
|
||||||
this.parentMesh = parentMesh;
|
|
||||||
if (parentMesh != null) {
|
|
||||||
this.bones = parentMesh.bones;
|
|
||||||
this.vertices = parentMesh.vertices;
|
|
||||||
this.regionUVs = parentMesh.regionUVs;
|
|
||||||
this.triangles = parentMesh.triangles;
|
|
||||||
this.hullLength = parentMesh.hullLength;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return MeshAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.MeshAttachment = MeshAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var PathAttachment = (function (_super) {
|
|
||||||
__extends(PathAttachment, _super);
|
|
||||||
function PathAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.closed = false;
|
|
||||||
this.constantSpeed = false;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return PathAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.PathAttachment = PathAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var RegionAttachment = (function (_super) {
|
|
||||||
__extends(RegionAttachment, _super);
|
|
||||||
function RegionAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.scaleX = 1;
|
|
||||||
this.scaleY = 1;
|
|
||||||
this.rotation = 0;
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.offset = spine.Utils.newFloatArray(8);
|
|
||||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
|
||||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
RegionAttachment.prototype.setRegion = function (region) {
|
|
||||||
var vertices = this.vertices;
|
|
||||||
if (region.rotate) {
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v2;
|
|
||||||
vertices[RegionAttachment.U3] = region.u;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v;
|
|
||||||
vertices[RegionAttachment.U1] = region.u2;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertices[RegionAttachment.U1] = region.u;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v;
|
|
||||||
vertices[RegionAttachment.U3] = region.u2;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateOffset = function () {
|
|
||||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
||||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
||||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
||||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
||||||
var localX2 = localX + this.region.width * regionScaleX;
|
|
||||||
var localY2 = localY + this.region.height * regionScaleY;
|
|
||||||
var radians = this.rotation * Math.PI / 180;
|
|
||||||
var cos = Math.cos(radians);
|
|
||||||
var sin = Math.sin(radians);
|
|
||||||
var localXCos = localX * cos + this.x;
|
|
||||||
var localXSin = localX * sin;
|
|
||||||
var localYCos = localY * cos + this.y;
|
|
||||||
var localYSin = localY * sin;
|
|
||||||
var localX2Cos = localX2 * cos + this.x;
|
|
||||||
var localX2Sin = localX2 * sin;
|
|
||||||
var localY2Cos = localY2 * cos + this.y;
|
|
||||||
var localY2Sin = localY2 * sin;
|
|
||||||
var offset = this.offset;
|
|
||||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
|
||||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
|
||||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
|
||||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
|
||||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
|
||||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color;
|
|
||||||
var slotColor = slot.color;
|
|
||||||
var regionColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var offset = this.offset;
|
|
||||||
var bone = slot.bone;
|
|
||||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
var offsetX = 0, offsetY = 0;
|
|
||||||
offsetX = offset[RegionAttachment.OX1];
|
|
||||||
offsetY = offset[RegionAttachment.OY1];
|
|
||||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX2];
|
|
||||||
offsetY = offset[RegionAttachment.OY2];
|
|
||||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX3];
|
|
||||||
offsetY = offset[RegionAttachment.OY3];
|
|
||||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX4];
|
|
||||||
offsetY = offset[RegionAttachment.OY4];
|
|
||||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
|
||||||
return vertices;
|
|
||||||
};
|
|
||||||
RegionAttachment.OX1 = 0;
|
|
||||||
RegionAttachment.OY1 = 1;
|
|
||||||
RegionAttachment.OX2 = 2;
|
|
||||||
RegionAttachment.OY2 = 3;
|
|
||||||
RegionAttachment.OX3 = 4;
|
|
||||||
RegionAttachment.OY3 = 5;
|
|
||||||
RegionAttachment.OX4 = 6;
|
|
||||||
RegionAttachment.OY4 = 7;
|
|
||||||
RegionAttachment.X1 = 0;
|
|
||||||
RegionAttachment.Y1 = 1;
|
|
||||||
RegionAttachment.C1R = 2;
|
|
||||||
RegionAttachment.C1G = 3;
|
|
||||||
RegionAttachment.C1B = 4;
|
|
||||||
RegionAttachment.C1A = 5;
|
|
||||||
RegionAttachment.U1 = 6;
|
|
||||||
RegionAttachment.V1 = 7;
|
|
||||||
RegionAttachment.X2 = 8;
|
|
||||||
RegionAttachment.Y2 = 9;
|
|
||||||
RegionAttachment.C2R = 10;
|
|
||||||
RegionAttachment.C2G = 11;
|
|
||||||
RegionAttachment.C2B = 12;
|
|
||||||
RegionAttachment.C2A = 13;
|
|
||||||
RegionAttachment.U2 = 14;
|
|
||||||
RegionAttachment.V2 = 15;
|
|
||||||
RegionAttachment.X3 = 16;
|
|
||||||
RegionAttachment.Y3 = 17;
|
|
||||||
RegionAttachment.C3R = 18;
|
|
||||||
RegionAttachment.C3G = 19;
|
|
||||||
RegionAttachment.C3B = 20;
|
|
||||||
RegionAttachment.C3A = 21;
|
|
||||||
RegionAttachment.U3 = 22;
|
|
||||||
RegionAttachment.V3 = 23;
|
|
||||||
RegionAttachment.X4 = 24;
|
|
||||||
RegionAttachment.Y4 = 25;
|
|
||||||
RegionAttachment.C4R = 26;
|
|
||||||
RegionAttachment.C4G = 27;
|
|
||||||
RegionAttachment.C4B = 28;
|
|
||||||
RegionAttachment.C4A = 29;
|
|
||||||
RegionAttachment.U4 = 30;
|
|
||||||
RegionAttachment.V4 = 31;
|
|
||||||
return RegionAttachment;
|
|
||||||
}(spine.Attachment));
|
|
||||||
spine.RegionAttachment = RegionAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
var threejs;
|
var threejs;
|
||||||
(function (threejs) {
|
(function (threejs) {
|
||||||
@ -4973,8 +4978,6 @@ var spine;
|
|||||||
return THREE.LinearFilter;
|
return THREE.LinearFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMap)
|
else if (filter === spine.TextureFilter.MipMap)
|
||||||
return THREE.LinearMipMapLinearFilter;
|
return THREE.LinearMipMapLinearFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMapLinearLinear)
|
|
||||||
return THREE.LinearMipMapLinearFilter;
|
|
||||||
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
||||||
return THREE.LinearMipMapNearestFilter;
|
return THREE.LinearMipMapNearestFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-core.d.ts
vendored
262
spine-ts/build/spine-core.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
|||||||
getErrors(): Map<string>;
|
getErrors(): Map<string>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare module spine {
|
||||||
|
abstract class Attachment {
|
||||||
|
name: string;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
abstract class VertexAttachment extends Attachment {
|
||||||
|
bones: Array<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
worldVerticesLength: number;
|
||||||
|
constructor(name: string);
|
||||||
|
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||||
|
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
interface AttachmentLoader {
|
||||||
|
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||||
|
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||||
|
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||||
|
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
enum AttachmentType {
|
||||||
|
Region = 0,
|
||||||
|
BoundingBox = 1,
|
||||||
|
Mesh = 2,
|
||||||
|
LinkedMesh = 3,
|
||||||
|
Path = 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class BoundingBoxAttachment extends VertexAttachment {
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class MeshAttachment extends VertexAttachment {
|
||||||
|
region: TextureRegion;
|
||||||
|
path: string;
|
||||||
|
regionUVs: ArrayLike<number>;
|
||||||
|
worldVertices: ArrayLike<number>;
|
||||||
|
triangles: Array<number>;
|
||||||
|
color: Color;
|
||||||
|
hullLength: number;
|
||||||
|
private parentMesh;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
updateUVs(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
getParentMesh(): MeshAttachment;
|
||||||
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class PathAttachment extends VertexAttachment {
|
||||||
|
lengths: Array<number>;
|
||||||
|
closed: boolean;
|
||||||
|
constantSpeed: boolean;
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class RegionAttachment extends Attachment {
|
||||||
|
static OX1: number;
|
||||||
|
static OY1: number;
|
||||||
|
static OX2: number;
|
||||||
|
static OY2: number;
|
||||||
|
static OX3: number;
|
||||||
|
static OY3: number;
|
||||||
|
static OX4: number;
|
||||||
|
static OY4: number;
|
||||||
|
static X1: number;
|
||||||
|
static Y1: number;
|
||||||
|
static C1R: number;
|
||||||
|
static C1G: number;
|
||||||
|
static C1B: number;
|
||||||
|
static C1A: number;
|
||||||
|
static U1: number;
|
||||||
|
static V1: number;
|
||||||
|
static X2: number;
|
||||||
|
static Y2: number;
|
||||||
|
static C2R: number;
|
||||||
|
static C2G: number;
|
||||||
|
static C2B: number;
|
||||||
|
static C2A: number;
|
||||||
|
static U2: number;
|
||||||
|
static V2: number;
|
||||||
|
static X3: number;
|
||||||
|
static Y3: number;
|
||||||
|
static C3R: number;
|
||||||
|
static C3G: number;
|
||||||
|
static C3B: number;
|
||||||
|
static C3A: number;
|
||||||
|
static U3: number;
|
||||||
|
static V3: number;
|
||||||
|
static X4: number;
|
||||||
|
static Y4: number;
|
||||||
|
static C4R: number;
|
||||||
|
static C4G: number;
|
||||||
|
static C4B: number;
|
||||||
|
static C4A: number;
|
||||||
|
static U4: number;
|
||||||
|
static V4: number;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
scaleX: number;
|
||||||
|
scaleY: number;
|
||||||
|
rotation: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: Color;
|
||||||
|
path: string;
|
||||||
|
rendererObject: any;
|
||||||
|
region: TextureRegion;
|
||||||
|
offset: ArrayLike<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
setRegion(region: TextureRegion): void;
|
||||||
|
updateOffset(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
enum BlendMode {
|
enum BlendMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
@ -757,7 +886,7 @@ declare module spine {
|
|||||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||||
static newFloatArray(size: number): ArrayLike<number>;
|
static newFloatArray(size: number): ArrayLike<number>;
|
||||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||||
}
|
}
|
||||||
class DebugUtils {
|
class DebugUtils {
|
||||||
static logBones(skeleton: Skeleton): void;
|
static logBones(skeleton: Skeleton): void;
|
||||||
@ -789,133 +918,8 @@ declare module spine {
|
|||||||
private frameTime;
|
private frameTime;
|
||||||
update(): void;
|
update(): void;
|
||||||
}
|
}
|
||||||
}
|
interface ArrayLike<T> {
|
||||||
declare module spine {
|
length: number;
|
||||||
abstract class Attachment {
|
[n: number]: T;
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
abstract class VertexAttachment extends Attachment {
|
|
||||||
bones: Array<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
worldVerticesLength: number;
|
|
||||||
constructor(name: string);
|
|
||||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
|
||||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
interface AttachmentLoader {
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
enum AttachmentType {
|
|
||||||
Region = 0,
|
|
||||||
BoundingBox = 1,
|
|
||||||
Mesh = 2,
|
|
||||||
LinkedMesh = 3,
|
|
||||||
Path = 4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class BoundingBoxAttachment extends VertexAttachment {
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class MeshAttachment extends VertexAttachment {
|
|
||||||
region: TextureRegion;
|
|
||||||
path: string;
|
|
||||||
regionUVs: ArrayLike<number>;
|
|
||||||
worldVertices: ArrayLike<number>;
|
|
||||||
triangles: Array<number>;
|
|
||||||
color: Color;
|
|
||||||
hullLength: number;
|
|
||||||
private parentMesh;
|
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
updateUVs(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class PathAttachment extends VertexAttachment {
|
|
||||||
lengths: Array<number>;
|
|
||||||
closed: boolean;
|
|
||||||
constantSpeed: boolean;
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class RegionAttachment extends Attachment {
|
|
||||||
static OX1: number;
|
|
||||||
static OY1: number;
|
|
||||||
static OX2: number;
|
|
||||||
static OY2: number;
|
|
||||||
static OX3: number;
|
|
||||||
static OY3: number;
|
|
||||||
static OX4: number;
|
|
||||||
static OY4: number;
|
|
||||||
static X1: number;
|
|
||||||
static Y1: number;
|
|
||||||
static C1R: number;
|
|
||||||
static C1G: number;
|
|
||||||
static C1B: number;
|
|
||||||
static C1A: number;
|
|
||||||
static U1: number;
|
|
||||||
static V1: number;
|
|
||||||
static X2: number;
|
|
||||||
static Y2: number;
|
|
||||||
static C2R: number;
|
|
||||||
static C2G: number;
|
|
||||||
static C2B: number;
|
|
||||||
static C2A: number;
|
|
||||||
static U2: number;
|
|
||||||
static V2: number;
|
|
||||||
static X3: number;
|
|
||||||
static Y3: number;
|
|
||||||
static C3R: number;
|
|
||||||
static C3G: number;
|
|
||||||
static C3B: number;
|
|
||||||
static C3A: number;
|
|
||||||
static U3: number;
|
|
||||||
static V3: number;
|
|
||||||
static X4: number;
|
|
||||||
static Y4: number;
|
|
||||||
static C4R: number;
|
|
||||||
static C4G: number;
|
|
||||||
static C4B: number;
|
|
||||||
static C4A: number;
|
|
||||||
static U4: number;
|
|
||||||
static V4: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
rotation: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
color: Color;
|
|
||||||
path: string;
|
|
||||||
rendererObject: any;
|
|
||||||
region: TextureRegion;
|
|
||||||
offset: ArrayLike<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
setRegion(region: TextureRegion): void;
|
|
||||||
updateOffset(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -770,16 +770,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
var event_1 = events[ii];
|
var event_1 = events[ii];
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.event != null)
|
||||||
current.listener.event(i, event_1);
|
current.listener.event(i, event_1);
|
||||||
for (var iii = 0; iii < listenerCount; iii++)
|
for (var iii = 0; iii < listenerCount; iii++)
|
||||||
|
if (this.listeners[iii].event)
|
||||||
this.listeners[iii].event(i, event_1);
|
this.listeners[iii].event(i, event_1);
|
||||||
}
|
}
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
var count = spine.MathUtils.toInt(time / endTime);
|
var count = spine.MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.complete)
|
||||||
current.listener.complete(i, count);
|
current.listener.complete(i, count);
|
||||||
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
|
if (this.listeners[ii].complete)
|
||||||
this.listeners[ii].complete(i, count);
|
this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -796,9 +798,10 @@ var spine;
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (current == null)
|
if (current == null)
|
||||||
return;
|
return;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(trackIndex);
|
current.listener.end(trackIndex);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(trackIndex);
|
this.listeners[i].end(trackIndex);
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
this.freeAll(current);
|
this.freeAll(current);
|
||||||
@ -821,9 +824,10 @@ var spine;
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
var previous = current.previous;
|
var previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(index);
|
current.listener.end(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(index);
|
this.listeners[i].end(index);
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -837,9 +841,10 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
if (entry.listener != null)
|
if (entry.listener != null && entry.listener.start != null)
|
||||||
entry.listener.start(index);
|
entry.listener.start(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].start)
|
||||||
this.listeners[i].start(index);
|
this.listeners[i].start(index);
|
||||||
};
|
};
|
||||||
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
||||||
@ -1091,6 +1096,423 @@ var spine;
|
|||||||
spine.AssetManager = AssetManager;
|
spine.AssetManager = AssetManager;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var Attachment = (function () {
|
||||||
|
function Attachment(name) {
|
||||||
|
if (name == null)
|
||||||
|
throw new Error("name cannot be null.");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
return Attachment;
|
||||||
|
}());
|
||||||
|
spine.Attachment = Attachment;
|
||||||
|
var VertexAttachment = (function (_super) {
|
||||||
|
__extends(VertexAttachment, _super);
|
||||||
|
function VertexAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.worldVerticesLength = 0;
|
||||||
|
}
|
||||||
|
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||||
|
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||||
|
count += offset;
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||||
|
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var v = 0, skip = 0;
|
||||||
|
for (var i = 0; i < start; i += 2) {
|
||||||
|
var n = bones[v];
|
||||||
|
v += n + 1;
|
||||||
|
skip += n;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment;
|
||||||
|
};
|
||||||
|
return VertexAttachment;
|
||||||
|
}(Attachment));
|
||||||
|
spine.VertexAttachment = VertexAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
(function (AttachmentType) {
|
||||||
|
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||||
|
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||||
|
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||||
|
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||||
|
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||||
|
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||||
|
var AttachmentType = spine.AttachmentType;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var BoundingBoxAttachment = (function (_super) {
|
||||||
|
__extends(BoundingBoxAttachment, _super);
|
||||||
|
function BoundingBoxAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return BoundingBoxAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var MeshAttachment = (function (_super) {
|
||||||
|
__extends(MeshAttachment, _super);
|
||||||
|
function MeshAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.inheritDeform = false;
|
||||||
|
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
MeshAttachment.prototype.updateUVs = function () {
|
||||||
|
var regionUVs = this.regionUVs;
|
||||||
|
var verticesLength = regionUVs.length;
|
||||||
|
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||||
|
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||||
|
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||||
|
var u = 0, v = 0, width = 0, height = 0;
|
||||||
|
if (this.region == null) {
|
||||||
|
u = v = 0;
|
||||||
|
width = height = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = this.region.u;
|
||||||
|
v = this.region.v;
|
||||||
|
width = this.region.u2 - u;
|
||||||
|
height = this.region.v2 - v;
|
||||||
|
}
|
||||||
|
if (this.region.rotate) {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||||
|
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||||
|
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
var verticesLength = vertices.length;
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||||
|
var vx = vertices[v], vy = vertices[v + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
|
return this.parentMesh;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
if (parentMesh != null) {
|
||||||
|
this.bones = parentMesh.bones;
|
||||||
|
this.vertices = parentMesh.vertices;
|
||||||
|
this.regionUVs = parentMesh.regionUVs;
|
||||||
|
this.triangles = parentMesh.triangles;
|
||||||
|
this.hullLength = parentMesh.hullLength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return MeshAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.MeshAttachment = MeshAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var PathAttachment = (function (_super) {
|
||||||
|
__extends(PathAttachment, _super);
|
||||||
|
function PathAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.closed = false;
|
||||||
|
this.constantSpeed = false;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return PathAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.PathAttachment = PathAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var RegionAttachment = (function (_super) {
|
||||||
|
__extends(RegionAttachment, _super);
|
||||||
|
function RegionAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.x = 0;
|
||||||
|
this.y = 0;
|
||||||
|
this.scaleX = 1;
|
||||||
|
this.scaleY = 1;
|
||||||
|
this.rotation = 0;
|
||||||
|
this.width = 0;
|
||||||
|
this.height = 0;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.offset = spine.Utils.newFloatArray(8);
|
||||||
|
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||||
|
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
RegionAttachment.prototype.setRegion = function (region) {
|
||||||
|
var vertices = this.vertices;
|
||||||
|
if (region.rotate) {
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v2;
|
||||||
|
vertices[RegionAttachment.U3] = region.u;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v;
|
||||||
|
vertices[RegionAttachment.U1] = region.u2;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertices[RegionAttachment.U1] = region.u;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v;
|
||||||
|
vertices[RegionAttachment.U3] = region.u2;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
|
}
|
||||||
|
this.region = region;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateOffset = function () {
|
||||||
|
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||||
|
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||||
|
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||||
|
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||||
|
var localX2 = localX + this.region.width * regionScaleX;
|
||||||
|
var localY2 = localY + this.region.height * regionScaleY;
|
||||||
|
var radians = this.rotation * Math.PI / 180;
|
||||||
|
var cos = Math.cos(radians);
|
||||||
|
var sin = Math.sin(radians);
|
||||||
|
var localXCos = localX * cos + this.x;
|
||||||
|
var localXSin = localX * sin;
|
||||||
|
var localYCos = localY * cos + this.y;
|
||||||
|
var localYSin = localY * sin;
|
||||||
|
var localX2Cos = localX2 * cos + this.x;
|
||||||
|
var localX2Sin = localX2 * sin;
|
||||||
|
var localY2Cos = localY2 * cos + this.y;
|
||||||
|
var localY2Sin = localY2 * sin;
|
||||||
|
var offset = this.offset;
|
||||||
|
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||||
|
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||||
|
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||||
|
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||||
|
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||||
|
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color;
|
||||||
|
var slotColor = slot.color;
|
||||||
|
var regionColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var offset = this.offset;
|
||||||
|
var bone = slot.bone;
|
||||||
|
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
var offsetX = 0, offsetY = 0;
|
||||||
|
offsetX = offset[RegionAttachment.OX1];
|
||||||
|
offsetY = offset[RegionAttachment.OY1];
|
||||||
|
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX2];
|
||||||
|
offsetY = offset[RegionAttachment.OY2];
|
||||||
|
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX3];
|
||||||
|
offsetY = offset[RegionAttachment.OY3];
|
||||||
|
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX4];
|
||||||
|
offsetY = offset[RegionAttachment.OY4];
|
||||||
|
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
return vertices;
|
||||||
|
};
|
||||||
|
RegionAttachment.OX1 = 0;
|
||||||
|
RegionAttachment.OY1 = 1;
|
||||||
|
RegionAttachment.OX2 = 2;
|
||||||
|
RegionAttachment.OY2 = 3;
|
||||||
|
RegionAttachment.OX3 = 4;
|
||||||
|
RegionAttachment.OY3 = 5;
|
||||||
|
RegionAttachment.OX4 = 6;
|
||||||
|
RegionAttachment.OY4 = 7;
|
||||||
|
RegionAttachment.X1 = 0;
|
||||||
|
RegionAttachment.Y1 = 1;
|
||||||
|
RegionAttachment.C1R = 2;
|
||||||
|
RegionAttachment.C1G = 3;
|
||||||
|
RegionAttachment.C1B = 4;
|
||||||
|
RegionAttachment.C1A = 5;
|
||||||
|
RegionAttachment.U1 = 6;
|
||||||
|
RegionAttachment.V1 = 7;
|
||||||
|
RegionAttachment.X2 = 8;
|
||||||
|
RegionAttachment.Y2 = 9;
|
||||||
|
RegionAttachment.C2R = 10;
|
||||||
|
RegionAttachment.C2G = 11;
|
||||||
|
RegionAttachment.C2B = 12;
|
||||||
|
RegionAttachment.C2A = 13;
|
||||||
|
RegionAttachment.U2 = 14;
|
||||||
|
RegionAttachment.V2 = 15;
|
||||||
|
RegionAttachment.X3 = 16;
|
||||||
|
RegionAttachment.Y3 = 17;
|
||||||
|
RegionAttachment.C3R = 18;
|
||||||
|
RegionAttachment.C3G = 19;
|
||||||
|
RegionAttachment.C3B = 20;
|
||||||
|
RegionAttachment.C3A = 21;
|
||||||
|
RegionAttachment.U3 = 22;
|
||||||
|
RegionAttachment.V3 = 23;
|
||||||
|
RegionAttachment.X4 = 24;
|
||||||
|
RegionAttachment.Y4 = 25;
|
||||||
|
RegionAttachment.C4R = 26;
|
||||||
|
RegionAttachment.C4G = 27;
|
||||||
|
RegionAttachment.C4B = 28;
|
||||||
|
RegionAttachment.C4A = 29;
|
||||||
|
RegionAttachment.U4 = 30;
|
||||||
|
RegionAttachment.V4 = 31;
|
||||||
|
return RegionAttachment;
|
||||||
|
}(spine.Attachment));
|
||||||
|
spine.RegionAttachment = RegionAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
(function (BlendMode) {
|
(function (BlendMode) {
|
||||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||||
@ -3483,7 +3905,7 @@ var spine;
|
|||||||
for (var key in dictionary) {
|
for (var key in dictionary) {
|
||||||
var skinAttachment = dictionary[key];
|
var skinAttachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
var attachment = this.getAttachment(slotIndex, name);
|
var attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null)
|
if (attachment != null)
|
||||||
slot.setAttachment(attachment);
|
slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
@ -3793,7 +4215,6 @@ var spine;
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
var attachment = new spine.RegionAttachment(name);
|
var attachment = new spine.RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
};
|
};
|
||||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||||
@ -4162,420 +4583,4 @@ var spine;
|
|||||||
}());
|
}());
|
||||||
spine.TimeKeeper = TimeKeeper;
|
spine.TimeKeeper = TimeKeeper;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var Attachment = (function () {
|
|
||||||
function Attachment(name) {
|
|
||||||
if (name == null)
|
|
||||||
throw new Error("name cannot be null.");
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
return Attachment;
|
|
||||||
}());
|
|
||||||
spine.Attachment = Attachment;
|
|
||||||
var VertexAttachment = (function (_super) {
|
|
||||||
__extends(VertexAttachment, _super);
|
|
||||||
function VertexAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.worldVerticesLength = 0;
|
|
||||||
}
|
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
|
||||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
|
||||||
count += offset;
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
|
||||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var v = 0, skip = 0;
|
|
||||||
for (var i = 0; i < start; i += 2) {
|
|
||||||
var n = bones[v];
|
|
||||||
v += n + 1;
|
|
||||||
skip += n;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
return VertexAttachment;
|
|
||||||
}(Attachment));
|
|
||||||
spine.VertexAttachment = VertexAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
(function (AttachmentType) {
|
|
||||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
|
||||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
|
||||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
|
||||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
|
||||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
|
||||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
|
||||||
var AttachmentType = spine.AttachmentType;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var BoundingBoxAttachment = (function (_super) {
|
|
||||||
__extends(BoundingBoxAttachment, _super);
|
|
||||||
function BoundingBoxAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return BoundingBoxAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var MeshAttachment = (function (_super) {
|
|
||||||
__extends(MeshAttachment, _super);
|
|
||||||
function MeshAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.inheritDeform = false;
|
|
||||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
MeshAttachment.prototype.updateUVs = function () {
|
|
||||||
var regionUVs = this.regionUVs;
|
|
||||||
var verticesLength = regionUVs.length;
|
|
||||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
|
||||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
|
||||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
|
||||||
var u = 0, v = 0, width = 0, height = 0;
|
|
||||||
if (this.region == null) {
|
|
||||||
u = v = 0;
|
|
||||||
width = height = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u = this.region.u;
|
|
||||||
v = this.region.v;
|
|
||||||
width = this.region.u2 - u;
|
|
||||||
height = this.region.v2 - v;
|
|
||||||
}
|
|
||||||
if (this.region.rotate) {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
|
||||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
|
||||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
var verticesLength = vertices.length;
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
|
||||||
var vx = vertices[v], vy = vertices[v + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
|
||||||
return this.parentMesh;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
|
||||||
this.parentMesh = parentMesh;
|
|
||||||
if (parentMesh != null) {
|
|
||||||
this.bones = parentMesh.bones;
|
|
||||||
this.vertices = parentMesh.vertices;
|
|
||||||
this.regionUVs = parentMesh.regionUVs;
|
|
||||||
this.triangles = parentMesh.triangles;
|
|
||||||
this.hullLength = parentMesh.hullLength;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return MeshAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.MeshAttachment = MeshAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var PathAttachment = (function (_super) {
|
|
||||||
__extends(PathAttachment, _super);
|
|
||||||
function PathAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.closed = false;
|
|
||||||
this.constantSpeed = false;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return PathAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.PathAttachment = PathAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var RegionAttachment = (function (_super) {
|
|
||||||
__extends(RegionAttachment, _super);
|
|
||||||
function RegionAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.scaleX = 1;
|
|
||||||
this.scaleY = 1;
|
|
||||||
this.rotation = 0;
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.offset = spine.Utils.newFloatArray(8);
|
|
||||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
|
||||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
RegionAttachment.prototype.setRegion = function (region) {
|
|
||||||
var vertices = this.vertices;
|
|
||||||
if (region.rotate) {
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v2;
|
|
||||||
vertices[RegionAttachment.U3] = region.u;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v;
|
|
||||||
vertices[RegionAttachment.U1] = region.u2;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertices[RegionAttachment.U1] = region.u;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v;
|
|
||||||
vertices[RegionAttachment.U3] = region.u2;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateOffset = function () {
|
|
||||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
||||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
||||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
||||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
||||||
var localX2 = localX + this.region.width * regionScaleX;
|
|
||||||
var localY2 = localY + this.region.height * regionScaleY;
|
|
||||||
var radians = this.rotation * Math.PI / 180;
|
|
||||||
var cos = Math.cos(radians);
|
|
||||||
var sin = Math.sin(radians);
|
|
||||||
var localXCos = localX * cos + this.x;
|
|
||||||
var localXSin = localX * sin;
|
|
||||||
var localYCos = localY * cos + this.y;
|
|
||||||
var localYSin = localY * sin;
|
|
||||||
var localX2Cos = localX2 * cos + this.x;
|
|
||||||
var localX2Sin = localX2 * sin;
|
|
||||||
var localY2Cos = localY2 * cos + this.y;
|
|
||||||
var localY2Sin = localY2 * sin;
|
|
||||||
var offset = this.offset;
|
|
||||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
|
||||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
|
||||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
|
||||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
|
||||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
|
||||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color;
|
|
||||||
var slotColor = slot.color;
|
|
||||||
var regionColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var offset = this.offset;
|
|
||||||
var bone = slot.bone;
|
|
||||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
var offsetX = 0, offsetY = 0;
|
|
||||||
offsetX = offset[RegionAttachment.OX1];
|
|
||||||
offsetY = offset[RegionAttachment.OY1];
|
|
||||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX2];
|
|
||||||
offsetY = offset[RegionAttachment.OY2];
|
|
||||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX3];
|
|
||||||
offsetY = offset[RegionAttachment.OY3];
|
|
||||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX4];
|
|
||||||
offsetY = offset[RegionAttachment.OY4];
|
|
||||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
|
||||||
return vertices;
|
|
||||||
};
|
|
||||||
RegionAttachment.OX1 = 0;
|
|
||||||
RegionAttachment.OY1 = 1;
|
|
||||||
RegionAttachment.OX2 = 2;
|
|
||||||
RegionAttachment.OY2 = 3;
|
|
||||||
RegionAttachment.OX3 = 4;
|
|
||||||
RegionAttachment.OY3 = 5;
|
|
||||||
RegionAttachment.OX4 = 6;
|
|
||||||
RegionAttachment.OY4 = 7;
|
|
||||||
RegionAttachment.X1 = 0;
|
|
||||||
RegionAttachment.Y1 = 1;
|
|
||||||
RegionAttachment.C1R = 2;
|
|
||||||
RegionAttachment.C1G = 3;
|
|
||||||
RegionAttachment.C1B = 4;
|
|
||||||
RegionAttachment.C1A = 5;
|
|
||||||
RegionAttachment.U1 = 6;
|
|
||||||
RegionAttachment.V1 = 7;
|
|
||||||
RegionAttachment.X2 = 8;
|
|
||||||
RegionAttachment.Y2 = 9;
|
|
||||||
RegionAttachment.C2R = 10;
|
|
||||||
RegionAttachment.C2G = 11;
|
|
||||||
RegionAttachment.C2B = 12;
|
|
||||||
RegionAttachment.C2A = 13;
|
|
||||||
RegionAttachment.U2 = 14;
|
|
||||||
RegionAttachment.V2 = 15;
|
|
||||||
RegionAttachment.X3 = 16;
|
|
||||||
RegionAttachment.Y3 = 17;
|
|
||||||
RegionAttachment.C3R = 18;
|
|
||||||
RegionAttachment.C3G = 19;
|
|
||||||
RegionAttachment.C3B = 20;
|
|
||||||
RegionAttachment.C3A = 21;
|
|
||||||
RegionAttachment.U3 = 22;
|
|
||||||
RegionAttachment.V3 = 23;
|
|
||||||
RegionAttachment.X4 = 24;
|
|
||||||
RegionAttachment.Y4 = 25;
|
|
||||||
RegionAttachment.C4R = 26;
|
|
||||||
RegionAttachment.C4G = 27;
|
|
||||||
RegionAttachment.C4B = 28;
|
|
||||||
RegionAttachment.C4A = 29;
|
|
||||||
RegionAttachment.U4 = 30;
|
|
||||||
RegionAttachment.V4 = 31;
|
|
||||||
return RegionAttachment;
|
|
||||||
}(spine.Attachment));
|
|
||||||
spine.RegionAttachment = RegionAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
//# sourceMappingURL=spine-core.js.map
|
//# sourceMappingURL=spine-core.js.map
|
||||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-threejs.d.ts
vendored
262
spine-ts/build/spine-threejs.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
|||||||
getErrors(): Map<string>;
|
getErrors(): Map<string>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare module spine {
|
||||||
|
abstract class Attachment {
|
||||||
|
name: string;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
abstract class VertexAttachment extends Attachment {
|
||||||
|
bones: Array<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
worldVerticesLength: number;
|
||||||
|
constructor(name: string);
|
||||||
|
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||||
|
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
interface AttachmentLoader {
|
||||||
|
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||||
|
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||||
|
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||||
|
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
enum AttachmentType {
|
||||||
|
Region = 0,
|
||||||
|
BoundingBox = 1,
|
||||||
|
Mesh = 2,
|
||||||
|
LinkedMesh = 3,
|
||||||
|
Path = 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class BoundingBoxAttachment extends VertexAttachment {
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class MeshAttachment extends VertexAttachment {
|
||||||
|
region: TextureRegion;
|
||||||
|
path: string;
|
||||||
|
regionUVs: ArrayLike<number>;
|
||||||
|
worldVertices: ArrayLike<number>;
|
||||||
|
triangles: Array<number>;
|
||||||
|
color: Color;
|
||||||
|
hullLength: number;
|
||||||
|
private parentMesh;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
updateUVs(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
getParentMesh(): MeshAttachment;
|
||||||
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class PathAttachment extends VertexAttachment {
|
||||||
|
lengths: Array<number>;
|
||||||
|
closed: boolean;
|
||||||
|
constantSpeed: boolean;
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class RegionAttachment extends Attachment {
|
||||||
|
static OX1: number;
|
||||||
|
static OY1: number;
|
||||||
|
static OX2: number;
|
||||||
|
static OY2: number;
|
||||||
|
static OX3: number;
|
||||||
|
static OY3: number;
|
||||||
|
static OX4: number;
|
||||||
|
static OY4: number;
|
||||||
|
static X1: number;
|
||||||
|
static Y1: number;
|
||||||
|
static C1R: number;
|
||||||
|
static C1G: number;
|
||||||
|
static C1B: number;
|
||||||
|
static C1A: number;
|
||||||
|
static U1: number;
|
||||||
|
static V1: number;
|
||||||
|
static X2: number;
|
||||||
|
static Y2: number;
|
||||||
|
static C2R: number;
|
||||||
|
static C2G: number;
|
||||||
|
static C2B: number;
|
||||||
|
static C2A: number;
|
||||||
|
static U2: number;
|
||||||
|
static V2: number;
|
||||||
|
static X3: number;
|
||||||
|
static Y3: number;
|
||||||
|
static C3R: number;
|
||||||
|
static C3G: number;
|
||||||
|
static C3B: number;
|
||||||
|
static C3A: number;
|
||||||
|
static U3: number;
|
||||||
|
static V3: number;
|
||||||
|
static X4: number;
|
||||||
|
static Y4: number;
|
||||||
|
static C4R: number;
|
||||||
|
static C4G: number;
|
||||||
|
static C4B: number;
|
||||||
|
static C4A: number;
|
||||||
|
static U4: number;
|
||||||
|
static V4: number;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
scaleX: number;
|
||||||
|
scaleY: number;
|
||||||
|
rotation: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: Color;
|
||||||
|
path: string;
|
||||||
|
rendererObject: any;
|
||||||
|
region: TextureRegion;
|
||||||
|
offset: ArrayLike<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
setRegion(region: TextureRegion): void;
|
||||||
|
updateOffset(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
enum BlendMode {
|
enum BlendMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
@ -757,7 +886,7 @@ declare module spine {
|
|||||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||||
static newFloatArray(size: number): ArrayLike<number>;
|
static newFloatArray(size: number): ArrayLike<number>;
|
||||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||||
}
|
}
|
||||||
class DebugUtils {
|
class DebugUtils {
|
||||||
static logBones(skeleton: Skeleton): void;
|
static logBones(skeleton: Skeleton): void;
|
||||||
@ -789,134 +918,9 @@ declare module spine {
|
|||||||
private frameTime;
|
private frameTime;
|
||||||
update(): void;
|
update(): void;
|
||||||
}
|
}
|
||||||
}
|
interface ArrayLike<T> {
|
||||||
declare module spine {
|
length: number;
|
||||||
abstract class Attachment {
|
[n: number]: T;
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
abstract class VertexAttachment extends Attachment {
|
|
||||||
bones: Array<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
worldVerticesLength: number;
|
|
||||||
constructor(name: string);
|
|
||||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
|
||||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
interface AttachmentLoader {
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
enum AttachmentType {
|
|
||||||
Region = 0,
|
|
||||||
BoundingBox = 1,
|
|
||||||
Mesh = 2,
|
|
||||||
LinkedMesh = 3,
|
|
||||||
Path = 4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class BoundingBoxAttachment extends VertexAttachment {
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class MeshAttachment extends VertexAttachment {
|
|
||||||
region: TextureRegion;
|
|
||||||
path: string;
|
|
||||||
regionUVs: ArrayLike<number>;
|
|
||||||
worldVertices: ArrayLike<number>;
|
|
||||||
triangles: Array<number>;
|
|
||||||
color: Color;
|
|
||||||
hullLength: number;
|
|
||||||
private parentMesh;
|
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
updateUVs(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class PathAttachment extends VertexAttachment {
|
|
||||||
lengths: Array<number>;
|
|
||||||
closed: boolean;
|
|
||||||
constantSpeed: boolean;
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class RegionAttachment extends Attachment {
|
|
||||||
static OX1: number;
|
|
||||||
static OY1: number;
|
|
||||||
static OX2: number;
|
|
||||||
static OY2: number;
|
|
||||||
static OX3: number;
|
|
||||||
static OY3: number;
|
|
||||||
static OX4: number;
|
|
||||||
static OY4: number;
|
|
||||||
static X1: number;
|
|
||||||
static Y1: number;
|
|
||||||
static C1R: number;
|
|
||||||
static C1G: number;
|
|
||||||
static C1B: number;
|
|
||||||
static C1A: number;
|
|
||||||
static U1: number;
|
|
||||||
static V1: number;
|
|
||||||
static X2: number;
|
|
||||||
static Y2: number;
|
|
||||||
static C2R: number;
|
|
||||||
static C2G: number;
|
|
||||||
static C2B: number;
|
|
||||||
static C2A: number;
|
|
||||||
static U2: number;
|
|
||||||
static V2: number;
|
|
||||||
static X3: number;
|
|
||||||
static Y3: number;
|
|
||||||
static C3R: number;
|
|
||||||
static C3G: number;
|
|
||||||
static C3B: number;
|
|
||||||
static C3A: number;
|
|
||||||
static U3: number;
|
|
||||||
static V3: number;
|
|
||||||
static X4: number;
|
|
||||||
static Y4: number;
|
|
||||||
static C4R: number;
|
|
||||||
static C4G: number;
|
|
||||||
static C4B: number;
|
|
||||||
static C4A: number;
|
|
||||||
static U4: number;
|
|
||||||
static V4: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
rotation: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
color: Color;
|
|
||||||
path: string;
|
|
||||||
rendererObject: any;
|
|
||||||
region: TextureRegion;
|
|
||||||
offset: ArrayLike<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
setRegion(region: TextureRegion): void;
|
|
||||||
updateOffset(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine.threejs {
|
declare module spine.threejs {
|
||||||
|
|||||||
@ -770,16 +770,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
var event_1 = events[ii];
|
var event_1 = events[ii];
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.event != null)
|
||||||
current.listener.event(i, event_1);
|
current.listener.event(i, event_1);
|
||||||
for (var iii = 0; iii < listenerCount; iii++)
|
for (var iii = 0; iii < listenerCount; iii++)
|
||||||
|
if (this.listeners[iii].event)
|
||||||
this.listeners[iii].event(i, event_1);
|
this.listeners[iii].event(i, event_1);
|
||||||
}
|
}
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
var count = spine.MathUtils.toInt(time / endTime);
|
var count = spine.MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.complete)
|
||||||
current.listener.complete(i, count);
|
current.listener.complete(i, count);
|
||||||
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
|
if (this.listeners[ii].complete)
|
||||||
this.listeners[ii].complete(i, count);
|
this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -796,9 +798,10 @@ var spine;
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (current == null)
|
if (current == null)
|
||||||
return;
|
return;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(trackIndex);
|
current.listener.end(trackIndex);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(trackIndex);
|
this.listeners[i].end(trackIndex);
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
this.freeAll(current);
|
this.freeAll(current);
|
||||||
@ -821,9 +824,10 @@ var spine;
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
var previous = current.previous;
|
var previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(index);
|
current.listener.end(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(index);
|
this.listeners[i].end(index);
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -837,9 +841,10 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
if (entry.listener != null)
|
if (entry.listener != null && entry.listener.start != null)
|
||||||
entry.listener.start(index);
|
entry.listener.start(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].start)
|
||||||
this.listeners[i].start(index);
|
this.listeners[i].start(index);
|
||||||
};
|
};
|
||||||
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
||||||
@ -1091,6 +1096,423 @@ var spine;
|
|||||||
spine.AssetManager = AssetManager;
|
spine.AssetManager = AssetManager;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var Attachment = (function () {
|
||||||
|
function Attachment(name) {
|
||||||
|
if (name == null)
|
||||||
|
throw new Error("name cannot be null.");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
return Attachment;
|
||||||
|
}());
|
||||||
|
spine.Attachment = Attachment;
|
||||||
|
var VertexAttachment = (function (_super) {
|
||||||
|
__extends(VertexAttachment, _super);
|
||||||
|
function VertexAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.worldVerticesLength = 0;
|
||||||
|
}
|
||||||
|
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||||
|
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||||
|
count += offset;
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||||
|
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var v = 0, skip = 0;
|
||||||
|
for (var i = 0; i < start; i += 2) {
|
||||||
|
var n = bones[v];
|
||||||
|
v += n + 1;
|
||||||
|
skip += n;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment;
|
||||||
|
};
|
||||||
|
return VertexAttachment;
|
||||||
|
}(Attachment));
|
||||||
|
spine.VertexAttachment = VertexAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
(function (AttachmentType) {
|
||||||
|
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||||
|
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||||
|
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||||
|
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||||
|
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||||
|
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||||
|
var AttachmentType = spine.AttachmentType;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var BoundingBoxAttachment = (function (_super) {
|
||||||
|
__extends(BoundingBoxAttachment, _super);
|
||||||
|
function BoundingBoxAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return BoundingBoxAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var MeshAttachment = (function (_super) {
|
||||||
|
__extends(MeshAttachment, _super);
|
||||||
|
function MeshAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.inheritDeform = false;
|
||||||
|
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
MeshAttachment.prototype.updateUVs = function () {
|
||||||
|
var regionUVs = this.regionUVs;
|
||||||
|
var verticesLength = regionUVs.length;
|
||||||
|
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||||
|
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||||
|
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||||
|
var u = 0, v = 0, width = 0, height = 0;
|
||||||
|
if (this.region == null) {
|
||||||
|
u = v = 0;
|
||||||
|
width = height = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = this.region.u;
|
||||||
|
v = this.region.v;
|
||||||
|
width = this.region.u2 - u;
|
||||||
|
height = this.region.v2 - v;
|
||||||
|
}
|
||||||
|
if (this.region.rotate) {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||||
|
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||||
|
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
var verticesLength = vertices.length;
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||||
|
var vx = vertices[v], vy = vertices[v + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
|
return this.parentMesh;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
if (parentMesh != null) {
|
||||||
|
this.bones = parentMesh.bones;
|
||||||
|
this.vertices = parentMesh.vertices;
|
||||||
|
this.regionUVs = parentMesh.regionUVs;
|
||||||
|
this.triangles = parentMesh.triangles;
|
||||||
|
this.hullLength = parentMesh.hullLength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return MeshAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.MeshAttachment = MeshAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var PathAttachment = (function (_super) {
|
||||||
|
__extends(PathAttachment, _super);
|
||||||
|
function PathAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.closed = false;
|
||||||
|
this.constantSpeed = false;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return PathAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.PathAttachment = PathAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var RegionAttachment = (function (_super) {
|
||||||
|
__extends(RegionAttachment, _super);
|
||||||
|
function RegionAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.x = 0;
|
||||||
|
this.y = 0;
|
||||||
|
this.scaleX = 1;
|
||||||
|
this.scaleY = 1;
|
||||||
|
this.rotation = 0;
|
||||||
|
this.width = 0;
|
||||||
|
this.height = 0;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.offset = spine.Utils.newFloatArray(8);
|
||||||
|
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||||
|
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
RegionAttachment.prototype.setRegion = function (region) {
|
||||||
|
var vertices = this.vertices;
|
||||||
|
if (region.rotate) {
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v2;
|
||||||
|
vertices[RegionAttachment.U3] = region.u;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v;
|
||||||
|
vertices[RegionAttachment.U1] = region.u2;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertices[RegionAttachment.U1] = region.u;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v;
|
||||||
|
vertices[RegionAttachment.U3] = region.u2;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
|
}
|
||||||
|
this.region = region;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateOffset = function () {
|
||||||
|
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||||
|
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||||
|
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||||
|
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||||
|
var localX2 = localX + this.region.width * regionScaleX;
|
||||||
|
var localY2 = localY + this.region.height * regionScaleY;
|
||||||
|
var radians = this.rotation * Math.PI / 180;
|
||||||
|
var cos = Math.cos(radians);
|
||||||
|
var sin = Math.sin(radians);
|
||||||
|
var localXCos = localX * cos + this.x;
|
||||||
|
var localXSin = localX * sin;
|
||||||
|
var localYCos = localY * cos + this.y;
|
||||||
|
var localYSin = localY * sin;
|
||||||
|
var localX2Cos = localX2 * cos + this.x;
|
||||||
|
var localX2Sin = localX2 * sin;
|
||||||
|
var localY2Cos = localY2 * cos + this.y;
|
||||||
|
var localY2Sin = localY2 * sin;
|
||||||
|
var offset = this.offset;
|
||||||
|
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||||
|
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||||
|
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||||
|
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||||
|
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||||
|
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color;
|
||||||
|
var slotColor = slot.color;
|
||||||
|
var regionColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var offset = this.offset;
|
||||||
|
var bone = slot.bone;
|
||||||
|
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
var offsetX = 0, offsetY = 0;
|
||||||
|
offsetX = offset[RegionAttachment.OX1];
|
||||||
|
offsetY = offset[RegionAttachment.OY1];
|
||||||
|
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX2];
|
||||||
|
offsetY = offset[RegionAttachment.OY2];
|
||||||
|
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX3];
|
||||||
|
offsetY = offset[RegionAttachment.OY3];
|
||||||
|
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX4];
|
||||||
|
offsetY = offset[RegionAttachment.OY4];
|
||||||
|
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
return vertices;
|
||||||
|
};
|
||||||
|
RegionAttachment.OX1 = 0;
|
||||||
|
RegionAttachment.OY1 = 1;
|
||||||
|
RegionAttachment.OX2 = 2;
|
||||||
|
RegionAttachment.OY2 = 3;
|
||||||
|
RegionAttachment.OX3 = 4;
|
||||||
|
RegionAttachment.OY3 = 5;
|
||||||
|
RegionAttachment.OX4 = 6;
|
||||||
|
RegionAttachment.OY4 = 7;
|
||||||
|
RegionAttachment.X1 = 0;
|
||||||
|
RegionAttachment.Y1 = 1;
|
||||||
|
RegionAttachment.C1R = 2;
|
||||||
|
RegionAttachment.C1G = 3;
|
||||||
|
RegionAttachment.C1B = 4;
|
||||||
|
RegionAttachment.C1A = 5;
|
||||||
|
RegionAttachment.U1 = 6;
|
||||||
|
RegionAttachment.V1 = 7;
|
||||||
|
RegionAttachment.X2 = 8;
|
||||||
|
RegionAttachment.Y2 = 9;
|
||||||
|
RegionAttachment.C2R = 10;
|
||||||
|
RegionAttachment.C2G = 11;
|
||||||
|
RegionAttachment.C2B = 12;
|
||||||
|
RegionAttachment.C2A = 13;
|
||||||
|
RegionAttachment.U2 = 14;
|
||||||
|
RegionAttachment.V2 = 15;
|
||||||
|
RegionAttachment.X3 = 16;
|
||||||
|
RegionAttachment.Y3 = 17;
|
||||||
|
RegionAttachment.C3R = 18;
|
||||||
|
RegionAttachment.C3G = 19;
|
||||||
|
RegionAttachment.C3B = 20;
|
||||||
|
RegionAttachment.C3A = 21;
|
||||||
|
RegionAttachment.U3 = 22;
|
||||||
|
RegionAttachment.V3 = 23;
|
||||||
|
RegionAttachment.X4 = 24;
|
||||||
|
RegionAttachment.Y4 = 25;
|
||||||
|
RegionAttachment.C4R = 26;
|
||||||
|
RegionAttachment.C4G = 27;
|
||||||
|
RegionAttachment.C4B = 28;
|
||||||
|
RegionAttachment.C4A = 29;
|
||||||
|
RegionAttachment.U4 = 30;
|
||||||
|
RegionAttachment.V4 = 31;
|
||||||
|
return RegionAttachment;
|
||||||
|
}(spine.Attachment));
|
||||||
|
spine.RegionAttachment = RegionAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
(function (BlendMode) {
|
(function (BlendMode) {
|
||||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||||
@ -3483,7 +3905,7 @@ var spine;
|
|||||||
for (var key in dictionary) {
|
for (var key in dictionary) {
|
||||||
var skinAttachment = dictionary[key];
|
var skinAttachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
var attachment = this.getAttachment(slotIndex, name);
|
var attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null)
|
if (attachment != null)
|
||||||
slot.setAttachment(attachment);
|
slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
@ -3793,7 +4215,6 @@ var spine;
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
var attachment = new spine.RegionAttachment(name);
|
var attachment = new spine.RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
};
|
};
|
||||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||||
@ -4163,422 +4584,6 @@ var spine;
|
|||||||
spine.TimeKeeper = TimeKeeper;
|
spine.TimeKeeper = TimeKeeper;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
(function (spine) {
|
|
||||||
var Attachment = (function () {
|
|
||||||
function Attachment(name) {
|
|
||||||
if (name == null)
|
|
||||||
throw new Error("name cannot be null.");
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
return Attachment;
|
|
||||||
}());
|
|
||||||
spine.Attachment = Attachment;
|
|
||||||
var VertexAttachment = (function (_super) {
|
|
||||||
__extends(VertexAttachment, _super);
|
|
||||||
function VertexAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.worldVerticesLength = 0;
|
|
||||||
}
|
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
|
||||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
|
||||||
count += offset;
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
|
||||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var v = 0, skip = 0;
|
|
||||||
for (var i = 0; i < start; i += 2) {
|
|
||||||
var n = bones[v];
|
|
||||||
v += n + 1;
|
|
||||||
skip += n;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
return VertexAttachment;
|
|
||||||
}(Attachment));
|
|
||||||
spine.VertexAttachment = VertexAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
(function (AttachmentType) {
|
|
||||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
|
||||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
|
||||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
|
||||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
|
||||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
|
||||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
|
||||||
var AttachmentType = spine.AttachmentType;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var BoundingBoxAttachment = (function (_super) {
|
|
||||||
__extends(BoundingBoxAttachment, _super);
|
|
||||||
function BoundingBoxAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return BoundingBoxAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var MeshAttachment = (function (_super) {
|
|
||||||
__extends(MeshAttachment, _super);
|
|
||||||
function MeshAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.inheritDeform = false;
|
|
||||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
MeshAttachment.prototype.updateUVs = function () {
|
|
||||||
var regionUVs = this.regionUVs;
|
|
||||||
var verticesLength = regionUVs.length;
|
|
||||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
|
||||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
|
||||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
|
||||||
var u = 0, v = 0, width = 0, height = 0;
|
|
||||||
if (this.region == null) {
|
|
||||||
u = v = 0;
|
|
||||||
width = height = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u = this.region.u;
|
|
||||||
v = this.region.v;
|
|
||||||
width = this.region.u2 - u;
|
|
||||||
height = this.region.v2 - v;
|
|
||||||
}
|
|
||||||
if (this.region.rotate) {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
|
||||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
|
||||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
var verticesLength = vertices.length;
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
|
||||||
var vx = vertices[v], vy = vertices[v + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
|
||||||
return this.parentMesh;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
|
||||||
this.parentMesh = parentMesh;
|
|
||||||
if (parentMesh != null) {
|
|
||||||
this.bones = parentMesh.bones;
|
|
||||||
this.vertices = parentMesh.vertices;
|
|
||||||
this.regionUVs = parentMesh.regionUVs;
|
|
||||||
this.triangles = parentMesh.triangles;
|
|
||||||
this.hullLength = parentMesh.hullLength;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return MeshAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.MeshAttachment = MeshAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var PathAttachment = (function (_super) {
|
|
||||||
__extends(PathAttachment, _super);
|
|
||||||
function PathAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.closed = false;
|
|
||||||
this.constantSpeed = false;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return PathAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.PathAttachment = PathAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var RegionAttachment = (function (_super) {
|
|
||||||
__extends(RegionAttachment, _super);
|
|
||||||
function RegionAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.scaleX = 1;
|
|
||||||
this.scaleY = 1;
|
|
||||||
this.rotation = 0;
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.offset = spine.Utils.newFloatArray(8);
|
|
||||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
|
||||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
RegionAttachment.prototype.setRegion = function (region) {
|
|
||||||
var vertices = this.vertices;
|
|
||||||
if (region.rotate) {
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v2;
|
|
||||||
vertices[RegionAttachment.U3] = region.u;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v;
|
|
||||||
vertices[RegionAttachment.U1] = region.u2;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertices[RegionAttachment.U1] = region.u;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v;
|
|
||||||
vertices[RegionAttachment.U3] = region.u2;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateOffset = function () {
|
|
||||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
||||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
||||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
||||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
||||||
var localX2 = localX + this.region.width * regionScaleX;
|
|
||||||
var localY2 = localY + this.region.height * regionScaleY;
|
|
||||||
var radians = this.rotation * Math.PI / 180;
|
|
||||||
var cos = Math.cos(radians);
|
|
||||||
var sin = Math.sin(radians);
|
|
||||||
var localXCos = localX * cos + this.x;
|
|
||||||
var localXSin = localX * sin;
|
|
||||||
var localYCos = localY * cos + this.y;
|
|
||||||
var localYSin = localY * sin;
|
|
||||||
var localX2Cos = localX2 * cos + this.x;
|
|
||||||
var localX2Sin = localX2 * sin;
|
|
||||||
var localY2Cos = localY2 * cos + this.y;
|
|
||||||
var localY2Sin = localY2 * sin;
|
|
||||||
var offset = this.offset;
|
|
||||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
|
||||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
|
||||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
|
||||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
|
||||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
|
||||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color;
|
|
||||||
var slotColor = slot.color;
|
|
||||||
var regionColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var offset = this.offset;
|
|
||||||
var bone = slot.bone;
|
|
||||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
var offsetX = 0, offsetY = 0;
|
|
||||||
offsetX = offset[RegionAttachment.OX1];
|
|
||||||
offsetY = offset[RegionAttachment.OY1];
|
|
||||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX2];
|
|
||||||
offsetY = offset[RegionAttachment.OY2];
|
|
||||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX3];
|
|
||||||
offsetY = offset[RegionAttachment.OY3];
|
|
||||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX4];
|
|
||||||
offsetY = offset[RegionAttachment.OY4];
|
|
||||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
|
||||||
return vertices;
|
|
||||||
};
|
|
||||||
RegionAttachment.OX1 = 0;
|
|
||||||
RegionAttachment.OY1 = 1;
|
|
||||||
RegionAttachment.OX2 = 2;
|
|
||||||
RegionAttachment.OY2 = 3;
|
|
||||||
RegionAttachment.OX3 = 4;
|
|
||||||
RegionAttachment.OY3 = 5;
|
|
||||||
RegionAttachment.OX4 = 6;
|
|
||||||
RegionAttachment.OY4 = 7;
|
|
||||||
RegionAttachment.X1 = 0;
|
|
||||||
RegionAttachment.Y1 = 1;
|
|
||||||
RegionAttachment.C1R = 2;
|
|
||||||
RegionAttachment.C1G = 3;
|
|
||||||
RegionAttachment.C1B = 4;
|
|
||||||
RegionAttachment.C1A = 5;
|
|
||||||
RegionAttachment.U1 = 6;
|
|
||||||
RegionAttachment.V1 = 7;
|
|
||||||
RegionAttachment.X2 = 8;
|
|
||||||
RegionAttachment.Y2 = 9;
|
|
||||||
RegionAttachment.C2R = 10;
|
|
||||||
RegionAttachment.C2G = 11;
|
|
||||||
RegionAttachment.C2B = 12;
|
|
||||||
RegionAttachment.C2A = 13;
|
|
||||||
RegionAttachment.U2 = 14;
|
|
||||||
RegionAttachment.V2 = 15;
|
|
||||||
RegionAttachment.X3 = 16;
|
|
||||||
RegionAttachment.Y3 = 17;
|
|
||||||
RegionAttachment.C3R = 18;
|
|
||||||
RegionAttachment.C3G = 19;
|
|
||||||
RegionAttachment.C3B = 20;
|
|
||||||
RegionAttachment.C3A = 21;
|
|
||||||
RegionAttachment.U3 = 22;
|
|
||||||
RegionAttachment.V3 = 23;
|
|
||||||
RegionAttachment.X4 = 24;
|
|
||||||
RegionAttachment.Y4 = 25;
|
|
||||||
RegionAttachment.C4R = 26;
|
|
||||||
RegionAttachment.C4G = 27;
|
|
||||||
RegionAttachment.C4B = 28;
|
|
||||||
RegionAttachment.C4A = 29;
|
|
||||||
RegionAttachment.U4 = 30;
|
|
||||||
RegionAttachment.V4 = 31;
|
|
||||||
return RegionAttachment;
|
|
||||||
}(spine.Attachment));
|
|
||||||
spine.RegionAttachment = RegionAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
var threejs;
|
var threejs;
|
||||||
(function (threejs) {
|
(function (threejs) {
|
||||||
@ -4796,8 +4801,6 @@ var spine;
|
|||||||
return THREE.LinearFilter;
|
return THREE.LinearFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMap)
|
else if (filter === spine.TextureFilter.MipMap)
|
||||||
return THREE.LinearMipMapLinearFilter;
|
return THREE.LinearMipMapLinearFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMapLinearLinear)
|
|
||||||
return THREE.LinearMipMapLinearFilter;
|
|
||||||
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
else if (filter === spine.TextureFilter.MipMapLinearNearest)
|
||||||
return THREE.LinearMipMapNearestFilter;
|
return THREE.LinearMipMapNearestFilter;
|
||||||
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
else if (filter === spine.TextureFilter.MipMapNearestLinear)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-webgl.d.ts
vendored
262
spine-ts/build/spine-webgl.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
|||||||
getErrors(): Map<string>;
|
getErrors(): Map<string>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare module spine {
|
||||||
|
abstract class Attachment {
|
||||||
|
name: string;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
abstract class VertexAttachment extends Attachment {
|
||||||
|
bones: Array<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
worldVerticesLength: number;
|
||||||
|
constructor(name: string);
|
||||||
|
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||||
|
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
interface AttachmentLoader {
|
||||||
|
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||||
|
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||||
|
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||||
|
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
enum AttachmentType {
|
||||||
|
Region = 0,
|
||||||
|
BoundingBox = 1,
|
||||||
|
Mesh = 2,
|
||||||
|
LinkedMesh = 3,
|
||||||
|
Path = 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class BoundingBoxAttachment extends VertexAttachment {
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class MeshAttachment extends VertexAttachment {
|
||||||
|
region: TextureRegion;
|
||||||
|
path: string;
|
||||||
|
regionUVs: ArrayLike<number>;
|
||||||
|
worldVertices: ArrayLike<number>;
|
||||||
|
triangles: Array<number>;
|
||||||
|
color: Color;
|
||||||
|
hullLength: number;
|
||||||
|
private parentMesh;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
updateUVs(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
getParentMesh(): MeshAttachment;
|
||||||
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class PathAttachment extends VertexAttachment {
|
||||||
|
lengths: Array<number>;
|
||||||
|
closed: boolean;
|
||||||
|
constantSpeed: boolean;
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class RegionAttachment extends Attachment {
|
||||||
|
static OX1: number;
|
||||||
|
static OY1: number;
|
||||||
|
static OX2: number;
|
||||||
|
static OY2: number;
|
||||||
|
static OX3: number;
|
||||||
|
static OY3: number;
|
||||||
|
static OX4: number;
|
||||||
|
static OY4: number;
|
||||||
|
static X1: number;
|
||||||
|
static Y1: number;
|
||||||
|
static C1R: number;
|
||||||
|
static C1G: number;
|
||||||
|
static C1B: number;
|
||||||
|
static C1A: number;
|
||||||
|
static U1: number;
|
||||||
|
static V1: number;
|
||||||
|
static X2: number;
|
||||||
|
static Y2: number;
|
||||||
|
static C2R: number;
|
||||||
|
static C2G: number;
|
||||||
|
static C2B: number;
|
||||||
|
static C2A: number;
|
||||||
|
static U2: number;
|
||||||
|
static V2: number;
|
||||||
|
static X3: number;
|
||||||
|
static Y3: number;
|
||||||
|
static C3R: number;
|
||||||
|
static C3G: number;
|
||||||
|
static C3B: number;
|
||||||
|
static C3A: number;
|
||||||
|
static U3: number;
|
||||||
|
static V3: number;
|
||||||
|
static X4: number;
|
||||||
|
static Y4: number;
|
||||||
|
static C4R: number;
|
||||||
|
static C4G: number;
|
||||||
|
static C4B: number;
|
||||||
|
static C4A: number;
|
||||||
|
static U4: number;
|
||||||
|
static V4: number;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
scaleX: number;
|
||||||
|
scaleY: number;
|
||||||
|
rotation: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: Color;
|
||||||
|
path: string;
|
||||||
|
rendererObject: any;
|
||||||
|
region: TextureRegion;
|
||||||
|
offset: ArrayLike<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
setRegion(region: TextureRegion): void;
|
||||||
|
updateOffset(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
enum BlendMode {
|
enum BlendMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
@ -757,7 +886,7 @@ declare module spine {
|
|||||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||||
static newFloatArray(size: number): ArrayLike<number>;
|
static newFloatArray(size: number): ArrayLike<number>;
|
||||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||||
}
|
}
|
||||||
class DebugUtils {
|
class DebugUtils {
|
||||||
static logBones(skeleton: Skeleton): void;
|
static logBones(skeleton: Skeleton): void;
|
||||||
@ -789,134 +918,9 @@ declare module spine {
|
|||||||
private frameTime;
|
private frameTime;
|
||||||
update(): void;
|
update(): void;
|
||||||
}
|
}
|
||||||
}
|
interface ArrayLike<T> {
|
||||||
declare module spine {
|
length: number;
|
||||||
abstract class Attachment {
|
[n: number]: T;
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
abstract class VertexAttachment extends Attachment {
|
|
||||||
bones: Array<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
worldVerticesLength: number;
|
|
||||||
constructor(name: string);
|
|
||||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
|
||||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
interface AttachmentLoader {
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
enum AttachmentType {
|
|
||||||
Region = 0,
|
|
||||||
BoundingBox = 1,
|
|
||||||
Mesh = 2,
|
|
||||||
LinkedMesh = 3,
|
|
||||||
Path = 4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class BoundingBoxAttachment extends VertexAttachment {
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class MeshAttachment extends VertexAttachment {
|
|
||||||
region: TextureRegion;
|
|
||||||
path: string;
|
|
||||||
regionUVs: ArrayLike<number>;
|
|
||||||
worldVertices: ArrayLike<number>;
|
|
||||||
triangles: Array<number>;
|
|
||||||
color: Color;
|
|
||||||
hullLength: number;
|
|
||||||
private parentMesh;
|
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
updateUVs(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class PathAttachment extends VertexAttachment {
|
|
||||||
lengths: Array<number>;
|
|
||||||
closed: boolean;
|
|
||||||
constantSpeed: boolean;
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class RegionAttachment extends Attachment {
|
|
||||||
static OX1: number;
|
|
||||||
static OY1: number;
|
|
||||||
static OX2: number;
|
|
||||||
static OY2: number;
|
|
||||||
static OX3: number;
|
|
||||||
static OY3: number;
|
|
||||||
static OX4: number;
|
|
||||||
static OY4: number;
|
|
||||||
static X1: number;
|
|
||||||
static Y1: number;
|
|
||||||
static C1R: number;
|
|
||||||
static C1G: number;
|
|
||||||
static C1B: number;
|
|
||||||
static C1A: number;
|
|
||||||
static U1: number;
|
|
||||||
static V1: number;
|
|
||||||
static X2: number;
|
|
||||||
static Y2: number;
|
|
||||||
static C2R: number;
|
|
||||||
static C2G: number;
|
|
||||||
static C2B: number;
|
|
||||||
static C2A: number;
|
|
||||||
static U2: number;
|
|
||||||
static V2: number;
|
|
||||||
static X3: number;
|
|
||||||
static Y3: number;
|
|
||||||
static C3R: number;
|
|
||||||
static C3G: number;
|
|
||||||
static C3B: number;
|
|
||||||
static C3A: number;
|
|
||||||
static U3: number;
|
|
||||||
static V3: number;
|
|
||||||
static X4: number;
|
|
||||||
static Y4: number;
|
|
||||||
static C4R: number;
|
|
||||||
static C4G: number;
|
|
||||||
static C4B: number;
|
|
||||||
static C4A: number;
|
|
||||||
static U4: number;
|
|
||||||
static V4: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
rotation: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
color: Color;
|
|
||||||
path: string;
|
|
||||||
rendererObject: any;
|
|
||||||
region: TextureRegion;
|
|
||||||
offset: ArrayLike<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
setRegion(region: TextureRegion): void;
|
|
||||||
updateOffset(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine.webgl {
|
declare module spine.webgl {
|
||||||
|
|||||||
@ -770,16 +770,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
var event_1 = events[ii];
|
var event_1 = events[ii];
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.event != null)
|
||||||
current.listener.event(i, event_1);
|
current.listener.event(i, event_1);
|
||||||
for (var iii = 0; iii < listenerCount; iii++)
|
for (var iii = 0; iii < listenerCount; iii++)
|
||||||
|
if (this.listeners[iii].event)
|
||||||
this.listeners[iii].event(i, event_1);
|
this.listeners[iii].event(i, event_1);
|
||||||
}
|
}
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
var count = spine.MathUtils.toInt(time / endTime);
|
var count = spine.MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.complete)
|
||||||
current.listener.complete(i, count);
|
current.listener.complete(i, count);
|
||||||
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
|
if (this.listeners[ii].complete)
|
||||||
this.listeners[ii].complete(i, count);
|
this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -796,9 +798,10 @@ var spine;
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (current == null)
|
if (current == null)
|
||||||
return;
|
return;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(trackIndex);
|
current.listener.end(trackIndex);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(trackIndex);
|
this.listeners[i].end(trackIndex);
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
this.freeAll(current);
|
this.freeAll(current);
|
||||||
@ -821,9 +824,10 @@ var spine;
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
var previous = current.previous;
|
var previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(index);
|
current.listener.end(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(index);
|
this.listeners[i].end(index);
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -837,9 +841,10 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
if (entry.listener != null)
|
if (entry.listener != null && entry.listener.start != null)
|
||||||
entry.listener.start(index);
|
entry.listener.start(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].start)
|
||||||
this.listeners[i].start(index);
|
this.listeners[i].start(index);
|
||||||
};
|
};
|
||||||
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
||||||
@ -1091,6 +1096,423 @@ var spine;
|
|||||||
spine.AssetManager = AssetManager;
|
spine.AssetManager = AssetManager;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var Attachment = (function () {
|
||||||
|
function Attachment(name) {
|
||||||
|
if (name == null)
|
||||||
|
throw new Error("name cannot be null.");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
return Attachment;
|
||||||
|
}());
|
||||||
|
spine.Attachment = Attachment;
|
||||||
|
var VertexAttachment = (function (_super) {
|
||||||
|
__extends(VertexAttachment, _super);
|
||||||
|
function VertexAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.worldVerticesLength = 0;
|
||||||
|
}
|
||||||
|
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||||
|
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||||
|
count += offset;
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||||
|
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var v = 0, skip = 0;
|
||||||
|
for (var i = 0; i < start; i += 2) {
|
||||||
|
var n = bones[v];
|
||||||
|
v += n + 1;
|
||||||
|
skip += n;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment;
|
||||||
|
};
|
||||||
|
return VertexAttachment;
|
||||||
|
}(Attachment));
|
||||||
|
spine.VertexAttachment = VertexAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
(function (AttachmentType) {
|
||||||
|
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||||
|
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||||
|
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||||
|
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||||
|
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||||
|
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||||
|
var AttachmentType = spine.AttachmentType;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var BoundingBoxAttachment = (function (_super) {
|
||||||
|
__extends(BoundingBoxAttachment, _super);
|
||||||
|
function BoundingBoxAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return BoundingBoxAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var MeshAttachment = (function (_super) {
|
||||||
|
__extends(MeshAttachment, _super);
|
||||||
|
function MeshAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.inheritDeform = false;
|
||||||
|
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
MeshAttachment.prototype.updateUVs = function () {
|
||||||
|
var regionUVs = this.regionUVs;
|
||||||
|
var verticesLength = regionUVs.length;
|
||||||
|
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||||
|
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||||
|
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||||
|
var u = 0, v = 0, width = 0, height = 0;
|
||||||
|
if (this.region == null) {
|
||||||
|
u = v = 0;
|
||||||
|
width = height = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = this.region.u;
|
||||||
|
v = this.region.v;
|
||||||
|
width = this.region.u2 - u;
|
||||||
|
height = this.region.v2 - v;
|
||||||
|
}
|
||||||
|
if (this.region.rotate) {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||||
|
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||||
|
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
var verticesLength = vertices.length;
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||||
|
var vx = vertices[v], vy = vertices[v + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
|
return this.parentMesh;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
if (parentMesh != null) {
|
||||||
|
this.bones = parentMesh.bones;
|
||||||
|
this.vertices = parentMesh.vertices;
|
||||||
|
this.regionUVs = parentMesh.regionUVs;
|
||||||
|
this.triangles = parentMesh.triangles;
|
||||||
|
this.hullLength = parentMesh.hullLength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return MeshAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.MeshAttachment = MeshAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var PathAttachment = (function (_super) {
|
||||||
|
__extends(PathAttachment, _super);
|
||||||
|
function PathAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.closed = false;
|
||||||
|
this.constantSpeed = false;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return PathAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.PathAttachment = PathAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var RegionAttachment = (function (_super) {
|
||||||
|
__extends(RegionAttachment, _super);
|
||||||
|
function RegionAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.x = 0;
|
||||||
|
this.y = 0;
|
||||||
|
this.scaleX = 1;
|
||||||
|
this.scaleY = 1;
|
||||||
|
this.rotation = 0;
|
||||||
|
this.width = 0;
|
||||||
|
this.height = 0;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.offset = spine.Utils.newFloatArray(8);
|
||||||
|
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||||
|
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
RegionAttachment.prototype.setRegion = function (region) {
|
||||||
|
var vertices = this.vertices;
|
||||||
|
if (region.rotate) {
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v2;
|
||||||
|
vertices[RegionAttachment.U3] = region.u;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v;
|
||||||
|
vertices[RegionAttachment.U1] = region.u2;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertices[RegionAttachment.U1] = region.u;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v;
|
||||||
|
vertices[RegionAttachment.U3] = region.u2;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
|
}
|
||||||
|
this.region = region;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateOffset = function () {
|
||||||
|
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||||
|
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||||
|
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||||
|
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||||
|
var localX2 = localX + this.region.width * regionScaleX;
|
||||||
|
var localY2 = localY + this.region.height * regionScaleY;
|
||||||
|
var radians = this.rotation * Math.PI / 180;
|
||||||
|
var cos = Math.cos(radians);
|
||||||
|
var sin = Math.sin(radians);
|
||||||
|
var localXCos = localX * cos + this.x;
|
||||||
|
var localXSin = localX * sin;
|
||||||
|
var localYCos = localY * cos + this.y;
|
||||||
|
var localYSin = localY * sin;
|
||||||
|
var localX2Cos = localX2 * cos + this.x;
|
||||||
|
var localX2Sin = localX2 * sin;
|
||||||
|
var localY2Cos = localY2 * cos + this.y;
|
||||||
|
var localY2Sin = localY2 * sin;
|
||||||
|
var offset = this.offset;
|
||||||
|
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||||
|
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||||
|
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||||
|
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||||
|
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||||
|
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color;
|
||||||
|
var slotColor = slot.color;
|
||||||
|
var regionColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var offset = this.offset;
|
||||||
|
var bone = slot.bone;
|
||||||
|
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
var offsetX = 0, offsetY = 0;
|
||||||
|
offsetX = offset[RegionAttachment.OX1];
|
||||||
|
offsetY = offset[RegionAttachment.OY1];
|
||||||
|
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX2];
|
||||||
|
offsetY = offset[RegionAttachment.OY2];
|
||||||
|
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX3];
|
||||||
|
offsetY = offset[RegionAttachment.OY3];
|
||||||
|
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX4];
|
||||||
|
offsetY = offset[RegionAttachment.OY4];
|
||||||
|
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
return vertices;
|
||||||
|
};
|
||||||
|
RegionAttachment.OX1 = 0;
|
||||||
|
RegionAttachment.OY1 = 1;
|
||||||
|
RegionAttachment.OX2 = 2;
|
||||||
|
RegionAttachment.OY2 = 3;
|
||||||
|
RegionAttachment.OX3 = 4;
|
||||||
|
RegionAttachment.OY3 = 5;
|
||||||
|
RegionAttachment.OX4 = 6;
|
||||||
|
RegionAttachment.OY4 = 7;
|
||||||
|
RegionAttachment.X1 = 0;
|
||||||
|
RegionAttachment.Y1 = 1;
|
||||||
|
RegionAttachment.C1R = 2;
|
||||||
|
RegionAttachment.C1G = 3;
|
||||||
|
RegionAttachment.C1B = 4;
|
||||||
|
RegionAttachment.C1A = 5;
|
||||||
|
RegionAttachment.U1 = 6;
|
||||||
|
RegionAttachment.V1 = 7;
|
||||||
|
RegionAttachment.X2 = 8;
|
||||||
|
RegionAttachment.Y2 = 9;
|
||||||
|
RegionAttachment.C2R = 10;
|
||||||
|
RegionAttachment.C2G = 11;
|
||||||
|
RegionAttachment.C2B = 12;
|
||||||
|
RegionAttachment.C2A = 13;
|
||||||
|
RegionAttachment.U2 = 14;
|
||||||
|
RegionAttachment.V2 = 15;
|
||||||
|
RegionAttachment.X3 = 16;
|
||||||
|
RegionAttachment.Y3 = 17;
|
||||||
|
RegionAttachment.C3R = 18;
|
||||||
|
RegionAttachment.C3G = 19;
|
||||||
|
RegionAttachment.C3B = 20;
|
||||||
|
RegionAttachment.C3A = 21;
|
||||||
|
RegionAttachment.U3 = 22;
|
||||||
|
RegionAttachment.V3 = 23;
|
||||||
|
RegionAttachment.X4 = 24;
|
||||||
|
RegionAttachment.Y4 = 25;
|
||||||
|
RegionAttachment.C4R = 26;
|
||||||
|
RegionAttachment.C4G = 27;
|
||||||
|
RegionAttachment.C4B = 28;
|
||||||
|
RegionAttachment.C4A = 29;
|
||||||
|
RegionAttachment.U4 = 30;
|
||||||
|
RegionAttachment.V4 = 31;
|
||||||
|
return RegionAttachment;
|
||||||
|
}(spine.Attachment));
|
||||||
|
spine.RegionAttachment = RegionAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
(function (BlendMode) {
|
(function (BlendMode) {
|
||||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||||
@ -3483,7 +3905,7 @@ var spine;
|
|||||||
for (var key in dictionary) {
|
for (var key in dictionary) {
|
||||||
var skinAttachment = dictionary[key];
|
var skinAttachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
var attachment = this.getAttachment(slotIndex, name);
|
var attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null)
|
if (attachment != null)
|
||||||
slot.setAttachment(attachment);
|
slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
@ -3793,7 +4215,6 @@ var spine;
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
var attachment = new spine.RegionAttachment(name);
|
var attachment = new spine.RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
};
|
};
|
||||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||||
@ -4163,422 +4584,6 @@ var spine;
|
|||||||
spine.TimeKeeper = TimeKeeper;
|
spine.TimeKeeper = TimeKeeper;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
(function (spine) {
|
|
||||||
var Attachment = (function () {
|
|
||||||
function Attachment(name) {
|
|
||||||
if (name == null)
|
|
||||||
throw new Error("name cannot be null.");
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
return Attachment;
|
|
||||||
}());
|
|
||||||
spine.Attachment = Attachment;
|
|
||||||
var VertexAttachment = (function (_super) {
|
|
||||||
__extends(VertexAttachment, _super);
|
|
||||||
function VertexAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.worldVerticesLength = 0;
|
|
||||||
}
|
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
|
||||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
|
||||||
count += offset;
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
|
||||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var v = 0, skip = 0;
|
|
||||||
for (var i = 0; i < start; i += 2) {
|
|
||||||
var n = bones[v];
|
|
||||||
v += n + 1;
|
|
||||||
skip += n;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
return VertexAttachment;
|
|
||||||
}(Attachment));
|
|
||||||
spine.VertexAttachment = VertexAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
(function (AttachmentType) {
|
|
||||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
|
||||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
|
||||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
|
||||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
|
||||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
|
||||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
|
||||||
var AttachmentType = spine.AttachmentType;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var BoundingBoxAttachment = (function (_super) {
|
|
||||||
__extends(BoundingBoxAttachment, _super);
|
|
||||||
function BoundingBoxAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return BoundingBoxAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var MeshAttachment = (function (_super) {
|
|
||||||
__extends(MeshAttachment, _super);
|
|
||||||
function MeshAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.inheritDeform = false;
|
|
||||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
MeshAttachment.prototype.updateUVs = function () {
|
|
||||||
var regionUVs = this.regionUVs;
|
|
||||||
var verticesLength = regionUVs.length;
|
|
||||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
|
||||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
|
||||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
|
||||||
var u = 0, v = 0, width = 0, height = 0;
|
|
||||||
if (this.region == null) {
|
|
||||||
u = v = 0;
|
|
||||||
width = height = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u = this.region.u;
|
|
||||||
v = this.region.v;
|
|
||||||
width = this.region.u2 - u;
|
|
||||||
height = this.region.v2 - v;
|
|
||||||
}
|
|
||||||
if (this.region.rotate) {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
|
||||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
|
||||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
var verticesLength = vertices.length;
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
|
||||||
var vx = vertices[v], vy = vertices[v + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
|
||||||
return this.parentMesh;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
|
||||||
this.parentMesh = parentMesh;
|
|
||||||
if (parentMesh != null) {
|
|
||||||
this.bones = parentMesh.bones;
|
|
||||||
this.vertices = parentMesh.vertices;
|
|
||||||
this.regionUVs = parentMesh.regionUVs;
|
|
||||||
this.triangles = parentMesh.triangles;
|
|
||||||
this.hullLength = parentMesh.hullLength;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return MeshAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.MeshAttachment = MeshAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var PathAttachment = (function (_super) {
|
|
||||||
__extends(PathAttachment, _super);
|
|
||||||
function PathAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.closed = false;
|
|
||||||
this.constantSpeed = false;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return PathAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.PathAttachment = PathAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var RegionAttachment = (function (_super) {
|
|
||||||
__extends(RegionAttachment, _super);
|
|
||||||
function RegionAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.scaleX = 1;
|
|
||||||
this.scaleY = 1;
|
|
||||||
this.rotation = 0;
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.offset = spine.Utils.newFloatArray(8);
|
|
||||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
|
||||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
RegionAttachment.prototype.setRegion = function (region) {
|
|
||||||
var vertices = this.vertices;
|
|
||||||
if (region.rotate) {
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v2;
|
|
||||||
vertices[RegionAttachment.U3] = region.u;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v;
|
|
||||||
vertices[RegionAttachment.U1] = region.u2;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertices[RegionAttachment.U1] = region.u;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v;
|
|
||||||
vertices[RegionAttachment.U3] = region.u2;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateOffset = function () {
|
|
||||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
||||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
||||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
||||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
||||||
var localX2 = localX + this.region.width * regionScaleX;
|
|
||||||
var localY2 = localY + this.region.height * regionScaleY;
|
|
||||||
var radians = this.rotation * Math.PI / 180;
|
|
||||||
var cos = Math.cos(radians);
|
|
||||||
var sin = Math.sin(radians);
|
|
||||||
var localXCos = localX * cos + this.x;
|
|
||||||
var localXSin = localX * sin;
|
|
||||||
var localYCos = localY * cos + this.y;
|
|
||||||
var localYSin = localY * sin;
|
|
||||||
var localX2Cos = localX2 * cos + this.x;
|
|
||||||
var localX2Sin = localX2 * sin;
|
|
||||||
var localY2Cos = localY2 * cos + this.y;
|
|
||||||
var localY2Sin = localY2 * sin;
|
|
||||||
var offset = this.offset;
|
|
||||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
|
||||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
|
||||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
|
||||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
|
||||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
|
||||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color;
|
|
||||||
var slotColor = slot.color;
|
|
||||||
var regionColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var offset = this.offset;
|
|
||||||
var bone = slot.bone;
|
|
||||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
var offsetX = 0, offsetY = 0;
|
|
||||||
offsetX = offset[RegionAttachment.OX1];
|
|
||||||
offsetY = offset[RegionAttachment.OY1];
|
|
||||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX2];
|
|
||||||
offsetY = offset[RegionAttachment.OY2];
|
|
||||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX3];
|
|
||||||
offsetY = offset[RegionAttachment.OY3];
|
|
||||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX4];
|
|
||||||
offsetY = offset[RegionAttachment.OY4];
|
|
||||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
|
||||||
return vertices;
|
|
||||||
};
|
|
||||||
RegionAttachment.OX1 = 0;
|
|
||||||
RegionAttachment.OY1 = 1;
|
|
||||||
RegionAttachment.OX2 = 2;
|
|
||||||
RegionAttachment.OY2 = 3;
|
|
||||||
RegionAttachment.OX3 = 4;
|
|
||||||
RegionAttachment.OY3 = 5;
|
|
||||||
RegionAttachment.OX4 = 6;
|
|
||||||
RegionAttachment.OY4 = 7;
|
|
||||||
RegionAttachment.X1 = 0;
|
|
||||||
RegionAttachment.Y1 = 1;
|
|
||||||
RegionAttachment.C1R = 2;
|
|
||||||
RegionAttachment.C1G = 3;
|
|
||||||
RegionAttachment.C1B = 4;
|
|
||||||
RegionAttachment.C1A = 5;
|
|
||||||
RegionAttachment.U1 = 6;
|
|
||||||
RegionAttachment.V1 = 7;
|
|
||||||
RegionAttachment.X2 = 8;
|
|
||||||
RegionAttachment.Y2 = 9;
|
|
||||||
RegionAttachment.C2R = 10;
|
|
||||||
RegionAttachment.C2G = 11;
|
|
||||||
RegionAttachment.C2B = 12;
|
|
||||||
RegionAttachment.C2A = 13;
|
|
||||||
RegionAttachment.U2 = 14;
|
|
||||||
RegionAttachment.V2 = 15;
|
|
||||||
RegionAttachment.X3 = 16;
|
|
||||||
RegionAttachment.Y3 = 17;
|
|
||||||
RegionAttachment.C3R = 18;
|
|
||||||
RegionAttachment.C3G = 19;
|
|
||||||
RegionAttachment.C3B = 20;
|
|
||||||
RegionAttachment.C3A = 21;
|
|
||||||
RegionAttachment.U3 = 22;
|
|
||||||
RegionAttachment.V3 = 23;
|
|
||||||
RegionAttachment.X4 = 24;
|
|
||||||
RegionAttachment.Y4 = 25;
|
|
||||||
RegionAttachment.C4R = 26;
|
|
||||||
RegionAttachment.C4G = 27;
|
|
||||||
RegionAttachment.C4B = 28;
|
|
||||||
RegionAttachment.C4A = 29;
|
|
||||||
RegionAttachment.U4 = 30;
|
|
||||||
RegionAttachment.V4 = 31;
|
|
||||||
return RegionAttachment;
|
|
||||||
}(spine.Attachment));
|
|
||||||
spine.RegionAttachment = RegionAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
var webgl;
|
var webgl;
|
||||||
(function (webgl) {
|
(function (webgl) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
262
spine-ts/build/spine-widget.d.ts
vendored
262
spine-ts/build/spine-widget.d.ts
vendored
@ -256,6 +256,135 @@ declare module spine {
|
|||||||
getErrors(): Map<string>;
|
getErrors(): Map<string>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
declare module spine {
|
||||||
|
abstract class Attachment {
|
||||||
|
name: string;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
abstract class VertexAttachment extends Attachment {
|
||||||
|
bones: Array<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
worldVerticesLength: number;
|
||||||
|
constructor(name: string);
|
||||||
|
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
||||||
|
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
interface AttachmentLoader {
|
||||||
|
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
||||||
|
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
||||||
|
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
||||||
|
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
enum AttachmentType {
|
||||||
|
Region = 0,
|
||||||
|
BoundingBox = 1,
|
||||||
|
Mesh = 2,
|
||||||
|
LinkedMesh = 3,
|
||||||
|
Path = 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class BoundingBoxAttachment extends VertexAttachment {
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class MeshAttachment extends VertexAttachment {
|
||||||
|
region: TextureRegion;
|
||||||
|
path: string;
|
||||||
|
regionUVs: ArrayLike<number>;
|
||||||
|
worldVertices: ArrayLike<number>;
|
||||||
|
triangles: Array<number>;
|
||||||
|
color: Color;
|
||||||
|
hullLength: number;
|
||||||
|
private parentMesh;
|
||||||
|
inheritDeform: boolean;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
updateUVs(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||||
|
getParentMesh(): MeshAttachment;
|
||||||
|
setParentMesh(parentMesh: MeshAttachment): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class PathAttachment extends VertexAttachment {
|
||||||
|
lengths: Array<number>;
|
||||||
|
closed: boolean;
|
||||||
|
constantSpeed: boolean;
|
||||||
|
color: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module spine {
|
||||||
|
class RegionAttachment extends Attachment {
|
||||||
|
static OX1: number;
|
||||||
|
static OY1: number;
|
||||||
|
static OX2: number;
|
||||||
|
static OY2: number;
|
||||||
|
static OX3: number;
|
||||||
|
static OY3: number;
|
||||||
|
static OX4: number;
|
||||||
|
static OY4: number;
|
||||||
|
static X1: number;
|
||||||
|
static Y1: number;
|
||||||
|
static C1R: number;
|
||||||
|
static C1G: number;
|
||||||
|
static C1B: number;
|
||||||
|
static C1A: number;
|
||||||
|
static U1: number;
|
||||||
|
static V1: number;
|
||||||
|
static X2: number;
|
||||||
|
static Y2: number;
|
||||||
|
static C2R: number;
|
||||||
|
static C2G: number;
|
||||||
|
static C2B: number;
|
||||||
|
static C2A: number;
|
||||||
|
static U2: number;
|
||||||
|
static V2: number;
|
||||||
|
static X3: number;
|
||||||
|
static Y3: number;
|
||||||
|
static C3R: number;
|
||||||
|
static C3G: number;
|
||||||
|
static C3B: number;
|
||||||
|
static C3A: number;
|
||||||
|
static U3: number;
|
||||||
|
static V3: number;
|
||||||
|
static X4: number;
|
||||||
|
static Y4: number;
|
||||||
|
static C4R: number;
|
||||||
|
static C4G: number;
|
||||||
|
static C4B: number;
|
||||||
|
static C4A: number;
|
||||||
|
static U4: number;
|
||||||
|
static V4: number;
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
scaleX: number;
|
||||||
|
scaleY: number;
|
||||||
|
rotation: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
color: Color;
|
||||||
|
path: string;
|
||||||
|
rendererObject: any;
|
||||||
|
region: TextureRegion;
|
||||||
|
offset: ArrayLike<number>;
|
||||||
|
vertices: ArrayLike<number>;
|
||||||
|
tempColor: Color;
|
||||||
|
constructor(name: string);
|
||||||
|
setRegion(region: TextureRegion): void;
|
||||||
|
updateOffset(): void;
|
||||||
|
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
||||||
|
}
|
||||||
|
}
|
||||||
declare module spine {
|
declare module spine {
|
||||||
enum BlendMode {
|
enum BlendMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
@ -757,7 +886,7 @@ declare module spine {
|
|||||||
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
|
||||||
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
static newArray<T>(size: number, defaultValue: T): Array<T>;
|
||||||
static newFloatArray(size: number): ArrayLike<number>;
|
static newFloatArray(size: number): ArrayLike<number>;
|
||||||
static toFloatArray(array: Array<number>): Float32Array | number[];
|
static toFloatArray(array: Array<number>): number[] | Float32Array;
|
||||||
}
|
}
|
||||||
class DebugUtils {
|
class DebugUtils {
|
||||||
static logBones(skeleton: Skeleton): void;
|
static logBones(skeleton: Skeleton): void;
|
||||||
@ -789,134 +918,9 @@ declare module spine {
|
|||||||
private frameTime;
|
private frameTime;
|
||||||
update(): void;
|
update(): void;
|
||||||
}
|
}
|
||||||
}
|
interface ArrayLike<T> {
|
||||||
declare module spine {
|
length: number;
|
||||||
abstract class Attachment {
|
[n: number]: T;
|
||||||
name: string;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
abstract class VertexAttachment extends Attachment {
|
|
||||||
bones: Array<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
worldVerticesLength: number;
|
|
||||||
constructor(name: string);
|
|
||||||
computeWorldVertices(slot: Slot, worldVertices: ArrayLike<number>): void;
|
|
||||||
computeWorldVerticesWith(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number): void;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
interface AttachmentLoader {
|
|
||||||
newRegionAttachment(skin: Skin, name: string, path: string): RegionAttachment;
|
|
||||||
newMeshAttachment(skin: Skin, name: string, path: string): MeshAttachment;
|
|
||||||
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
|
|
||||||
newPathAttachment(skin: Skin, name: string): PathAttachment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
enum AttachmentType {
|
|
||||||
Region = 0,
|
|
||||||
BoundingBox = 1,
|
|
||||||
Mesh = 2,
|
|
||||||
LinkedMesh = 3,
|
|
||||||
Path = 4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class BoundingBoxAttachment extends VertexAttachment {
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class MeshAttachment extends VertexAttachment {
|
|
||||||
region: TextureRegion;
|
|
||||||
path: string;
|
|
||||||
regionUVs: ArrayLike<number>;
|
|
||||||
worldVertices: ArrayLike<number>;
|
|
||||||
triangles: Array<number>;
|
|
||||||
color: Color;
|
|
||||||
hullLength: number;
|
|
||||||
private parentMesh;
|
|
||||||
inheritDeform: boolean;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
updateUVs(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
|
||||||
getParentMesh(): MeshAttachment;
|
|
||||||
setParentMesh(parentMesh: MeshAttachment): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class PathAttachment extends VertexAttachment {
|
|
||||||
lengths: Array<number>;
|
|
||||||
closed: boolean;
|
|
||||||
constantSpeed: boolean;
|
|
||||||
color: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
declare module spine {
|
|
||||||
class RegionAttachment extends Attachment {
|
|
||||||
static OX1: number;
|
|
||||||
static OY1: number;
|
|
||||||
static OX2: number;
|
|
||||||
static OY2: number;
|
|
||||||
static OX3: number;
|
|
||||||
static OY3: number;
|
|
||||||
static OX4: number;
|
|
||||||
static OY4: number;
|
|
||||||
static X1: number;
|
|
||||||
static Y1: number;
|
|
||||||
static C1R: number;
|
|
||||||
static C1G: number;
|
|
||||||
static C1B: number;
|
|
||||||
static C1A: number;
|
|
||||||
static U1: number;
|
|
||||||
static V1: number;
|
|
||||||
static X2: number;
|
|
||||||
static Y2: number;
|
|
||||||
static C2R: number;
|
|
||||||
static C2G: number;
|
|
||||||
static C2B: number;
|
|
||||||
static C2A: number;
|
|
||||||
static U2: number;
|
|
||||||
static V2: number;
|
|
||||||
static X3: number;
|
|
||||||
static Y3: number;
|
|
||||||
static C3R: number;
|
|
||||||
static C3G: number;
|
|
||||||
static C3B: number;
|
|
||||||
static C3A: number;
|
|
||||||
static U3: number;
|
|
||||||
static V3: number;
|
|
||||||
static X4: number;
|
|
||||||
static Y4: number;
|
|
||||||
static C4R: number;
|
|
||||||
static C4G: number;
|
|
||||||
static C4B: number;
|
|
||||||
static C4A: number;
|
|
||||||
static U4: number;
|
|
||||||
static V4: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
scaleX: number;
|
|
||||||
scaleY: number;
|
|
||||||
rotation: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
color: Color;
|
|
||||||
path: string;
|
|
||||||
rendererObject: any;
|
|
||||||
region: TextureRegion;
|
|
||||||
offset: ArrayLike<number>;
|
|
||||||
vertices: ArrayLike<number>;
|
|
||||||
tempColor: Color;
|
|
||||||
constructor(name: string);
|
|
||||||
setRegion(region: TextureRegion): void;
|
|
||||||
updateOffset(): void;
|
|
||||||
updateWorldVertices(slot: Slot, premultipliedAlpha: boolean): ArrayLike<number>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module spine.webgl {
|
declare module spine.webgl {
|
||||||
|
|||||||
@ -770,16 +770,18 @@ var spine;
|
|||||||
}
|
}
|
||||||
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
for (var ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
var event_1 = events[ii];
|
var event_1 = events[ii];
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.event != null)
|
||||||
current.listener.event(i, event_1);
|
current.listener.event(i, event_1);
|
||||||
for (var iii = 0; iii < listenerCount; iii++)
|
for (var iii = 0; iii < listenerCount; iii++)
|
||||||
|
if (this.listeners[iii].event)
|
||||||
this.listeners[iii].event(i, event_1);
|
this.listeners[iii].event(i, event_1);
|
||||||
}
|
}
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
var count = spine.MathUtils.toInt(time / endTime);
|
var count = spine.MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.complete)
|
||||||
current.listener.complete(i, count);
|
current.listener.complete(i, count);
|
||||||
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (var ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
|
if (this.listeners[ii].complete)
|
||||||
this.listeners[ii].complete(i, count);
|
this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -796,9 +798,10 @@ var spine;
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (current == null)
|
if (current == null)
|
||||||
return;
|
return;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(trackIndex);
|
current.listener.end(trackIndex);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(trackIndex);
|
this.listeners[i].end(trackIndex);
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
this.freeAll(current);
|
this.freeAll(current);
|
||||||
@ -821,9 +824,10 @@ var spine;
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
var previous = current.previous;
|
var previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
if (current.listener != null)
|
if (current.listener != null && current.listener.end != null)
|
||||||
current.listener.end(index);
|
current.listener.end(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].end)
|
||||||
this.listeners[i].end(index);
|
this.listeners[i].end(index);
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -837,9 +841,10 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
if (entry.listener != null)
|
if (entry.listener != null && entry.listener.start != null)
|
||||||
entry.listener.start(index);
|
entry.listener.start(index);
|
||||||
for (var i = 0, n = this.listeners.length; i < n; i++)
|
for (var i = 0, n = this.listeners.length; i < n; i++)
|
||||||
|
if (this.listeners[i].start)
|
||||||
this.listeners[i].start(index);
|
this.listeners[i].start(index);
|
||||||
};
|
};
|
||||||
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) {
|
||||||
@ -1091,6 +1096,423 @@ var spine;
|
|||||||
spine.AssetManager = AssetManager;
|
spine.AssetManager = AssetManager;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var Attachment = (function () {
|
||||||
|
function Attachment(name) {
|
||||||
|
if (name == null)
|
||||||
|
throw new Error("name cannot be null.");
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
return Attachment;
|
||||||
|
}());
|
||||||
|
spine.Attachment = Attachment;
|
||||||
|
var VertexAttachment = (function (_super) {
|
||||||
|
__extends(VertexAttachment, _super);
|
||||||
|
function VertexAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.worldVerticesLength = 0;
|
||||||
|
}
|
||||||
|
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
||||||
|
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
||||||
|
count += offset;
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
||||||
|
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var v = 0, skip = 0;
|
||||||
|
for (var i = 0; i < start; i += 2) {
|
||||||
|
var n = bones[v];
|
||||||
|
v += n + 1;
|
||||||
|
skip += n;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var n = bones[v++];
|
||||||
|
n += v;
|
||||||
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment;
|
||||||
|
};
|
||||||
|
return VertexAttachment;
|
||||||
|
}(Attachment));
|
||||||
|
spine.VertexAttachment = VertexAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
(function (AttachmentType) {
|
||||||
|
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
||||||
|
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
||||||
|
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
||||||
|
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
||||||
|
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
||||||
|
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
||||||
|
var AttachmentType = spine.AttachmentType;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var BoundingBoxAttachment = (function (_super) {
|
||||||
|
__extends(BoundingBoxAttachment, _super);
|
||||||
|
function BoundingBoxAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return BoundingBoxAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var MeshAttachment = (function (_super) {
|
||||||
|
__extends(MeshAttachment, _super);
|
||||||
|
function MeshAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.inheritDeform = false;
|
||||||
|
this.tempColor = new spine.Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
MeshAttachment.prototype.updateUVs = function () {
|
||||||
|
var regionUVs = this.regionUVs;
|
||||||
|
var verticesLength = regionUVs.length;
|
||||||
|
var worldVerticesLength = (verticesLength >> 1) * 8;
|
||||||
|
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
||||||
|
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
||||||
|
var u = 0, v = 0, width = 0, height = 0;
|
||||||
|
if (this.region == null) {
|
||||||
|
u = v = 0;
|
||||||
|
width = height = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
u = this.region.u;
|
||||||
|
v = this.region.v;
|
||||||
|
width = this.region.u2 - u;
|
||||||
|
height = this.region.v2 - v;
|
||||||
|
}
|
||||||
|
if (this.region.rotate) {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
||||||
|
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
||||||
|
this.worldVertices[w] = u + regionUVs[i] * width;
|
||||||
|
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
||||||
|
var x = skeleton.x, y = skeleton.y;
|
||||||
|
var deformArray = slot.attachmentVertices;
|
||||||
|
var vertices = this.vertices, worldVertices = this.worldVertices;
|
||||||
|
var bones = this.bones;
|
||||||
|
if (bones == null) {
|
||||||
|
var verticesLength = vertices.length;
|
||||||
|
if (deformArray.length > 0)
|
||||||
|
vertices = deformArray;
|
||||||
|
var bone = slot.bone;
|
||||||
|
x += bone.worldX;
|
||||||
|
y += bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
||||||
|
var vx = vertices[v], vy = vertices[v + 1];
|
||||||
|
worldVertices[w] = vx * a + vy * b + x;
|
||||||
|
worldVertices[w + 1] = vx * c + vy * d + y;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
}
|
||||||
|
var skeletonBones = skeleton.bones;
|
||||||
|
if (deformArray.length == 0) {
|
||||||
|
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var vx = vertices[b], vy = vertices[b + 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var deform = deformArray;
|
||||||
|
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
||||||
|
var wx = x, wy = y;
|
||||||
|
var nn = bones[v++] + v;
|
||||||
|
for (; v < nn; v++, b += 3, f += 2) {
|
||||||
|
var bone = skeletonBones[bones[v]];
|
||||||
|
var 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;
|
||||||
|
worldVertices[w + 2] = color.r;
|
||||||
|
worldVertices[w + 3] = color.g;
|
||||||
|
worldVertices[w + 4] = color.b;
|
||||||
|
worldVertices[w + 5] = color.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldVertices;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||||
|
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.getParentMesh = function () {
|
||||||
|
return this.parentMesh;
|
||||||
|
};
|
||||||
|
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
if (parentMesh != null) {
|
||||||
|
this.bones = parentMesh.bones;
|
||||||
|
this.vertices = parentMesh.vertices;
|
||||||
|
this.regionUVs = parentMesh.regionUVs;
|
||||||
|
this.triangles = parentMesh.triangles;
|
||||||
|
this.hullLength = parentMesh.hullLength;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return MeshAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.MeshAttachment = MeshAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var PathAttachment = (function (_super) {
|
||||||
|
__extends(PathAttachment, _super);
|
||||||
|
function PathAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.closed = false;
|
||||||
|
this.constantSpeed = false;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
return PathAttachment;
|
||||||
|
}(spine.VertexAttachment));
|
||||||
|
spine.PathAttachment = PathAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
|
(function (spine) {
|
||||||
|
var RegionAttachment = (function (_super) {
|
||||||
|
__extends(RegionAttachment, _super);
|
||||||
|
function RegionAttachment(name) {
|
||||||
|
_super.call(this, name);
|
||||||
|
this.x = 0;
|
||||||
|
this.y = 0;
|
||||||
|
this.scaleX = 1;
|
||||||
|
this.scaleY = 1;
|
||||||
|
this.rotation = 0;
|
||||||
|
this.width = 0;
|
||||||
|
this.height = 0;
|
||||||
|
this.color = new spine.Color(1, 1, 1, 1);
|
||||||
|
this.offset = spine.Utils.newFloatArray(8);
|
||||||
|
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
||||||
|
this.tempColor = new spine.Color(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
RegionAttachment.prototype.setRegion = function (region) {
|
||||||
|
var vertices = this.vertices;
|
||||||
|
if (region.rotate) {
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v2;
|
||||||
|
vertices[RegionAttachment.U3] = region.u;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v;
|
||||||
|
vertices[RegionAttachment.U1] = region.u2;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vertices[RegionAttachment.U1] = region.u;
|
||||||
|
vertices[RegionAttachment.V1] = region.v2;
|
||||||
|
vertices[RegionAttachment.U2] = region.u;
|
||||||
|
vertices[RegionAttachment.V2] = region.v;
|
||||||
|
vertices[RegionAttachment.U3] = region.u2;
|
||||||
|
vertices[RegionAttachment.V3] = region.v;
|
||||||
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
|
}
|
||||||
|
this.region = region;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateOffset = function () {
|
||||||
|
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
||||||
|
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
||||||
|
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
||||||
|
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
||||||
|
var localX2 = localX + this.region.width * regionScaleX;
|
||||||
|
var localY2 = localY + this.region.height * regionScaleY;
|
||||||
|
var radians = this.rotation * Math.PI / 180;
|
||||||
|
var cos = Math.cos(radians);
|
||||||
|
var sin = Math.sin(radians);
|
||||||
|
var localXCos = localX * cos + this.x;
|
||||||
|
var localXSin = localX * sin;
|
||||||
|
var localYCos = localY * cos + this.y;
|
||||||
|
var localYSin = localY * sin;
|
||||||
|
var localX2Cos = localX2 * cos + this.x;
|
||||||
|
var localX2Sin = localX2 * sin;
|
||||||
|
var localY2Cos = localY2 * cos + this.y;
|
||||||
|
var localY2Sin = localY2 * sin;
|
||||||
|
var offset = this.offset;
|
||||||
|
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
||||||
|
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
||||||
|
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
||||||
|
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
||||||
|
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
||||||
|
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
||||||
|
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
||||||
|
};
|
||||||
|
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
||||||
|
var skeleton = slot.bone.skeleton;
|
||||||
|
var skeletonColor = skeleton.color;
|
||||||
|
var slotColor = slot.color;
|
||||||
|
var regionColor = this.color;
|
||||||
|
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
||||||
|
var multiplier = premultipliedAlpha ? alpha : 1;
|
||||||
|
var color = this.tempColor;
|
||||||
|
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
||||||
|
var vertices = this.vertices;
|
||||||
|
var offset = this.offset;
|
||||||
|
var bone = slot.bone;
|
||||||
|
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
||||||
|
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
||||||
|
var offsetX = 0, offsetY = 0;
|
||||||
|
offsetX = offset[RegionAttachment.OX1];
|
||||||
|
offsetY = offset[RegionAttachment.OY1];
|
||||||
|
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX2];
|
||||||
|
offsetY = offset[RegionAttachment.OY2];
|
||||||
|
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX3];
|
||||||
|
offsetY = offset[RegionAttachment.OY3];
|
||||||
|
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
offsetX = offset[RegionAttachment.OX4];
|
||||||
|
offsetY = offset[RegionAttachment.OY4];
|
||||||
|
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
||||||
|
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
||||||
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
return vertices;
|
||||||
|
};
|
||||||
|
RegionAttachment.OX1 = 0;
|
||||||
|
RegionAttachment.OY1 = 1;
|
||||||
|
RegionAttachment.OX2 = 2;
|
||||||
|
RegionAttachment.OY2 = 3;
|
||||||
|
RegionAttachment.OX3 = 4;
|
||||||
|
RegionAttachment.OY3 = 5;
|
||||||
|
RegionAttachment.OX4 = 6;
|
||||||
|
RegionAttachment.OY4 = 7;
|
||||||
|
RegionAttachment.X1 = 0;
|
||||||
|
RegionAttachment.Y1 = 1;
|
||||||
|
RegionAttachment.C1R = 2;
|
||||||
|
RegionAttachment.C1G = 3;
|
||||||
|
RegionAttachment.C1B = 4;
|
||||||
|
RegionAttachment.C1A = 5;
|
||||||
|
RegionAttachment.U1 = 6;
|
||||||
|
RegionAttachment.V1 = 7;
|
||||||
|
RegionAttachment.X2 = 8;
|
||||||
|
RegionAttachment.Y2 = 9;
|
||||||
|
RegionAttachment.C2R = 10;
|
||||||
|
RegionAttachment.C2G = 11;
|
||||||
|
RegionAttachment.C2B = 12;
|
||||||
|
RegionAttachment.C2A = 13;
|
||||||
|
RegionAttachment.U2 = 14;
|
||||||
|
RegionAttachment.V2 = 15;
|
||||||
|
RegionAttachment.X3 = 16;
|
||||||
|
RegionAttachment.Y3 = 17;
|
||||||
|
RegionAttachment.C3R = 18;
|
||||||
|
RegionAttachment.C3G = 19;
|
||||||
|
RegionAttachment.C3B = 20;
|
||||||
|
RegionAttachment.C3A = 21;
|
||||||
|
RegionAttachment.U3 = 22;
|
||||||
|
RegionAttachment.V3 = 23;
|
||||||
|
RegionAttachment.X4 = 24;
|
||||||
|
RegionAttachment.Y4 = 25;
|
||||||
|
RegionAttachment.C4R = 26;
|
||||||
|
RegionAttachment.C4G = 27;
|
||||||
|
RegionAttachment.C4B = 28;
|
||||||
|
RegionAttachment.C4A = 29;
|
||||||
|
RegionAttachment.U4 = 30;
|
||||||
|
RegionAttachment.V4 = 31;
|
||||||
|
return RegionAttachment;
|
||||||
|
}(spine.Attachment));
|
||||||
|
spine.RegionAttachment = RegionAttachment;
|
||||||
|
})(spine || (spine = {}));
|
||||||
|
var spine;
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
(function (BlendMode) {
|
(function (BlendMode) {
|
||||||
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
BlendMode[BlendMode["Normal"] = 0] = "Normal";
|
||||||
@ -3483,7 +3905,7 @@ var spine;
|
|||||||
for (var key in dictionary) {
|
for (var key in dictionary) {
|
||||||
var skinAttachment = dictionary[key];
|
var skinAttachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
var attachment = this.getAttachment(slotIndex, name);
|
var attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null)
|
if (attachment != null)
|
||||||
slot.setAttachment(attachment);
|
slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
@ -3793,7 +4215,6 @@ var spine;
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
var attachment = new spine.RegionAttachment(name);
|
var attachment = new spine.RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
};
|
};
|
||||||
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
TextureAtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) {
|
||||||
@ -4163,422 +4584,6 @@ var spine;
|
|||||||
spine.TimeKeeper = TimeKeeper;
|
spine.TimeKeeper = TimeKeeper;
|
||||||
})(spine || (spine = {}));
|
})(spine || (spine = {}));
|
||||||
var spine;
|
var spine;
|
||||||
(function (spine) {
|
|
||||||
var Attachment = (function () {
|
|
||||||
function Attachment(name) {
|
|
||||||
if (name == null)
|
|
||||||
throw new Error("name cannot be null.");
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
return Attachment;
|
|
||||||
}());
|
|
||||||
spine.Attachment = Attachment;
|
|
||||||
var VertexAttachment = (function (_super) {
|
|
||||||
__extends(VertexAttachment, _super);
|
|
||||||
function VertexAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.worldVerticesLength = 0;
|
|
||||||
}
|
|
||||||
VertexAttachment.prototype.computeWorldVertices = function (slot, worldVertices) {
|
|
||||||
this.computeWorldVerticesWith(slot, 0, this.worldVerticesLength, worldVertices, 0);
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.computeWorldVerticesWith = function (slot, start, count, worldVertices, offset) {
|
|
||||||
count += offset;
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v_1 = start, w = offset; w < count; v_1 += 2, w += 2) {
|
|
||||||
var vx = vertices[v_1], vy = vertices[v_1 + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var v = 0, skip = 0;
|
|
||||||
for (var i = 0; i < start; i += 2) {
|
|
||||||
var n = bones[v];
|
|
||||||
v += n + 1;
|
|
||||||
skip += n;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = offset, b = skip * 3; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += 2) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var n = bones[v++];
|
|
||||||
n += v;
|
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment;
|
|
||||||
};
|
|
||||||
return VertexAttachment;
|
|
||||||
}(Attachment));
|
|
||||||
spine.VertexAttachment = VertexAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
(function (AttachmentType) {
|
|
||||||
AttachmentType[AttachmentType["Region"] = 0] = "Region";
|
|
||||||
AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox";
|
|
||||||
AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh";
|
|
||||||
AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh";
|
|
||||||
AttachmentType[AttachmentType["Path"] = 4] = "Path";
|
|
||||||
})(spine.AttachmentType || (spine.AttachmentType = {}));
|
|
||||||
var AttachmentType = spine.AttachmentType;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var BoundingBoxAttachment = (function (_super) {
|
|
||||||
__extends(BoundingBoxAttachment, _super);
|
|
||||||
function BoundingBoxAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return BoundingBoxAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var MeshAttachment = (function (_super) {
|
|
||||||
__extends(MeshAttachment, _super);
|
|
||||||
function MeshAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.inheritDeform = false;
|
|
||||||
this.tempColor = new spine.Color(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
MeshAttachment.prototype.updateUVs = function () {
|
|
||||||
var regionUVs = this.regionUVs;
|
|
||||||
var verticesLength = regionUVs.length;
|
|
||||||
var worldVerticesLength = (verticesLength >> 1) * 8;
|
|
||||||
if (this.worldVertices == null || this.worldVertices.length != worldVerticesLength)
|
|
||||||
this.worldVertices = spine.Utils.newFloatArray(worldVerticesLength);
|
|
||||||
var u = 0, v = 0, width = 0, height = 0;
|
|
||||||
if (this.region == null) {
|
|
||||||
u = v = 0;
|
|
||||||
width = height = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
u = this.region.u;
|
|
||||||
v = this.region.v;
|
|
||||||
width = this.region.u2 - u;
|
|
||||||
height = this.region.v2 - v;
|
|
||||||
}
|
|
||||||
if (this.region.rotate) {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i + 1] * width;
|
|
||||||
this.worldVertices[w + 1] = v + height - regionUVs[i] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (var i = 0, w = 6; i < verticesLength; i += 2, w += 8) {
|
|
||||||
this.worldVertices[w] = u + regionUVs[i] * width;
|
|
||||||
this.worldVertices[w + 1] = v + regionUVs[i + 1] * height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color, slotColor = slot.color, meshColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * meshColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * meshColor.r * multiplier, skeletonColor.g * slotColor.g * meshColor.g * multiplier, skeletonColor.b * slotColor.b * meshColor.b * multiplier, alpha);
|
|
||||||
var x = skeleton.x, y = skeleton.y;
|
|
||||||
var deformArray = slot.attachmentVertices;
|
|
||||||
var vertices = this.vertices, worldVertices = this.worldVertices;
|
|
||||||
var bones = this.bones;
|
|
||||||
if (bones == null) {
|
|
||||||
var verticesLength = vertices.length;
|
|
||||||
if (deformArray.length > 0)
|
|
||||||
vertices = deformArray;
|
|
||||||
var bone = slot.bone;
|
|
||||||
x += bone.worldX;
|
|
||||||
y += bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
for (var v = 0, w = 0; v < verticesLength; v += 2, w += 8) {
|
|
||||||
var vx = vertices[v], vy = vertices[v + 1];
|
|
||||||
worldVertices[w] = vx * a + vy * b + x;
|
|
||||||
worldVertices[w + 1] = vx * c + vy * d + y;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
}
|
|
||||||
var skeletonBones = skeleton.bones;
|
|
||||||
if (deformArray.length == 0) {
|
|
||||||
for (var w = 0, v = 0, b = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var vx = vertices[b], vy = vertices[b + 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var deform = deformArray;
|
|
||||||
for (var w = 0, v = 0, b = 0, f = 0, n = bones.length; v < n; w += 8) {
|
|
||||||
var wx = x, wy = y;
|
|
||||||
var nn = bones[v++] + v;
|
|
||||||
for (; v < nn; v++, b += 3, f += 2) {
|
|
||||||
var bone = skeletonBones[bones[v]];
|
|
||||||
var 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;
|
|
||||||
worldVertices[w + 2] = color.r;
|
|
||||||
worldVertices[w + 3] = color.g;
|
|
||||||
worldVertices[w + 4] = color.b;
|
|
||||||
worldVertices[w + 5] = color.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldVertices;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.applyDeform = function (sourceAttachment) {
|
|
||||||
return this == sourceAttachment || (this.inheritDeform && this.parentMesh == sourceAttachment);
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.getParentMesh = function () {
|
|
||||||
return this.parentMesh;
|
|
||||||
};
|
|
||||||
MeshAttachment.prototype.setParentMesh = function (parentMesh) {
|
|
||||||
this.parentMesh = parentMesh;
|
|
||||||
if (parentMesh != null) {
|
|
||||||
this.bones = parentMesh.bones;
|
|
||||||
this.vertices = parentMesh.vertices;
|
|
||||||
this.regionUVs = parentMesh.regionUVs;
|
|
||||||
this.triangles = parentMesh.triangles;
|
|
||||||
this.hullLength = parentMesh.hullLength;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return MeshAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.MeshAttachment = MeshAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var PathAttachment = (function (_super) {
|
|
||||||
__extends(PathAttachment, _super);
|
|
||||||
function PathAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.closed = false;
|
|
||||||
this.constantSpeed = false;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
return PathAttachment;
|
|
||||||
}(spine.VertexAttachment));
|
|
||||||
spine.PathAttachment = PathAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
|
||||||
var RegionAttachment = (function (_super) {
|
|
||||||
__extends(RegionAttachment, _super);
|
|
||||||
function RegionAttachment(name) {
|
|
||||||
_super.call(this, name);
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.scaleX = 1;
|
|
||||||
this.scaleY = 1;
|
|
||||||
this.rotation = 0;
|
|
||||||
this.width = 0;
|
|
||||||
this.height = 0;
|
|
||||||
this.color = new spine.Color(1, 1, 1, 1);
|
|
||||||
this.offset = spine.Utils.newFloatArray(8);
|
|
||||||
this.vertices = spine.Utils.newFloatArray(8 * 4);
|
|
||||||
this.tempColor = new spine.Color(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
RegionAttachment.prototype.setRegion = function (region) {
|
|
||||||
var vertices = this.vertices;
|
|
||||||
if (region.rotate) {
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v2;
|
|
||||||
vertices[RegionAttachment.U3] = region.u;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v;
|
|
||||||
vertices[RegionAttachment.U1] = region.u2;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vertices[RegionAttachment.U1] = region.u;
|
|
||||||
vertices[RegionAttachment.V1] = region.v2;
|
|
||||||
vertices[RegionAttachment.U2] = region.u;
|
|
||||||
vertices[RegionAttachment.V2] = region.v;
|
|
||||||
vertices[RegionAttachment.U3] = region.u2;
|
|
||||||
vertices[RegionAttachment.V3] = region.v;
|
|
||||||
vertices[RegionAttachment.U4] = region.u2;
|
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateOffset = function () {
|
|
||||||
var regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
||||||
var regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
||||||
var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
||||||
var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
||||||
var localX2 = localX + this.region.width * regionScaleX;
|
|
||||||
var localY2 = localY + this.region.height * regionScaleY;
|
|
||||||
var radians = this.rotation * Math.PI / 180;
|
|
||||||
var cos = Math.cos(radians);
|
|
||||||
var sin = Math.sin(radians);
|
|
||||||
var localXCos = localX * cos + this.x;
|
|
||||||
var localXSin = localX * sin;
|
|
||||||
var localYCos = localY * cos + this.y;
|
|
||||||
var localYSin = localY * sin;
|
|
||||||
var localX2Cos = localX2 * cos + this.x;
|
|
||||||
var localX2Sin = localX2 * sin;
|
|
||||||
var localY2Cos = localY2 * cos + this.y;
|
|
||||||
var localY2Sin = localY2 * sin;
|
|
||||||
var offset = this.offset;
|
|
||||||
offset[RegionAttachment.OX1] = localXCos - localYSin;
|
|
||||||
offset[RegionAttachment.OY1] = localYCos + localXSin;
|
|
||||||
offset[RegionAttachment.OX2] = localXCos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY2] = localY2Cos + localXSin;
|
|
||||||
offset[RegionAttachment.OX3] = localX2Cos - localY2Sin;
|
|
||||||
offset[RegionAttachment.OY3] = localY2Cos + localX2Sin;
|
|
||||||
offset[RegionAttachment.OX4] = localX2Cos - localYSin;
|
|
||||||
offset[RegionAttachment.OY4] = localYCos + localX2Sin;
|
|
||||||
};
|
|
||||||
RegionAttachment.prototype.updateWorldVertices = function (slot, premultipliedAlpha) {
|
|
||||||
var skeleton = slot.bone.skeleton;
|
|
||||||
var skeletonColor = skeleton.color;
|
|
||||||
var slotColor = slot.color;
|
|
||||||
var regionColor = this.color;
|
|
||||||
var alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
||||||
var multiplier = premultipliedAlpha ? alpha : 1;
|
|
||||||
var color = this.tempColor;
|
|
||||||
color.set(skeletonColor.r * slotColor.r * regionColor.r * multiplier, skeletonColor.g * slotColor.g * regionColor.g * multiplier, skeletonColor.b * slotColor.b * regionColor.b * multiplier, alpha);
|
|
||||||
var vertices = this.vertices;
|
|
||||||
var offset = this.offset;
|
|
||||||
var bone = slot.bone;
|
|
||||||
var x = skeleton.x + bone.worldX, y = skeleton.y + bone.worldY;
|
|
||||||
var a = bone.a, b = bone.b, c = bone.c, d = bone.d;
|
|
||||||
var offsetX = 0, offsetY = 0;
|
|
||||||
offsetX = offset[RegionAttachment.OX1];
|
|
||||||
offsetY = offset[RegionAttachment.OY1];
|
|
||||||
vertices[RegionAttachment.X1] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y1] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX2];
|
|
||||||
offsetY = offset[RegionAttachment.OY2];
|
|
||||||
vertices[RegionAttachment.X2] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y2] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX3];
|
|
||||||
offsetY = offset[RegionAttachment.OY3];
|
|
||||||
vertices[RegionAttachment.X3] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y3] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
|
||||||
offsetX = offset[RegionAttachment.OX4];
|
|
||||||
offsetY = offset[RegionAttachment.OY4];
|
|
||||||
vertices[RegionAttachment.X4] = offsetX * a + offsetY * b + x;
|
|
||||||
vertices[RegionAttachment.Y4] = offsetX * c + offsetY * d + y;
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
|
||||||
return vertices;
|
|
||||||
};
|
|
||||||
RegionAttachment.OX1 = 0;
|
|
||||||
RegionAttachment.OY1 = 1;
|
|
||||||
RegionAttachment.OX2 = 2;
|
|
||||||
RegionAttachment.OY2 = 3;
|
|
||||||
RegionAttachment.OX3 = 4;
|
|
||||||
RegionAttachment.OY3 = 5;
|
|
||||||
RegionAttachment.OX4 = 6;
|
|
||||||
RegionAttachment.OY4 = 7;
|
|
||||||
RegionAttachment.X1 = 0;
|
|
||||||
RegionAttachment.Y1 = 1;
|
|
||||||
RegionAttachment.C1R = 2;
|
|
||||||
RegionAttachment.C1G = 3;
|
|
||||||
RegionAttachment.C1B = 4;
|
|
||||||
RegionAttachment.C1A = 5;
|
|
||||||
RegionAttachment.U1 = 6;
|
|
||||||
RegionAttachment.V1 = 7;
|
|
||||||
RegionAttachment.X2 = 8;
|
|
||||||
RegionAttachment.Y2 = 9;
|
|
||||||
RegionAttachment.C2R = 10;
|
|
||||||
RegionAttachment.C2G = 11;
|
|
||||||
RegionAttachment.C2B = 12;
|
|
||||||
RegionAttachment.C2A = 13;
|
|
||||||
RegionAttachment.U2 = 14;
|
|
||||||
RegionAttachment.V2 = 15;
|
|
||||||
RegionAttachment.X3 = 16;
|
|
||||||
RegionAttachment.Y3 = 17;
|
|
||||||
RegionAttachment.C3R = 18;
|
|
||||||
RegionAttachment.C3G = 19;
|
|
||||||
RegionAttachment.C3B = 20;
|
|
||||||
RegionAttachment.C3A = 21;
|
|
||||||
RegionAttachment.U3 = 22;
|
|
||||||
RegionAttachment.V3 = 23;
|
|
||||||
RegionAttachment.X4 = 24;
|
|
||||||
RegionAttachment.Y4 = 25;
|
|
||||||
RegionAttachment.C4R = 26;
|
|
||||||
RegionAttachment.C4G = 27;
|
|
||||||
RegionAttachment.C4B = 28;
|
|
||||||
RegionAttachment.C4A = 29;
|
|
||||||
RegionAttachment.U4 = 30;
|
|
||||||
RegionAttachment.V4 = 31;
|
|
||||||
return RegionAttachment;
|
|
||||||
}(spine.Attachment));
|
|
||||||
spine.RegionAttachment = RegionAttachment;
|
|
||||||
})(spine || (spine = {}));
|
|
||||||
var spine;
|
|
||||||
(function (spine) {
|
(function (spine) {
|
||||||
var webgl;
|
var webgl;
|
||||||
(function (webgl) {
|
(function (webgl) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -108,17 +108,17 @@ module spine {
|
|||||||
|
|
||||||
for (let ii = 0, nn = events.length; ii < nn; ii++) {
|
for (let ii = 0, nn = events.length; ii < nn; ii++) {
|
||||||
let event = events[ii];
|
let event = events[ii];
|
||||||
if (current.listener != null) current.listener.event(i, event);
|
if (current.listener != null && current.listener.event != null) current.listener.event(i, event);
|
||||||
for (let iii = 0; iii < listenerCount; iii++)
|
for (let iii = 0; iii < listenerCount; iii++)
|
||||||
this.listeners[iii].event(i, event);
|
if (this.listeners[iii].event) this.listeners[iii].event(i, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if completed the animation or a loop iteration.
|
// Check if completed the animation or a loop iteration.
|
||||||
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
if (loop ? (lastTime % endTime > time % endTime) : (lastTime < endTime && time >= endTime)) {
|
||||||
let count = MathUtils.toInt(time / endTime);
|
let count = MathUtils.toInt(time / endTime);
|
||||||
if (current.listener != null) current.listener.complete(i, count);
|
if (current.listener != null && current.listener.complete) current.listener.complete(i, count);
|
||||||
for (let ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
for (let ii = 0, nn = this.listeners.length; ii < nn; ii++)
|
||||||
this.listeners[ii].complete(i, count);
|
if (this.listeners[ii].complete) this.listeners[ii].complete(i, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
current.lastTime = current.time;
|
current.lastTime = current.time;
|
||||||
@ -136,9 +136,9 @@ module spine {
|
|||||||
let current = this.tracks[trackIndex];
|
let current = this.tracks[trackIndex];
|
||||||
if (current == null) return;
|
if (current == null) return;
|
||||||
|
|
||||||
if (current.listener != null) current.listener.end(trackIndex);
|
if (current.listener != null && current.listener.end != null) current.listener.end(trackIndex);
|
||||||
for (let i = 0, n = this.listeners.length; i < n; i++)
|
for (let i = 0, n = this.listeners.length; i < n; i++)
|
||||||
this.listeners[i].end(trackIndex);
|
if (this.listeners[i].end) this.listeners[i].end(trackIndex);
|
||||||
|
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = null;
|
||||||
|
|
||||||
@ -165,9 +165,9 @@ module spine {
|
|||||||
let previous = current.previous;
|
let previous = current.previous;
|
||||||
current.previous = null;
|
current.previous = null;
|
||||||
|
|
||||||
if (current.listener != null) current.listener.end(index);
|
if (current.listener != null && current.listener.end != null) current.listener.end(index);
|
||||||
for (let i = 0, n = this.listeners.length; i < n; i++)
|
for (let i = 0, n = this.listeners.length; i < n; i++)
|
||||||
this.listeners[i].end(index);
|
if (this.listeners[i].end) this.listeners[i].end(index);
|
||||||
|
|
||||||
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
entry.mixDuration = this.data.getMix(current.animation, entry.animation);
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
@ -183,9 +183,9 @@ module spine {
|
|||||||
|
|
||||||
this.tracks[index] = entry;
|
this.tracks[index] = entry;
|
||||||
|
|
||||||
if (entry.listener != null) entry.listener.start(index);
|
if (entry.listener != null && entry.listener.start != null) entry.listener.start(index);
|
||||||
for (let i = 0, n = this.listeners.length; i < n; i++)
|
for (let i = 0, n = this.listeners.length; i < n; i++)
|
||||||
this.listeners[i].start(index);
|
if (this.listeners[i].start) this.listeners[i].start(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @see #setAnimation(int, Animation, boolean) */
|
/** @see #setAnimation(int, Animation, boolean) */
|
||||||
|
|||||||
@ -64,7 +64,7 @@ module spine {
|
|||||||
for (let key in dictionary) {
|
for (let key in dictionary) {
|
||||||
let skinAttachment:Attachment = dictionary[key];
|
let skinAttachment:Attachment = dictionary[key];
|
||||||
if (slotAttachment == skinAttachment) {
|
if (slotAttachment == skinAttachment) {
|
||||||
let attachment = this.getAttachment(slotIndex, name);
|
let attachment = this.getAttachment(slotIndex, key);
|
||||||
if (attachment != null) slot.setAttachment(attachment);
|
if (attachment != null) slot.setAttachment(attachment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,6 @@ module spine {
|
|||||||
region.renderObject = region;
|
region.renderObject = region;
|
||||||
let attachment = new RegionAttachment(name);
|
let attachment = new RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -261,4 +261,9 @@ module spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ArrayLike<T> {
|
||||||
|
length: number;
|
||||||
|
[n: number]: T;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,6 +113,7 @@ module spine {
|
|||||||
vertices[RegionAttachment.U4] = region.u2;
|
vertices[RegionAttachment.U4] = region.u2;
|
||||||
vertices[RegionAttachment.V4] = region.v2;
|
vertices[RegionAttachment.V4] = region.v2;
|
||||||
}
|
}
|
||||||
|
this.region = region;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOffset () : void {
|
updateOffset () : void {
|
||||||
|
|||||||
@ -56,8 +56,7 @@ module spine.threejs {
|
|||||||
|
|
||||||
static toThreeJsTextureFilter(filter: TextureFilter) {
|
static toThreeJsTextureFilter(filter: TextureFilter) {
|
||||||
if (filter === TextureFilter.Linear) return THREE.LinearFilter;
|
if (filter === TextureFilter.Linear) return THREE.LinearFilter;
|
||||||
else if (filter === TextureFilter.MipMap) return THREE.LinearMipMapLinearFilter;
|
else if (filter === TextureFilter.MipMap) return THREE.LinearMipMapLinearFilter; // also includes TextureFilter.MipMapLinearLinear
|
||||||
else if (filter === TextureFilter.MipMapLinearLinear) return THREE.LinearMipMapLinearFilter;
|
|
||||||
else if (filter === TextureFilter.MipMapLinearNearest) return THREE.LinearMipMapNearestFilter;
|
else if (filter === TextureFilter.MipMapLinearNearest) return THREE.LinearMipMapNearestFilter;
|
||||||
else if (filter === TextureFilter.MipMapNearestLinear) return THREE.NearestMipMapLinearFilter;
|
else if (filter === TextureFilter.MipMapNearestLinear) return THREE.NearestMipMapLinearFilter;
|
||||||
else if (filter === TextureFilter.MipMapNearestNearest) return THREE.NearestMipMapNearestFilter;
|
else if (filter === TextureFilter.MipMapNearestNearest) return THREE.NearestMipMapNearestFilter;
|
||||||
|
|||||||
@ -84,7 +84,7 @@ function load () {
|
|||||||
skeletons["spineboy"] = loadSkeleton("spineboy", "run", false);
|
skeletons["spineboy"] = loadSkeleton("spineboy", "run", false);
|
||||||
skeletons["raptor"] = loadSkeleton("raptor", "walk", false);
|
skeletons["raptor"] = loadSkeleton("raptor", "walk", false);
|
||||||
skeletons["tank"] = loadSkeleton("tank", "drive", false);
|
skeletons["tank"] = loadSkeleton("tank", "drive", false);
|
||||||
skeletons["goblins"] = loadSkeleton("goblins-mesh", "walk", true, "goblin");
|
skeletons["goblins"] = loadSkeleton("goblins-mesh", "walk", false, "goblin");
|
||||||
skeletons["vine"] = loadSkeleton("vine", "animation", false);
|
skeletons["vine"] = loadSkeleton("vine", "animation", false);
|
||||||
skeletons["stretchyman"] = loadSkeleton("stretchyman", "sneak", false);
|
skeletons["stretchyman"] = loadSkeleton("stretchyman", "sneak", false);
|
||||||
setupUI();
|
setupUI();
|
||||||
|
|||||||
@ -46,6 +46,11 @@ namespace Spine.Unity.Editor {
|
|||||||
private SerializedProperty atlasFile, materials;
|
private SerializedProperty atlasFile, materials;
|
||||||
private AtlasAsset atlasAsset;
|
private AtlasAsset atlasAsset;
|
||||||
|
|
||||||
|
static List<AtlasRegion> GetRegions (Atlas atlas) {
|
||||||
|
FieldInfo regionsField = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
return (List<AtlasRegion>)regionsField.GetValue(atlas);
|
||||||
|
}
|
||||||
|
|
||||||
void OnEnable () {
|
void OnEnable () {
|
||||||
SpineEditorUtilities.ConfirmInitialization();
|
SpineEditorUtilities.ConfirmInitialization();
|
||||||
atlasFile = serializedObject.FindProperty("atlasFile");
|
atlasFile = serializedObject.FindProperty("atlasFile");
|
||||||
@ -66,14 +71,10 @@ namespace Spine.Unity.Editor {
|
|||||||
baked = new List<bool>();
|
baked = new List<bool>();
|
||||||
bakedObjects = new List<GameObject>();
|
bakedObjects = new List<GameObject>();
|
||||||
if (atlasFile.objectReferenceValue != null) {
|
if (atlasFile.objectReferenceValue != null) {
|
||||||
Atlas atlas = asset.GetAtlas();
|
List<AtlasRegion> regions = this.Regions;
|
||||||
FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic);
|
|
||||||
List<AtlasRegion> regions = (List<AtlasRegion>)field.GetValue(atlas);
|
|
||||||
string atlasAssetPath = AssetDatabase.GetAssetPath(atlasAsset);
|
string atlasAssetPath = AssetDatabase.GetAssetPath(atlasAsset);
|
||||||
string atlasAssetDirPath = Path.GetDirectoryName(atlasAssetPath);
|
string atlasAssetDirPath = Path.GetDirectoryName(atlasAssetPath);
|
||||||
string bakedDirPath = Path.Combine(atlasAssetDirPath, atlasAsset.name);
|
string bakedDirPath = Path.Combine(atlasAssetDirPath, atlasAsset.name);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < regions.Count; i++) {
|
for (int i = 0; i < regions.Count; i++) {
|
||||||
AtlasRegion region = regions[i];
|
AtlasRegion region = regions[i];
|
||||||
string bakedPrefabPath = Path.Combine(bakedDirPath, SpineEditorUtilities.GetPathSafeRegionName(region) + ".prefab").Replace("\\", "/");
|
string bakedPrefabPath = Path.Combine(bakedDirPath, SpineEditorUtilities.GetPathSafeRegionName(region) + ".prefab").Replace("\\", "/");
|
||||||
@ -92,8 +93,7 @@ namespace Spine.Unity.Editor {
|
|||||||
var spriteSheet = t.spritesheet;
|
var spriteSheet = t.spritesheet;
|
||||||
var sprites = new List<SpriteMetaData>(spriteSheet);
|
var sprites = new List<SpriteMetaData>(spriteSheet);
|
||||||
|
|
||||||
FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.NonPublic);
|
var regions = AtlasAssetInspector.GetRegions(atlas);
|
||||||
var regions = (List<AtlasRegion>)field.GetValue(atlas);
|
|
||||||
int textureHeight = texture.height;
|
int textureHeight = texture.height;
|
||||||
char[] FilenameDelimiter = {'.'};
|
char[] FilenameDelimiter = {'.'};
|
||||||
int updatedCount = 0;
|
int updatedCount = 0;
|
||||||
@ -168,20 +168,27 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
if (atlasFile.objectReferenceValue != null) {
|
if (atlasFile.objectReferenceValue != null) {
|
||||||
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
|
EditorGUILayout.Space();
|
||||||
if (GUILayout.Button(
|
if (GUILayout.Button(
|
||||||
new GUIContent(
|
new GUIContent(
|
||||||
"Apply Regions as Texture Sprite Slices",
|
"Apply Regions as Texture Sprite Slices",
|
||||||
|
SpineEditorUtilities.Icons.unityIcon,
|
||||||
"Adds Sprite slices to atlas texture(s). " +
|
"Adds Sprite slices to atlas texture(s). " +
|
||||||
"Updates existing slices if ones with matching names exist. \n\n" +
|
"Updates existing slices if ones with matching names exist. \n\n" +
|
||||||
"If your atlas was exported with Premultiply Alpha, " +
|
"If your atlas was exported with Premultiply Alpha, " +
|
||||||
"your SpriteRenderer should use the generated Spine _Material asset (or any Material with a PMA shader) instead of Sprites-Default.")
|
"your SpriteRenderer should use the generated Spine _Material asset (or any Material with a PMA shader) instead of Sprites-Default.")
|
||||||
, GUILayout.Height(70f))) {
|
, GUILayout.Height(30f))) {
|
||||||
var atlas = atlasAsset.GetAtlas();
|
var atlas = atlasAsset.GetAtlas();
|
||||||
foreach (var m in atlasAsset.materials)
|
foreach (var m in atlasAsset.materials)
|
||||||
UpdateSpriteSlices(m.mainTexture, atlas);
|
UpdateSpriteSlices(m.mainTexture, atlas);
|
||||||
}
|
}
|
||||||
|
EditorGUILayout.Space();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
#if REGION_BAKING_MESH
|
#if REGION_BAKING_MESH
|
||||||
if (atlasFile.objectReferenceValue != null) {
|
if (atlasFile.objectReferenceValue != null) {
|
||||||
@ -289,6 +296,39 @@ namespace Spine.Unity.Editor {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (atlasFile.objectReferenceValue != null) {
|
||||||
|
EditorGUILayout.LabelField("Atlas Regions", EditorStyles.boldLabel);
|
||||||
|
|
||||||
|
var regions = AtlasAssetInspector.GetRegions(atlasAsset.GetAtlas());
|
||||||
|
AtlasPage lastPage = null;
|
||||||
|
for (int i = 0; i < regions.Count; i++) {
|
||||||
|
if (lastPage != regions[i].page) {
|
||||||
|
if (lastPage != null) {
|
||||||
|
EditorGUILayout.Separator();
|
||||||
|
EditorGUILayout.Separator();
|
||||||
|
}
|
||||||
|
lastPage = regions[i].page;
|
||||||
|
Material mat = ((Material)lastPage.rendererObject);
|
||||||
|
if (mat != null) {
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
{
|
||||||
|
EditorGUI.BeginDisabledGroup(true);
|
||||||
|
EditorGUILayout.ObjectField(mat, typeof(Material), false, GUILayout.Width(250));
|
||||||
|
EditorGUI.EndDisabledGroup();
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
EditorGUILayout.LabelField(new GUIContent("Page missing material!", SpineEditorUtilities.Icons.warning));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditorGUILayout.LabelField(new GUIContent(regions[i].name, SpineEditorUtilities.Icons.image));
|
||||||
|
}
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (serializedObject.ApplyModifiedProperties() ||
|
if (serializedObject.ApplyModifiedProperties() ||
|
||||||
|
|||||||
@ -1434,6 +1434,67 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Handles
|
||||||
|
static public void DrawBone (Matrix4x4 transformMatrix) {
|
||||||
|
SpineEditorUtilities.Icons.BoneMaterial.SetPass(0);
|
||||||
|
Graphics.DrawMeshNow(SpineEditorUtilities.Icons.BoneMesh, transformMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float[] pathVertexBuffer;
|
||||||
|
static public void DrawPath (Slot s, PathAttachment p, Transform t) {
|
||||||
|
int worldVerticesLength = p.WorldVerticesLength;
|
||||||
|
|
||||||
|
if (pathVertexBuffer == null || pathVertexBuffer.Length < worldVerticesLength)
|
||||||
|
pathVertexBuffer = new float[worldVerticesLength];
|
||||||
|
|
||||||
|
float[] pv = pathVertexBuffer;
|
||||||
|
p.ComputeWorldVertices(s, pv);
|
||||||
|
|
||||||
|
var ocolor = Handles.color;
|
||||||
|
Handles.color = new Color(254f/255f, 127f/255f, 0); // Path orange
|
||||||
|
|
||||||
|
Matrix4x4 m = t.localToWorldMatrix;
|
||||||
|
const int step = 6;
|
||||||
|
int n = worldVerticesLength - step;
|
||||||
|
Vector3 p0, p1, p2, p3;
|
||||||
|
for (int i = 2; i < n; i += step) {
|
||||||
|
p0 = m.MultiplyPoint(new Vector3(pv[i], pv[i+1]));
|
||||||
|
p1 = m.MultiplyPoint(new Vector3(pv[i+2], pv[i+3]));
|
||||||
|
p2 = m.MultiplyPoint(new Vector3(pv[i+4], pv[i+5]));
|
||||||
|
p3 = m.MultiplyPoint(new Vector3(pv[i+6], pv[i+7]));
|
||||||
|
DrawCubicBezier(p0, p1, p2, p3);
|
||||||
|
}
|
||||||
|
|
||||||
|
n += step;
|
||||||
|
if (p.Closed) {
|
||||||
|
p0 = m.MultiplyPoint(new Vector3(pv[n - 4], pv[n - 3]));
|
||||||
|
p1 = m.MultiplyPoint(new Vector3(pv[n - 2], pv[n - 1]));
|
||||||
|
p2 = m.MultiplyPoint(new Vector3(pv[0], pv[1]));
|
||||||
|
p3 = m.MultiplyPoint(new Vector3(pv[2], pv[3]));
|
||||||
|
DrawCubicBezier(p0, p1, p2, p3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const float endCapSize = 0.05f;
|
||||||
|
var q = Quaternion.identity;
|
||||||
|
Handles.DotCap(0, m.MultiplyPoint(new Vector3(pv[2], pv[3])), q, endCapSize);
|
||||||
|
// if (!p.Closed) Handles.DotCap(0, m.MultiplyPoint(new Vector3(pv[n - 4], pv[n - 3])), q, endCapSize);
|
||||||
|
|
||||||
|
Handles.color = ocolor;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void DrawCubicBezier (Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3) {
|
||||||
|
Handles.DrawBezier(p0, p3, p1, p2, Handles.color, Texture2D.whiteTexture, 2f);
|
||||||
|
// const float dotSize = 0.01f;
|
||||||
|
// Quaternion q = Quaternion.identity;
|
||||||
|
// Handles.DotCap(0, p0, q, dotSize);
|
||||||
|
// Handles.DotCap(0, p1, q, dotSize);
|
||||||
|
// Handles.DotCap(0, p2, q, dotSize);
|
||||||
|
// Handles.DotCap(0, p3, q, dotSize);
|
||||||
|
// Handles.DrawLine(p0, p1);
|
||||||
|
// Handles.DrawLine(p3, p2);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static string GetPathSafeRegionName (AtlasRegion region) {
|
public static string GetPathSafeRegionName (AtlasRegion region) {
|
||||||
return region.name.Replace("/", "_");
|
return region.name.Replace("/", "_");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.3
|
* Version 2.3
|
||||||
*
|
*
|
||||||
@ -46,7 +46,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
public static void PropertyFieldWideLabel (SerializedProperty property, GUIContent label = null, float minimumLabelWidth = 150) {
|
public static void PropertyFieldWideLabel (SerializedProperty property, GUIContent label = null, float minimumLabelWidth = 150) {
|
||||||
using (new EditorGUILayout.HorizontalScope()) {
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
GUILayout.Label(label ?? new GUIContent(property.name, property.tooltip), GUILayout.MinWidth(minimumLabelWidth));
|
GUILayout.Label(label ?? new GUIContent(property.displayName, property.tooltip), GUILayout.MinWidth(minimumLabelWidth));
|
||||||
//GUILayout.FlexibleSpace();
|
//GUILayout.FlexibleSpace();
|
||||||
EditorGUILayout.PropertyField(property, GUIContent.none, true, GUILayout.MinWidth(100));
|
EditorGUILayout.PropertyField(property, GUIContent.none, true, GUILayout.MinWidth(100));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License
|
* Spine Runtimes Software License
|
||||||
* Version 2.3
|
* Version 2.3
|
||||||
*
|
*
|
||||||
@ -162,9 +162,8 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
uvs[vi + 2].x = regionUVs[RegionAttachment.X2]; uvs[vi + 2].y = regionUVs[RegionAttachment.Y2];
|
uvs[vi + 2].x = regionUVs[RegionAttachment.X2]; uvs[vi + 2].y = regionUVs[RegionAttachment.Y2];
|
||||||
uvs[vi + 3].x = regionUVs[RegionAttachment.X3]; uvs[vi + 3].y = regionUVs[RegionAttachment.Y3];
|
uvs[vi + 3].x = regionUVs[RegionAttachment.X3]; uvs[vi + 3].y = regionUVs[RegionAttachment.Y3];
|
||||||
|
|
||||||
// Calculate min/max X
|
if (x1 < bmin.x) bmin.x = x1; // Potential first attachment bounds initialization. Initial min should not block initial max. Same for Y below.
|
||||||
if (x1 < bmin.x) bmin.x = x1;
|
if (x1 > bmax.x) bmax.x = x1;
|
||||||
else if (x1 > bmax.x) bmax.x = x1;
|
|
||||||
if (x2 < bmin.x) bmin.x = x2;
|
if (x2 < bmin.x) bmin.x = x2;
|
||||||
else if (x2 > bmax.x) bmax.x = x2;
|
else if (x2 > bmax.x) bmax.x = x2;
|
||||||
if (x3 < bmin.x) bmin.x = x3;
|
if (x3 < bmin.x) bmin.x = x3;
|
||||||
@ -172,9 +171,8 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
if (x4 < bmin.x) bmin.x = x4;
|
if (x4 < bmin.x) bmin.x = x4;
|
||||||
else if (x4 > bmax.x) bmax.x = x4;
|
else if (x4 > bmax.x) bmax.x = x4;
|
||||||
|
|
||||||
// Calculate min/max Y
|
|
||||||
if (y1 < bmin.y) bmin.y = y1;
|
if (y1 < bmin.y) bmin.y = y1;
|
||||||
else if (y1 > bmax.y) bmax.y = y1;
|
if (y1 > bmax.y) bmax.y = y1;
|
||||||
if (y2 < bmin.y) bmin.y = y2;
|
if (y2 < bmin.y) bmin.y = y2;
|
||||||
else if (y2 > bmax.y) bmax.y = y2;
|
else if (y2 > bmax.y) bmax.y = y2;
|
||||||
if (y3 < bmin.y) bmin.y = y3;
|
if (y3 < bmin.y) bmin.y = y3;
|
||||||
@ -204,6 +202,19 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float[] attachmentUVs = meshAttachment.uvs;
|
float[] attachmentUVs = meshAttachment.uvs;
|
||||||
|
|
||||||
|
// Potential first attachment bounds initialization. See conditions in RegionAttachment logic.
|
||||||
|
if (vi == vertexIndex) {
|
||||||
|
// Initial min should not block initial max.
|
||||||
|
// vi == vertexIndex does not always mean the bounds are fresh. It could be a submesh. Do not nuke old values by omitting the check.
|
||||||
|
// Should know that this is the first attachment in the submesh. slotIndex == startSlot could be an empty slot.
|
||||||
|
float fx = tempVerts[0], fy = tempVerts[1];
|
||||||
|
if (fx < bmin.x) bmin.x = fx;
|
||||||
|
if (fx > bmax.x) bmax.x = fx;
|
||||||
|
if (fy < bmin.y) bmin.y = fy;
|
||||||
|
if (fy > bmax.y) bmax.y = fy;
|
||||||
|
}
|
||||||
|
|
||||||
for (int iii = 0; iii < meshVertexCount; iii += 2) {
|
for (int iii = 0; iii < meshVertexCount; iii += 2) {
|
||||||
float x = tempVerts[iii], y = tempVerts[iii + 1];
|
float x = tempVerts[iii], y = tempVerts[iii + 1];
|
||||||
verts[vi].x = x; verts[vi].y = y; verts[vi].z = z;
|
verts[vi].x = x; verts[vi].y = y; verts[vi].z = z;
|
||||||
@ -314,8 +325,7 @@ namespace Spine.Unity.MeshGeneration {
|
|||||||
/// <summary>Creates a UnityEngine.Bounds struct from minimum and maximum value vectors.</summary>
|
/// <summary>Creates a UnityEngine.Bounds struct from minimum and maximum value vectors.</summary>
|
||||||
public static Bounds ToBounds (Vector3 boundsMin, Vector3 boundsMax) {
|
public static Bounds ToBounds (Vector3 boundsMin, Vector3 boundsMax) {
|
||||||
Vector3 size = (boundsMax - boundsMin);
|
Vector3 size = (boundsMax - boundsMin);
|
||||||
Vector3 center = boundsMin + size * 0.5f;
|
return new Bounds((boundsMin + (size * 0.5f)), size);
|
||||||
return new Bounds(center, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region TangentSolver2D
|
#region TangentSolver2D
|
||||||
|
|||||||
@ -47,7 +47,6 @@ namespace Spine.Unity {
|
|||||||
string currentAttachmentName;
|
string currentAttachmentName;
|
||||||
PolygonCollider2D currentCollider;
|
PolygonCollider2D currentCollider;
|
||||||
|
|
||||||
bool valid = false;
|
|
||||||
bool hasReset;
|
bool hasReset;
|
||||||
|
|
||||||
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
||||||
@ -128,7 +127,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
valid = colliderTable.Count != 0;
|
bool valid = colliderTable.Count != 0;
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
if (this.gameObject.activeInHierarchy)
|
if (this.gameObject.activeInHierarchy)
|
||||||
Debug.LogWarning("Bounding Box Follower not valid! Slot [" + slotName + "] does not contain any Bounding Box Attachments!");
|
Debug.LogWarning("Bounding Box Follower not valid! Slot [" + slotName + "] does not contain any Bounding Box Attachments!");
|
||||||
|
|||||||
@ -130,6 +130,7 @@ namespace Spine {
|
|||||||
drawOrder.Clear(false);
|
drawOrder.Clear(false);
|
||||||
drawOrder.GrowIfNeeded(n);
|
drawOrder.GrowIfNeeded(n);
|
||||||
System.Array.Copy(slotsItems, drawOrder.Items, n);
|
System.Array.Copy(slotsItems, drawOrder.Items, n);
|
||||||
|
drawOrder.Count = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Resets the color of a slot to Setup Pose value.</summary>
|
/// <summary>Resets the color of a slot to Setup Pose value.</summary>
|
||||||
@ -149,8 +150,13 @@ namespace Spine {
|
|||||||
/// <summary>Resets the attachment of slot at a given slotIndex to setup pose. This is faster than Slot.SetAttachmentToSetupPose.</summary>
|
/// <summary>Resets the attachment of slot at a given slotIndex to setup pose. This is faster than Slot.SetAttachmentToSetupPose.</summary>
|
||||||
public static void SetSlotAttachmentToSetupPose (this Skeleton skeleton, int slotIndex) {
|
public static void SetSlotAttachmentToSetupPose (this Skeleton skeleton, int slotIndex) {
|
||||||
var slot = skeleton.slots.Items[slotIndex];
|
var slot = skeleton.slots.Items[slotIndex];
|
||||||
var attachment = skeleton.GetAttachment(slotIndex, slot.data.attachmentName);
|
// Based on Slot.SetToSetupPose
|
||||||
slot.Attachment = attachment;
|
if (slot.data.attachmentName == null)
|
||||||
|
slot.Attachment = null;
|
||||||
|
else {
|
||||||
|
slot.attachment = null;
|
||||||
|
slot.Attachment = skeleton.GetAttachment(slotIndex, slot.data.attachmentName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Resets Skeleton parts to Setup Pose according to a Spine.Animation's keyed items.</summary>
|
/// <summary>Resets Skeleton parts to Setup Pose according to a Spine.Animation's keyed items.</summary>
|
||||||
|
|||||||
@ -449,9 +449,11 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
int oldSubmeshCount = submeshes.Count;
|
int oldSubmeshCount = submeshes.Count;
|
||||||
|
|
||||||
|
if (submeshes.Capacity < submeshCount)
|
||||||
submeshes.Capacity = submeshCount;
|
submeshes.Capacity = submeshCount;
|
||||||
for (int i = oldSubmeshCount; i < submeshCount; i++)
|
for (int i = oldSubmeshCount; i < submeshCount; i++)
|
||||||
submeshes.Items[i] = new ArraysMeshGenerator.SubmeshTriangleBuffer(workingSubmeshInstructions.Items[i].triangleCount);
|
submeshes.Items[i] = new ArraysMeshGenerator.SubmeshTriangleBuffer(workingSubmeshInstructions.Items[i].triangleCount);
|
||||||
|
submeshes.Count = submeshCount;
|
||||||
|
|
||||||
var mutableTriangles = !workingInstruction.immutableTriangles;
|
var mutableTriangles = !workingInstruction.immutableTriangles;
|
||||||
for (int i = 0, last = submeshCount - 1; i < submeshCount; i++) {
|
for (int i = 0, last = submeshCount - 1; i < submeshCount; i++) {
|
||||||
|
|||||||
@ -98,13 +98,19 @@ namespace Spine.Unity.Editor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var m = transform.localToWorldMatrix;
|
||||||
foreach (Bone b in skeleton.Bones) {
|
foreach (Bone b in skeleton.Bones) {
|
||||||
Vector3 pos = new Vector3(b.WorldX, b.WorldY, 0);
|
Vector3 pos = new Vector3(b.WorldX, b.WorldY, 0);
|
||||||
Quaternion rot = Quaternion.Euler(0, 0, b.WorldRotationX - 90f);
|
Quaternion rot = Quaternion.Euler(0, 0, b.WorldRotationX - 90f);
|
||||||
Vector3 scale = Vector3.one * b.Data.Length * b.WorldScaleX;
|
Vector3 scale = Vector3.one * b.Data.Length * b.WorldScaleX;
|
||||||
|
const float mx = 2.5f;
|
||||||
|
scale.x = Mathf.Clamp(scale.x, -mx, mx);
|
||||||
|
SpineEditorUtilities.DrawBone(m * Matrix4x4.TRS(pos, rot, scale));
|
||||||
|
}
|
||||||
|
|
||||||
SpineEditorUtilities.Icons.BoneMaterial.SetPass(0);
|
foreach (Slot s in skeleton.DrawOrder) {
|
||||||
Graphics.DrawMeshNow(SpineEditorUtilities.Icons.BoneMesh, transform.localToWorldMatrix * Matrix4x4.TRS(pos, rot, scale));
|
var p = s.Attachment as PathAttachment;
|
||||||
|
if (p != null) SpineEditorUtilities.DrawPath(s, p, transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user