Skip to content

Commit

Permalink
fix: remove object assign for non primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Apr 15, 2023
1 parent 54385d1 commit f9e0d4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
16 changes: 6 additions & 10 deletions playground/src/components/gltf/TheModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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>
3 changes: 2 additions & 1 deletion playground/src/components/gltf/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ 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>
<TresAxesHelper />
<TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
</TresCanvas>
</template>
0.5
2 changes: 1 addition & 1 deletion src/core/nodeOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f9e0d4b

Please sign in to comment.