@threlte/gltf 1.0.0-next.12 → 1.0.0-next.13
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 +6 -0
- package/package.json +1 -1
- package/src/index.js +3 -7
- package/src/utils/parser.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @threlte/gltf
|
|
2
2
|
|
|
3
|
+
## 1.0.0-next.13
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- d5abde5: Simplified root option to more reasonable approach. When no root is given, the path supplied will be normalized and used as a file path, if root is given, takes full control.
|
|
8
|
+
|
|
3
9
|
## 1.0.0-next.12
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -25,12 +25,8 @@ function toArrayBuffer(buf) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export default function (file, output, options) {
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
const rootPath = options.root ? path.resolve(options.root) : path.dirname(file)
|
|
31
|
-
const relativePath = path.relative(rootPath, filePath) || ''
|
|
32
|
-
if (process.platform === 'win32') return relativePath.replace(/\\/g, '/')
|
|
33
|
-
return relativePath
|
|
28
|
+
function getFilePath(file) {
|
|
29
|
+
return `${options.root ?? '/'}${options.root ? path.basename(file) : path.normalize(file)}`
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
return new Promise((resolve, reject) => {
|
|
@@ -48,7 +44,7 @@ export default function (file, output, options) {
|
|
|
48
44
|
}
|
|
49
45
|
resolve()
|
|
50
46
|
|
|
51
|
-
const filePath =
|
|
47
|
+
const filePath = getFilePath(file)
|
|
52
48
|
const data = fs.readFileSync(file)
|
|
53
49
|
const arrayBuffer = toArrayBuffer(data)
|
|
54
50
|
|
package/src/utils/parser.js
CHANGED
|
@@ -2,7 +2,7 @@ import THREE from 'three'
|
|
|
2
2
|
import isVarName from './isVarName.js'
|
|
3
3
|
|
|
4
4
|
function parse(fileName, gltf, options = {}) {
|
|
5
|
-
const url =
|
|
5
|
+
const url = fileName
|
|
6
6
|
const animations = gltf.animations
|
|
7
7
|
const hasAnimations = animations.length > 0
|
|
8
8
|
|