entangled-worlds-orbiters-shared 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -3
- package/src/arrow-ui/GUI.js +1 -1
- package/src/arrow-ui/NumberController.js +1 -1
- package/src/loaders/glbLoader.js +3 -2
- package/src/moons/moonsGeneration.js +1 -1
- package/src/world/worldGLB.js +2 -2
- package/src/world/worldManager.js +5 -1
- package/src/world/worldTexture.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "entangled-worlds-orbiters-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Shared library for entangled worlds orbiters - contains core world rendering, moons system, and UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -35,15 +35,23 @@
|
|
|
35
35
|
"three-stdlib": "^2.34.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@eslint/js": "^10.0.1",
|
|
39
|
+
"eslint": "^10.0.0",
|
|
40
|
+
"globals": "^17.3.0",
|
|
38
41
|
"three": "^0.166.1",
|
|
39
42
|
"three-stdlib": "^2.34.0"
|
|
40
43
|
},
|
|
41
44
|
"repository": {
|
|
42
45
|
"type": "git",
|
|
43
|
-
"url": "git@github.com
|
|
46
|
+
"url": "git+ssh://git@github.com/plantasia-space-org/entangled-worlds-orbiters-shared.git"
|
|
44
47
|
},
|
|
45
48
|
"bugs": {
|
|
46
49
|
"url": "https://github.com/plantasia-space-org/entangled-worlds-orbiters-shared/issues"
|
|
47
50
|
},
|
|
48
|
-
"homepage": "https://github.com/plantasia-space-org/entangled-worlds-orbiters-shared#readme"
|
|
51
|
+
"homepage": "https://github.com/plantasia-space-org/entangled-worlds-orbiters-shared#readme",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"lint": "eslint .",
|
|
54
|
+
"lint:strict": "eslint . --max-warnings=0",
|
|
55
|
+
"lint:fallback": "node scripts/lint.js"
|
|
56
|
+
}
|
|
49
57
|
}
|
package/src/arrow-ui/GUI.js
CHANGED
|
@@ -280,7 +280,7 @@ export default class NumberController extends Controller {
|
|
|
280
280
|
const setValueFromX = clientX => {
|
|
281
281
|
const rect = this.$slider.getBoundingClientRect();
|
|
282
282
|
const x = Math.max( rect.left, Math.min( clientX, rect.right ) );
|
|
283
|
-
|
|
283
|
+
const value = map( x, rect.left, rect.right, this._min, this._max );
|
|
284
284
|
this._snapClampSetValue( value );
|
|
285
285
|
};
|
|
286
286
|
|
package/src/loaders/glbLoader.js
CHANGED
|
@@ -10,7 +10,7 @@ function getSharedKTX2Loader(renderer) {
|
|
|
10
10
|
return loader;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export async function loadGLB(url, { retries = 3, signal, onProgress, applyFlags } = {}) {
|
|
13
|
+
export async function loadGLB(url, { retries = 3, signal, onProgress, applyFlags, withCredentials = false } = {}) {
|
|
14
14
|
const renderer = window.__EW_RENDERER;
|
|
15
15
|
if (!renderer) throw new Error('Renderer not ready for KTX2');
|
|
16
16
|
|
|
@@ -18,7 +18,8 @@ export async function loadGLB(url, { retries = 3, signal, onProgress, applyFlags
|
|
|
18
18
|
while (attempt < retries) {
|
|
19
19
|
try {
|
|
20
20
|
const loader = new GLTFLoader()
|
|
21
|
-
.setCrossOrigin('anonymous')
|
|
21
|
+
.setCrossOrigin(withCredentials ? 'use-credentials' : 'anonymous')
|
|
22
|
+
.setWithCredentials(Boolean(withCredentials))
|
|
22
23
|
.setKTX2Loader(getSharedKTX2Loader(renderer));
|
|
23
24
|
|
|
24
25
|
const root = await new Promise((resolve, reject) => {
|
|
@@ -91,7 +91,7 @@ export async function generateMoons({
|
|
|
91
91
|
try { sharedTexture = await buildUvGridTexture(); usedUvGrid = true; } catch(_) {}
|
|
92
92
|
} else if (useTexture) {
|
|
93
93
|
// Use textureKey if provided, otherwise fall back to default textures
|
|
94
|
-
|
|
94
|
+
const primaryTexture = textureKey ? resolvePublicUrl(textureKey) : textureKTX2;
|
|
95
95
|
const fallbackTexture = textureFallback || texturePNG;
|
|
96
96
|
|
|
97
97
|
try {
|
package/src/world/worldGLB.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { loadGLB } from '../loaders/glbLoader.js';
|
|
2
2
|
|
|
3
|
-
export async function makeGLB({ modelUrl, flags, retries = 3 }) {
|
|
3
|
+
export async function makeGLB({ modelUrl, flags, retries = 3, withCredentials = false } = {}) {
|
|
4
4
|
if (!modelUrl) throw new Error('modelUrl is required');
|
|
5
|
-
const obj = await loadGLB(modelUrl, { retries, applyFlags: flags });
|
|
5
|
+
const obj = await loadGLB(modelUrl, { retries, applyFlags: flags, withCredentials });
|
|
6
6
|
return obj;
|
|
7
7
|
}
|
|
@@ -42,7 +42,11 @@ export class WorldManager {
|
|
|
42
42
|
if (this.customCreators.has(mode)) {
|
|
43
43
|
obj = await this.customCreators.get(mode)({ flags: this.flags, ...args });
|
|
44
44
|
} else if (mode === 2) {
|
|
45
|
-
obj = await makeGLB({
|
|
45
|
+
obj = await makeGLB({
|
|
46
|
+
modelUrl: args.modelUrl,
|
|
47
|
+
flags: this.flags,
|
|
48
|
+
withCredentials: Boolean(args.withCredentials),
|
|
49
|
+
});
|
|
46
50
|
} else if (mode === 3) {
|
|
47
51
|
obj = await makeNormalSphere({ flags: this.flags, ...args });
|
|
48
52
|
} else {
|