@threlte/gltf 0.0.4 → 0.0.5
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/CHANGELOG.md +7 -0
- package/package.json +5 -5
- package/readme.md +4 -0
- package/src/utils/parser.js +12 -5
- package/Arcade.glb +0 -0
- package/Arcade.svelte +0 -86
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/gltf",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "GLTF to Threlte converter",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"cleanup": "rm -rf node_modules"
|
|
7
|
-
},
|
|
8
5
|
"type": "module",
|
|
9
6
|
"keywords": [
|
|
10
7
|
"gltf",
|
|
@@ -65,5 +62,8 @@
|
|
|
65
62
|
"*.{js,jsx,ts,tsx}": [
|
|
66
63
|
"prettier --write"
|
|
67
64
|
]
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"cleanup": "rm -rf node_modules"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
package/readme.md
CHANGED
|
@@ -244,3 +244,7 @@ gltfLoader.load(url, (gltf) => {
|
|
|
244
244
|
- [three](https://github.com/mrdoob/three.js/) (>= 122.x)
|
|
245
245
|
- @threlte/core > 5.0.0
|
|
246
246
|
- @threlte/core > 4.9.3
|
|
247
|
+
|
|
248
|
+
## Credits
|
|
249
|
+
|
|
250
|
+
This tool started off as a fork of [gltfjsx](https://github.com/pmndrs/gltfjsx) by [pmndrs](https://pmnd.rs/).
|
package/src/utils/parser.js
CHANGED
|
@@ -456,6 +456,17 @@ function parse(fileName, gltf, options = {}) {
|
|
|
456
456
|
// 2nd pass to eliminate hard to swat left-overs
|
|
457
457
|
const scene = printThrelte(gltf.scene)
|
|
458
458
|
|
|
459
|
+
const useGltfOptions =
|
|
460
|
+
options.transform && options.draco
|
|
461
|
+
? {
|
|
462
|
+
useDraco: options.draco
|
|
463
|
+
}
|
|
464
|
+
: options.transform
|
|
465
|
+
? {
|
|
466
|
+
useDraco: true
|
|
467
|
+
}
|
|
468
|
+
: undefined
|
|
469
|
+
|
|
459
470
|
// Output
|
|
460
471
|
return `
|
|
461
472
|
<!--
|
|
@@ -487,11 +498,7 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
|
|
|
487
498
|
${options.types ? printThrelteTypes(objects, animations) : ''}
|
|
488
499
|
|
|
489
500
|
const { gltf } = useGltf${options.types ? '<GLTFResult>' : ''}('${url}'${
|
|
490
|
-
|
|
491
|
-
? `, {
|
|
492
|
-
useDraco: ${JSON.stringify(options.draco)},
|
|
493
|
-
}`
|
|
494
|
-
: ''
|
|
501
|
+
useGltfOptions ? `, ${JSON.stringify(useGltfOptions)}` : ''
|
|
495
502
|
})
|
|
496
503
|
${
|
|
497
504
|
hasAnimations
|
package/Arcade.glb
DELETED
|
Binary file
|
package/Arcade.svelte
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Auto-generated by: https://github.com/threlte/threlte/tree/main/packages/gltf
|
|
3
|
-
Command: npx @threlte/gltf@0.0.3 Arcade.glb
|
|
4
|
-
-->
|
|
5
|
-
<script>
|
|
6
|
-
import { Group } from 'three'
|
|
7
|
-
import { T, Three } from '@threlte/core'
|
|
8
|
-
import { useGltf } from '@threlte/extras'
|
|
9
|
-
|
|
10
|
-
export const ref = new Group()
|
|
11
|
-
|
|
12
|
-
const { gltf } = useGltf('/Arcade.glb')
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
{#if $gltf}
|
|
16
|
-
<Three type={ref} {...$$restProps}>
|
|
17
|
-
<T.Mesh
|
|
18
|
-
geometry={$gltf.nodes.Screen.geometry}
|
|
19
|
-
material={$gltf.materials.Screen}
|
|
20
|
-
position={[0, 1.38, 0.14]}
|
|
21
|
-
scale={1.01}
|
|
22
|
-
/>
|
|
23
|
-
<T.Mesh
|
|
24
|
-
geometry={$gltf.nodes.BodyMesh.geometry}
|
|
25
|
-
material={$gltf.materials['machine body main']}
|
|
26
|
-
position={[0.28, 0, 0]}
|
|
27
|
-
/>
|
|
28
|
-
<T.Mesh
|
|
29
|
-
geometry={$gltf.nodes.LeftCover.geometry}
|
|
30
|
-
material={$gltf.materials['machine body outer']}
|
|
31
|
-
position={[0.3, 1.21, -0.13]}
|
|
32
|
-
/>
|
|
33
|
-
<T.Mesh
|
|
34
|
-
geometry={$gltf.nodes.RightCover.geometry}
|
|
35
|
-
material={$gltf.materials['machine body outer']}
|
|
36
|
-
position={[-0.3, 1.21, -0.13]}
|
|
37
|
-
scale={[-1, 1, 1]}
|
|
38
|
-
/>
|
|
39
|
-
<T.Mesh
|
|
40
|
-
geometry={$gltf.nodes.ScreenFrame.geometry}
|
|
41
|
-
material={$gltf.materials['screen frame']}
|
|
42
|
-
position={[0.28, 0.06, 0.03]}
|
|
43
|
-
/>
|
|
44
|
-
<T.Mesh
|
|
45
|
-
geometry={$gltf.nodes.joystick_base.geometry}
|
|
46
|
-
material={$gltf.materials['joystick base']}
|
|
47
|
-
position={[0.13, 0.96, -0.2]}
|
|
48
|
-
rotation={[-0.19, 0, 0]}
|
|
49
|
-
/>
|
|
50
|
-
<T.Mesh
|
|
51
|
-
geometry={$gltf.nodes.Main_Button_Enclosure.geometry}
|
|
52
|
-
material={$gltf.materials['joystick base']}
|
|
53
|
-
position={[-0.11, 0.98, -0.09]}
|
|
54
|
-
rotation={[-0.18, 0, 0]}
|
|
55
|
-
scale={0.94}
|
|
56
|
-
>
|
|
57
|
-
<T.Mesh
|
|
58
|
-
geometry={$gltf.nodes.Main_Button.geometry}
|
|
59
|
-
material={$gltf.materials['joystick cap']}
|
|
60
|
-
position={[0, 0.01, 0]}
|
|
61
|
-
rotation={[0.19, 0, 0]}
|
|
62
|
-
scale={0.72}
|
|
63
|
-
/>
|
|
64
|
-
</T.Mesh>
|
|
65
|
-
<T.Mesh
|
|
66
|
-
geometry={$gltf.nodes.joystick_stick_application.geometry}
|
|
67
|
-
material={$gltf.materials['joystick base']}
|
|
68
|
-
position={[0.13, 0.97, -0.2]}
|
|
69
|
-
rotation={[-0.19, 0, 0]}
|
|
70
|
-
>
|
|
71
|
-
<T.Mesh
|
|
72
|
-
geometry={$gltf.nodes.joystick_stick.geometry}
|
|
73
|
-
material={$gltf.materials['joystick stick']}
|
|
74
|
-
position={[0, -0.01, 0]}
|
|
75
|
-
>
|
|
76
|
-
<T.Mesh
|
|
77
|
-
geometry={$gltf.nodes.joystick_cap.geometry}
|
|
78
|
-
material={$gltf.materials['joystick cap']}
|
|
79
|
-
position={[0, 0.11, 0]}
|
|
80
|
-
/>
|
|
81
|
-
</T.Mesh>
|
|
82
|
-
</T.Mesh>
|
|
83
|
-
|
|
84
|
-
<slot {ref} />
|
|
85
|
-
</Three>
|
|
86
|
-
{/if}
|