Merge branch '3.7-beta' into 3.7-beta-cpp

This commit is contained in:
badlogic 2018-12-22 15:07:39 +01:00
commit 5e96b03f43
9 changed files with 46 additions and 10 deletions

View File

@ -36,7 +36,9 @@ encoding//src/spine/animation/TrackEntry.as=UTF-8
encoding//src/spine/animation/TransformConstraintTimeline.as=UTF-8
encoding//src/spine/animation/TranslateTimeline.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/MeshAttachment.as=UTF-8
encoding//src/spine/attachments/PointAttachment.as=UTF-8
encoding//src/spine/interpolation/Pow.as=UTF-8
encoding//src/spine/interpolation/PowOut.as=UTF-8

View File

@ -79,6 +79,8 @@ package spine.attachments {
attachment.regionHeight = region.height;
attachment.regionOriginalWidth = region.originalWidth;
attachment.regionOriginalHeight = region.originalHeight;
attachment.regionTextureWidth = region.page.width;
attachment.regionTextureHeight = region.page.height;
return attachment;
}

View File

@ -52,6 +52,8 @@ package spine.attachments {
public var regionHeight : Number;
public var regionOriginalWidth : Number; // Unrotated, unstripped size.
public var regionOriginalHeight : Number;
public var regionTextureWidth: Number;
public var regionTextureHeight: Number;
// Nonessential.
public var edges : Vector.<int>;
public var width : Number;
@ -62,18 +64,34 @@ package spine.attachments {
}
public function updateUVs() : void {
var width : Number = regionU2 - regionU, height : Number = regionV2 - regionV;
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 (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) {
uvs[i] = regionU + regionUVs[int(i + 1)] * width;
uvs[int(i + 1)] = regionV + height - regionUVs[i] * height;
uvs[i] = u + regionUVs[int(i + 1)] * width;
uvs[int(i + 1)] = v + height - regionUVs[i] * height;
}
} 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) {
uvs[i] = regionU + regionUVs[i] * width;
uvs[int(i + 1)] = regionV + regionUVs[int(i + 1)] * height;
uvs[i] = u + regionUVs[i] * width;
uvs[int(i + 1)] = v + regionUVs[int(i + 1)] * height;
}
}
}

View File

@ -67,14 +67,26 @@ function MeshAttachment:updateUVs ()
width = 1
height = 1
else
u = self.region.u;
v = self.region.v;
width = self.region.u2 - u;
height = self.region.v2 - v;
local region = self.region
local textureWidth = region.page.width
local textureHeight = region.page.height
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
local regionUVs = self.regionUVs
if not self.uvs or (#self.uvs ~= #regionUVs) then self.uvs = utils.newNumberArray(#regionUVs) end
local uvs = self.uvs
if self.region and self.region.rotate then
local i = 0
local n = #uvs

View File

@ -123,6 +123,8 @@ package spine.starling {
attachment.regionHeight = texture.height;
attachment.regionOriginalWidth = frame ? frame.width : texture.width;
attachment.regionOriginalHeight = frame ? frame.height : texture.height;
attachment.regionTextureWidth = atlas.texture.width;
attachment.regionTextureHeight = atlas.texture.height;
if (rotated) {
var tmp : Number = attachment.regionOriginalWidth;
attachment.regionOriginalWidth = attachment.regionOriginalHeight;