@threlte/gltf 0.0.1 → 0.0.3
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/Arcade.glb +0 -0
- package/Arcade.svelte +86 -0
- package/package.json +2 -4
- package/src/index.js +21 -14
package/Arcade.glb
ADDED
|
Binary file
|
package/Arcade.svelte
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Auto-generated by: https://github.com/threlte/threlte/tree/main/packages/gltf
|
|
3
|
+
Command: npx @threlte/gltf@0.0.2 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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/gltf",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "GLTF to Threlte converter",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"cleanup": "rm -rf node_modules"
|
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
"url": "https://github.com/threlte/threlte.git/issues"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/threlte/threlte.git#readme",
|
|
30
|
-
"bin":
|
|
31
|
-
"@threlte/core": "./cli.js"
|
|
32
|
-
},
|
|
30
|
+
"bin": "./cli.js",
|
|
33
31
|
"main": "./src/utils/exports.js",
|
|
34
32
|
"engines": {
|
|
35
33
|
"node": ">=16"
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import fs from 'fs'
|
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import transform from './utils/transform.js'
|
|
5
5
|
|
|
6
|
-
import prettier from 'prettier'
|
|
6
|
+
import * as prettier from 'prettier'
|
|
7
7
|
import THREE from 'three'
|
|
8
8
|
global.THREE = THREE
|
|
9
9
|
|
|
@@ -54,19 +54,26 @@ export default function (file, output, options) {
|
|
|
54
54
|
'',
|
|
55
55
|
(gltf) => {
|
|
56
56
|
const raw = parse(filePath, gltf, options)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
try {
|
|
58
|
+
const prettiered = prettier.format(raw, {
|
|
59
|
+
semi: false,
|
|
60
|
+
bracketSameLine: true,
|
|
61
|
+
svelteBracketNewLine: false,
|
|
62
|
+
printWidth: options.printwidth || 120,
|
|
63
|
+
svelteBracketNewLine: true,
|
|
64
|
+
singleQuote: true,
|
|
65
|
+
parser: 'svelte',
|
|
66
|
+
plugins: ['prettier-plugin-svelte']
|
|
67
|
+
})
|
|
68
|
+
stream.write(prettiered)
|
|
69
|
+
stream.end()
|
|
70
|
+
resolve()
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error(error)
|
|
73
|
+
stream.write(raw)
|
|
74
|
+
stream.end()
|
|
75
|
+
reject(error)
|
|
76
|
+
}
|
|
70
77
|
},
|
|
71
78
|
reject
|
|
72
79
|
)
|