mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Merge branch '3.8' into 4.0-beta
# Conflicts: # spine-as3/spine-as3/lib/spine-as3.swc # spine-as3/spine-as3/src/spine/BinaryInput.as # spine-starling/spine-starling/lib/spine-starling.swc
This commit is contained in:
commit
131b586a42
@ -33,9 +33,9 @@ package spine {
|
||||
internal class BinaryInput {
|
||||
private var bytes : ByteArray;
|
||||
public var strings : Vector.<String> = new Vector.<String>();
|
||||
|
||||
|
||||
public function BinaryInput(bytes: ByteArray) {
|
||||
this.bytes = bytes;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public function readByte() : int {
|
||||
@ -45,15 +45,15 @@ package spine {
|
||||
public function readUnsignedByte() : int {
|
||||
return bytes.readUnsignedByte();
|
||||
}
|
||||
|
||||
|
||||
public function readShort() : int {
|
||||
return bytes.readShort();
|
||||
}
|
||||
|
||||
|
||||
public function readInt32(): int {
|
||||
return bytes.readInt();
|
||||
}
|
||||
|
||||
|
||||
public function readInt(optimizePositive: Boolean) : int {
|
||||
var b : int = readByte();
|
||||
var result : int = b & 0x7F;
|
||||
@ -75,12 +75,12 @@ package spine {
|
||||
}
|
||||
return optimizePositive ? result : ((result >>> 1) ^ -(result & 1));
|
||||
}
|
||||
|
||||
|
||||
public function readStringRef (): String {
|
||||
var index : int = readInt(true);
|
||||
return index == 0 ? null : strings[index - 1];
|
||||
}
|
||||
|
||||
|
||||
public function readString () : String {
|
||||
var byteCount : int = readInt(true);
|
||||
switch (byteCount) {
|
||||
@ -90,7 +90,7 @@ package spine {
|
||||
return "";
|
||||
}
|
||||
byteCount--;
|
||||
var chars : String = "";
|
||||
var chars : String = "";
|
||||
for (var i : int = 0; i < byteCount;) {
|
||||
var b : int = readByte();
|
||||
switch (b >> 4) {
|
||||
@ -110,11 +110,11 @@ package spine {
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
|
||||
|
||||
public function readFloat (): Number {
|
||||
return bytes.readFloat();
|
||||
return bytes.readFloat();
|
||||
}
|
||||
|
||||
|
||||
public function readBoolean (): Boolean {
|
||||
return this.readByte() != 0;
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
package spine.attachments {
|
||||
import spine.Color;
|
||||
import spine.Bone;
|
||||
import flash.trace.Trace;
|
||||
|
||||
public dynamic class RegionAttachment extends Attachment {
|
||||
public const BLX : int = 0;
|
||||
@ -72,25 +73,26 @@ package spine.attachments {
|
||||
var localY : Number = -height * 0.5 * scaleY + regionOffsetY * regionScaleY;
|
||||
var localX2 : Number = localX + regionWidth * regionScaleX;
|
||||
var localY2 : Number = localY + regionHeight * regionScaleY;
|
||||
|
||||
|
||||
var radians : Number = rotation * Math.PI / 180;
|
||||
var ulDist : Number = Math.sqrt(localX * localX + localY * localY);
|
||||
var ulAngle : Number = Math.atan2(localY, localX);
|
||||
var urDist : Number = Math.sqrt(localX2 * localX2 + localY * localY);
|
||||
var urAngle : Number = Math.atan2(localY, localX2);
|
||||
var blDist : Number = Math.sqrt(localX * localX + localY2 * localY2);
|
||||
var blAngle : Number = Math.atan2(localY2, localX);
|
||||
var brDist : Number = Math.sqrt(localX2 * localX2 + localY2 * localY2);
|
||||
var brAngle : Number = Math.atan2(localY2, localX2);
|
||||
|
||||
offset[BLX] = Math.cos(radians - blAngle) * blDist + x;
|
||||
offset[BLY] = Math.sin(radians - blAngle) * blDist + y;
|
||||
offset[ULX] = Math.cos(radians - ulAngle) * ulDist + x;
|
||||
offset[ULY] = Math.sin(radians - ulAngle) * ulDist + y;
|
||||
offset[URX] = Math.cos(radians - urAngle) * urDist + x;
|
||||
offset[URY] = Math.sin(radians - urAngle) * urDist + y;
|
||||
offset[BRX] = Math.cos(radians - brAngle) * brDist + x;
|
||||
offset[BRY] = Math.sin(radians - brAngle) * brDist + y;
|
||||
var cos:Number = Math.cos(radians);
|
||||
var sin:Number = Math.sin(radians);
|
||||
var localXCos:Number = localX * cos + x;
|
||||
var localXSin:Number = localX * sin;
|
||||
var localYCos:Number = localY * cos + y;
|
||||
var localYSin:Number = localY * sin;
|
||||
var localX2Cos:Number = localX2 * cos + x;
|
||||
var localX2Sin:Number = localX2 * sin;
|
||||
var localY2Cos:Number = localY2 * cos + y;
|
||||
var localY2Sin:Number = localY2 * sin;
|
||||
offset[BLX] = localXCos - localYSin;
|
||||
offset[BLY] = localYCos + localXSin;
|
||||
offset[ULX] = localXCos - localY2Sin;
|
||||
offset[ULY] = localY2Cos + localXSin;
|
||||
offset[URX] = localX2Cos - localY2Sin;
|
||||
offset[URY] = localY2Cos + localX2Sin;
|
||||
offset[BRX] = localX2Cos - localYSin;
|
||||
offset[BRY] = localYCos + localX2Sin;
|
||||
}
|
||||
|
||||
public function setUVs(u : Number, v : Number, u2 : Number, v2 : Number, degrees : int) : void {
|
||||
@ -127,33 +129,33 @@ package spine.attachments {
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x; // br
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
offset += stride;
|
||||
|
||||
|
||||
offsetX = vertexOffset[BLX];
|
||||
offsetY = vertexOffset[BLY];
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x; // bl
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
offset += stride;
|
||||
|
||||
|
||||
offsetX = vertexOffset[ULX];
|
||||
offsetY = vertexOffset[ULY];
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x; // ul
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
offset += stride;
|
||||
|
||||
|
||||
offsetX = vertexOffset[URX];
|
||||
offsetY = vertexOffset[URY];
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x; // ur
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
}
|
||||
|
||||
|
||||
override public function copy (): Attachment {
|
||||
var copy : RegionAttachment = new RegionAttachment(name);
|
||||
var copy : RegionAttachment = new RegionAttachment(name);
|
||||
copy.regionWidth = regionWidth;
|
||||
copy.regionHeight = regionHeight;
|
||||
copy.regionOffsetX = regionOffsetX;
|
||||
copy.regionOffsetY = regionOffsetY;
|
||||
copy.regionOriginalWidth = regionOriginalWidth;
|
||||
copy.regionOriginalHeight = regionOriginalHeight;
|
||||
copy.regionOriginalHeight = regionOriginalHeight;
|
||||
copy.rendererObject = rendererObject;
|
||||
copy.path = path;
|
||||
copy.x = x;
|
||||
@ -164,7 +166,7 @@ package spine.attachments {
|
||||
copy.width = width;
|
||||
copy.height = height;
|
||||
copy.uvs = uvs.concat();
|
||||
copy.offset = offset.concat();
|
||||
copy.offset = offset.concat();
|
||||
copy.color.setFromColor(color);
|
||||
return copy;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user