mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[ts] Removed VertexEffect, see #2076
This commit is contained in:
parent
276737f1fd
commit
5a9982b2fb
@ -1,37 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated September 24, 2021. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2021, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import { Skeleton } from "./Skeleton";
|
||||
import { Vector2, Color } from "./Utils";
|
||||
|
||||
export interface VertexEffect {
|
||||
begin (skeleton: Skeleton): void;
|
||||
transform (position: Vector2, uv: Vector2, light: Color, dark: Color): void;
|
||||
end (): void;
|
||||
}
|
||||
@ -28,7 +28,6 @@ export * from './TransformConstraintData';
|
||||
export * from './Triangulator';
|
||||
export * from './Updatable';
|
||||
export * from './Utils';
|
||||
export * from './VertexEffect';
|
||||
export * from './polyfills';
|
||||
export * from './attachments/Attachment';
|
||||
export * from './attachments/AttachmentLoader';
|
||||
@ -38,5 +37,3 @@ export * from './attachments/MeshAttachment';
|
||||
export * from './attachments/PathAttachment';
|
||||
export * from './attachments/PointAttachment';
|
||||
export * from './attachments/RegionAttachment';
|
||||
export * from './vertexeffects/JitterEffect';
|
||||
export * from './vertexeffects/SwirlEffect';
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated September 24, 2021. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2021, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import { Skeleton } from "../Skeleton";
|
||||
import { Vector2, Color, MathUtils } from "../Utils";
|
||||
import { VertexEffect } from "../VertexEffect";
|
||||
|
||||
export class JitterEffect implements VertexEffect {
|
||||
jitterX = 0;
|
||||
jitterY = 0;
|
||||
|
||||
constructor (jitterX: number, jitterY: number) {
|
||||
this.jitterX = jitterX;
|
||||
this.jitterY = jitterY;
|
||||
}
|
||||
|
||||
begin (skeleton: Skeleton): void {
|
||||
}
|
||||
|
||||
transform (position: Vector2, uv: Vector2, light: Color, dark: Color): void {
|
||||
position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
||||
position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY);
|
||||
}
|
||||
|
||||
end (): void {
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated September 24, 2021. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2021, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import { Skeleton } from "../Skeleton";
|
||||
import { PowOut, Vector2, Color, MathUtils } from "../Utils";
|
||||
import { VertexEffect } from "../VertexEffect";
|
||||
|
||||
export class SwirlEffect implements VertexEffect {
|
||||
static interpolation = new PowOut(2);
|
||||
centerX = 0;
|
||||
centerY = 0;
|
||||
radius = 0;
|
||||
angle = 0;
|
||||
private worldX = 0;
|
||||
private worldY = 0;
|
||||
|
||||
constructor (radius: number) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
begin (skeleton: Skeleton): void {
|
||||
this.worldX = skeleton.x + this.centerX;
|
||||
this.worldY = skeleton.y + this.centerY;
|
||||
}
|
||||
|
||||
transform (position: Vector2, uv: Vector2, light: Color, dark: Color): void {
|
||||
let radAngle = this.angle * MathUtils.degreesToRadians;
|
||||
let x = position.x - this.worldX;
|
||||
let y = position.y - this.worldY;
|
||||
let dist = Math.sqrt(x * x + y * y);
|
||||
if (dist < this.radius) {
|
||||
let theta = SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius);
|
||||
let cos = Math.cos(theta);
|
||||
let sin = Math.sin(theta);
|
||||
position.x = cos * x - sin * y + this.worldX;
|
||||
position.y = sin * x + cos * y + this.worldY;
|
||||
}
|
||||
}
|
||||
|
||||
end (): void {
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import { AnimationState, AnimationStateData, BlendMode, ClippingAttachment, Color, MeshAttachment, NumberArrayLike, RegionAttachment, Skeleton, SkeletonClipping, SkeletonData, TextureAtlasRegion, Utils, Vector2, VertexEffect } from "@esotericsoftware/spine-core";
|
||||
import { AnimationState, AnimationStateData, BlendMode, ClippingAttachment, Color, MeshAttachment, NumberArrayLike, RegionAttachment, Skeleton, SkeletonClipping, SkeletonData, TextureAtlasRegion, Utils, Vector2 } from "@esotericsoftware/spine-core";
|
||||
import { MeshBatcher } from "./MeshBatcher";
|
||||
import * as THREE from "three";
|
||||
import { ThreeJsTexture } from "./ThreeJsTexture";
|
||||
@ -90,7 +90,6 @@ export class SkeletonMesh extends THREE.Object3D {
|
||||
skeleton: Skeleton;
|
||||
state: AnimationState;
|
||||
zOffset: number = 0.1;
|
||||
vertexEffect: VertexEffect | null = null;
|
||||
|
||||
private batches = new Array<MeshBatcher>();
|
||||
private nextBatchIndex = 0;
|
||||
@ -224,61 +223,19 @@ export class SkeletonMesh extends THREE.Object3D {
|
||||
clipper.clipTriangles(vertices, numFloats, triangles, triangles.length, uvs, color, tempLight, false);
|
||||
let clippedVertices = clipper.clippedVertices;
|
||||
let clippedTriangles = clipper.clippedTriangles;
|
||||
if (this.vertexEffect != null) {
|
||||
let vertexEffect = this.vertexEffect;
|
||||
let verts = clippedVertices;
|
||||
for (let v = 0, n = clippedVertices.length; v < n; v += vertexSize) {
|
||||
tempPos.x = verts[v];
|
||||
tempPos.y = verts[v + 1];
|
||||
tempLight.setFromColor(color);
|
||||
tempDark.set(0, 0, 0, 0);
|
||||
tempUv.x = verts[v + 6];
|
||||
tempUv.y = verts[v + 7];
|
||||
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;
|
||||
}
|
||||
}
|
||||
finalVertices = clippedVertices;
|
||||
finalVerticesLength = clippedVertices.length;
|
||||
finalIndices = clippedTriangles;
|
||||
finalIndicesLength = clippedTriangles.length;
|
||||
} else {
|
||||
let verts = vertices;
|
||||
if (this.vertexEffect != null) {
|
||||
let vertexEffect = this.vertexEffect;
|
||||
for (let v = 0, u = 0, n = numFloats; v < n; v += vertexSize, u += 2) {
|
||||
tempPos.x = verts[v];
|
||||
tempPos.y = verts[v + 1];
|
||||
tempLight.setFromColor(color);
|
||||
tempDark.set(0, 0, 0, 0);
|
||||
tempUv.x = uvs[u];
|
||||
tempUv.y = uvs[u + 1];
|
||||
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 (let v = 2, u = 0, n = numFloats; v < n; v += vertexSize, u += 2) {
|
||||
verts[v] = color.r;
|
||||
verts[v + 1] = color.g;
|
||||
verts[v + 2] = color.b;
|
||||
verts[v + 3] = color.a;
|
||||
verts[v + 4] = uvs[u];
|
||||
verts[v + 5] = uvs[u + 1];
|
||||
}
|
||||
for (let v = 2, u = 0, n = numFloats; v < n; v += vertexSize, u += 2) {
|
||||
verts[v] = color.r;
|
||||
verts[v + 1] = color.g;
|
||||
verts[v + 2] = color.b;
|
||||
verts[v + 3] = color.a;
|
||||
verts[v + 4] = uvs[u];
|
||||
verts[v + 5] = uvs[u + 1];
|
||||
}
|
||||
finalVertices = vertices;
|
||||
finalVerticesLength = numFloats;
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
<span>Skeleton:</span><select id="skeletonList"></select>
|
||||
<span>Animation:</span><select id="animationList"></select>
|
||||
<span>Skin:</span><select id="skinList"></select>
|
||||
<span>Vertex Effect:</span><select id="effectList"></select>
|
||||
<span>Debug:</span><input type="checkbox" id="debug">
|
||||
</div>
|
||||
</center>
|
||||
@ -48,10 +47,6 @@
|
||||
let skeletons = {};
|
||||
let format = "JSON";
|
||||
let activeSkeleton = "spineboy";
|
||||
let pow2 = new spine.Pow(2);
|
||||
let swirlEffect = new spine.SwirlEffect(0);
|
||||
let jitterEffect = new spine.JitterEffect(20, 20);
|
||||
let swirlTime = 0;
|
||||
|
||||
function init() {
|
||||
// Create the managed WebGL context. Managed contexts will restore resources like shaders
|
||||
@ -242,14 +237,6 @@
|
||||
if (skeletonName === activeSkeleton) option.attr("selected", "selected");
|
||||
skeletonList.append(option);
|
||||
}
|
||||
let effectList = $("#effectList");
|
||||
let effects = ["None", "Swirl", "Jitter"];
|
||||
for (let effect in effects) {
|
||||
let effectName = effects[effect];
|
||||
let option = $("<option></option>");
|
||||
option.attr("value", effectName).text(effectName);
|
||||
effectList.append(option);
|
||||
}
|
||||
let setupAnimationUI = function () {
|
||||
let animationList = $("#animationList");
|
||||
animationList.empty();
|
||||
@ -339,21 +326,6 @@
|
||||
// Start the batch and tell the SkeletonRenderer to render the active skeleton.
|
||||
batcher.begin(shader);
|
||||
|
||||
let effect = $("#effectList option:selected").text();
|
||||
if (effect == "None") {
|
||||
skeletonRenderer.vertexEffect = null;
|
||||
} else if (effect == "Swirl") {
|
||||
swirlTime += delta;
|
||||
let percent = swirlTime % 2;
|
||||
if (percent > 1) percent = 1 - (percent - 1);
|
||||
swirlEffect.angle = pow2.apply(-60, 60, percent);
|
||||
swirlEffect.centerX = bounds.offset.x + bounds.size.x / 2;
|
||||
swirlEffect.centerY = bounds.offset.y + bounds.size.y / 2;
|
||||
swirlEffect.radius = Math.sqrt(bounds.size.x * bounds.size.x + bounds.size.y * bounds.size.y) * 0.75;
|
||||
skeletonRenderer.vertexEffect = swirlEffect;
|
||||
} else if (effect == "Jitter")
|
||||
skeletonRenderer.vertexEffect = jitterEffect;
|
||||
|
||||
skeletonRenderer.premultipliedAlpha = premultipliedAlpha;
|
||||
skeletonRenderer.draw(batcher, skeleton);
|
||||
batcher.end();
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
import { NumberArrayLike, VertexEffect, Color, SkeletonClipping, Vector2, Utils, Skeleton, BlendMode, RegionAttachment, TextureAtlasRegion, MeshAttachment, ClippingAttachment } from "@esotericsoftware/spine-core";
|
||||
import { NumberArrayLike, Color, SkeletonClipping, Vector2, Utils, Skeleton, BlendMode, RegionAttachment, TextureAtlasRegion, MeshAttachment, ClippingAttachment } from "@esotericsoftware/spine-core";
|
||||
import { GLTexture } from "./GLTexture";
|
||||
import { PolygonBatcher } from "./PolygonBatcher";
|
||||
import { ManagedWebGLRenderingContext, WebGLBlendModeConverter } from "./WebGL";
|
||||
@ -41,7 +41,6 @@ export class SkeletonRenderer {
|
||||
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
||||
|
||||
premultipliedAlpha = false;
|
||||
vertexEffect: VertexEffect | null = null;
|
||||
private tempColor = new Color();
|
||||
private tempColor2 = new Color();
|
||||
private vertices: NumberArrayLike;
|
||||
@ -175,120 +174,30 @@ export class SkeletonRenderer {
|
||||
clipper.clipTriangles(renderable.vertices, renderable.numFloats, triangles, triangles.length, uvs, finalColor, darkColor, twoColorTint);
|
||||
let clippedVertices = new Float32Array(clipper.clippedVertices);
|
||||
let clippedTriangles = clipper.clippedTriangles;
|
||||
if (this.vertexEffect) {
|
||||
let vertexEffect = this.vertexEffect;
|
||||
let verts = clippedVertices;
|
||||
if (!twoColorTint) {
|
||||
for (let v = 0, n = clippedVertices.length; v < n; v += vertexSize) {
|
||||
tempPos.x = verts[v];
|
||||
tempPos.y = verts[v + 1];
|
||||
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
||||
tempUv.x = verts[v + 6];
|
||||
tempUv.y = verts[v + 7];
|
||||
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 (let v = 0, n = clippedVertices.length; v < n; v += vertexSize) {
|
||||
tempPos.x = verts[v];
|
||||
tempPos.y = verts[v + 1];
|
||||
tempLight.set(verts[v + 2], verts[v + 3], verts[v + 4], verts[v + 5]);
|
||||
tempUv.x = verts[v + 6];
|
||||
tempUv.y = verts[v + 7];
|
||||
tempDark.set(verts[v + 8], verts[v + 9], verts[v + 10], verts[v + 11]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
batcher.draw(texture, clippedVertices, clippedTriangles);
|
||||
} else {
|
||||
let verts = renderable.vertices;
|
||||
if (this.vertexEffect) {
|
||||
let vertexEffect = this.vertexEffect;
|
||||
if (!twoColorTint) {
|
||||
for (let v = 0, u = 0, n = renderable.numFloats; v < n; 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 (let v = 0, u = 0, n = renderable.numFloats; v < n; 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;
|
||||
}
|
||||
if (!twoColorTint) {
|
||||
for (let v = 2, u = 0, n = renderable.numFloats; v < n; 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 {
|
||||
if (!twoColorTint) {
|
||||
for (let v = 2, u = 0, n = renderable.numFloats; v < n; 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 (let v = 2, u = 0, n = renderable.numFloats; v < n; 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;
|
||||
}
|
||||
for (let v = 2, u = 0, n = renderable.numFloats; v < n; 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;
|
||||
}
|
||||
}
|
||||
let view = (renderable.vertices as Float32Array).subarray(0, renderable.numFloats);
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
var label = document.getElementById("label");
|
||||
var updateMean = new spine.WindowedMean();
|
||||
var renderMean = new spine.WindowedMean();
|
||||
var swirlEffect = new spine.SwirlEffect();
|
||||
var swirlTime = 0;
|
||||
var interpolation = new spine.Pow(2);
|
||||
|
||||
function init() {
|
||||
@ -52,11 +50,6 @@
|
||||
renderer.skeletonDebugRenderer.drawMeshHull = false;
|
||||
renderer.skeletonDebugRenderer.drawRegionAttachments = false;
|
||||
renderer.skeletonDebugRenderer.drawBoundingBoxes = false;
|
||||
renderer.skeletonRenderer.vertexEffect = swirlEffect;
|
||||
|
||||
swirlEffect.centerX = 0;
|
||||
swirlEffect.centerY = 200;
|
||||
swirlEffect.radius = 500;
|
||||
|
||||
assetManager = new spine.AssetManager(context, "../example/assets/");
|
||||
input = new spine.Input(canvas);
|
||||
@ -106,11 +99,6 @@
|
||||
var delta = timeKeeper.delta;
|
||||
delta = 0.016;
|
||||
|
||||
swirlTime += delta;
|
||||
var percent = swirlTime % 2;
|
||||
if (percent > 1) percent = 1 - (percent - 1);
|
||||
swirlEffect.angle = interpolation.apply(-60, 60, percent);
|
||||
|
||||
for (var i = 0; i < skeletons.length; i++) {
|
||||
var state = skeletons[i].state;
|
||||
var skeleton = skeletons[i].skeleton;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user