|
@@ -5747,6 +5747,16 @@ var spine;
|
|
var y = Math.pow(Math.abs(x), 1 / 3);
|
|
var y = Math.pow(Math.abs(x), 1 / 3);
|
|
return x < 0 ? -y : y;
|
|
return x < 0 ? -y : y;
|
|
};
|
|
};
|
|
|
|
+ MathUtils.randomTriangular = function (min, max) {
|
|
|
|
+ return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);
|
|
|
|
+ };
|
|
|
|
+ MathUtils.randomTriangularWith = function (min, max, mode) {
|
|
|
|
+ var u = Math.random();
|
|
|
|
+ var d = max - min;
|
|
|
|
+ if (u <= (mode - min) / d)
|
|
|
|
+ return min + Math.sqrt(u * d * (mode - min));
|
|
|
|
+ return max - Math.sqrt((1 - u) * d * (max - mode));
|
|
|
|
+ };
|
|
return MathUtils;
|
|
return MathUtils;
|
|
}());
|
|
}());
|
|
MathUtils.PI = 3.1415927;
|
|
MathUtils.PI = 3.1415927;
|
|
@@ -6317,6 +6327,62 @@ var spine;
|
|
spine.RegionAttachment = RegionAttachment;
|
|
spine.RegionAttachment = RegionAttachment;
|
|
})(spine || (spine = {}));
|
|
})(spine || (spine = {}));
|
|
var spine;
|
|
var spine;
|
|
|
|
+(function (spine) {
|
|
|
|
+ var JitterEffect = (function () {
|
|
|
|
+ function JitterEffect(jitterX, jitterY) {
|
|
|
|
+ this.jitterX = 0;
|
|
|
|
+ this.jitterY = 0;
|
|
|
|
+ this.jitterX = jitterX;
|
|
|
|
+ this.jitterY = jitterY;
|
|
|
|
+ }
|
|
|
|
+ JitterEffect.prototype.begin = function (skeleton) {
|
|
|
|
+ };
|
|
|
|
+ JitterEffect.prototype.transform = function (position, uv, light, dark) {
|
|
|
|
+ position.x += spine.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
|
|
+ position.y += spine.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
|
|
|
+ };
|
|
|
|
+ JitterEffect.prototype.end = function () {
|
|
|
|
+ };
|
|
|
|
+ return JitterEffect;
|
|
|
|
+ }());
|
|
|
|
+ spine.JitterEffect = JitterEffect;
|
|
|
|
+})(spine || (spine = {}));
|
|
|
|
+var spine;
|
|
|
|
+(function (spine) {
|
|
|
|
+ var SwirlEffect = (function () {
|
|
|
|
+ function SwirlEffect(radius) {
|
|
|
|
+ this.centerX = 0;
|
|
|
|
+ this.centerY = 0;
|
|
|
|
+ this.radius = 0;
|
|
|
|
+ this.angle = 0;
|
|
|
|
+ this.worldX = 0;
|
|
|
|
+ this.worldY = 0;
|
|
|
|
+ this.radius = radius;
|
|
|
|
+ }
|
|
|
|
+ SwirlEffect.prototype.begin = function (skeleton) {
|
|
|
|
+ this.worldX = skeleton.x + this.centerX;
|
|
|
|
+ this.worldY = skeleton.y + this.centerY;
|
|
|
|
+ };
|
|
|
|
+ SwirlEffect.prototype.transform = function (position, uv, light, dark) {
|
|
|
|
+ var radAngle = this.angle * spine.MathUtils.degreesToRadians;
|
|
|
|
+ var x = position.x - this.worldX;
|
|
|
|
+ var y = position.y - this.worldY;
|
|
|
|
+ var dist = Math.sqrt(x * x + y * y);
|
|
|
|
+ if (dist < this.radius) {
|
|
|
|
+ var theta = radAngle * (Math.pow(((this.radius - dist) / this.radius) - 1, 2) * (2 % 2 == 0 ? -1 : 1) + 1);
|
|
|
|
+ var cos = Math.cos(theta);
|
|
|
|
+ var sin = Math.sin(theta);
|
|
|
|
+ position.x = cos * x - sin * y + this.worldX;
|
|
|
|
+ position.y = sin * x + cos * y + this.worldY;
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ SwirlEffect.prototype.end = function () {
|
|
|
|
+ };
|
|
|
|
+ return SwirlEffect;
|
|
|
|
+ }());
|
|
|
|
+ spine.SwirlEffect = SwirlEffect;
|
|
|
|
+})(spine || (spine = {}));
|
|
|
|
+var spine;
|
|
(function (spine) {
|
|
(function (spine) {
|
|
var webgl;
|
|
var webgl;
|
|
(function (webgl) {
|
|
(function (webgl) {
|
|
@@ -8420,12 +8486,17 @@ var spine;
|
|
function SkeletonRenderer(context, twoColorTint) {
|
|
function SkeletonRenderer(context, twoColorTint) {
|
|
if (twoColorTint === void 0) { twoColorTint = true; }
|
|
if (twoColorTint === void 0) { twoColorTint = true; }
|
|
this.premultipliedAlpha = false;
|
|
this.premultipliedAlpha = false;
|
|
|
|
+ this.vertexEffect = null;
|
|
this.tempColor = new spine.Color();
|
|
this.tempColor = new spine.Color();
|
|
this.tempColor2 = new spine.Color();
|
|
this.tempColor2 = new spine.Color();
|
|
this.vertexSize = 2 + 2 + 4;
|
|
this.vertexSize = 2 + 2 + 4;
|
|
this.twoColorTint = false;
|
|
this.twoColorTint = false;
|
|
this.renderable = new Renderable(null, 0, 0);
|
|
this.renderable = new Renderable(null, 0, 0);
|
|
this.clipper = new spine.SkeletonClipping();
|
|
this.clipper = new spine.SkeletonClipping();
|
|
|
|
+ this.temp = new spine.Vector2();
|
|
|
|
+ this.temp2 = new spine.Vector2();
|
|
|
|
+ this.temp3 = new spine.Color();
|
|
|
|
+ this.temp4 = new spine.Color();
|
|
this.twoColorTint = twoColorTint;
|
|
this.twoColorTint = twoColorTint;
|
|
if (twoColorTint)
|
|
if (twoColorTint)
|
|
this.vertexSize += 4;
|
|
this.vertexSize += 4;
|
|
@@ -8436,6 +8507,10 @@ var spine;
|
|
var premultipliedAlpha = this.premultipliedAlpha;
|
|
var premultipliedAlpha = this.premultipliedAlpha;
|
|
var twoColorTint = this.twoColorTint;
|
|
var twoColorTint = this.twoColorTint;
|
|
var blendMode = null;
|
|
var blendMode = null;
|
|
|
|
+ var tempPos = this.temp;
|
|
|
|
+ var tempUv = this.temp2;
|
|
|
|
+ var tempLight = this.temp3;
|
|
|
|
+ var tempDark = this.temp4;
|
|
var renderable = this.renderable;
|
|
var renderable = this.renderable;
|
|
var uvs = null;
|
|
var uvs = null;
|
|
var triangles = null;
|
|
var triangles = null;
|
|
@@ -8510,28 +8585,75 @@ var spine;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
var verts = renderable.vertices;
|
|
var verts = renderable.vertices;
|
|
- if (!twoColorTint) {
|
|
|
|
- for (var v = 2, u = 0, n_3 = renderable.numFloats; v < n_3; v += vertexSize, u += 2) {
|
|
|
|
- verts[v] = finalColor.r;
|
|
|
|
- verts[v + 1] = finalColor.g;
|
|
|
|
- verts[v + 2] = finalColor.b;
|
|
|
|
- verts[v + 3] = finalColor.a;
|
|
|
|
- verts[v + 4] = uvs[u];
|
|
|
|
- verts[v + 5] = uvs[u + 1];
|
|
|
|
|
|
+ if (this.vertexEffect != null) {
|
|
|
|
+ var vertexEffect = this.vertexEffect;
|
|
|
|
+ if (!twoColorTint) {
|
|
|
|
+ for (var v = 0, u = 0, n_3 = renderable.numFloats; v < n_3; v += vertexSize, u += 2) {
|
|
|
|
+ tempPos.x = verts[v];
|
|
|
|
+ tempPos.y = verts[v + 1];
|
|
|
|
+ tempUv.x = uvs[u];
|
|
|
|
+ tempUv.y = uvs[u + 1];
|
|
|
|
+ tempLight.setFromColor(finalColor);
|
|
|
|
+ tempDark.set(0, 0, 0, 0);
|
|
|
|
+ vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
|
|
+ verts[v] = tempPos.x;
|
|
|
|
+ verts[v + 1] = tempPos.y;
|
|
|
|
+ verts[v + 2] = tempLight.r;
|
|
|
|
+ verts[v + 3] = tempLight.g;
|
|
|
|
+ verts[v + 4] = tempLight.b;
|
|
|
|
+ verts[v + 5] = tempLight.a;
|
|
|
|
+ verts[v + 6] = tempUv.x;
|
|
|
|
+ verts[v + 7] = tempUv.y;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ for (var v = 0, u = 0, n_4 = renderable.numFloats; v < n_4; v += vertexSize, u += 2) {
|
|
|
|
+ tempPos.x = verts[v];
|
|
|
|
+ tempPos.y = verts[v + 1];
|
|
|
|
+ tempUv.x = uvs[u];
|
|
|
|
+ tempUv.y = uvs[u + 1];
|
|
|
|
+ tempLight.setFromColor(finalColor);
|
|
|
|
+ tempDark.setFromColor(darkColor);
|
|
|
|
+ vertexEffect.transform(tempPos, tempUv, tempLight, tempDark);
|
|
|
|
+ verts[v] = tempPos.x;
|
|
|
|
+ verts[v + 1] = tempPos.y;
|
|
|
|
+ verts[v + 2] = tempLight.r;
|
|
|
|
+ verts[v + 3] = tempLight.g;
|
|
|
|
+ verts[v + 4] = tempLight.b;
|
|
|
|
+ verts[v + 5] = tempLight.a;
|
|
|
|
+ verts[v + 6] = tempUv.x;
|
|
|
|
+ verts[v + 7] = tempUv.y;
|
|
|
|
+ verts[v + 8] = tempDark.r;
|
|
|
|
+ verts[v + 9] = tempDark.g;
|
|
|
|
+ verts[v + 10] = tempDark.b;
|
|
|
|
+ verts[v + 11] = tempDark.a;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- for (var v = 2, u = 0, n_4 = renderable.numFloats; v < n_4; v += vertexSize, u += 2) {
|
|
|
|
- verts[v] = finalColor.r;
|
|
|
|
- verts[v + 1] = finalColor.g;
|
|
|
|
- verts[v + 2] = finalColor.b;
|
|
|
|
- verts[v + 3] = finalColor.a;
|
|
|
|
- verts[v + 4] = uvs[u];
|
|
|
|
- verts[v + 5] = uvs[u + 1];
|
|
|
|
- verts[v + 6] = darkColor.r;
|
|
|
|
- verts[v + 7] = darkColor.g;
|
|
|
|
- verts[v + 8] = darkColor.b;
|
|
|
|
- verts[v + 9] = darkColor.a;
|
|
|
|
|
|
+ if (!twoColorTint) {
|
|
|
|
+ for (var v = 2, u = 0, n_5 = renderable.numFloats; v < n_5; v += vertexSize, u += 2) {
|
|
|
|
+ verts[v] = finalColor.r;
|
|
|
|
+ verts[v + 1] = finalColor.g;
|
|
|
|
+ verts[v + 2] = finalColor.b;
|
|
|
|
+ verts[v + 3] = finalColor.a;
|
|
|
|
+ verts[v + 4] = uvs[u];
|
|
|
|
+ verts[v + 5] = uvs[u + 1];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ for (var v = 2, u = 0, n_6 = renderable.numFloats; v < n_6; v += vertexSize, u += 2) {
|
|
|
|
+ verts[v] = finalColor.r;
|
|
|
|
+ verts[v + 1] = finalColor.g;
|
|
|
|
+ verts[v + 2] = finalColor.b;
|
|
|
|
+ verts[v + 3] = finalColor.a;
|
|
|
|
+ verts[v + 4] = uvs[u];
|
|
|
|
+ verts[v + 5] = uvs[u + 1];
|
|
|
|
+ verts[v + 6] = darkColor.r;
|
|
|
|
+ verts[v + 7] = darkColor.g;
|
|
|
|
+ verts[v + 8] = darkColor.b;
|
|
|
|
+ verts[v + 9] = darkColor.a;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var view = renderable.vertices.subarray(0, renderable.numFloats);
|
|
var view = renderable.vertices.subarray(0, renderable.numFloats);
|