@threlte/gltf 1.0.0-next.7 → 1.0.0-next.9
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 +12 -0
- package/package.json +2 -2
- package/src/bin/DRACOLoader.js +222 -0
- package/src/bin/GLTFLoader.js +2842 -0
- package/src/index.js +10 -6
- package/src/utils/parser.js +1 -1
package/src/index.js
CHANGED
|
@@ -2,17 +2,20 @@ import 'jsdom-global'
|
|
|
2
2
|
import fs from 'fs'
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import transform from './utils/transform.js'
|
|
5
|
-
import { GLTFLoader, DRACOLoader } from 'three-stdlib'
|
|
5
|
+
// import { GLTFLoader, DRACOLoader } from 'three-stdlib'
|
|
6
6
|
import * as prettier from 'prettier'
|
|
7
|
-
import
|
|
7
|
+
import THREE from 'three'
|
|
8
|
+
|
|
8
9
|
global.THREE = THREE
|
|
9
10
|
|
|
11
|
+
import './bin/GLTFLoader.js'
|
|
12
|
+
import DracoLoader from './bin/DRACOLoader.js'
|
|
13
|
+
THREE.DRACOLoader.getDecoderModule = () => {}
|
|
14
|
+
|
|
10
15
|
import parse from './utils/parser.js'
|
|
11
16
|
|
|
12
|
-
const gltfLoader = new GLTFLoader()
|
|
13
|
-
|
|
14
|
-
dracoloader.setDecoderPath('https://www.gstatic.com/draco/v1/decoders/')
|
|
15
|
-
gltfLoader.setDRACOLoader(dracoloader)
|
|
17
|
+
const gltfLoader = new THREE.GLTFLoader()
|
|
18
|
+
gltfLoader.setDRACOLoader(new DracoLoader())
|
|
16
19
|
|
|
17
20
|
function toArrayBuffer(buf) {
|
|
18
21
|
var ab = new ArrayBuffer(buf.length)
|
|
@@ -48,6 +51,7 @@ export default function (file, output, options) {
|
|
|
48
51
|
const filePath = getRelativeFilePath(file)
|
|
49
52
|
const data = fs.readFileSync(file)
|
|
50
53
|
const arrayBuffer = toArrayBuffer(data)
|
|
54
|
+
|
|
51
55
|
gltfLoader.parse(
|
|
52
56
|
arrayBuffer,
|
|
53
57
|
'',
|
package/src/utils/parser.js
CHANGED