1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/geometries/CylinderGeometry.ts

20 lines
802 B
TypeScript
Raw Normal View History

2021-04-16 10:13:00 +08:00
import { geometryComponent } from './Geometry.js'
import { CylinderGeometry } from 'three'
2020-09-28 21:36:22 +08:00
2021-03-16 03:01:08 +08:00
export const props = {
radiusTop: { type: Number, default: 1 },
radiusBottom: { type: Number, default: 1 },
height: { type: Number, default: 1 },
radialSegments: { type: Number, default: 8 },
heightSegments: { type: Number, default: 1 },
openEnded: { type: Boolean, default: false },
thetaStart: { type: Number, default: 0 },
thetaLength: { type: Number, default: Math.PI * 2 },
2021-04-16 10:13:00 +08:00
}
2021-03-16 03:01:08 +08:00
2021-04-16 10:13:00 +08:00
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)
}
2021-03-16 03:01:08 +08:00
2021-04-16 10:13:00 +08:00
export default geometryComponent('CylinderGeometry', props, createGeometry)