diff --git a/src/geometries/BoxGeometry.ts b/src/geometries/BoxGeometry.ts index e7cc409..474ea28 100644 --- a/src/geometries/BoxGeometry.ts +++ b/src/geometries/BoxGeometry.ts @@ -9,7 +9,7 @@ export const props = { widthSegments: { type: Number, default: 1 }, heightSegments: { type: Number, default: 1 }, depthSegments: { type: Number, default: 1 }, -} +} as const export function createGeometry(comp: any): BoxGeometry { if (comp.size) { diff --git a/src/geometries/CircleGeometry.ts b/src/geometries/CircleGeometry.ts index a58adfa..6d5d558 100644 --- a/src/geometries/CircleGeometry.ts +++ b/src/geometries/CircleGeometry.ts @@ -6,7 +6,7 @@ export const props = { segments: { type: Number, default: 8 }, thetaStart: { type: Number, default: 0 }, thetaLength: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): CircleGeometry { return new CircleGeometry(comp.radius, comp.segments, comp.thetaStart, comp.thetaLength) diff --git a/src/geometries/ConeGeometry.ts b/src/geometries/ConeGeometry.ts index c4abb40..31553b7 100644 --- a/src/geometries/ConeGeometry.ts +++ b/src/geometries/ConeGeometry.ts @@ -9,7 +9,7 @@ export const props = { openEnded: { type: Boolean, default: false }, thetaStart: { type: Number, default: 0 }, thetaLength: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): ConeGeometry { return new ConeGeometry(comp.radius, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength) diff --git a/src/geometries/CylinderGeometry.ts b/src/geometries/CylinderGeometry.ts index 4d70219..dc9af5f 100644 --- a/src/geometries/CylinderGeometry.ts +++ b/src/geometries/CylinderGeometry.ts @@ -10,7 +10,7 @@ export const props = { openEnded: { type: Boolean, default: false }, thetaStart: { type: Number, default: 0 }, thetaLength: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): CylinderGeometry { return new CylinderGeometry(comp.radiusTop, comp.radiusBottom, comp.height, comp.radialSegments, comp.heightSegments, comp.openEnded, comp.thetaStart, comp.thetaLength) diff --git a/src/geometries/DodecahedronGeometry.ts b/src/geometries/DodecahedronGeometry.ts index f3dd33e..563fca1 100644 --- a/src/geometries/DodecahedronGeometry.ts +++ b/src/geometries/DodecahedronGeometry.ts @@ -4,7 +4,7 @@ import { DodecahedronGeometry } from 'three' export const props = { radius: { type: Number, default: 1 }, detail: { type: Number, default: 0 }, -} +} as const export function createGeometry(comp: any): DodecahedronGeometry { return new DodecahedronGeometry(comp.radius, comp.detail) diff --git a/src/geometries/Geometry.ts b/src/geometries/Geometry.ts index 906aa16..5d4bd9c 100644 --- a/src/geometries/Geometry.ts +++ b/src/geometries/Geometry.ts @@ -1,5 +1,5 @@ +import { ComponentPropsOptions, defineComponent, watch } from 'vue' import { BufferGeometry } from 'three' -import { defineComponent, inject, watch } from 'vue' import { MeshInjectionKey, MeshInterface } from '../meshes/Mesh' export interface GeometrySetupInterface { @@ -66,20 +66,20 @@ const Geometry = defineComponent({ export default Geometry -// @ts-ignore -export function geometryComponent(name, props, createGeometry) { +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +export function geometryComponent

>( + name: string, + props: P, + createGeometry: {(c: any): BufferGeometry} +) { return defineComponent({ name, extends: Geometry, props, - setup(): GeometrySetupInterface { - return {} - }, methods: { createGeometry() { this.geometry = createGeometry(this) }, }, - // __hmrId: name, }) } diff --git a/src/geometries/IcosahedronGeometry.ts b/src/geometries/IcosahedronGeometry.ts index e96c3d6..316fafa 100644 --- a/src/geometries/IcosahedronGeometry.ts +++ b/src/geometries/IcosahedronGeometry.ts @@ -4,7 +4,7 @@ import { IcosahedronGeometry } from 'three' export const props = { radius: { type: Number, default: 1 }, detail: { type: Number, default: 0 }, -} +} as const export function createGeometry(comp: any): IcosahedronGeometry { return new IcosahedronGeometry(comp.radius, comp.detail) diff --git a/src/geometries/LatheGeometry.ts b/src/geometries/LatheGeometry.ts index 281d807..44f99f8 100644 --- a/src/geometries/LatheGeometry.ts +++ b/src/geometries/LatheGeometry.ts @@ -6,7 +6,7 @@ export const props = { segments: { type: Number, default: 12 }, phiStart: { type: Number, default: 0 }, phiLength: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): LatheGeometry { return new LatheGeometry(comp.points, comp.segments, comp.phiStart, comp.phiLength) diff --git a/src/geometries/OctahedronGeometry.ts b/src/geometries/OctahedronGeometry.ts index 430620b..d0f1293 100644 --- a/src/geometries/OctahedronGeometry.ts +++ b/src/geometries/OctahedronGeometry.ts @@ -4,7 +4,7 @@ import { OctahedronGeometry } from 'three' export const props = { radius: { type: Number, default: 1 }, detail: { type: Number, default: 0 }, -} +} as const export function createGeometry(comp: any): OctahedronGeometry { return new OctahedronGeometry(comp.radius, comp.detail) diff --git a/src/geometries/PlaneGeometry.ts b/src/geometries/PlaneGeometry.ts index f3b8fbb..e631d06 100644 --- a/src/geometries/PlaneGeometry.ts +++ b/src/geometries/PlaneGeometry.ts @@ -6,7 +6,7 @@ export const props = { height: { type: Number, default: 1 }, widthSegments: { type: Number, default: 1 }, heightSegments: { type: Number, default: 1 }, -} +} as const export function createGeometry(comp: any): PlaneGeometry { return new PlaneGeometry(comp.width, comp.height, comp.widthSegments, comp.heightSegments) diff --git a/src/geometries/PolyhedronGeometry.ts b/src/geometries/PolyhedronGeometry.ts index 4a7e10a..9edf715 100644 --- a/src/geometries/PolyhedronGeometry.ts +++ b/src/geometries/PolyhedronGeometry.ts @@ -6,7 +6,7 @@ export const props = { indices: Array, radius: { type: Number, default: 1 }, detail: { type: Number, default: 0 }, -} +} as const export function createGeometry(comp: any): PolyhedronGeometry { return new PolyhedronGeometry(comp.vertices, comp.indices, comp.radius, comp.detail) diff --git a/src/geometries/RingGeometry.ts b/src/geometries/RingGeometry.ts index ee30e97..88ad2be 100644 --- a/src/geometries/RingGeometry.ts +++ b/src/geometries/RingGeometry.ts @@ -8,7 +8,7 @@ export const props = { phiSegments: { type: Number, default: 1 }, thetaStart: { type: Number, default: 0 }, thetaLength: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): RingGeometry { return new RingGeometry(comp.innerRadius, comp.outerRadius, comp.thetaSegments, comp.phiSegments, comp.thetaStart, comp.thetaLength) diff --git a/src/geometries/SphereGeometry.ts b/src/geometries/SphereGeometry.ts index 2a1c316..d7ebe58 100644 --- a/src/geometries/SphereGeometry.ts +++ b/src/geometries/SphereGeometry.ts @@ -5,7 +5,7 @@ export const props = { radius: { type: Number, default: 1 }, widthSegments: { type: Number, default: 12 }, heightSegments: { type: Number, default: 12 }, -} +} as const export function createGeometry(comp: any): SphereGeometry { return new SphereGeometry(comp.radius, comp.widthSegments, comp.heightSegments) diff --git a/src/geometries/TetrahedronGeometry.ts b/src/geometries/TetrahedronGeometry.ts index 757e3cc..561015a 100644 --- a/src/geometries/TetrahedronGeometry.ts +++ b/src/geometries/TetrahedronGeometry.ts @@ -4,7 +4,7 @@ import { TetrahedronGeometry } from 'three' export const props = { radius: { type: Number, default: 1 }, detail: { type: Number, default: 0 }, -} +} as const export function createGeometry(comp: any): TetrahedronGeometry { return new TetrahedronGeometry(comp.radius, comp.detail) diff --git a/src/geometries/TorusGeometry.ts b/src/geometries/TorusGeometry.ts index 99de1e4..734d9d8 100644 --- a/src/geometries/TorusGeometry.ts +++ b/src/geometries/TorusGeometry.ts @@ -7,7 +7,7 @@ export const props = { radialSegments: { type: Number, default: 8 }, tubularSegments: { type: Number, default: 6 }, arc: { type: Number, default: Math.PI * 2 }, -} +} as const export function createGeometry(comp: any): TorusGeometry { return new TorusGeometry(comp.radius, comp.tube, comp.radialSegments, comp.tubularSegments, comp.arc) diff --git a/src/geometries/TorusKnotGeometry.ts b/src/geometries/TorusKnotGeometry.ts index 7ac6958..f8d48da 100644 --- a/src/geometries/TorusKnotGeometry.ts +++ b/src/geometries/TorusKnotGeometry.ts @@ -8,7 +8,7 @@ export const props = { radialSegments: { type: Number, default: 8 }, p: { type: Number, default: 2 }, q: { type: Number, default: 3 }, -} +} as const export function createGeometry(comp: any): TorusKnotGeometry { return new TorusKnotGeometry(comp.radius, comp.tube, comp.tubularSegments, comp.radialSegments, comp.p, comp.q) diff --git a/src/geometries/TubeGeometry.ts b/src/geometries/TubeGeometry.ts index 237d5f6..d70eb62 100644 --- a/src/geometries/TubeGeometry.ts +++ b/src/geometries/TubeGeometry.ts @@ -9,7 +9,7 @@ export const props = { radius: { type: Number, default: 1 }, radialSegments: { type: Number, default: 8 }, closed: { type: Boolean, default: false }, -} +} as const export function createGeometry(comp: any): TubeGeometry { let curve