@threlte/gltf 1.0.0-next.10 → 1.0.0-next.12
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 +1 -1
- package/src/utils/parser.js +19 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @threlte/gltf
|
|
2
2
|
|
|
3
|
+
## 1.0.0-next.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6d56d11c: Added proper types for new slots error & fallback
|
|
8
|
+
|
|
9
|
+
## 1.0.0-next.11
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- e91cc094: await instead of if clause for less if-blocks (helps with transitions)
|
|
14
|
+
|
|
3
15
|
## 1.0.0-next.10
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
package/src/utils/parser.js
CHANGED
|
@@ -149,24 +149,24 @@ function parse(fileName, gltf, options = {}) {
|
|
|
149
149
|
|
|
150
150
|
// Write out geometry first
|
|
151
151
|
if (obj.geometry) {
|
|
152
|
-
result += `geometry={
|
|
152
|
+
result += `geometry={gltf.${node}.geometry} `
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// Write out materials
|
|
156
156
|
if (obj.material) {
|
|
157
157
|
if (obj.material.name)
|
|
158
|
-
result += `material={
|
|
159
|
-
else result += `material={
|
|
158
|
+
result += `material={gltf.materials${sanitizeName(obj.material.name)}} `
|
|
159
|
+
else result += `material={gltf.${node}.material} `
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
if (obj.skeleton) result += `skeleton={
|
|
162
|
+
if (obj.skeleton) result += `skeleton={gltf.${node}.skeleton} `
|
|
163
163
|
if (obj.visible === false) result += `visible={false} `
|
|
164
164
|
if (obj.castShadow === true) result += `castShadow `
|
|
165
165
|
if (obj.receiveShadow === true) result += `receiveShadow `
|
|
166
166
|
if (obj.morphTargetDictionary)
|
|
167
|
-
result += `morphTargetDictionary={
|
|
167
|
+
result += `morphTargetDictionary={gltf.${node}.morphTargetDictionary} `
|
|
168
168
|
if (obj.morphTargetInfluences)
|
|
169
|
-
result += `morphTargetInfluences={
|
|
169
|
+
result += `morphTargetInfluences={gltf.${node}.morphTargetInfluences} `
|
|
170
170
|
if (obj.intensity && rNbr(obj.intensity)) result += `intensity={${rNbr(obj.intensity)}} `
|
|
171
171
|
//if (obj.power && obj.power !== 4 * Math.PI) result += `power={${rNbr(obj.power)}} `
|
|
172
172
|
if (obj.angle && obj.angle !== Math.PI / 3) result += `angle={${rDeg(obj.angle)}} `
|
|
@@ -378,7 +378,7 @@ function parse(fileName, gltf, options = {}) {
|
|
|
378
378
|
|
|
379
379
|
// Bail out on lights and bones
|
|
380
380
|
if (type === 'bone') {
|
|
381
|
-
return `<T is={
|
|
381
|
+
return `<T is={gltf.${node}} />\n`
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
// Collect children
|
|
@@ -535,7 +535,11 @@ ${
|
|
|
535
535
|
|
|
536
536
|
${options.types && !options.isolated ? 'type $$Props = Props<THREE.Group>' : ''}
|
|
537
537
|
${options.types && !options.isolated ? 'type $$Events = Events<THREE.Group>' : ''}
|
|
538
|
-
${
|
|
538
|
+
${
|
|
539
|
+
options.types && !options.isolated
|
|
540
|
+
? 'type $$Slots = Slots<THREE.Group> & { fallback: {}; error: { error: any } }'
|
|
541
|
+
: ''
|
|
542
|
+
}
|
|
539
543
|
|
|
540
544
|
export const ref = new Group()
|
|
541
545
|
|
|
@@ -556,9 +560,13 @@ ${
|
|
|
556
560
|
</script>
|
|
557
561
|
|
|
558
562
|
<T is={ref} dispose={false} ${!options.isolated ? '{...$$restProps} bind:this={$component}' : ''}>
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
{
|
|
563
|
+
{#await gltf}
|
|
564
|
+
<slot name="fallback" />
|
|
565
|
+
{:then gltf}
|
|
566
|
+
${scene}
|
|
567
|
+
{:catch error}
|
|
568
|
+
<slot name="error" {error} />
|
|
569
|
+
{/await}
|
|
562
570
|
|
|
563
571
|
<slot {ref} />
|
|
564
572
|
</T>
|