From f6ecd087fba78206a692fb12c3597305c5d4e974 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Sat, 3 Apr 2021 22:06:41 +0200 Subject: [PATCH] defineComponent for geometries (#10) --- src/geometries/BoxGeometry.js | 5 +++-- src/geometries/CircleGeometry.js | 5 +++-- src/geometries/ConeGeometry.js | 6 +++--- src/geometries/CylinderGeometry.js | 5 +++-- src/geometries/DodecahedronGeometry.js | 5 +++-- src/geometries/Geometry.js | 6 +++--- src/geometries/IcosahedronGeometry.js | 5 +++-- src/geometries/LatheGeometry.js | 5 +++-- src/geometries/OctahedronGeometry.js | 5 +++-- src/geometries/PlaneGeometry.js | 5 +++-- src/geometries/PolyhedronGeometry.js | 5 +++-- src/geometries/RingGeometry.js | 5 +++-- src/geometries/SphereGeometry.js | 5 +++-- src/geometries/TetrahedronGeometry.js | 5 +++-- src/geometries/TorusGeometry.js | 5 +++-- src/geometries/TorusKnotGeometry.js | 5 +++-- src/geometries/TubeGeometry.js | 5 +++-- 17 files changed, 51 insertions(+), 36 deletions(-) diff --git a/src/geometries/BoxGeometry.js b/src/geometries/BoxGeometry.js index d46bb57..e002b76 100644 --- a/src/geometries/BoxGeometry.js +++ b/src/geometries/BoxGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { BoxGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -19,7 +20,7 @@ export function createGeometry(comp) { } }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -27,4 +28,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/CircleGeometry.js b/src/geometries/CircleGeometry.js index 93aa9d2..7049bf5 100644 --- a/src/geometries/CircleGeometry.js +++ b/src/geometries/CircleGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { CircleGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -12,7 +13,7 @@ export function createGeometry(comp) { return new CircleGeometry(comp.radius, comp.segments, comp.thetaStart, comp.thetaLength); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -20,4 +21,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/ConeGeometry.js b/src/geometries/ConeGeometry.js index 99d8ed2..106e787 100644 --- a/src/geometries/ConeGeometry.js +++ b/src/geometries/ConeGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { ConeGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -15,7 +16,7 @@ export function createGeometry(comp) { return new ConeGeometry(comp.radius, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -23,5 +24,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; - +}); diff --git a/src/geometries/CylinderGeometry.js b/src/geometries/CylinderGeometry.js index 415f5b2..1748eab 100644 --- a/src/geometries/CylinderGeometry.js +++ b/src/geometries/CylinderGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { CylinderGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -16,7 +17,7 @@ export function createGeometry(comp) { return new CylinderGeometry(comp.radiusTop, comp.radiusBottom, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -24,4 +25,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/DodecahedronGeometry.js b/src/geometries/DodecahedronGeometry.js index 2e3040e..3eb16c9 100644 --- a/src/geometries/DodecahedronGeometry.js +++ b/src/geometries/DodecahedronGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { DodecahedronGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -10,7 +11,7 @@ export function createGeometry(comp) { return new DodecahedronGeometry(comp.radius, comp.detail); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -18,4 +19,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/Geometry.js b/src/geometries/Geometry.js index 055fb91..2bf608b 100644 --- a/src/geometries/Geometry.js +++ b/src/geometries/Geometry.js @@ -1,6 +1,6 @@ -import { watch } from 'vue'; +import { defineComponent, watch } from 'vue'; -export default { +export default defineComponent({ inject: ['mesh'], props: { rotateX: Number, @@ -46,4 +46,4 @@ export default { }, }, render() { return []; }, -}; +}); diff --git a/src/geometries/IcosahedronGeometry.js b/src/geometries/IcosahedronGeometry.js index 8e3efb7..3c532fe 100644 --- a/src/geometries/IcosahedronGeometry.js +++ b/src/geometries/IcosahedronGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { IcosahedronGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -10,7 +11,7 @@ export function createGeometry(comp) { return new IcosahedronGeometry(comp.radius, comp.detail); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -18,4 +19,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/LatheGeometry.js b/src/geometries/LatheGeometry.js index e856804..5d5127e 100644 --- a/src/geometries/LatheGeometry.js +++ b/src/geometries/LatheGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { LatheGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -12,7 +13,7 @@ export function createGeometry(comp) { return new LatheGeometry(comp.points, comp.segments, comp.phiStart, comp.phiLength); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -20,4 +21,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/OctahedronGeometry.js b/src/geometries/OctahedronGeometry.js index a81edde..07bcf1e 100644 --- a/src/geometries/OctahedronGeometry.js +++ b/src/geometries/OctahedronGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { OctahedronGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -10,7 +11,7 @@ export function createGeometry(comp) { return new OctahedronGeometry(comp.radius, comp.detail); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -18,4 +19,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/PlaneGeometry.js b/src/geometries/PlaneGeometry.js index 70c4285..7acdd8d 100644 --- a/src/geometries/PlaneGeometry.js +++ b/src/geometries/PlaneGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { PlaneGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -12,7 +13,7 @@ export function createGeometry(comp) { return new PlaneGeometry(comp.width, comp.height, comp.widthSegments, comp.heightSegments); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -20,4 +21,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/PolyhedronGeometry.js b/src/geometries/PolyhedronGeometry.js index b516985..4be4798 100644 --- a/src/geometries/PolyhedronGeometry.js +++ b/src/geometries/PolyhedronGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { PolyhedronGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -12,7 +13,7 @@ export function createGeometry(comp) { return new PolyhedronGeometry(comp.vertices, comp.indices, comp.radius, comp.detail); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -20,4 +21,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/RingGeometry.js b/src/geometries/RingGeometry.js index 41891f7..b418b25 100644 --- a/src/geometries/RingGeometry.js +++ b/src/geometries/RingGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { RingGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -14,7 +15,7 @@ export function createGeometry(comp) { return new RingGeometry(comp.innerRadius, comp.outerRadius, comp.thetaSegments, comp.phiSegments, comp.thetaStart, comp.thetaLength); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -22,4 +23,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/SphereGeometry.js b/src/geometries/SphereGeometry.js index ff2dd70..05f623b 100644 --- a/src/geometries/SphereGeometry.js +++ b/src/geometries/SphereGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { SphereGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -11,7 +12,7 @@ export function createGeometry(comp) { return new SphereGeometry(comp.radius, comp.widthSegments, comp.heightSegments); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -19,4 +20,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/TetrahedronGeometry.js b/src/geometries/TetrahedronGeometry.js index 8fadb47..d91d2aa 100644 --- a/src/geometries/TetrahedronGeometry.js +++ b/src/geometries/TetrahedronGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { TetrahedronGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -10,7 +11,7 @@ export function createGeometry(comp) { return new TetrahedronGeometry(comp.radius, comp.detail); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -18,4 +19,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/TorusGeometry.js b/src/geometries/TorusGeometry.js index ba3f041..df20a40 100644 --- a/src/geometries/TorusGeometry.js +++ b/src/geometries/TorusGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { TorusGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -13,7 +14,7 @@ export function createGeometry(comp) { return new TorusGeometry(comp.radius, comp.tube, comp.radialSegments, comp.tubularSegments, comp.arc); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -21,4 +22,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/TorusKnotGeometry.js b/src/geometries/TorusKnotGeometry.js index e61c059..4a20b54 100644 --- a/src/geometries/TorusKnotGeometry.js +++ b/src/geometries/TorusKnotGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { TorusKnotGeometry } from 'three'; import Geometry from './Geometry.js'; @@ -14,7 +15,7 @@ export function createGeometry(comp) { return new TorusKnotGeometry(comp.radius, comp.tube, comp.tubularSegments, comp.radialSegments, comp.p, comp.q); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -22,4 +23,4 @@ export default { this.geometry = createGeometry(this); }, }, -}; +}); diff --git a/src/geometries/TubeGeometry.js b/src/geometries/TubeGeometry.js index b86ca8e..2c36a69 100644 --- a/src/geometries/TubeGeometry.js +++ b/src/geometries/TubeGeometry.js @@ -1,3 +1,4 @@ +import { defineComponent } from 'vue'; import { CatmullRomCurve3, Curve, TubeGeometry, Vector3 } from 'three'; import Geometry from './Geometry.js'; @@ -22,7 +23,7 @@ export function createGeometry(comp) { return new TubeGeometry(curve, comp.tubularSegments, comp.radius, comp.radiusSegments, comp.closed); }; -export default { +export default defineComponent({ extends: Geometry, props, methods: { @@ -34,7 +35,7 @@ export default { updateTubeGeometryPoints(this.geometry, points); }, }, -}; +}); export function updateTubeGeometryPoints(tube, points) { const curve = new CatmullRomCurve3(points);