1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 20:32:02 +08:00
trois/src/geometries/RingGeometry.js

27 lines
764 B
JavaScript
Raw Normal View History

2021-04-04 04:06:41 +08:00
import { defineComponent } from 'vue';
2021-03-07 06:14:22 +08:00
import { RingGeometry } from 'three';
2020-09-28 21:36:22 +08:00
import Geometry from './Geometry.js';
2021-03-16 03:39:24 +08:00
export const props = {
innerRadius: { type: Number, default: 0.5 },
outerRadius: { type: Number, default: 1 },
thetaSegments: { type: Number, default: 8 },
phiSegments: { type: Number, default: 1 },
thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 },
};
export function createGeometry(comp) {
return new RingGeometry(comp.innerRadius, comp.outerRadius, comp.thetaSegments, comp.phiSegments, comp.thetaStart, comp.thetaLength);
};
2021-04-04 04:06:41 +08:00
export default defineComponent({
2020-09-28 21:36:22 +08:00
extends: Geometry,
2021-03-16 03:39:24 +08:00
props,
2020-10-03 17:00:37 +08:00
methods: {
createGeometry() {
2021-03-16 03:39:24 +08:00
this.geometry = createGeometry(this);
2020-10-03 17:00:37 +08:00
},
2020-09-28 21:36:22 +08:00
},
2021-04-04 04:06:41 +08:00
});