-
-
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 Icosahedron, fixes Dodecahedron as certain types are m…
…issing from three.js - #297
- Loading branch information
1 parent
8e52826
commit fa06af3
Showing
4 changed files
with
90 additions
and
3 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
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,62 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
IcosahedronGeometry, | ||
Mesh, | ||
PolyhedronGeometry | ||
} from 'three'; | ||
|
||
interface IcosahedronBufferGeometry extends PolyhedronGeometry { | ||
constructor(radius: number, detail: number): IcosahedronBufferGeometry; | ||
} | ||
|
||
interface IcosahedronParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry?: { | ||
|
||
/** | ||
* Radius | ||
* Default is 1. | ||
*/ | ||
radius?: number; | ||
|
||
/** | ||
* Detail level. | ||
* Setting this to a value greater than 0 adds more vertices making it no longer an icosahedron. | ||
* When detail is greater than 1, it's effectively a sphere. | ||
* Default is 0. | ||
*/ | ||
detail?: number; | ||
}; | ||
|
||
/** | ||
* Whether to create buffered geometry or not. | ||
* Default is false. | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
export class Icosahedron extends MeshComponent { | ||
|
||
/** | ||
* @constructor Creates an Icosahedron | ||
* @param params | ||
*/ | ||
constructor(params?: IcosahedronParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: IcosahedronParams): Mesh; | ||
|
||
/** | ||
* Build the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: IcosahedronParams): IcosahedronGeometry | IcosahedronBufferGeometry; | ||
} |
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