diff --git a/types/components/meshes/Lathe.d.ts b/types/components/meshes/Lathe.d.ts new file mode 100644 index 000000000..ac11431de --- /dev/null +++ b/types/components/meshes/Lathe.d.ts @@ -0,0 +1,47 @@ +import { + MeshComponent, + MeshComponentParams +} from '../../core/MeshComponent'; + +import { + LatheBufferGeometry, + LatheGeometry, + Mesh, + Vector2 +} from 'three'; + +interface LatheParams extends MeshComponentParams { + + /** Geometry parameters */ + geometry?: { + + /** + * Array of Vector2s. The x-coordinate of each point must be greater than zero. + */ + points: Array; + } + + /** Sets whether to build a buffered geometry */ + buffer?: boolean; +} + + export class Lathe extends MeshComponent { + + /** + * @constructor Creates a Lath + * @param params parameters + */ + constructor(params?: LatheParams); + + /** + * Build lifecycle creates a mesh using input params. + * @param params + */ + build(params?: LatheParams): Mesh; + + /** + * Builds the geometry + * @param params + */ + buildGeometry(params?: LatheParams): LatheGeometry | LatheBufferGeometry; +} diff --git a/types/components/meshes/index.d.ts b/types/components/meshes/index.d.ts index 34f3ebb4d..5e5d3dc58 100644 --- a/types/components/meshes/index.d.ts +++ b/types/components/meshes/index.d.ts @@ -6,6 +6,7 @@ export {Dodecahedron} from './Dodecahedron'; export * from './Extrude'; export {Icosahedron} from './Icosahedron'; export * from './Importer'; +export * from './Lathe'; export * from './Sphere'; export * from './Text'; export * from './Tetrahedron'; diff --git a/types/whs-tests.ts b/types/whs-tests.ts index f1a1144d5..5b68f5856 100644 --- a/types/whs-tests.ts +++ b/types/whs-tests.ts @@ -3,7 +3,7 @@ import { Material, Mesh, MeshStandardMaterial, - GLTF2Loader, + JSONLoader, Shape, Vector2 } from 'three'; @@ -25,6 +25,7 @@ import { Group, Icosahedron, Importer, + Lathe, OrthographicCamera, PerspectiveCamera, Sphere @@ -164,9 +165,9 @@ const icosahedron = new Icosahedron({ icosahedron.addTo(app); new Importer({ - loader: new GLTF2Loader(), + loader: new JSONLoader(), - url: 'some/path/model.gltf', + url: 'some/path/model.json', onLoad: () => { console.log('on load'); @@ -187,6 +188,13 @@ new Importer({ useCustomMaterial: false }).addTo(app); +const lathe = new Lathe({ + geometry: { + points: [new Vector2(1, 1)] + } +}); +lathe.addTo(app); + // Cameras const cubeCamera = new CubeCamera({