Ver Fonte

docs(lights): clean up demo

* move directives from lights demo to misc/directives
* add SpotLight
* add preview image
* fit scene in default camera view
Peter há 2 meses atrás
pai
commit
efe4be3228

Diff do ficheiro suprimidas por serem muito extensas
+ 13 - 4
playground/vue/src/pages/basic/Lights.vue


+ 14 - 2
playground/vue/src/pages/misc/directives/index.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 <script setup lang="ts">
 import { OrbitControls } from '@tresjs/cientos'
 import { OrbitControls } from '@tresjs/cientos'
-import { TresCanvas } from '@tresjs/core'
+import type { TresObject } from '@tresjs/core'
+import { TresCanvas, vDistanceTo, vLog } from '@tresjs/core'
 import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
 import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
 import DirectiveSubComponent from './DirectiveSubComponent.vue'
 import DirectiveSubComponent from './DirectiveSubComponent.vue'
 
 
@@ -12,14 +13,25 @@ const gl = {
   outputColorSpace: SRGBColorSpace,
   outputColorSpace: SRGBColorSpace,
   toneMapping: NoToneMapping,
   toneMapping: NoToneMapping,
 }
 }
+
+const planeRef: Ref<TresObject | null> = ref(null)
 </script>
 </script>
 
 
 <template>
 <template>
   <TresCanvas v-bind="gl">
   <TresCanvas v-bind="gl">
-    <TresPerspectiveCamera :position="[3, 3, 3]" />
+    <TresPerspectiveCamera v-distance-to="planeRef" :position="[3, 3, 3]" />
     <OrbitControls />
     <OrbitControls />
     <TresGridHelper />
     <TresGridHelper />
     <DirectiveSubComponent />
     <DirectiveSubComponent />
     <TresAmbientLight :intensity="1" />
     <TresAmbientLight :intensity="1" />
+    <TresMesh
+      ref="planeRef"
+      v-log:material
+      :rotation="[-Math.PI / 2, 0, 0]"
+      receive-shadow
+    >
+      <TresPlaneGeometry :args="[10, 10, 10, 10]" />
+      <TresMeshToonMaterial />
+    </TresMesh>
   </TresCanvas>
   </TresCanvas>
 </template>
 </template>

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff