Quellcode durchsuchen

fix: remove object assign for non primitive

alvarosabu vor 2 Jahren
Ursprung
Commit
f9e0d4b893

+ 6 - 10
playground/src/components/gltf/TheModel.vue

@@ -3,8 +3,8 @@ import { useTweakPane, useGLTF } from '@tresjs/cientos'
 
 useTweakPane()
 
-/* const { scene: model } = await useGLTF(
-  'https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/aku-aku/AkuAku.gltf',
+const { nodes, materials } = await useGLTF(
+  'https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/threejs-journey/threejs-journey-level-vue.glb',
   {
     draco: true,
   },
@@ -14,15 +14,11 @@ const akuAkuRef = ref(null)
 
 watch(akuAkuRef, value => {
   console.log('akuAkuRef', value)
-}) */
+})
 </script>
 
 <template>
-  <!-- <primitive ref="akuAkuRef" :object="model.children[0]">
-    <MeshWobbleMaterial color="orange" :speed="10" :factor="5" />
-  </primitive> -->
-  <TresMesh>
-    <TresBoxGeometry :args="[2, 2, 2]" />
-    <MeshWobbleMaterial color="orange" :speed="10" :factor="5" />
-  </TresMesh>
+  <primitive ref="akuAkuRef" :object="nodes.Cactus">
+    <MeshWobbleMaterial :speed="10" :factor="0.4" :map="materials.Cactus.map" />
+  </primitive>
 </template>

+ 2 - 1
playground/src/components/gltf/index.vue

@@ -34,7 +34,7 @@ watchEffect(() => {
         path="https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/aku-aku/AkuAku.gltf"
         draco
       /> -->
-      <TresGroup :position="[0, 4, 0]">
+      <TresGroup :scale="[1, 2, 1]">
         <TheModel />
       </TresGroup>
     </Suspense>
@@ -42,3 +42,4 @@ watchEffect(() => {
     <TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
   </TresCanvas>
 </template>
+0.5

+ 1 - 1
src/core/nodeOps.ts

@@ -44,7 +44,7 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
       if (!target) {
         logError(`${name} is not defined on the THREE namespace. Use extend to add it to the catalog.`)
       }
-      instance = Object.assign(new target(...props.args), { type: name, attach: props.attach })
+      instance = new target(...props.args)
     }
 
     if (instance.isCamera) {