From fb5fcfdb6c663d518d9eaf4ce4af4262a7b96c1a Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Mon, 14 Sep 2020 22:53:30 +0200 Subject: [PATCH] improve poc --- src/components/Test.vue | 20 ++++++++++----- src/core/PerspectiveCamera.js | 7 +---- src/core/Renderer.vue | 48 +++++++++++++++++------------------ src/core/Scene.js | 9 ++++--- src/core/useThree.js | 38 +++++++++++++++------------ src/materials/Material.js | 4 +-- src/meshes/Sphere.js | 10 +++++++- 7 files changed, 77 insertions(+), 59 deletions(-) diff --git a/src/components/Test.vue b/src/components/Test.vue index 7846ccb..c5266c7 100644 --- a/src/components/Test.vue +++ b/src/components/Test.vue @@ -1,14 +1,14 @@ @@ -28,5 +28,13 @@ export default { Box, Sphere, LambertMaterial, PhongMaterial, }, + mounted() { + const renderer = this.$refs.renderer; + const box = this.$refs.box.mesh; + + renderer.onBeforeRender(() => { + box.rotation.x += 0.01; + }); + }, }; diff --git a/src/core/PerspectiveCamera.js b/src/core/PerspectiveCamera.js index 3c1fe64..afb2055 100644 --- a/src/core/PerspectiveCamera.js +++ b/src/core/PerspectiveCamera.js @@ -1,5 +1,4 @@ -import { PerspectiveCamera, Vector3 } from 'three'; - +import { PerspectiveCamera } from 'three'; import { setFromProp } from '../tools.js'; export default { @@ -10,10 +9,6 @@ export default { default: 50, }, position: Object, - // position: { - // type: Object, - // default: new Vector3(), - // }, }, created() { const camera = new PerspectiveCamera(this.fov); diff --git a/src/core/Renderer.vue b/src/core/Renderer.vue index 8f119df..6f364db 100644 --- a/src/core/Renderer.vue +++ b/src/core/Renderer.vue @@ -7,30 +7,25 @@