-
-
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 Shape and a few adjustments to Polyhedron and Ring #297
- Loading branch information
1 parent
42ae787
commit b4e47aa
Showing
5 changed files
with
83 additions
and
17 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
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,63 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
BufferGeometry, | ||
Mesh, | ||
Shape as ShapeNative, | ||
ShapeGeometry | ||
} from 'three'; | ||
|
||
interface ShapeBufferGeometry extends BufferGeometry { | ||
constructor(shape: ShapeNative, options?: any); | ||
constructor(shapes: ShapeNative[], options?: any); | ||
} | ||
|
||
interface ShapeParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry: { | ||
|
||
/** | ||
* Array of shapes or a single shape. | ||
*/ | ||
shapes: ShapeNative | Array<ShapeNative>; | ||
|
||
/** | ||
* Integer Number of segments per shape. | ||
* Default is 12. | ||
* FIXME, changing this will have no effect, it will always be 12. | ||
*/ | ||
curveSegments?: number; | ||
}; | ||
|
||
/** | ||
* Sets whether to build a buffered geometry | ||
* Default is false. | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
export class Shape extends MeshComponent { | ||
|
||
/** | ||
* @description Creates an one-sided polygonal geometry from one or more path shapes. | ||
* @constructor | ||
* @param params parameters | ||
*/ | ||
constructor(params: ShapeParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: ShapeParams): Mesh; | ||
|
||
/** | ||
* Builds the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: ShapeParams): ShapeGeometry | ShapeBufferGeometry; | ||
} |
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