From 50eadf89afc032e781264d49f1663bf3074d8c9b Mon Sep 17 00:00:00 2001
From: Sean Boult <996134+Hacksore@users.noreply.github.com>
Date: Thu, 28 Sep 2023 19:43:16 -0500
Subject: [PATCH] Update threejs to latest (#145)
---
examples/index.html | 2 +-
package-lock.json | 31 +++++++++----------------------
package.json | 5 ++---
src/model.ts | 44 ++++++++++++++++++--------------------------
src/viewer.ts | 2 +-
tsconfig.json | 27 ++++++++++++++++++++++++---
6 files changed, 55 insertions(+), 56 deletions(-)
diff --git a/examples/index.html b/examples/index.html
index c526490..5619843 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -129,7 +129,7 @@
Viewport
Light
-
+
diff --git a/package-lock.json b/package-lock.json
index ce7700e..0a9f48d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,20 +1,19 @@
{
"name": "skinview3d",
- "version": "3.0.0",
+ "version": "3.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "skinview3d",
- "version": "3.0.0",
+ "version": "3.0.1",
"license": "MIT",
"dependencies": {
"@types/three": "^0.142.0",
"skinview-utils": "^0.7.1",
- "three": "^0.142.0"
+ "three": "^0.156.1"
},
"devDependencies": {
- "@gplane/tsconfig": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@swc/core": "^1.3.53",
"@typescript-eslint/eslint-plugin": "^5.59.0",
@@ -106,12 +105,6 @@
"integrity": "sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==",
"dev": true
},
- "node_modules/@gplane/tsconfig": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/@gplane/tsconfig/-/tsconfig-6.0.0.tgz",
- "integrity": "sha512-K61z8tl3I5tR66MJoGoBCY1y950fybDfPol7uzcg/YPilretE0bl41GOOX0BpRbblYLOWzSJvdqlimzjAfryog==",
- "dev": true
- },
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@@ -4291,9 +4284,9 @@
}
},
"node_modules/three": {
- "version": "0.142.0",
- "resolved": "https://registry.npmjs.org/three/-/three-0.142.0.tgz",
- "integrity": "sha512-ESjPO+3geFr+ZUfVMpMnF/eVU2uJPOh0e2ZpMFqjNca1wApS9lJb7E4MjwGIczgt9iuKd8PEm6Pfgp2bJ92Xtg=="
+ "version": "0.156.1",
+ "resolved": "https://registry.npmjs.org/three/-/three-0.156.1.tgz",
+ "integrity": "sha512-kP7H0FK9d/k6t/XvQ9FO6i+QrePoDcNhwl0I02+wmUJRNSLCUIDMcfObnzQvxb37/0Uc9TDT0T1HgsRRrO6SYQ=="
},
"node_modules/through": {
"version": "2.3.8",
@@ -4647,12 +4640,6 @@
"integrity": "sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==",
"dev": true
},
- "@gplane/tsconfig": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/@gplane/tsconfig/-/tsconfig-6.0.0.tgz",
- "integrity": "sha512-K61z8tl3I5tR66MJoGoBCY1y950fybDfPol7uzcg/YPilretE0bl41GOOX0BpRbblYLOWzSJvdqlimzjAfryog==",
- "dev": true
- },
"@humanwhocodes/config-array": {
"version": "0.11.8",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
@@ -7757,9 +7744,9 @@
}
},
"three": {
- "version": "0.142.0",
- "resolved": "https://registry.npmjs.org/three/-/three-0.142.0.tgz",
- "integrity": "sha512-ESjPO+3geFr+ZUfVMpMnF/eVU2uJPOh0e2ZpMFqjNca1wApS9lJb7E4MjwGIczgt9iuKd8PEm6Pfgp2bJ92Xtg=="
+ "version": "0.156.1",
+ "resolved": "https://registry.npmjs.org/three/-/three-0.156.1.tgz",
+ "integrity": "sha512-kP7H0FK9d/k6t/XvQ9FO6i+QrePoDcNhwl0I02+wmUJRNSLCUIDMcfObnzQvxb37/0Uc9TDT0T1HgsRRrO6SYQ=="
},
"through": {
"version": "2.3.8",
diff --git a/package.json b/package.json
index 0eadaaf..896c2e8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "skinview3d",
- "version": "3.0.0",
+ "version": "3.0.1",
"description": "Three.js powered Minecraft skin viewer",
"main": "libs/skinview3d.js",
"type": "module",
@@ -42,10 +42,9 @@
"dependencies": {
"@types/three": "^0.142.0",
"skinview-utils": "^0.7.1",
- "three": "^0.142.0"
+ "three": "^0.156.1"
},
"devDependencies": {
- "@gplane/tsconfig": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@swc/core": "^1.3.53",
"@typescript-eslint/eslint-plugin": "^5.59.0",
diff --git a/src/model.ts b/src/model.ts
index 361cd35..e96392a 100644
--- a/src/model.ts
+++ b/src/model.ts
@@ -37,32 +37,24 @@ function setUVs(
const back = toFaceVertices(u + width + depth * 2, v + depth, u + width * 2 + depth * 2, v + height + depth);
const uvAttr = box.attributes.uv as BufferAttribute;
- uvAttr.copyVector2sArray([
- right[3],
- right[2],
- right[0],
- right[1],
- left[3],
- left[2],
- left[0],
- left[1],
- top[3],
- top[2],
- top[0],
- top[1],
- bottom[0],
- bottom[1],
- bottom[3],
- bottom[2],
- front[3],
- front[2],
- front[0],
- front[1],
- back[3],
- back[2],
- back[0],
- back[1],
- ]);
+ const uvRight = [right[3], right[2], right[0], right[1]];
+ const uvLeft = [left[3], left[2], left[0], left[1]];
+ const uvTop = [top[3], top[2], top[0], top[1]];
+ const uvBottom = [bottom[0], bottom[1], bottom[3], bottom[2]];
+ const uvFront = [front[3], front[2], front[0], front[1]];
+ const uvBack = [back[3], back[2], back[0], back[1]];
+
+ // Create a new array to hold the modified UV data
+ const newUVData = [];
+
+ // Iterate over the arrays and copy the data to uvData
+ for (const uvArray of [uvRight, uvLeft, uvTop, uvBottom, uvFront, uvBack]) {
+ for (const uv of uvArray) {
+ newUVData.push(uv.x, uv.y);
+ }
+ }
+
+ uvAttr.set(new Float32Array(newUVData));
uvAttr.needsUpdate = true;
}
diff --git a/src/viewer.ts b/src/viewer.ts
index b84516b..1519a69 100644
--- a/src/viewer.ts
+++ b/src/viewer.ts
@@ -279,7 +279,7 @@ export class SkinViewer {
*/
readonly playerWrapper: Group;
- readonly globalLight: AmbientLight = new AmbientLight(0xffffff, 0.4);
+ readonly globalLight: AmbientLight = new AmbientLight(0xffffff, 3);
readonly cameraLight: PointLight = new PointLight(0xffffff, 0.6);
readonly composer: EffectComposer;
diff --git a/tsconfig.json b/tsconfig.json
index 644b1e7..9943530 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,9 +1,30 @@
{
- "extends": "@gplane/tsconfig",
"compilerOptions": {
- "target": "es2019",
"outDir": "libs",
- "noUncheckedIndexedAccess": false
+ "allowJs": false,
+ "allowSyntheticDefaultImports": true,
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "alwaysStrict": true,
+ "declaration": true,
+ "esModuleInterop": true,
+ "verbatimModuleSyntax": true,
+ "isolatedModules": true,
+ "module": "nodenext",
+ "moduleResolution": "nodenext",
+ "newLine": "LF",
+ "noEmitOnError": true,
+ "noUncheckedIndexedAccess": false,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "pretty": true,
+ "resolveJsonModule": true,
+ "skipLibCheck": true,
+ "sourceMap": true,
+ "strict": true,
+ "stripInternal": true,
+ "target": "es2021",
+ "useDefineForClassFields": true
},
"include": ["src"]
}