[ts][threejs] Update to latest THREE, fix shader compilation error in THREE 138.

This commit is contained in:
Mario Zechner 2022-03-21 19:26:29 +01:00
parent ec53964603
commit 5365d661b6
4 changed files with 22 additions and 22 deletions

View File

@ -53,9 +53,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/three": { "node_modules/@types/three": {
"version": "0.133.1", "version": "0.138.0",
"resolved": "https://registry.npmjs.org/@types/three/-/three-0.133.1.tgz", "resolved": "https://registry.npmjs.org/@types/three/-/three-0.138.0.tgz",
"integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" "integrity": "sha512-D8AoV7h2kbCfrv/DcebHOFh1WDwyus3HdooBkAwcBikXArdqnsQ38PQ85JCunnvun160oA9jz53GszF3zch3tg=="
}, },
"node_modules/accepts": { "node_modules/accepts": {
"version": "1.3.8", "version": "1.3.8",
@ -7553,9 +7553,9 @@
} }
}, },
"node_modules/three": { "node_modules/three": {
"version": "0.133.1", "version": "0.138.3",
"resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", "resolved": "https://registry.npmjs.org/three/-/three-0.138.3.tgz",
"integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" "integrity": "sha512-4t1cKC8gimNyJChJbaklg8W/qj3PpsLJUIFm5LIuAy/hVxxNm1ru2FGTSfbTSsuHmC/7ipsyuGKqrSAKLNtkzg=="
}, },
"node_modules/through": { "node_modules/through": {
"version": "2.3.8", "version": "2.3.8",
@ -7976,8 +7976,8 @@
"license": "LicenseRef-LICENSE", "license": "LicenseRef-LICENSE",
"dependencies": { "dependencies": {
"@esotericsoftware/spine-core": "^4.0.24", "@esotericsoftware/spine-core": "^4.0.24",
"@types/three": "^0.133.1", "@types/three": "^0.138.0",
"three": "^0.133.1" "three": "^0.138.3"
} }
}, },
"spine-webgl": { "spine-webgl": {
@ -8009,8 +8009,8 @@
"version": "file:spine-threejs", "version": "file:spine-threejs",
"requires": { "requires": {
"@esotericsoftware/spine-core": "^4.0.24", "@esotericsoftware/spine-core": "^4.0.24",
"@types/three": "^0.133.1", "@types/three": "^0.138.0",
"three": "^0.133.1" "three": "^0.138.3"
} }
}, },
"@esotericsoftware/spine-webgl": { "@esotericsoftware/spine-webgl": {
@ -8026,9 +8026,9 @@
"dev": true "dev": true
}, },
"@types/three": { "@types/three": {
"version": "0.133.1", "version": "0.138.0",
"resolved": "https://registry.npmjs.org/@types/three/-/three-0.133.1.tgz", "resolved": "https://registry.npmjs.org/@types/three/-/three-0.138.0.tgz",
"integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" "integrity": "sha512-D8AoV7h2kbCfrv/DcebHOFh1WDwyus3HdooBkAwcBikXArdqnsQ38PQ85JCunnvun160oA9jz53GszF3zch3tg=="
}, },
"accepts": { "accepts": {
"version": "1.3.8", "version": "1.3.8",
@ -13938,9 +13938,9 @@
} }
}, },
"three": { "three": {
"version": "0.133.1", "version": "0.138.3",
"resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", "resolved": "https://registry.npmjs.org/three/-/three-0.138.3.tgz",
"integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" "integrity": "sha512-4t1cKC8gimNyJChJbaklg8W/qj3PpsLJUIFm5LIuAy/hVxxNm1ru2FGTSfbTSsuHmC/7ipsyuGKqrSAKLNtkzg=="
}, },
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>spine-threejs</title> <title>spine-threejs</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.js"></script> <script src="https://unpkg.com/three@0.138.3/build/three.js"></script>
<script src="../dist/iife/spine-threejs.js"></script> <script src="../dist/iife/spine-threejs.js"></script>
</head> </head>
<style> <style>

View File

@ -30,8 +30,8 @@
}, },
"homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme",
"dependencies": { "dependencies": {
"@types/three": "^0.133.1", "@types/three": "^0.138.0",
"three": "^0.133.1", "three": "^0.138.3",
"@esotericsoftware/spine-core": "^4.0.24" "@esotericsoftware/spine-core": "^4.0.24"
} }
} }

View File

@ -48,14 +48,14 @@ export class SkeletonMeshMaterial extends THREE.ShaderMaterial {
`; `;
let fragmentShader = ` let fragmentShader = `
uniform sampler2D map; uniform sampler2D map;
#ifdef USE_ALPHATEST #ifdef USE_SPINE_ALPHATEST
uniform float alphaTest; uniform float alphaTest;
#endif #endif
varying vec2 vUv; varying vec2 vUv;
varying vec4 vColor; varying vec4 vColor;
void main(void) { void main(void) {
gl_FragColor = texture2D(map, vUv)*vColor; gl_FragColor = texture2D(map, vUv)*vColor;
#ifdef USE_ALPHATEST #ifdef USE_SPINE_ALPHATEST
if (gl_FragColor.a < alphaTest) discard; if (gl_FragColor.a < alphaTest) discard;
#endif #endif
} }
@ -74,7 +74,7 @@ export class SkeletonMeshMaterial extends THREE.ShaderMaterial {
}; };
customizer(parameters); customizer(parameters);
if (parameters.alphaTest > 0) { if (parameters.alphaTest > 0) {
parameters.defines = { "USE_ALPHATEST": 1 }; parameters.defines = { "USE_SPINE_ALPHATEST": 1 };
parameters.uniforms["alphaTest"] = { value: parameters.alphaTest }; parameters.uniforms["alphaTest"] = { value: parameters.alphaTest };
} }
super(parameters); super(parameters);