1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

defineComponent for geometries (#10)

This commit is contained in:
Kevin Levron 2021-04-03 22:06:41 +02:00
parent e02d28dfd9
commit f6ecd087fb
17 changed files with 51 additions and 36 deletions

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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 []; },
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);
},
},
};
});

View File

@ -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);