Skip to content

Commit 1f71173

Browse files
committed
chore: update @Tresjs/core dependency to version 5.0.0-next.0
- Changed the dependency for @Tresjs/core in package.json and playground/vue/package.json to the stable version 5.0.0-next.0 from a previous URL reference. - Updated pnpm-lock.yaml to reflect the new version of @Tresjs/core across all relevant sections. - Adjusted the useGLTF implementation in documentation to align with the new state management approach.
1 parent 21a7c71 commit 1f71173

File tree

6 files changed

+55
-31
lines changed

6 files changed

+55
-31
lines changed

docs/guide/loaders/use-gltf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ An advantage of using `useGLTF`is that you can pass a `draco` prop to enable [Dr
4949
```ts
5050
import { useGLTF } from '@tresjs/cientos'
5151

52-
const { scene } = useGLTF('/models/AkuAku.gltf', { draco: true })
52+
const { state } = useGLTF('/models/AkuAku.gltf', { draco: true })
5353
```
5454

5555
## Options

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
},
7171
"devDependencies": {
7272
"@release-it/conventional-changelog": "^10.0.0",
73-
"@tresjs/core": "https://pkg.pr.new/@tresjs/core@a9c3e98",
73+
"@tresjs/core": "5.0.0-next.0",
7474
"@tresjs/eslint-config": "^1.4.0",
7575
"@types/node": "^22.10.5",
7676
"@types/three": "^0.172.0",

playground/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@tresjs/core": "https://pkg.pr.new/@tresjs/core@1938351",
12+
"@tresjs/core": "5.0.0-next.0",
1313
"vue-router": "^4.5.0"
1414
},
1515
"devDependencies": {

playground/vue/src/pages/loaders/use-gltf/TheModel.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22
/* eslint-disable no-console */
33
import { useGLTF } from '@tresjs/cientos'
44
5-
const { state: model } = useGLTF(
5+
const state = inject<{
6+
hasFinishLoading: boolean
7+
progress: number
8+
}>('gltf-loader-state')!
9+
10+
const { state: model, progress } = useGLTF(
611
'/blender-cube-draco.glb',
712
{ draco: true },
813
)
914
10-
watch(model, (newVal) => {
11-
console.log(newVal)
15+
watch(model, (newModel) => {
16+
console.log('model', newModel)
17+
setTimeout(() => {
18+
state.hasFinishLoading = true
19+
}, 1000)
20+
})
21+
22+
watch(progress, (newProgress) => {
23+
console.log('progress', newProgress)
24+
state.progress = newProgress.percentage
1225
}, { immediate: true })
1326
</script>
1427

playground/vue/src/pages/loaders/use-gltf/index.vue

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
11
<script setup lang="ts">
22
import { OrbitControls } from '@tresjs/cientos'
33
import { TresCanvas } from '@tresjs/core'
4-
import BlenderCube from '../../../components/gltf/BlenderCube.vue'
4+
import TheModel from './TheModel.vue'
55
66
const gl = {
77
clearColor: '#82DBC5',
88
shadows: true,
99
}
10+
11+
const state = reactive({
12+
hasFinishLoading: false,
13+
progress: 0,
14+
})
15+
16+
provide('gltf-loader-state', state)
1017
</script>
1118

1219
<template>
20+
<Transition
21+
name="fade-overlay"
22+
enter-active-class="opacity-1 transition-opacity duration-200"
23+
leave-active-class="opacity-0 transition-opacity duration-200"
24+
>
25+
<div
26+
v-show="!state.hasFinishLoading"
27+
class="absolute bg-white t-0 l-0 w-full h-full z-20 flex justify-center items-center text-black font-mono"
28+
>
29+
<div class="w-200px">
30+
Loading...
31+
{{ state.progress }} %
32+
</div>
33+
</div>
34+
</Transition>
1335
<TresCanvas v-bind="gl">
1436
<TresPerspectiveCamera :position="[5.3, 2.45, 9.3]" :look-at="[0, 0, 0]" />
1537
<OrbitControls />
16-
<!-- <TresGroup :position="[0, 1, 0]">
17-
<TheModel />
18-
</TresGroup> -->
1938
<TresGroup :position="[0, 1, 0]">
20-
<BlenderCube />
39+
<TheModel />
2140
</TresGroup>
2241
<TresMesh
2342
:rotate-x="Math.PI * -0.5"

pnpm-lock.yaml

Lines changed: 12 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)