mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '3.7-beta' into 3.7-beta-cpp
This commit is contained in:
commit
5e96b03f43
Binary file not shown.
@ -36,7 +36,9 @@ encoding//src/spine/animation/TrackEntry.as=UTF-8
|
|||||||
encoding//src/spine/animation/TransformConstraintTimeline.as=UTF-8
|
encoding//src/spine/animation/TransformConstraintTimeline.as=UTF-8
|
||||||
encoding//src/spine/animation/TranslateTimeline.as=UTF-8
|
encoding//src/spine/animation/TranslateTimeline.as=UTF-8
|
||||||
encoding//src/spine/animation/TwoColorTimeline.as=UTF-8
|
encoding//src/spine/animation/TwoColorTimeline.as=UTF-8
|
||||||
|
encoding//src/spine/attachments/AtlasAttachmentLoader.as=UTF-8
|
||||||
encoding//src/spine/attachments/ClippingAttachment.as=UTF-8
|
encoding//src/spine/attachments/ClippingAttachment.as=UTF-8
|
||||||
|
encoding//src/spine/attachments/MeshAttachment.as=UTF-8
|
||||||
encoding//src/spine/attachments/PointAttachment.as=UTF-8
|
encoding//src/spine/attachments/PointAttachment.as=UTF-8
|
||||||
encoding//src/spine/interpolation/Pow.as=UTF-8
|
encoding//src/spine/interpolation/Pow.as=UTF-8
|
||||||
encoding//src/spine/interpolation/PowOut.as=UTF-8
|
encoding//src/spine/interpolation/PowOut.as=UTF-8
|
||||||
|
|||||||
@ -79,6 +79,8 @@ package spine.attachments {
|
|||||||
attachment.regionHeight = region.height;
|
attachment.regionHeight = region.height;
|
||||||
attachment.regionOriginalWidth = region.originalWidth;
|
attachment.regionOriginalWidth = region.originalWidth;
|
||||||
attachment.regionOriginalHeight = region.originalHeight;
|
attachment.regionOriginalHeight = region.originalHeight;
|
||||||
|
attachment.regionTextureWidth = region.page.width;
|
||||||
|
attachment.regionTextureHeight = region.page.height;
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,8 @@ package spine.attachments {
|
|||||||
public var regionHeight : Number;
|
public var regionHeight : Number;
|
||||||
public var regionOriginalWidth : Number; // Unrotated, unstripped size.
|
public var regionOriginalWidth : Number; // Unrotated, unstripped size.
|
||||||
public var regionOriginalHeight : Number;
|
public var regionOriginalHeight : Number;
|
||||||
|
public var regionTextureWidth: Number;
|
||||||
|
public var regionTextureHeight: Number;
|
||||||
// Nonessential.
|
// Nonessential.
|
||||||
public var edges : Vector.<int>;
|
public var edges : Vector.<int>;
|
||||||
public var width : Number;
|
public var width : Number;
|
||||||
@ -62,18 +64,34 @@ package spine.attachments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function updateUVs() : void {
|
public function updateUVs() : void {
|
||||||
var width : Number = regionU2 - regionU, height : Number = regionV2 - regionV;
|
|
||||||
var i : int, n : int = regionUVs.length;
|
var i : int, n : int = regionUVs.length;
|
||||||
|
var u: Number, v: Number, width: Number, height: Number;
|
||||||
|
var widthO : Number = regionU2 - regionU, heightO : Number = regionV2 - regionV;
|
||||||
|
var uO = regionU, vO = regionV;
|
||||||
if (!uvs || uvs.length != n) uvs = new Vector.<Number>(n, true);
|
if (!uvs || uvs.length != n) uvs = new Vector.<Number>(n, true);
|
||||||
if (regionRotate) {
|
if (regionRotate) {
|
||||||
|
u = regionU - (regionOriginalHeight - regionOffsetY - regionHeight) / regionTextureWidth;
|
||||||
|
v = regionV - (regionOriginalWidth - regionOffsetX - regionWidth) / regionTextureHeight;
|
||||||
|
width = regionOriginalHeight / regionTextureWidth;
|
||||||
|
height = regionOriginalWidth / regionTextureHeight;
|
||||||
|
if (u != uO || v != vO || width != widthO || heightO != height) {
|
||||||
|
trace("fah");
|
||||||
|
}
|
||||||
for (i = 0; i < n; i += 2) {
|
for (i = 0; i < n; i += 2) {
|
||||||
uvs[i] = regionU + regionUVs[int(i + 1)] * width;
|
uvs[i] = u + regionUVs[int(i + 1)] * width;
|
||||||
uvs[int(i + 1)] = regionV + height - regionUVs[i] * height;
|
uvs[int(i + 1)] = v + height - regionUVs[i] * height;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
u = regionU - regionOffsetX / regionTextureWidth;
|
||||||
|
v = regionV - (regionOriginalHeight - regionOffsetY - regionHeight) / regionTextureHeight;
|
||||||
|
width = regionOriginalWidth / regionTextureWidth;
|
||||||
|
height = regionOriginalHeight / regionTextureHeight;
|
||||||
|
if (u != uO || v != vO || width != widthO || heightO != height) {
|
||||||
|
trace("fah");
|
||||||
|
}
|
||||||
for (i = 0; i < n; i += 2) {
|
for (i = 0; i < n; i += 2) {
|
||||||
uvs[i] = regionU + regionUVs[i] * width;
|
uvs[i] = u + regionUVs[i] * width;
|
||||||
uvs[int(i + 1)] = regionV + regionUVs[int(i + 1)] * height;
|
uvs[int(i + 1)] = v + regionUVs[int(i + 1)] * height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,14 +67,26 @@ function MeshAttachment:updateUVs ()
|
|||||||
width = 1
|
width = 1
|
||||||
height = 1
|
height = 1
|
||||||
else
|
else
|
||||||
u = self.region.u;
|
local region = self.region
|
||||||
v = self.region.v;
|
local textureWidth = region.page.width
|
||||||
width = self.region.u2 - u;
|
local textureHeight = region.page.height
|
||||||
height = self.region.v2 - v;
|
if region.rotate then
|
||||||
|
u = region.u - (region.originalHeight - region.offsetY - region.height) / textureWidth
|
||||||
|
v = region.v - (region.originalWidth - region.offsetX - region.width) / textureHeight
|
||||||
|
width = region.originalHeight / textureWidth
|
||||||
|
height = region.originalWidth / textureHeight
|
||||||
|
else
|
||||||
|
u = region.u - region.offsetX / textureWidth;
|
||||||
|
v = region.v - (region.originalHeight - region.offsetY - region.height) / textureHeight;
|
||||||
|
width = region.originalWidth / textureWidth;
|
||||||
|
height = region.originalHeight / textureHeight;
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local regionUVs = self.regionUVs
|
local regionUVs = self.regionUVs
|
||||||
if not self.uvs or (#self.uvs ~= #regionUVs) then self.uvs = utils.newNumberArray(#regionUVs) end
|
if not self.uvs or (#self.uvs ~= #regionUVs) then self.uvs = utils.newNumberArray(#regionUVs) end
|
||||||
local uvs = self.uvs
|
local uvs = self.uvs
|
||||||
|
|
||||||
if self.region and self.region.rotate then
|
if self.region and self.region.rotate then
|
||||||
local i = 0
|
local i = 0
|
||||||
local n = #uvs
|
local n = #uvs
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -123,6 +123,8 @@ package spine.starling {
|
|||||||
attachment.regionHeight = texture.height;
|
attachment.regionHeight = texture.height;
|
||||||
attachment.regionOriginalWidth = frame ? frame.width : texture.width;
|
attachment.regionOriginalWidth = frame ? frame.width : texture.width;
|
||||||
attachment.regionOriginalHeight = frame ? frame.height : texture.height;
|
attachment.regionOriginalHeight = frame ? frame.height : texture.height;
|
||||||
|
attachment.regionTextureWidth = atlas.texture.width;
|
||||||
|
attachment.regionTextureHeight = atlas.texture.height;
|
||||||
if (rotated) {
|
if (rotated) {
|
||||||
var tmp : Number = attachment.regionOriginalWidth;
|
var tmp : Number = attachment.regionOriginalWidth;
|
||||||
attachment.regionOriginalWidth = attachment.regionOriginalHeight;
|
attachment.regionOriginalWidth = attachment.regionOriginalHeight;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user