Skip to content

Commit

Permalink
Merge pull request #311 from WhitestormJS/#297
Browse files Browse the repository at this point in the history
PR for #297
  • Loading branch information
sasha240100 committed Jul 31, 2017
2 parents 5e4d092 + e717ad5 commit ddd0753
Show file tree
Hide file tree
Showing 25 changed files with 1,289 additions and 57 deletions.
50 changes: 35 additions & 15 deletions types/components/meshes/Box.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
MeshComponent,
MeshComponentParams
} from '../../core/MeshComponent';

import {
BoxGeometry,
BoxBufferGeometry,
Expand All @@ -9,36 +13,52 @@ interface BoxParams extends MeshComponentParams {

/** Geometry parameters */
geometry?: {
/** Width of the sides on the X axis. Default is 1. */
/**
* Width of the sides on the X axis.
* Default is 1.
*/
width?: number;

/** Height of the sides on the Y axis. Default is 1. */
/**
* Height of the sides on the Y axis.
* Default is 1.
*/
height?: number;

/** Depth of the sides on the Z axis. Default is 1. */
/**
* Depth of the sides on the Z axis.
* Default is 1.
*/
depth?: number;

/** Number of segmented faces along the width of the sides. Default is 1. */
/**
* Number of segmented faces along the width of the sides.
* Default is 1.
*/
widthSegments?: number;

/** Number of segmented faces along the height of the sides. Default is 1. */
/**
* Number of segmented faces along the height of the sides.
* Default is 1.
*/
heightSegments?: number;

/** Number of segmented faces along the depth of the sides. Default is 1. */
/**
* Number of segmented faces along the depth of the sides.
* Default is 1.
*/
depthSegments?: number;
}
}

interface BufferedBoxParams extends BoxParams {
};

/** Sets whether to build a buffered geometry */
buffer?: boolean
}
buffer?: boolean;
}

export class Box extends MeshComponent {

/**
* @constructor Creates a Box
* @description Creates a Box
* @constructor
* @param params parameters
*/
constructor(params?: BoxParams);
Expand All @@ -53,5 +73,5 @@ interface BufferedBoxParams extends BoxParams {
* Builds the geometry
* @param params
*/
buildGeometry(params?: BufferedBoxParams): BoxGeometry | BoxBufferGeometry;
buildGeometry(params?: BoxParams): BoxGeometry | BoxBufferGeometry;
}
8 changes: 6 additions & 2 deletions types/components/meshes/Cone.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
MeshComponent,
MeshComponentParams
} from '../../core/MeshComponent';

import {
Mesh,
ConeBufferGeometry,
Expand Down Expand Up @@ -62,7 +66,7 @@ interface BufferedConeParams extends ConeParams {
export class Cone extends MeshComponent {

/**
* Creates a Cone
* @description Creates a Cone.
* @param params
*/
constructor(params?: ConeParams);
Expand Down
87 changes: 87 additions & 0 deletions types/components/meshes/Cylinder.d.ts
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;
}
71 changes: 71 additions & 0 deletions types/components/meshes/Dodecahedron.d.ts
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;
}
110 changes: 110 additions & 0 deletions types/components/meshes/Extrude.d.ts
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;
}
22 changes: 22 additions & 0 deletions types/components/meshes/Group.d.ts
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;

}
Loading

0 comments on commit ddd0753

Please sign in to comment.