Skip to content

Commit

Permalink
Extrude and Shape geometries #112
Browse files Browse the repository at this point in the history
  • Loading branch information
klevron committed Feb 3, 2022
1 parent 5ad5e87 commit 74c2f50
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/geometries/ExtrudeGeometry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PropType } from 'vue'
import { geometryComponent } from './Geometry'
import { ExtrudeGeometry, ExtrudeGeometryOptions, Shape } from 'three'

export const props = {
shapes: { type: [Object, Array] as PropType<Shape | Shape[]> },
options: { type: Object as PropType<ExtrudeGeometryOptions> },
} as const

export function createGeometry(comp: any): ExtrudeGeometry {
return new ExtrudeGeometry(comp.shapes, comp.options)
}

export default geometryComponent('ExtrudeGeometry', props, createGeometry)
14 changes: 14 additions & 0 deletions src/geometries/ShapeGeometry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PropType } from 'vue'
import { geometryComponent } from './Geometry'
import { Shape, ShapeGeometry } from 'three'

export const props = {
shapes: { type: [Object, Array] as PropType<Shape | Shape[]> },
curveSegments: { type: Number },
} as const

export function createGeometry(comp: any): ShapeGeometry {
return new ShapeGeometry(comp.shapes, comp.curveSegments)
}

export default geometryComponent('ShapeGeometry', props, createGeometry)
2 changes: 2 additions & 0 deletions src/geometries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ export { default as CircleGeometry } from './CircleGeometry'
export { default as ConeGeometry } from './ConeGeometry'
export { default as CylinderGeometry } from './CylinderGeometry'
export { default as DodecahedronGeometry } from './DodecahedronGeometry'
export { default as ExtrudeGeometry } from './ExtrudeGeometry'
export { default as IcosahedronGeometry } from './IcosahedronGeometry'
export { default as LatheGeometry } from './LatheGeometry'
export { default as OctahedronGeometry } from './OctahedronGeometry'
export { default as PlaneGeometry } from './PlaneGeometry'
export { default as PolyhedronGeometry } from './PolyhedronGeometry'
export { default as RingGeometry } from './RingGeometry'
export { default as SphereGeometry } from './SphereGeometry'
export { default as ShapeGeometry } from './ShapeGeometry'
export { default as TetrahedronGeometry } from './TetrahedronGeometry'
export { default as TorusGeometry } from './TorusGeometry'
export { default as TorusKnotGeometry } from './TorusKnotGeometry'
Expand Down

0 comments on commit 74c2f50

Please sign in to comment.