Ver código fonte

feat: updated path from examples jsm to addons

alvarosabu 2 anos atrás
pai
commit
1778edfc96

+ 8 - 5
playground/src/components/Text3D.vue

@@ -1,8 +1,8 @@
 <script setup lang="ts">
-import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'
-import { FontLoader } from 'three/examples/jsm/loaders/FontLoader'
-import { extend } from '../core/catalogue'
+import { TextGeometry } from 'three/addons/geometries/TextGeometry'
+import { FontLoader } from 'three/addons/loaders/FontLoader'
 import { useTexture } from '/@/composables'
+import { extend } from '/@/'
 
 extend({ TextGeometry })
 
@@ -35,7 +35,10 @@ const matcapTexture = await useTexture(['https://raw.githubusercontent.com/Tresj
 </script>
 <template>
   <TresMesh>
-    <TresTextGeometry :args="['TresJS', { font, ...fontOptions }]" center />
-    <TresMeshNormalMaterial :matcap="matcapTexture" />
+    <Suspense>
+      <TresTextGeometry :args="['TresJS', { font, ...fontOptions }]" center>
+        <TresMeshMatcapMaterial :args="[matcapTexture]" />
+      </TresTextGeometry>
+    </Suspense>
   </TresMesh>
 </template>

+ 1 - 1
playground/src/pages/index.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts"></script>
 <template>
   <Suspense>
-    <Gltf />
+    <Text3D />
   </Suspense>
 </template>

+ 1 - 1
src/composables/useLoader/index.ts

@@ -49,7 +49,7 @@ export type Extensions<T extends { prototype: LoaderProto<any> }> = (loader: T['
  *
  * ```ts
  * import { useLoader } from '@tresjs/core'
- * import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
+ * import { GLTFLoader } from 'three/addons/loaders/GLTFLoader'
  *
  * const { scene } = await useLoader(THREE.GLTFLoader, 'path/to/asset.gltf')
  * ```

+ 1 - 1
src/composables/useLoader/useLoader.test.ts

@@ -1,5 +1,5 @@
 import { useLoader } from './'
-import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
+import { GLTFLoader } from 'three/addons/loaders/GLTFLoader'
 
 describe('useLoader', () => {
   test('is defined', () => {