|
@@ -1,6 +1,8 @@
|
|
import { VertexData } from "../mesh.vertexData";
|
|
import { VertexData } from "../mesh.vertexData";
|
|
import { Vector2, Vector3, Matrix } from "../../Maths/math.vector";
|
|
import { Vector2, Vector3, Matrix } from "../../Maths/math.vector";
|
|
import { Mesh, _CreationDataStorage } from "../mesh";
|
|
import { Mesh, _CreationDataStorage } from "../mesh";
|
|
|
|
+import { Nullable } from "../../types";
|
|
|
|
+import { Scene } from "../../scene";
|
|
/**
|
|
/**
|
|
* Scripts based off of https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js
|
|
* Scripts based off of https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js
|
|
* @param options the constructors options used to shape the mesh.
|
|
* @param options the constructors options used to shape the mesh.
|
|
@@ -246,6 +248,9 @@ export interface ICreateCapsuleOptions{
|
|
|
|
|
|
/** Overwrite for the bottom capSubdivisions. */
|
|
/** Overwrite for the bottom capSubdivisions. */
|
|
bottomCapSubdivisions?: number;
|
|
bottomCapSubdivisions?: number;
|
|
|
|
+
|
|
|
|
+ /** Internal geometry is supposed to change once created. */
|
|
|
|
+ updatable?: boolean;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -271,18 +276,22 @@ export class CapsuleBuilder {
|
|
* @param scene The scene the mesh is scoped to.
|
|
* @param scene The scene the mesh is scoped to.
|
|
* @returns Capsule Mesh
|
|
* @returns Capsule Mesh
|
|
*/
|
|
*/
|
|
- public static CreateCapsule(name: string, options: ICreateCapsuleOptions = {
|
|
|
|
|
|
+ public static CreateCapsule(
|
|
|
|
+ name: string,
|
|
|
|
+ options: ICreateCapsuleOptions = {
|
|
orientation : Vector3.Up(),
|
|
orientation : Vector3.Up(),
|
|
subdivisions: 2,
|
|
subdivisions: 2,
|
|
tessellation: 16,
|
|
tessellation: 16,
|
|
height: 1,
|
|
height: 1,
|
|
radius: 0.25,
|
|
radius: 0.25,
|
|
- capSubdivisions: 6
|
|
|
|
- }, scene: any): Mesh {
|
|
|
|
-
|
|
|
|
|
|
+ capSubdivisions: 6,
|
|
|
|
+ updatable: false,
|
|
|
|
+ },
|
|
|
|
+ scene: Nullable<Scene> = null
|
|
|
|
+ ): Mesh {
|
|
var capsule = new Mesh(name, scene);
|
|
var capsule = new Mesh(name, scene);
|
|
var vertexData = VertexData.CreateCapsule(options);
|
|
var vertexData = VertexData.CreateCapsule(options);
|
|
- vertexData.applyToMesh(capsule);
|
|
|
|
|
|
+ vertexData.applyToMesh(capsule, options.updatable);
|
|
return capsule;
|
|
return capsule;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|