Skip to content

Commit

Permalink
Adds types for Cylinder and Dodecahedron, simplifies Sphere params - #…
Browse files Browse the repository at this point in the history
  • Loading branch information
hirako2000 committed Jul 21, 2017
1 parent d9a7c74 commit 4306293
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 8 deletions.
82 changes: 82 additions & 0 deletions types/components/meshes/Cylinder.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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 {

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

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: CylinderParams): Mesh;

/**
* Build the geometry
* @param params
*/
buildGeometry(params?: CylinderParams): CylinderGeometry | CylinderBufferGeometry;
}
54 changes: 54 additions & 0 deletions types/components/meshes/Dodecahedron.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
MeshComponent,
MeshComponentParams
} from '../../core/MeshComponent';

import {
DodecahedronGeometry,
DodecahedronBufferGeometry,
Mesh
} from 'three';

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 {

/**
* @constructor Creates a Dodecahedron
* @param params
*/
constructor(params?: SphereParams);

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: DodecahedronParams): Mesh;

/**
* Build the geometry
* @param params
*/
buildGeometry(params?: DodecahedronParams): DodecahedronGeometry | DodecahedronBufferGeometry;
}
16 changes: 8 additions & 8 deletions types/components/meshes/Sphere.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ interface SphereParams extends MeshComponentParams {
phiLength?: number;
thetaStart?: number;
thetaLength?: number;
}
}

interface BufferedSphereParams extends SphereParams {
};

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

export class Sphere extends MeshComponent {

Expand All @@ -60,5 +60,5 @@ interface BufferedSphereParams extends SphereParams {
* Build the geometry
* @param params
*/
buildGeometry(params?: BufferedSphereParams): SphereGeometry | SphereBufferGeometry;
buildGeometry(params?: SphereParams): SphereGeometry | SphereBufferGeometry;
}

0 comments on commit 4306293

Please sign in to comment.