From b31556c894684161047eb3f3d763b92166d9d952 Mon Sep 17 00:00:00 2001 From: alvarosabu Date: Mon, 27 May 2024 08:20:30 +0200 Subject: [PATCH 01/18] feat: update orbit controls to invalidate on-demand --- playground/components.d.ts | 1 + playground/src/components/GraphPane.vue | 101 ++++++++++++++++++ playground/src/composables/state.ts | 10 ++ .../src/pages/controls/OrbitControlsDemo.vue | 10 +- src/core/controls/OrbitControls.vue | 11 +- 5 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 playground/src/components/GraphPane.vue create mode 100644 playground/src/composables/state.ts diff --git a/playground/components.d.ts b/playground/components.d.ts index 09766ef1..f707e945 100644 --- a/playground/components.d.ts +++ b/playground/components.d.ts @@ -10,6 +10,7 @@ declare module 'vue' { AkuAku: typeof import('./src/components/AkuAku.vue')['default'] FboCube: typeof import('./src/components/FboCube.vue')['default'] Gltf: typeof import('./src/components/gltf/index.vue')['default'] + GraphPane: typeof import('./src/components/GraphPane.vue')['default'] ModelsDemo: typeof import('./src/components/ModelsDemo.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/playground/src/components/GraphPane.vue b/playground/src/components/GraphPane.vue new file mode 100644 index 00000000..79110e0f --- /dev/null +++ b/playground/src/components/GraphPane.vue @@ -0,0 +1,101 @@ + + + diff --git a/playground/src/composables/state.ts b/playground/src/composables/state.ts new file mode 100644 index 00000000..cf675e9a --- /dev/null +++ b/playground/src/composables/state.ts @@ -0,0 +1,10 @@ +import { reactive, toRefs } from 'vue' + +const state = reactive({ + renderingTimes: 0, +}) +export function useState() { + return { + ...toRefs(state), + } +} diff --git a/playground/src/pages/controls/OrbitControlsDemo.vue b/playground/src/pages/controls/OrbitControlsDemo.vue index 3e3d4216..0c800dcb 100644 --- a/playground/src/pages/controls/OrbitControlsDemo.vue +++ b/playground/src/pages/controls/OrbitControlsDemo.vue @@ -6,6 +6,7 @@ import { OrbitControls } from '@tresjs/cientos' import { reactive } from 'vue' import { TresLeches, useControls } from '@tresjs/leches' import '@tresjs/leches/styles' +import { useState } from '../../composables/state' const gl = { clearColor: '#82DBC5', @@ -174,11 +175,18 @@ function onStart() { function onEnd() { /* console.log('end') */ } +// For testing render mode on-demand, +const { renderingTimes } = useState() + +function onRender() { + renderingTimes.value = 1 +}