-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR for #297 #311
Merged
Merged
PR for #297 #311
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4306293
Adds types for Cylinder and Dodecahedron, simplifies Sphere params - …
hirako2000 e659b55
Adds types for Extrude, adds missing export for other meshes #297
hirako2000 8e52826
Adds types for Group, adds missing extrude file #297
hirako2000 fa06af3
Adds types for Icosahedron, fixes Dodecahedron as certain types are m…
hirako2000 b282c43
Adds types for Importer - #297
hirako2000 4f49f11
Adds types for Lathe - #297
hirako2000 a20fee9
Adds types for Line - #297
hirako2000 15195b6
Adds types for Octahedron - #297
hirako2000 72b8251
Adds types for Parametric - #297
hirako2000 eaacfe2
Adds types for Plane - #297
hirako2000 e6f6fcf
Adds types for Polyhedron - #297
hirako2000 42ae787
Adds types for Ring - #297
hirako2000 b4e47aa
Adds types for Shape and a few adjustments to Polyhedron and Ring #297
hirako2000 e3c75e4
Brings more consistency and fix a typo etc for mesh types #297
hirako2000 d02dab1
Fixed code style
sasha240100 e717ad5
Merge branch 'dev' into #297
sasha240100 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,87 @@ | ||
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 { | ||
|
||
/** | ||
* @description Creates a Cylinder. | ||
* @constructor | ||
* @param params | ||
*/ | ||
constructor(params?: CylinderParams); | ||
|
||
/** | ||
* 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,71 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
BufferGeometry, | ||
DodecahedronGeometry, | ||
Geometry, | ||
Mesh | ||
} from 'three'; | ||
|
||
/** | ||
* this is missing in @types from three.js :( | ||
* | ||
* @interface DodecahedronBufferGeometry | ||
* @extends {Geometry} | ||
*/ | ||
interface DodecahedronBufferGeometry extends BufferGeometry { | ||
constructor(radius: number, detail: number): DodecahedronBufferGeometry; | ||
|
||
parameters: { | ||
radius: number; | ||
detail: number; | ||
}; | ||
} | ||
|
||
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 { | ||
|
||
/** | ||
* @description Creates a Dodecahedron. | ||
* @constructor | ||
* @param params | ||
*/ | ||
constructor(params?: DodecahedronParams); | ||
|
||
/** | ||
* 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import { | ||
BufferGeometry, | ||
CurvePath, | ||
ExtrudeGeometry, | ||
Mesh, | ||
Shape, | ||
Vector | ||
} from 'three'; | ||
|
||
interface ExtrudeParams extends MeshComponentParams { | ||
|
||
/** Geometry parameters */ | ||
geometry: { | ||
shapes: Shape | Array<Shape>, | ||
options?: { | ||
/** | ||
* Number of points on the curves. | ||
* Default is 12. | ||
*/ | ||
curveSegments?: number; | ||
|
||
/** | ||
* Number of points used for subdividing segments along the depth of the extruded spline. | ||
* Default is 1. | ||
*/ | ||
steps?: number; | ||
|
||
/** | ||
* Depth to extrude the shape. Default is 100. | ||
*/ | ||
amount?: number; | ||
|
||
/** | ||
* Apply beveling to the shape. | ||
* Default is true. | ||
*/ | ||
bevelEnabled?: boolean; | ||
|
||
/** | ||
* How deep into the original shape the bevel goes. | ||
* Default is 6. | ||
*/ | ||
bevelThickness?: number; | ||
|
||
/** | ||
* Distance from the shape outline that the bevel extends. | ||
* Default is bevelThickness minus 2. | ||
*/ | ||
bevelSize?: number; | ||
|
||
/** | ||
* Number of bevel layers. | ||
* Default is 3. | ||
*/ | ||
bevelSegments?: number; | ||
|
||
/** | ||
* A 3D spline path along which the shape should be extruded (creates Frames if frames aren't defined). | ||
*/ | ||
extrudePath?: CurvePath<Vector>; | ||
|
||
/** | ||
* An object containing arrays of tangents, normals, binormals for each step along the extrudePath. | ||
*/ | ||
frames?: Object; | ||
|
||
/** | ||
* An object that provides UV generator functions | ||
*/ | ||
UVGenerator?: Object; | ||
} | ||
}; | ||
|
||
/** | ||
* Whether to create buffered geometry or not. | ||
* Default is false. | ||
*/ | ||
buffer?: boolean; | ||
} | ||
|
||
interface ExtrudeParamsOptions { | ||
|
||
} | ||
|
||
export class Extrude extends MeshComponent { | ||
|
||
/** | ||
* @description Creates an extruded geometry from a path shape. | ||
* @constructor | ||
* @param params parameters | ||
*/ | ||
constructor(params?: ExtrudeParams); | ||
|
||
/** | ||
* Build lifecycle creates a mesh using input params. | ||
* @param params | ||
*/ | ||
build(params?: ExtrudeParams): Mesh; | ||
|
||
/** | ||
* Builds the geometry | ||
* @param params | ||
*/ | ||
buildGeometry(params?: ExtrudeParams): ExtrudeGeometry | BufferGeometry; | ||
} |
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,22 @@ | ||
import { | ||
MeshComponent, | ||
MeshComponentParams | ||
} from '../../core/MeshComponent'; | ||
|
||
import {Object3D} from 'three'; | ||
|
||
export class Group extends MeshComponent { | ||
|
||
/** | ||
* @description Creates a Group of meshes | ||
* @constructor | ||
* @param objects spread Meshes | ||
*/ | ||
constructor(...objects: Array<MeshComponent>); | ||
|
||
/** | ||
* Returns a new Object3D | ||
*/ | ||
build(): Object3D; | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we add such things to separate file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best would be to fix
@types/three
imo.Unless there is a reason they don't provide interfaces for certain buffer geometries...