From db5aca7538c7e942ee9e3342c20c7794fd871cb8 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Sun, 4 Apr 2021 21:06:06 +0200 Subject: [PATCH] defineComponent for components (#10) --- src/components/liquid/LiquidPlane.js | 6 +++--- src/components/noisy/NoisyImage.js | 6 +++--- src/components/noisy/NoisyPlane.js | 6 +++--- src/components/noisy/NoisySphere.js | 6 +++--- src/components/noisy/NoisyText.js | 6 +++--- src/components/sliders/Slider1.vue | 5 +++-- src/components/sliders/Slider2.vue | 5 +++-- src/components/viewers/GLTFViewer.vue | 5 +++-- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/components/liquid/LiquidPlane.js b/src/components/liquid/LiquidPlane.js index dcb5505..d3bdeff 100644 --- a/src/components/liquid/LiquidPlane.js +++ b/src/components/liquid/LiquidPlane.js @@ -1,10 +1,10 @@ +import { defineComponent, watch } from 'vue'; import { DoubleSide, Mesh, MeshStandardMaterial, PlaneGeometry } from 'three'; -import { watch } from 'vue'; import Object3D from '../../core/Object3D.js'; import { bindProps } from '../../tools'; import LiquidEffect from './LiquidEffect.js'; -export default { +export default defineComponent({ extends: Object3D, props: { width: { type: Number, default: 10 }, @@ -51,4 +51,4 @@ export default { this.liquidEffect.update(); }, }, -}; +}); diff --git a/src/components/noisy/NoisyImage.js b/src/components/noisy/NoisyImage.js index 2bcc0cc..3b3de8a 100644 --- a/src/components/noisy/NoisyImage.js +++ b/src/components/noisy/NoisyImage.js @@ -1,9 +1,9 @@ +import { defineComponent, watch } from 'vue'; import { DoubleSide, MeshBasicMaterial, PlaneGeometry } from 'three'; -import { watch } from 'vue'; import Image from '../../meshes/Image.js'; import snoise2 from '../../glsl/snoise2.glsl.js'; -export default { +export default defineComponent({ extends: Image, props: { widthSegments: { type: Number, default: 20 }, @@ -86,4 +86,4 @@ export default { }, }, __hmrId: 'NoisyImage', -}; +}); diff --git a/src/components/noisy/NoisyPlane.js b/src/components/noisy/NoisyPlane.js index 3a68591..c6bd34c 100644 --- a/src/components/noisy/NoisyPlane.js +++ b/src/components/noisy/NoisyPlane.js @@ -1,10 +1,10 @@ +import { defineComponent, watch } from 'vue'; import { ObjectSpaceNormalMap, ShaderMaterial, Vector2, WebGLRenderTarget } from 'three'; import { Pass } from 'three/examples/jsm/postprocessing/Pass.js'; -import { watch } from 'vue'; import Plane from '../../meshes/Plane.js'; import snoise3 from '../../glsl/snoise3.glsl.js'; -export default { +export default defineComponent({ extends: Plane, props: { timeCoef: { type: Number, default: 0.001 }, @@ -126,4 +126,4 @@ export default { }, }, __hmrId: 'NoisyPlane', -}; +}); diff --git a/src/components/noisy/NoisySphere.js b/src/components/noisy/NoisySphere.js index c129751..1fe9789 100644 --- a/src/components/noisy/NoisySphere.js +++ b/src/components/noisy/NoisySphere.js @@ -1,8 +1,8 @@ -import { watch } from 'vue'; +import { defineComponent, watch } from 'vue'; import Sphere from '../../meshes/Sphere.js'; import snoise4 from '../../glsl/snoise4.glsl.js'; -export default { +export default defineComponent({ extends: Sphere, props: { radius: { type: Number, default: 20 }, @@ -65,4 +65,4 @@ export default { }, }, __hmrId: 'NoisySphere', -}; +}); diff --git a/src/components/noisy/NoisyText.js b/src/components/noisy/NoisyText.js index a317ca4..34692c6 100644 --- a/src/components/noisy/NoisyText.js +++ b/src/components/noisy/NoisyText.js @@ -1,8 +1,8 @@ -import { watch } from 'vue'; +import { defineComponent, watch } from 'vue'; import Text from '../../meshes/Text.js'; import snoise2 from '../../glsl/snoise2.glsl.js'; -export default { +export default defineComponent({ extends: Text, props: { timeCoef: { type: Number, default: 0.001 }, @@ -62,4 +62,4 @@ export default { }, }, __hmrId: 'NoisyText', -}; +}); diff --git a/src/components/sliders/Slider1.vue b/src/components/sliders/Slider1.vue index fcb947e..094abde 100644 --- a/src/components/sliders/Slider1.vue +++ b/src/components/sliders/Slider1.vue @@ -7,6 +7,7 @@ diff --git a/src/components/sliders/Slider2.vue b/src/components/sliders/Slider2.vue index b277ba1..cac4d96 100644 --- a/src/components/sliders/Slider2.vue +++ b/src/components/sliders/Slider2.vue @@ -6,6 +6,7 @@ diff --git a/src/components/viewers/GLTFViewer.vue b/src/components/viewers/GLTFViewer.vue index 8c9bb09..a3028b3 100644 --- a/src/components/viewers/GLTFViewer.vue +++ b/src/components/viewers/GLTFViewer.vue @@ -8,12 +8,13 @@