alvarosabu hai 1 ano
pai
achega
09ce01c284
Modificáronse 2 ficheiros con 9 adicións e 3 borrados
  1. 6 2
      playground/src/pages/lights.vue
  2. 3 1
      src/directives/vLog.ts

+ 6 - 2
playground/src/pages/lights.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import type { TresObject } from '@tresjs/core'
-import { TresCanvas, vLightHelper, vAlwaysLookAt, vDistanceTo } from '@tresjs/core'
+import { TresCanvas, vLightHelper, vAlwaysLookAt, vDistanceTo, vLog } from '@tresjs/core'
 import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
 
 import { OrbitControls } from '@tresjs/cientos'
@@ -18,7 +18,10 @@ const planeRef: Ref<TresObject | null> = ref(null)
 </script>
 
 <template>
-  <TresCanvas v-bind="gl">
+  <TresCanvas
+   
+    v-bind="gl"
+  >
     <TresPerspectiveCamera :position="[3, 3, 3]" />
     <OrbitControls />
    
@@ -32,6 +35,7 @@ const planeRef: Ref<TresObject | null> = ref(null)
     />
     <TresMesh
       ref="planeRef"
+      v-log:material
       :rotation="[-Math.PI / 2, 0, 0]"
       receive-shadow
     >

+ 3 - 1
src/directives/vLog.ts

@@ -1,5 +1,7 @@
+import type { TresObject } from '../types'
+
 export const vLog = {
-  mounted: (el: any, binding: any) => {
+  mounted: (el: TresObject, binding: { arg: string }) => {
     if (binding.arg) {
     // eslint-disable-next-line no-console
       console.log(`v-log:${binding.arg}`, el[binding.arg])