-
-
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.
- Loading branch information
1 parent
eaacfe2
commit e6f6fcf
Showing
3 changed files
with
97 additions
and
0 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,71 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
Mesh, | ||
PolyhedronBufferGeometry, | ||
PolyhedronGeometry | ||
} from 'three'; | ||
|
||
interface PolyhedronParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry?: { | ||
|
||
/** | ||
* Array of points of the form [1,1,1, -1,-1,-1, ... ] | ||
*/ | ||
verticesOfCube?: Array<number>; | ||
|
||
/** | ||
* Array of indices that make up the faces of the form [0,1,2, 2,3,0, ... ] | ||
*/ | ||
indicesOfFaces?: Array<number>; | ||
|
||
/** | ||
* The radius of the final shape | ||
* Default is 6. | ||
*/ | ||
radius?: number; | ||
|
||
/** | ||
* How many levels to subdivide the geometry. | ||
* The more detail, the smoother the shape. | ||
* Default is 2. | ||
*/ | ||
detail?: number; | ||
}; | ||
|
||
/** | ||
* Sets whether to build a buffered geometry | ||
* Default is false. | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
/** | ||
* A polyhedron is a solid in three dimensions with flat faces. | ||
* This component will take an array of vertices, project them onto a sphere, and then divide them up to the desired level of detail. | ||
*/ | ||
export class Polyhedron extends MeshComponent { | ||
|
||
/** | ||
* @constructor Creates a Polyhedron | ||
* @param params parameters | ||
*/ | ||
constructor(params?: PolyhedronParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: PolyhedronParams): Mesh; | ||
|
||
/** | ||
* Builds the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: PolyhedronParams): PolyhedronGeometry | PolyhedronBufferGeometry; | ||
} |
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
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