Skip to content

Commit

Permalink
Brings more consistency and fix a typo etc for mesh types #297
Browse files Browse the repository at this point in the history
  • Loading branch information
hirako2000 committed Jul 29, 2017
1 parent b4e47aa commit e3c75e4
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 51 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
15 changes: 10 additions & 5 deletions types/components/meshes/Cylinder.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 {
CylinderGeometry,
CylinderBufferGeometry,
Expand Down Expand Up @@ -50,23 +54,24 @@ interface CylinderParams extends MeshComponentParams {
* The thetha length
* Default is Math.PI * 2.
*/
thetaLength: number;
thetaLength?: number;
};

/**
* Whether to create buffered geometry or not.
* Default is false
* Default is false.
*/
buffer?: boolean;
}

export class Cylinder extends MeshComponent {

/**
* @constructor Creates a Cylinder
* @description Creates a Cylinder.
* @constructor
* @param params
*/
constructor(params?: SphereParams);
constructor(params?: CylinderParams);

/**
* Build lifecycle creates a mesh using input params.
Expand Down
6 changes: 4 additions & 2 deletions types/components/meshes/Dodecahedron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from '../../core/MeshComponent';

import {
BufferGeometry,
DodecahedronGeometry,
Geometry,
Mesh
Expand All @@ -15,7 +16,7 @@ import {
* @interface DodecahedronBufferGeometry
* @extends {Geometry}
*/
interface DodecahedronBufferGeometry extends Geometry {
interface DodecahedronBufferGeometry extends BufferGeometry {
constructor(radius: number, detail: number): DodecahedronBufferGeometry;

parameters: {
Expand Down Expand Up @@ -50,7 +51,8 @@ interface DodecahedronParams extends MeshComponentParams {
export class Dodecahedron extends MeshComponent {

/**
* @constructor Creates a Dodecahedron
* @description Creates a Dodecahedron.
* @constructor
* @param params
*/
constructor(params?: DodecahedronParams);
Expand Down
9 changes: 7 additions & 2 deletions types/components/meshes/Extrude.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 {
BufferGeometry,
CurvePath,
Expand Down Expand Up @@ -86,7 +90,8 @@ interface ExtrudeParamsOptions {
export class Extrude extends MeshComponent {

/**
* @constructor Creates an extruded geometry from a path shape.
* @description Creates an extruded geometry from a path shape.
* @constructor
* @param params parameters
*/
constructor(params?: ExtrudeParams);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Group.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {Object3D} from 'three';
export class Group extends MeshComponent {

/**
* @constructor Creates a Group of meshes
* @description Creates a Group of meshes
* @constructor
* @param objects spread Meshes
*/
constructor(...objects: Array<MeshComponent>);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Icosahedron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ interface IcosahedronParams extends MeshComponentParams {
export class Icosahedron extends MeshComponent {

/**
* @constructor Creates an Icosahedron
* @description Creates an Icosahedron.
* @constructor
* @param params
*/
constructor(params?: IcosahedronParams);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Importer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ interface ImporterParams extends MeshComponentParams {
export class Importer extends MeshComponent {

/**
* @constructor Creates an Importer
* @description Creates an importer of meshes and any other data to your scene.
* @constructor
* @param params parameters
*/
constructor(params?: ImporterParams);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Lathe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ interface LatheParams extends MeshComponentParams {
export class Lathe extends MeshComponent {

/**
* @constructor Creates a Lath
* @description Creates a Lath
* @constructor
* @param params parameters
*/
constructor(params?: LatheParams);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Line.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ interface LineParams extends MeshComponentParams {
export class Line extends MeshComponent {

/**
* @constructor Creates a Line
* @description Creates a Line
* @constructor
* @param params parameters
*/
constructor(params?: LineParams);
Expand Down
12 changes: 9 additions & 3 deletions types/components/meshes/Octahedron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import {
MeshComponentParams
} from '../../core/MeshComponent';

import {PolyhedronBufferGeometry} from './Polyhedron';

import {
Mesh,
OctahedronBufferGeometry,
OctahedronGeometry
OctahedronGeometry,
} from 'three';

export class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
constructor(radius: number, detail: number);
}

interface OctahedronParams extends MeshComponentParams {

/** Geometry parameters */
Expand Down Expand Up @@ -37,7 +42,8 @@ interface OctahedronParams extends MeshComponentParams {
export class Octahedron extends MeshComponent {

/**
* @constructor Creates an Octahedron
* @description Creates an Octahedron
* @constructor
* @param params parameters
*/
constructor(params?: OctahedronParams);
Expand Down
16 changes: 14 additions & 2 deletions types/components/meshes/Parametric.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ import {
} from '../../core/MeshComponent';

import {
BufferGeometry,
Mesh,
ParametricBufferGeometry,
ParametricGeometry,
Vector3
} from 'three';

interface ParametricBufferGeometry extends BufferGeometry {
constructor(func: (u: number, v: number) => Vector3, slices: number, stacks: number): ParametricBufferGeometry;

parameters: {
func: (u: number, v: number) => Vector3;
slices: number;
stacks: number;
};
}

interface ParametricParams extends MeshComponentParams {

/** Geometry parameters */
Expand Down Expand Up @@ -42,7 +53,8 @@ interface ParametricParams extends MeshComponentParams {
export class Parametric extends MeshComponent {

/**
* @constructor Creates a Parametric
* @description Creates a Parametric surface.
* @constructor
* @param params parameters
*/
constructor(params?: ParametricParams);
Expand Down
3 changes: 2 additions & 1 deletion types/components/meshes/Plane.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ interface PlaneParams extends MeshComponentParams {
export class Plane extends MeshComponent {

/**
* @constructor Creates a Plane
* @description Creates a Plane.
* @constructor
* @param params parameters
*/
constructor(params?: PlaneParams);
Expand Down
15 changes: 13 additions & 2 deletions types/components/meshes/Polyhedron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ import {
} from '../../core/MeshComponent';

import {
BufferGeometry,
Mesh,
PolyhedronBufferGeometry,
PolyhedronGeometry
PolyhedronGeometry,
} from 'three';

export class PolyhedronBufferGeometry extends BufferGeometry {
constructor(vertices: number[], indices: number[], radius?: number, detail?: number): PolyhedronBufferGeometry;

parameters: {
vertices: number[];
indices: number[];
radius: number;
detail: number;
};
}

interface PolyhedronParams extends MeshComponentParams {

/** Geometry parameters */
Expand Down
4 changes: 2 additions & 2 deletions types/components/meshes/Shape.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
} from 'three';

interface ShapeBufferGeometry extends BufferGeometry {
constructor(shape: ShapeNative, options?: any);
constructor(shapes: ShapeNative[], options?: any);
constructor(shape: ShapeNative, options?: any): ShapeBufferGeometry;
constructor(shapes: ShapeNative[], options?: any): ShapeBufferGeometry;
}

interface ShapeParams extends MeshComponentParams {
Expand Down
9 changes: 7 additions & 2 deletions types/components/meshes/Sphere.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 {
SphereGeometry,
SphereBufferGeometry,
Expand Down Expand Up @@ -45,7 +49,8 @@ interface SphereParams extends MeshComponentParams {
export class Sphere extends MeshComponent {

/**
* @constructor Creates a Sphere
* @description Creates a Sphere.
* @constructor
* @param params
*/
constructor(params?: SphereParams);
Expand Down
9 changes: 7 additions & 2 deletions types/components/meshes/Tetrahedron.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
} from 'three';
Expand All @@ -25,7 +29,8 @@ interface TetrahedronParams extends MeshComponentParams {

export class Tetrahedron extends MeshComponent {
/**
* @constructor Creates Tetrahedron
* @description Creates a Tetrahedron
* @constructor
* @param params
*/
constructor(params?: TetrahedronParams);
Expand Down
Loading

0 comments on commit e3c75e4

Please sign in to comment.