mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-19 00:06:42 +08:00
Fixed bug in SkeletonJson, used = instead of == in condition. Fixed vertex component order for mesh attachment. Fixed SkeletonRenderer.
This commit is contained in:
parent
fcade28c7a
commit
be1a2e3cbb
2933
spine-ts/build/spine-all.d.ts
vendored
2933
spine-ts/build/spine-all.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -499,13 +499,19 @@ var spine;
|
|||||||
g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;
|
g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;
|
||||||
b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;
|
b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;
|
||||||
}
|
}
|
||||||
if (alpha == 1)
|
if (alpha == 1) {
|
||||||
slot.color.set(r, g, b, a);
|
slot.color.set(r, g, b, a);
|
||||||
|
slot.darkColor.set(r2, g2, b2, 1);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
var color = slot.color;
|
var light = slot.color;
|
||||||
if (setupPose)
|
var dark = slot.darkColor;
|
||||||
color.setFromColor(slot.data.color);
|
if (setupPose) {
|
||||||
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
light.setFromColor(slot.data.color);
|
||||||
|
dark.setFromColor(slot.data.darkColor);
|
||||||
|
}
|
||||||
|
light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha);
|
||||||
|
dark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
TwoColorTimeline.ENTRIES = 8;
|
TwoColorTimeline.ENTRIES = 8;
|
||||||
@ -1991,7 +1997,7 @@ var spine;
|
|||||||
else {
|
else {
|
||||||
for (var i = 0, n = uvs.length; i < n; i += 2) {
|
for (var i = 0, n = uvs.length; i < n; i += 2) {
|
||||||
uvs[i] = u + regionUVs[i] * width;
|
uvs[i] = u + regionUVs[i] * width;
|
||||||
uvs[i] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -4321,7 +4327,7 @@ var spine;
|
|||||||
throw new Error("Slot not found: " + slotName);
|
throw new Error("Slot not found: " + slotName);
|
||||||
for (var timelineName in slotMap) {
|
for (var timelineName in slotMap) {
|
||||||
var timelineMap = slotMap[timelineName];
|
var timelineMap = slotMap[timelineName];
|
||||||
if (timelineName = "attachment") {
|
if (timelineName == "attachment") {
|
||||||
var timeline = new spine.AttachmentTimeline(timelineMap.length);
|
var timeline = new spine.AttachmentTimeline(timelineMap.length);
|
||||||
timeline.slotIndex = slotIndex;
|
timeline.slotIndex = slotIndex;
|
||||||
var frameIndex = 0;
|
var frameIndex = 0;
|
||||||
@ -7545,30 +7551,30 @@ var spine;
|
|||||||
var vertices = spine.Utils.newFloatArray(4 * SkeletonRenderer.VERTEX_SIZE);
|
var vertices = spine.Utils.newFloatArray(4 * SkeletonRenderer.VERTEX_SIZE);
|
||||||
region.computeWorldVertices(slot.bone, vertices, 0, SkeletonRenderer.VERTEX_SIZE);
|
region.computeWorldVertices(slot.bone, vertices, 0, SkeletonRenderer.VERTEX_SIZE);
|
||||||
var uvs = region.uvs;
|
var uvs = region.uvs;
|
||||||
vertices[spine.RegionAttachment.U1] = uvs[0];
|
|
||||||
vertices[spine.RegionAttachment.V1] = uvs[1];
|
|
||||||
vertices[spine.RegionAttachment.C1R] = color.r;
|
vertices[spine.RegionAttachment.C1R] = color.r;
|
||||||
vertices[spine.RegionAttachment.C1G] = color.g;
|
vertices[spine.RegionAttachment.C1G] = color.g;
|
||||||
vertices[spine.RegionAttachment.C1B] = color.b;
|
vertices[spine.RegionAttachment.C1B] = color.b;
|
||||||
vertices[spine.RegionAttachment.C1A] = color.a;
|
vertices[spine.RegionAttachment.C1A] = color.a;
|
||||||
vertices[spine.RegionAttachment.U2] = uvs[2];
|
vertices[spine.RegionAttachment.U1] = uvs[0];
|
||||||
vertices[spine.RegionAttachment.V2] = uvs[3];
|
vertices[spine.RegionAttachment.V1] = uvs[1];
|
||||||
vertices[spine.RegionAttachment.C2R] = color.r;
|
vertices[spine.RegionAttachment.C2R] = color.r;
|
||||||
vertices[spine.RegionAttachment.C2G] = color.g;
|
vertices[spine.RegionAttachment.C2G] = color.g;
|
||||||
vertices[spine.RegionAttachment.C2B] = color.b;
|
vertices[spine.RegionAttachment.C2B] = color.b;
|
||||||
vertices[spine.RegionAttachment.C2A] = color.a;
|
vertices[spine.RegionAttachment.C2A] = color.a;
|
||||||
vertices[spine.RegionAttachment.U3] = uvs[4];
|
vertices[spine.RegionAttachment.U2] = uvs[2];
|
||||||
vertices[spine.RegionAttachment.V3] = uvs[5];
|
vertices[spine.RegionAttachment.V2] = uvs[3];
|
||||||
vertices[spine.RegionAttachment.C3R] = color.r;
|
vertices[spine.RegionAttachment.C3R] = color.r;
|
||||||
vertices[spine.RegionAttachment.C3G] = color.g;
|
vertices[spine.RegionAttachment.C3G] = color.g;
|
||||||
vertices[spine.RegionAttachment.C3B] = color.b;
|
vertices[spine.RegionAttachment.C3B] = color.b;
|
||||||
vertices[spine.RegionAttachment.C3A] = color.a;
|
vertices[spine.RegionAttachment.C3A] = color.a;
|
||||||
vertices[spine.RegionAttachment.U4] = uvs[6];
|
vertices[spine.RegionAttachment.U3] = uvs[4];
|
||||||
vertices[spine.RegionAttachment.V4] = uvs[7];
|
vertices[spine.RegionAttachment.V3] = uvs[5];
|
||||||
vertices[spine.RegionAttachment.C4R] = color.r;
|
vertices[spine.RegionAttachment.C4R] = color.r;
|
||||||
vertices[spine.RegionAttachment.C4G] = color.g;
|
vertices[spine.RegionAttachment.C4G] = color.g;
|
||||||
vertices[spine.RegionAttachment.C4B] = color.b;
|
vertices[spine.RegionAttachment.C4B] = color.b;
|
||||||
vertices[spine.RegionAttachment.C4A] = color.a;
|
vertices[spine.RegionAttachment.C4A] = color.a;
|
||||||
|
vertices[spine.RegionAttachment.U4] = uvs[6];
|
||||||
|
vertices[spine.RegionAttachment.V4] = uvs[7];
|
||||||
return vertices;
|
return vertices;
|
||||||
};
|
};
|
||||||
SkeletonRenderer.prototype.computeMeshVertices = function (slot, mesh, pma) {
|
SkeletonRenderer.prototype.computeMeshVertices = function (slot, mesh, pma) {
|
||||||
@ -7585,12 +7591,12 @@ var spine;
|
|||||||
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, SkeletonRenderer.VERTEX_SIZE);
|
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, SkeletonRenderer.VERTEX_SIZE);
|
||||||
var uvs = mesh.uvs;
|
var uvs = mesh.uvs;
|
||||||
for (var i = 0, n = numVertices, u = 0, v = 2; i < n; i++) {
|
for (var i = 0, n = numVertices, u = 0, v = 2; i < n; i++) {
|
||||||
vertices[v++] = uvs[u++];
|
|
||||||
vertices[v++] = uvs[u++];
|
|
||||||
vertices[v++] = color.r;
|
vertices[v++] = color.r;
|
||||||
vertices[v++] = color.g;
|
vertices[v++] = color.g;
|
||||||
vertices[v++] = color.b;
|
vertices[v++] = color.b;
|
||||||
vertices[v++] = color.a;
|
vertices[v++] = color.a;
|
||||||
|
vertices[v++] = uvs[u++];
|
||||||
|
vertices[v++] = uvs[u++];
|
||||||
v += 2;
|
v += 2;
|
||||||
}
|
}
|
||||||
return vertices;
|
return vertices;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -561,12 +561,18 @@ module spine {
|
|||||||
g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;
|
g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent;
|
||||||
b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;
|
b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent;
|
||||||
}
|
}
|
||||||
if (alpha == 1)
|
if (alpha == 1) {
|
||||||
slot.color.set(r, g, b, a);
|
slot.color.set(r, g, b, a);
|
||||||
else {
|
slot.darkColor.set(r2, g2, b2, 1);
|
||||||
let color = slot.color;
|
} else {
|
||||||
if (setupPose) color.setFromColor(slot.data.color);
|
let light = slot.color;
|
||||||
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
let dark = slot.darkColor;
|
||||||
|
if (setupPose) {
|
||||||
|
light.setFromColor(slot.data.color);
|
||||||
|
dark.setFromColor(slot.data.darkColor);
|
||||||
|
}
|
||||||
|
light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha);
|
||||||
|
dark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -382,7 +382,7 @@ module spine {
|
|||||||
if (slotIndex == -1) throw new Error("Slot not found: " + slotName);
|
if (slotIndex == -1) throw new Error("Slot not found: " + slotName);
|
||||||
for (let timelineName in slotMap) {
|
for (let timelineName in slotMap) {
|
||||||
let timelineMap = slotMap[timelineName];
|
let timelineMap = slotMap[timelineName];
|
||||||
if (timelineName = "attachment") {
|
if (timelineName == "attachment") {
|
||||||
let timeline = new AttachmentTimeline(timelineMap.length);
|
let timeline = new AttachmentTimeline(timelineMap.length);
|
||||||
timeline.slotIndex = slotIndex;
|
timeline.slotIndex = slotIndex;
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ module spine {
|
|||||||
} else {
|
} else {
|
||||||
for (let i = 0, n = uvs.length; i < n; i += 2) {
|
for (let i = 0, n = uvs.length; i < n; i += 2) {
|
||||||
uvs[i] = u + regionUVs[i] * width;
|
uvs[i] = u + regionUVs[i] * width;
|
||||||
uvs[i] = v + regionUVs[i + 1] * height;
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ var skeletonRenderer;
|
|||||||
var debugRenderer;
|
var debugRenderer;
|
||||||
var shapes;
|
var shapes;
|
||||||
var skeletons = {};
|
var skeletons = {};
|
||||||
var activeSkeleton = "raptor";
|
var activeSkeleton = "vine";
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
// Setup canvas and WebGL context. We pass alpha: false to canvas.getContext() so we don't use premultiplied alpha when
|
// Setup canvas and WebGL context. We pass alpha: false to canvas.getContext() so we don't use premultiplied alpha when
|
||||||
|
|||||||
@ -94,33 +94,33 @@ module spine.webgl {
|
|||||||
|
|
||||||
let uvs = region.uvs;
|
let uvs = region.uvs;
|
||||||
|
|
||||||
vertices[RegionAttachment.U1] = uvs[0];
|
|
||||||
vertices[RegionAttachment.V1] = uvs[1];
|
|
||||||
vertices[RegionAttachment.C1R] = color.r;
|
vertices[RegionAttachment.C1R] = color.r;
|
||||||
vertices[RegionAttachment.C1G] = color.g;
|
vertices[RegionAttachment.C1G] = color.g;
|
||||||
vertices[RegionAttachment.C1B] = color.b;
|
vertices[RegionAttachment.C1B] = color.b;
|
||||||
vertices[RegionAttachment.C1A] = color.a;
|
vertices[RegionAttachment.C1A] = color.a;
|
||||||
|
vertices[RegionAttachment.U1] = uvs[0];
|
||||||
|
vertices[RegionAttachment.V1] = uvs[1];
|
||||||
|
|
||||||
vertices[RegionAttachment.U2] = uvs[2];
|
|
||||||
vertices[RegionAttachment.V2] = uvs[3];
|
|
||||||
vertices[RegionAttachment.C2R] = color.r;
|
vertices[RegionAttachment.C2R] = color.r;
|
||||||
vertices[RegionAttachment.C2G] = color.g;
|
vertices[RegionAttachment.C2G] = color.g;
|
||||||
vertices[RegionAttachment.C2B] = color.b;
|
vertices[RegionAttachment.C2B] = color.b;
|
||||||
vertices[RegionAttachment.C2A] = color.a;
|
vertices[RegionAttachment.C2A] = color.a;
|
||||||
|
vertices[RegionAttachment.U2] = uvs[2];
|
||||||
|
vertices[RegionAttachment.V2] = uvs[3];
|
||||||
|
|
||||||
vertices[RegionAttachment.U3] = uvs[4];
|
|
||||||
vertices[RegionAttachment.V3] = uvs[5];
|
|
||||||
vertices[RegionAttachment.C3R] = color.r;
|
vertices[RegionAttachment.C3R] = color.r;
|
||||||
vertices[RegionAttachment.C3G] = color.g;
|
vertices[RegionAttachment.C3G] = color.g;
|
||||||
vertices[RegionAttachment.C3B] = color.b;
|
vertices[RegionAttachment.C3B] = color.b;
|
||||||
vertices[RegionAttachment.C3A] = color.a;
|
vertices[RegionAttachment.C3A] = color.a;
|
||||||
|
vertices[RegionAttachment.U3] = uvs[4];
|
||||||
|
vertices[RegionAttachment.V3] = uvs[5];
|
||||||
|
|
||||||
vertices[RegionAttachment.U4] = uvs[6];
|
|
||||||
vertices[RegionAttachment.V4] = uvs[7];
|
|
||||||
vertices[RegionAttachment.C4R] = color.r;
|
vertices[RegionAttachment.C4R] = color.r;
|
||||||
vertices[RegionAttachment.C4G] = color.g;
|
vertices[RegionAttachment.C4G] = color.g;
|
||||||
vertices[RegionAttachment.C4B] = color.b;
|
vertices[RegionAttachment.C4B] = color.b;
|
||||||
vertices[RegionAttachment.C4A] = color.a;
|
vertices[RegionAttachment.C4A] = color.a;
|
||||||
|
vertices[RegionAttachment.U4] = uvs[6];
|
||||||
|
vertices[RegionAttachment.V4] = uvs[7];
|
||||||
|
|
||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
@ -144,12 +144,12 @@ module spine.webgl {
|
|||||||
|
|
||||||
let uvs = mesh.uvs;
|
let uvs = mesh.uvs;
|
||||||
for (let i = 0, n = numVertices, u = 0, v = 2; i < n; i++) {
|
for (let i = 0, n = numVertices, u = 0, v = 2; i < n; i++) {
|
||||||
vertices[v++] = uvs[u++];
|
|
||||||
vertices[v++] = uvs[u++];
|
|
||||||
vertices[v++] = color.r;
|
vertices[v++] = color.r;
|
||||||
vertices[v++] = color.g;
|
vertices[v++] = color.g;
|
||||||
vertices[v++] = color.b;
|
vertices[v++] = color.b;
|
||||||
vertices[v++] = color.a;
|
vertices[v++] = color.a;
|
||||||
|
vertices[v++] = uvs[u++];
|
||||||
|
vertices[v++] = uvs[u++];
|
||||||
v += 2;
|
v += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user