-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds types for Cylinder and Dodecahedron, simplifies Sphere params - #…
- Loading branch information
1 parent
d9a7c74
commit 4306293
Showing
3 changed files
with
144 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent'; | ||
import { | ||
CylinderGeometry, | ||
CylinderBufferGeometry, | ||
Mesh | ||
} from 'three'; | ||
|
||
interface CylinderParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry?: { | ||
|
||
/** | ||
* Radius of the top of the cylinder. | ||
* Default is 0. | ||
*/ | ||
radiusTop?: number; | ||
|
||
/** | ||
* Radius of the bottom of the cylinder. | ||
* Default is 1. | ||
*/ | ||
radiusBottom?: number; | ||
|
||
/** | ||
* Height of cylinder. | ||
* Default is 1. | ||
*/ | ||
height?: number; | ||
|
||
/** | ||
* Number of radius segments. | ||
* Default is 32. | ||
*/ | ||
radiusSegments?: number; | ||
|
||
/** | ||
* Whether the cylinder is open ended. | ||
* Default is false. | ||
*/ | ||
openEnded?: boolean; | ||
|
||
/** | ||
* Thetha start. | ||
* Default is 0. | ||
*/ | ||
thetaStart?: number; | ||
|
||
/** | ||
* The thetha length | ||
* Default is Math.PI * 2. | ||
*/ | ||
thetaLength: number; | ||
}; | ||
|
||
/** | ||
* Whether to create buffered geometry or not. | ||
* Default is false | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
export class Cylinder extends MeshComponent { | ||
|
||
/** | ||
* @constructor Creates a Cylinder | ||
* @param params | ||
*/ | ||
constructor(params?: SphereParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: CylinderParams): Mesh; | ||
|
||
/** | ||
* Build the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: CylinderParams): CylinderGeometry | CylinderBufferGeometry; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
DodecahedronGeometry, | ||
DodecahedronBufferGeometry, | ||
Mesh | ||
} from 'three'; | ||
|
||
interface DodecahedronParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry?: { | ||
|
||
/** | ||
* Radius/ | ||
*/ | ||
radius?: number; | ||
|
||
/** | ||
* Detail level. | ||
*/ | ||
detail?: number; | ||
}; | ||
|
||
/** | ||
* Whether to create buffered geometry or not. | ||
* Default is false. | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
export class Dodecahedron extends MeshComponent { | ||
|
||
/** | ||
* @constructor Creates a Dodecahedron | ||
* @param params | ||
*/ | ||
constructor(params?: SphereParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: DodecahedronParams): Mesh; | ||
|
||
/** | ||
* Build the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: DodecahedronParams): DodecahedronGeometry | DodecahedronBufferGeometry; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters