|
@@ -3185,6 +3185,249 @@ declare module BABYLON {
|
|
}
|
|
}
|
|
|
|
|
|
declare module BABYLON {
|
|
declare module BABYLON {
|
|
|
|
+ class Collider {
|
|
|
|
+ radius: Vector3;
|
|
|
|
+ retry: number;
|
|
|
|
+ velocity: Vector3;
|
|
|
|
+ basePoint: Vector3;
|
|
|
|
+ epsilon: number;
|
|
|
|
+ collisionFound: boolean;
|
|
|
|
+ velocityWorldLength: number;
|
|
|
|
+ basePointWorld: Vector3;
|
|
|
|
+ velocityWorld: Vector3;
|
|
|
|
+ normalizedVelocity: Vector3;
|
|
|
|
+ initialVelocity: Vector3;
|
|
|
|
+ initialPosition: Vector3;
|
|
|
|
+ nearestDistance: number;
|
|
|
|
+ intersectionPoint: Vector3;
|
|
|
|
+ collidedMesh: AbstractMesh;
|
|
|
|
+ private _collisionPoint;
|
|
|
|
+ private _planeIntersectionPoint;
|
|
|
|
+ private _tempVector;
|
|
|
|
+ private _tempVector2;
|
|
|
|
+ private _tempVector3;
|
|
|
|
+ private _tempVector4;
|
|
|
|
+ private _edge;
|
|
|
|
+ private _baseToVertex;
|
|
|
|
+ private _destinationPoint;
|
|
|
|
+ private _slidePlaneNormal;
|
|
|
|
+ private _displacementVector;
|
|
|
|
+ private _collisionMask;
|
|
|
|
+ collisionMask: number;
|
|
|
|
+ _initialize(source: Vector3, dir: Vector3, e: number): void;
|
|
|
|
+ _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
|
|
|
|
+ _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
|
|
|
|
+ _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
|
|
|
|
+ _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: IndicesArray, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
|
|
|
|
+ _getResponse(pos: Vector3, vel: Vector3): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ var CollisionWorker: string;
|
|
|
|
+ interface ICollisionCoordinator {
|
|
|
|
+ getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
+ init(scene: Scene): void;
|
|
|
|
+ destroy(): void;
|
|
|
|
+ onMeshAdded(mesh: AbstractMesh): any;
|
|
|
|
+ onMeshUpdated(mesh: AbstractMesh): any;
|
|
|
|
+ onMeshRemoved(mesh: AbstractMesh): any;
|
|
|
|
+ onGeometryAdded(geometry: Geometry): any;
|
|
|
|
+ onGeometryUpdated(geometry: Geometry): any;
|
|
|
|
+ onGeometryDeleted(geometry: Geometry): any;
|
|
|
|
+ }
|
|
|
|
+ interface SerializedMesh {
|
|
|
|
+ id: string;
|
|
|
|
+ name: string;
|
|
|
|
+ uniqueId: number;
|
|
|
|
+ geometryId: string;
|
|
|
|
+ sphereCenter: Array<number>;
|
|
|
|
+ sphereRadius: number;
|
|
|
|
+ boxMinimum: Array<number>;
|
|
|
|
+ boxMaximum: Array<number>;
|
|
|
|
+ worldMatrixFromCache: any;
|
|
|
|
+ subMeshes: Array<SerializedSubMesh>;
|
|
|
|
+ checkCollisions: boolean;
|
|
|
|
+ }
|
|
|
|
+ interface SerializedSubMesh {
|
|
|
|
+ position: number;
|
|
|
|
+ verticesStart: number;
|
|
|
|
+ verticesCount: number;
|
|
|
|
+ indexStart: number;
|
|
|
|
+ indexCount: number;
|
|
|
|
+ hasMaterial: boolean;
|
|
|
|
+ sphereCenter: Array<number>;
|
|
|
|
+ sphereRadius: number;
|
|
|
|
+ boxMinimum: Array<number>;
|
|
|
|
+ boxMaximum: Array<number>;
|
|
|
|
+ }
|
|
|
|
+ interface SerializedGeometry {
|
|
|
|
+ id: string;
|
|
|
|
+ positions: Float32Array;
|
|
|
|
+ indices: Uint32Array;
|
|
|
|
+ normals: Float32Array;
|
|
|
|
+ }
|
|
|
|
+ interface BabylonMessage {
|
|
|
|
+ taskType: WorkerTaskType;
|
|
|
|
+ payload: InitPayload | CollidePayload | UpdatePayload;
|
|
|
|
+ }
|
|
|
|
+ interface SerializedColliderToWorker {
|
|
|
|
+ position: Array<number>;
|
|
|
|
+ velocity: Array<number>;
|
|
|
|
+ radius: Array<number>;
|
|
|
|
+ }
|
|
|
|
+ enum WorkerTaskType {
|
|
|
|
+ INIT = 0,
|
|
|
|
+ UPDATE = 1,
|
|
|
|
+ COLLIDE = 2,
|
|
|
|
+ }
|
|
|
|
+ interface WorkerReply {
|
|
|
|
+ error: WorkerReplyType;
|
|
|
|
+ taskType: WorkerTaskType;
|
|
|
|
+ payload?: any;
|
|
|
|
+ }
|
|
|
|
+ interface CollisionReplyPayload {
|
|
|
|
+ newPosition: Array<number>;
|
|
|
|
+ collisionId: number;
|
|
|
|
+ collidedMeshUniqueId: number;
|
|
|
|
+ }
|
|
|
|
+ interface InitPayload {
|
|
|
|
+ }
|
|
|
|
+ interface CollidePayload {
|
|
|
|
+ collisionId: number;
|
|
|
|
+ collider: SerializedColliderToWorker;
|
|
|
|
+ maximumRetry: number;
|
|
|
|
+ excludedMeshUniqueId?: number;
|
|
|
|
+ }
|
|
|
|
+ interface UpdatePayload {
|
|
|
|
+ updatedMeshes: {
|
|
|
|
+ [n: number]: SerializedMesh;
|
|
|
|
+ };
|
|
|
|
+ updatedGeometries: {
|
|
|
|
+ [s: string]: SerializedGeometry;
|
|
|
|
+ };
|
|
|
|
+ removedMeshes: Array<number>;
|
|
|
|
+ removedGeometries: Array<string>;
|
|
|
|
+ }
|
|
|
|
+ enum WorkerReplyType {
|
|
|
|
+ SUCCESS = 0,
|
|
|
|
+ UNKNOWN_ERROR = 1,
|
|
|
|
+ }
|
|
|
|
+ class CollisionCoordinatorWorker implements ICollisionCoordinator {
|
|
|
|
+ private _scene;
|
|
|
|
+ private _scaledPosition;
|
|
|
|
+ private _scaledVelocity;
|
|
|
|
+ private _collisionsCallbackArray;
|
|
|
|
+ private _init;
|
|
|
|
+ private _runningUpdated;
|
|
|
|
+ private _runningCollisionTask;
|
|
|
|
+ private _worker;
|
|
|
|
+ private _addUpdateMeshesList;
|
|
|
|
+ private _addUpdateGeometriesList;
|
|
|
|
+ private _toRemoveMeshesArray;
|
|
|
|
+ private _toRemoveGeometryArray;
|
|
|
|
+ constructor();
|
|
|
|
+ static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
|
|
|
|
+ static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
|
|
|
|
+ getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
+ init(scene: Scene): void;
|
|
|
|
+ destroy(): void;
|
|
|
|
+ onMeshAdded(mesh: AbstractMesh): void;
|
|
|
|
+ onMeshUpdated: (mesh: AbstractMesh) => void;
|
|
|
|
+ onMeshRemoved(mesh: AbstractMesh): void;
|
|
|
|
+ onGeometryAdded(geometry: Geometry): void;
|
|
|
|
+ onGeometryUpdated: (geometry: Geometry) => void;
|
|
|
|
+ onGeometryDeleted(geometry: Geometry): void;
|
|
|
|
+ private _afterRender;
|
|
|
|
+ private _onMessageFromWorker;
|
|
|
|
+ }
|
|
|
|
+ class CollisionCoordinatorLegacy implements ICollisionCoordinator {
|
|
|
|
+ private _scene;
|
|
|
|
+ private _scaledPosition;
|
|
|
|
+ private _scaledVelocity;
|
|
|
|
+ private _finalPosition;
|
|
|
|
+ getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
+ init(scene: Scene): void;
|
|
|
|
+ destroy(): void;
|
|
|
|
+ onMeshAdded(mesh: AbstractMesh): void;
|
|
|
|
+ onMeshUpdated(mesh: AbstractMesh): void;
|
|
|
|
+ onMeshRemoved(mesh: AbstractMesh): void;
|
|
|
|
+ onGeometryAdded(geometry: Geometry): void;
|
|
|
|
+ onGeometryUpdated(geometry: Geometry): void;
|
|
|
|
+ onGeometryDeleted(geometry: Geometry): void;
|
|
|
|
+ private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ var WorkerIncluded: boolean;
|
|
|
|
+ class CollisionCache {
|
|
|
|
+ private _meshes;
|
|
|
|
+ private _geometries;
|
|
|
|
+ getMeshes(): {
|
|
|
|
+ [n: number]: SerializedMesh;
|
|
|
|
+ };
|
|
|
|
+ getGeometries(): {
|
|
|
|
+ [s: number]: SerializedGeometry;
|
|
|
|
+ };
|
|
|
|
+ getMesh(id: any): SerializedMesh;
|
|
|
|
+ addMesh(mesh: SerializedMesh): void;
|
|
|
|
+ removeMesh(uniqueId: number): void;
|
|
|
|
+ getGeometry(id: string): SerializedGeometry;
|
|
|
|
+ addGeometry(geometry: SerializedGeometry): void;
|
|
|
|
+ removeGeometry(id: string): void;
|
|
|
|
+ }
|
|
|
|
+ class CollideWorker {
|
|
|
|
+ collider: Collider;
|
|
|
|
+ private _collisionCache;
|
|
|
|
+ private finalPosition;
|
|
|
|
+ private collisionsScalingMatrix;
|
|
|
|
+ private collisionTranformationMatrix;
|
|
|
|
+ constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
|
|
|
|
+ collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
|
|
|
|
+ private checkCollision(mesh);
|
|
|
|
+ private processCollisionsForSubMeshes(transformMatrix, mesh);
|
|
|
|
+ private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
|
|
|
|
+ private checkSubmeshCollision(subMesh);
|
|
|
|
+ }
|
|
|
|
+ interface ICollisionDetector {
|
|
|
|
+ onInit(payload: InitPayload): void;
|
|
|
|
+ onUpdate(payload: UpdatePayload): void;
|
|
|
|
+ onCollision(payload: CollidePayload): void;
|
|
|
|
+ }
|
|
|
|
+ class CollisionDetectorTransferable implements ICollisionDetector {
|
|
|
|
+ private _collisionCache;
|
|
|
|
+ onInit(payload: InitPayload): void;
|
|
|
|
+ onUpdate(payload: UpdatePayload): void;
|
|
|
|
+ onCollision(payload: CollidePayload): void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ class IntersectionInfo {
|
|
|
|
+ bu: number;
|
|
|
|
+ bv: number;
|
|
|
|
+ distance: number;
|
|
|
|
+ faceId: number;
|
|
|
|
+ subMeshId: number;
|
|
|
|
+ constructor(bu: number, bv: number, distance: number);
|
|
|
|
+ }
|
|
|
|
+ class PickingInfo {
|
|
|
|
+ hit: boolean;
|
|
|
|
+ distance: number;
|
|
|
|
+ pickedPoint: Vector3;
|
|
|
|
+ pickedMesh: AbstractMesh;
|
|
|
|
+ bu: number;
|
|
|
|
+ bv: number;
|
|
|
|
+ faceId: number;
|
|
|
|
+ subMeshId: number;
|
|
|
|
+ pickedSprite: Sprite;
|
|
|
|
+ getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
|
|
|
|
+ getTextureCoordinates(): Vector2;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
class ArcRotateCamera extends TargetCamera {
|
|
class ArcRotateCamera extends TargetCamera {
|
|
alpha: number;
|
|
alpha: number;
|
|
beta: number;
|
|
beta: number;
|
|
@@ -3708,296 +3951,53 @@ declare module BABYLON {
|
|
constructor(minimum: Vector3, maximum: Vector3);
|
|
constructor(minimum: Vector3, maximum: Vector3);
|
|
_update(world: Matrix): void;
|
|
_update(world: Matrix): void;
|
|
isInFrustum(frustumPlanes: Plane[]): boolean;
|
|
isInFrustum(frustumPlanes: Plane[]): boolean;
|
|
- intersectsPoint(point: Vector3): boolean;
|
|
|
|
- static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- class Ray {
|
|
|
|
- origin: Vector3;
|
|
|
|
- direction: Vector3;
|
|
|
|
- length: number;
|
|
|
|
- private _edge1;
|
|
|
|
- private _edge2;
|
|
|
|
- private _pvec;
|
|
|
|
- private _tvec;
|
|
|
|
- private _qvec;
|
|
|
|
- private _tmpRay;
|
|
|
|
- private _rayHelper;
|
|
|
|
- constructor(origin: Vector3, direction: Vector3, length?: number);
|
|
|
|
- intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
|
|
|
|
- intersectsBox(box: BoundingBox): boolean;
|
|
|
|
- intersectsSphere(sphere: BoundingSphere): boolean;
|
|
|
|
- intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
|
|
|
|
- intersectsPlane(plane: Plane): number;
|
|
|
|
- intersectsMesh(mesh: AbstractMesh, fastCheck?: boolean): PickingInfo;
|
|
|
|
- intersectsMeshes(meshes: Array<AbstractMesh>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo>;
|
|
|
|
- private _comparePickingInfo(pickingInfoA, pickingInfoB);
|
|
|
|
- private static smallnum;
|
|
|
|
- private static rayl;
|
|
|
|
- /**
|
|
|
|
- * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
|
|
|
|
- * @param sega the first point of the segment to test the intersection against
|
|
|
|
- * @param segb the second point of the segment to test the intersection against
|
|
|
|
- * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
|
|
|
|
- * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
|
|
|
|
- */
|
|
|
|
- intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
|
|
|
|
- static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
|
|
|
|
- /**
|
|
|
|
- * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
|
|
|
|
- * transformed to the given world matrix.
|
|
|
|
- * @param origin The origin point
|
|
|
|
- * @param end The end point
|
|
|
|
- * @param world a matrix to transform the ray to. Default is the identity matrix.
|
|
|
|
- */
|
|
|
|
- static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
|
|
|
|
- static Transform(ray: Ray, matrix: Matrix): Ray;
|
|
|
|
- static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- class Collider {
|
|
|
|
- radius: Vector3;
|
|
|
|
- retry: number;
|
|
|
|
- velocity: Vector3;
|
|
|
|
- basePoint: Vector3;
|
|
|
|
- epsilon: number;
|
|
|
|
- collisionFound: boolean;
|
|
|
|
- velocityWorldLength: number;
|
|
|
|
- basePointWorld: Vector3;
|
|
|
|
- velocityWorld: Vector3;
|
|
|
|
- normalizedVelocity: Vector3;
|
|
|
|
- initialVelocity: Vector3;
|
|
|
|
- initialPosition: Vector3;
|
|
|
|
- nearestDistance: number;
|
|
|
|
- intersectionPoint: Vector3;
|
|
|
|
- collidedMesh: AbstractMesh;
|
|
|
|
- private _collisionPoint;
|
|
|
|
- private _planeIntersectionPoint;
|
|
|
|
- private _tempVector;
|
|
|
|
- private _tempVector2;
|
|
|
|
- private _tempVector3;
|
|
|
|
- private _tempVector4;
|
|
|
|
- private _edge;
|
|
|
|
- private _baseToVertex;
|
|
|
|
- private _destinationPoint;
|
|
|
|
- private _slidePlaneNormal;
|
|
|
|
- private _displacementVector;
|
|
|
|
- private _collisionMask;
|
|
|
|
- collisionMask: number;
|
|
|
|
- _initialize(source: Vector3, dir: Vector3, e: number): void;
|
|
|
|
- _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
|
|
|
|
- _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
|
|
|
|
- _testTriangle(faceIndex: number, trianglePlaneArray: Array<Plane>, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void;
|
|
|
|
- _collide(trianglePlaneArray: Array<Plane>, pts: Vector3[], indices: IndicesArray, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void;
|
|
|
|
- _getResponse(pos: Vector3, vel: Vector3): void;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- var CollisionWorker: string;
|
|
|
|
- interface ICollisionCoordinator {
|
|
|
|
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
- init(scene: Scene): void;
|
|
|
|
- destroy(): void;
|
|
|
|
- onMeshAdded(mesh: AbstractMesh): any;
|
|
|
|
- onMeshUpdated(mesh: AbstractMesh): any;
|
|
|
|
- onMeshRemoved(mesh: AbstractMesh): any;
|
|
|
|
- onGeometryAdded(geometry: Geometry): any;
|
|
|
|
- onGeometryUpdated(geometry: Geometry): any;
|
|
|
|
- onGeometryDeleted(geometry: Geometry): any;
|
|
|
|
- }
|
|
|
|
- interface SerializedMesh {
|
|
|
|
- id: string;
|
|
|
|
- name: string;
|
|
|
|
- uniqueId: number;
|
|
|
|
- geometryId: string;
|
|
|
|
- sphereCenter: Array<number>;
|
|
|
|
- sphereRadius: number;
|
|
|
|
- boxMinimum: Array<number>;
|
|
|
|
- boxMaximum: Array<number>;
|
|
|
|
- worldMatrixFromCache: any;
|
|
|
|
- subMeshes: Array<SerializedSubMesh>;
|
|
|
|
- checkCollisions: boolean;
|
|
|
|
- }
|
|
|
|
- interface SerializedSubMesh {
|
|
|
|
- position: number;
|
|
|
|
- verticesStart: number;
|
|
|
|
- verticesCount: number;
|
|
|
|
- indexStart: number;
|
|
|
|
- indexCount: number;
|
|
|
|
- hasMaterial: boolean;
|
|
|
|
- sphereCenter: Array<number>;
|
|
|
|
- sphereRadius: number;
|
|
|
|
- boxMinimum: Array<number>;
|
|
|
|
- boxMaximum: Array<number>;
|
|
|
|
- }
|
|
|
|
- interface SerializedGeometry {
|
|
|
|
- id: string;
|
|
|
|
- positions: Float32Array;
|
|
|
|
- indices: Uint32Array;
|
|
|
|
- normals: Float32Array;
|
|
|
|
- }
|
|
|
|
- interface BabylonMessage {
|
|
|
|
- taskType: WorkerTaskType;
|
|
|
|
- payload: InitPayload | CollidePayload | UpdatePayload;
|
|
|
|
- }
|
|
|
|
- interface SerializedColliderToWorker {
|
|
|
|
- position: Array<number>;
|
|
|
|
- velocity: Array<number>;
|
|
|
|
- radius: Array<number>;
|
|
|
|
- }
|
|
|
|
- enum WorkerTaskType {
|
|
|
|
- INIT = 0,
|
|
|
|
- UPDATE = 1,
|
|
|
|
- COLLIDE = 2,
|
|
|
|
- }
|
|
|
|
- interface WorkerReply {
|
|
|
|
- error: WorkerReplyType;
|
|
|
|
- taskType: WorkerTaskType;
|
|
|
|
- payload?: any;
|
|
|
|
- }
|
|
|
|
- interface CollisionReplyPayload {
|
|
|
|
- newPosition: Array<number>;
|
|
|
|
- collisionId: number;
|
|
|
|
- collidedMeshUniqueId: number;
|
|
|
|
- }
|
|
|
|
- interface InitPayload {
|
|
|
|
- }
|
|
|
|
- interface CollidePayload {
|
|
|
|
- collisionId: number;
|
|
|
|
- collider: SerializedColliderToWorker;
|
|
|
|
- maximumRetry: number;
|
|
|
|
- excludedMeshUniqueId?: number;
|
|
|
|
- }
|
|
|
|
- interface UpdatePayload {
|
|
|
|
- updatedMeshes: {
|
|
|
|
- [n: number]: SerializedMesh;
|
|
|
|
- };
|
|
|
|
- updatedGeometries: {
|
|
|
|
- [s: string]: SerializedGeometry;
|
|
|
|
- };
|
|
|
|
- removedMeshes: Array<number>;
|
|
|
|
- removedGeometries: Array<string>;
|
|
|
|
- }
|
|
|
|
- enum WorkerReplyType {
|
|
|
|
- SUCCESS = 0,
|
|
|
|
- UNKNOWN_ERROR = 1,
|
|
|
|
- }
|
|
|
|
- class CollisionCoordinatorWorker implements ICollisionCoordinator {
|
|
|
|
- private _scene;
|
|
|
|
- private _scaledPosition;
|
|
|
|
- private _scaledVelocity;
|
|
|
|
- private _collisionsCallbackArray;
|
|
|
|
- private _init;
|
|
|
|
- private _runningUpdated;
|
|
|
|
- private _runningCollisionTask;
|
|
|
|
- private _worker;
|
|
|
|
- private _addUpdateMeshesList;
|
|
|
|
- private _addUpdateGeometriesList;
|
|
|
|
- private _toRemoveMeshesArray;
|
|
|
|
- private _toRemoveGeometryArray;
|
|
|
|
- constructor();
|
|
|
|
- static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh;
|
|
|
|
- static SerializeGeometry: (geometry: Geometry) => SerializedGeometry;
|
|
|
|
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
- init(scene: Scene): void;
|
|
|
|
- destroy(): void;
|
|
|
|
- onMeshAdded(mesh: AbstractMesh): void;
|
|
|
|
- onMeshUpdated: (mesh: AbstractMesh) => void;
|
|
|
|
- onMeshRemoved(mesh: AbstractMesh): void;
|
|
|
|
- onGeometryAdded(geometry: Geometry): void;
|
|
|
|
- onGeometryUpdated: (geometry: Geometry) => void;
|
|
|
|
- onGeometryDeleted(geometry: Geometry): void;
|
|
|
|
- private _afterRender;
|
|
|
|
- private _onMessageFromWorker;
|
|
|
|
- }
|
|
|
|
- class CollisionCoordinatorLegacy implements ICollisionCoordinator {
|
|
|
|
- private _scene;
|
|
|
|
- private _scaledPosition;
|
|
|
|
- private _scaledVelocity;
|
|
|
|
- private _finalPosition;
|
|
|
|
- getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
|
|
|
|
- init(scene: Scene): void;
|
|
|
|
- destroy(): void;
|
|
|
|
- onMeshAdded(mesh: AbstractMesh): void;
|
|
|
|
- onMeshUpdated(mesh: AbstractMesh): void;
|
|
|
|
- onMeshRemoved(mesh: AbstractMesh): void;
|
|
|
|
- onGeometryAdded(geometry: Geometry): void;
|
|
|
|
- onGeometryUpdated(geometry: Geometry): void;
|
|
|
|
- onGeometryDeleted(geometry: Geometry): void;
|
|
|
|
- private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- var WorkerIncluded: boolean;
|
|
|
|
- class CollisionCache {
|
|
|
|
- private _meshes;
|
|
|
|
- private _geometries;
|
|
|
|
- getMeshes(): {
|
|
|
|
- [n: number]: SerializedMesh;
|
|
|
|
- };
|
|
|
|
- getGeometries(): {
|
|
|
|
- [s: number]: SerializedGeometry;
|
|
|
|
- };
|
|
|
|
- getMesh(id: any): SerializedMesh;
|
|
|
|
- addMesh(mesh: SerializedMesh): void;
|
|
|
|
- removeMesh(uniqueId: number): void;
|
|
|
|
- getGeometry(id: string): SerializedGeometry;
|
|
|
|
- addGeometry(geometry: SerializedGeometry): void;
|
|
|
|
- removeGeometry(id: string): void;
|
|
|
|
- }
|
|
|
|
- class CollideWorker {
|
|
|
|
- collider: Collider;
|
|
|
|
- private _collisionCache;
|
|
|
|
- private finalPosition;
|
|
|
|
- private collisionsScalingMatrix;
|
|
|
|
- private collisionTranformationMatrix;
|
|
|
|
- constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3);
|
|
|
|
- collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void;
|
|
|
|
- private checkCollision(mesh);
|
|
|
|
- private processCollisionsForSubMeshes(transformMatrix, mesh);
|
|
|
|
- private collideForSubMesh(subMesh, transformMatrix, meshGeometry);
|
|
|
|
- private checkSubmeshCollision(subMesh);
|
|
|
|
- }
|
|
|
|
- interface ICollisionDetector {
|
|
|
|
- onInit(payload: InitPayload): void;
|
|
|
|
- onUpdate(payload: UpdatePayload): void;
|
|
|
|
- onCollision(payload: CollidePayload): void;
|
|
|
|
- }
|
|
|
|
- class CollisionDetectorTransferable implements ICollisionDetector {
|
|
|
|
- private _collisionCache;
|
|
|
|
- onInit(payload: InitPayload): void;
|
|
|
|
- onUpdate(payload: UpdatePayload): void;
|
|
|
|
- onCollision(payload: CollidePayload): void;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- class IntersectionInfo {
|
|
|
|
- bu: number;
|
|
|
|
- bv: number;
|
|
|
|
- distance: number;
|
|
|
|
- faceId: number;
|
|
|
|
- subMeshId: number;
|
|
|
|
- constructor(bu: number, bv: number, distance: number);
|
|
|
|
|
|
+ intersectsPoint(point: Vector3): boolean;
|
|
|
|
+ static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
|
|
}
|
|
}
|
|
- class PickingInfo {
|
|
|
|
- hit: boolean;
|
|
|
|
- distance: number;
|
|
|
|
- pickedPoint: Vector3;
|
|
|
|
- pickedMesh: AbstractMesh;
|
|
|
|
- bu: number;
|
|
|
|
- bv: number;
|
|
|
|
- faceId: number;
|
|
|
|
- subMeshId: number;
|
|
|
|
- pickedSprite: Sprite;
|
|
|
|
- getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3;
|
|
|
|
- getTextureCoordinates(): Vector2;
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ class Ray {
|
|
|
|
+ origin: Vector3;
|
|
|
|
+ direction: Vector3;
|
|
|
|
+ length: number;
|
|
|
|
+ private _edge1;
|
|
|
|
+ private _edge2;
|
|
|
|
+ private _pvec;
|
|
|
|
+ private _tvec;
|
|
|
|
+ private _qvec;
|
|
|
|
+ private _tmpRay;
|
|
|
|
+ private _rayHelper;
|
|
|
|
+ constructor(origin: Vector3, direction: Vector3, length?: number);
|
|
|
|
+ intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean;
|
|
|
|
+ intersectsBox(box: BoundingBox): boolean;
|
|
|
|
+ intersectsSphere(sphere: BoundingSphere): boolean;
|
|
|
|
+ intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo;
|
|
|
|
+ intersectsPlane(plane: Plane): number;
|
|
|
|
+ intersectsMesh(mesh: AbstractMesh, fastCheck?: boolean): PickingInfo;
|
|
|
|
+ intersectsMeshes(meshes: Array<AbstractMesh>, fastCheck?: boolean, results?: Array<PickingInfo>): Array<PickingInfo>;
|
|
|
|
+ private _comparePickingInfo(pickingInfoA, pickingInfoB);
|
|
|
|
+ private static smallnum;
|
|
|
|
+ private static rayl;
|
|
|
|
+ /**
|
|
|
|
+ * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
|
|
|
|
+ * @param sega the first point of the segment to test the intersection against
|
|
|
|
+ * @param segb the second point of the segment to test the intersection against
|
|
|
|
+ * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
|
|
|
|
+ * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
|
|
|
|
+ */
|
|
|
|
+ intersectionSegment(sega: Vector3, segb: Vector3, threshold: number): number;
|
|
|
|
+ static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray;
|
|
|
|
+ /**
|
|
|
|
+ * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
|
|
|
|
+ * transformed to the given world matrix.
|
|
|
|
+ * @param origin The origin point
|
|
|
|
+ * @param end The end point
|
|
|
|
+ * @param world a matrix to transform the ray to. Default is the identity matrix.
|
|
|
|
+ */
|
|
|
|
+ static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray;
|
|
|
|
+ static Transform(ray: Ray, matrix: Matrix): Ray;
|
|
|
|
+ static TransformToRef(ray: Ray, matrix: Matrix, result: Ray): void;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4256,6 +4256,51 @@ declare module BABYLON {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ class LensFlare {
|
|
|
|
+ size: number;
|
|
|
|
+ position: number;
|
|
|
|
+ color: Color3;
|
|
|
|
+ texture: Texture;
|
|
|
|
+ alphaMode: number;
|
|
|
|
+ private _system;
|
|
|
|
+ constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
|
|
|
|
+ dispose: () => void;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ class LensFlareSystem {
|
|
|
|
+ name: string;
|
|
|
|
+ lensFlares: LensFlare[];
|
|
|
|
+ borderLimit: number;
|
|
|
|
+ viewportBorder: number;
|
|
|
|
+ meshesSelectionPredicate: (mesh: Mesh) => boolean;
|
|
|
|
+ layerMask: number;
|
|
|
|
+ id: string;
|
|
|
|
+ private _scene;
|
|
|
|
+ private _emitter;
|
|
|
|
+ private _vertexBuffers;
|
|
|
|
+ private _indexBuffer;
|
|
|
|
+ private _effect;
|
|
|
|
+ private _positionX;
|
|
|
|
+ private _positionY;
|
|
|
|
+ private _isEnabled;
|
|
|
|
+ constructor(name: string, emitter: any, scene: Scene);
|
|
|
|
+ isEnabled: boolean;
|
|
|
|
+ getScene(): Scene;
|
|
|
|
+ getEmitter(): any;
|
|
|
|
+ setEmitter(newEmitter: any): void;
|
|
|
|
+ getEmitterPosition(): Vector3;
|
|
|
|
+ computeEffectivePosition(globalViewport: Viewport): boolean;
|
|
|
|
+ _isVisible(): boolean;
|
|
|
|
+ render(): boolean;
|
|
|
|
+ dispose(): void;
|
|
|
|
+ static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
|
|
|
|
+ serialize(): any;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
declare module BABYLON.Debug {
|
|
declare module BABYLON.Debug {
|
|
class AxesViewer {
|
|
class AxesViewer {
|
|
private _xline;
|
|
private _xline;
|
|
@@ -4362,51 +4407,6 @@ declare module BABYLON.Debug {
|
|
}
|
|
}
|
|
|
|
|
|
declare module BABYLON {
|
|
declare module BABYLON {
|
|
- class LensFlare {
|
|
|
|
- size: number;
|
|
|
|
- position: number;
|
|
|
|
- color: Color3;
|
|
|
|
- texture: Texture;
|
|
|
|
- alphaMode: number;
|
|
|
|
- private _system;
|
|
|
|
- constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem);
|
|
|
|
- dispose: () => void;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- class LensFlareSystem {
|
|
|
|
- name: string;
|
|
|
|
- lensFlares: LensFlare[];
|
|
|
|
- borderLimit: number;
|
|
|
|
- viewportBorder: number;
|
|
|
|
- meshesSelectionPredicate: (mesh: Mesh) => boolean;
|
|
|
|
- layerMask: number;
|
|
|
|
- id: string;
|
|
|
|
- private _scene;
|
|
|
|
- private _emitter;
|
|
|
|
- private _vertexBuffers;
|
|
|
|
- private _indexBuffer;
|
|
|
|
- private _effect;
|
|
|
|
- private _positionX;
|
|
|
|
- private _positionY;
|
|
|
|
- private _isEnabled;
|
|
|
|
- constructor(name: string, emitter: any, scene: Scene);
|
|
|
|
- isEnabled: boolean;
|
|
|
|
- getScene(): Scene;
|
|
|
|
- getEmitter(): any;
|
|
|
|
- setEmitter(newEmitter: any): void;
|
|
|
|
- getEmitterPosition(): Vector3;
|
|
|
|
- computeEffectivePosition(globalViewport: Viewport): boolean;
|
|
|
|
- _isVisible(): boolean;
|
|
|
|
- render(): boolean;
|
|
|
|
- dispose(): void;
|
|
|
|
- static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
|
|
|
|
- serialize(): any;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
interface ISceneLoaderPluginExtensions {
|
|
interface ISceneLoaderPluginExtensions {
|
|
[extension: string]: {
|
|
[extension: string]: {
|
|
isBinary: boolean;
|
|
isBinary: boolean;
|
|
@@ -11216,60 +11216,6 @@ declare module BABYLON {
|
|
}
|
|
}
|
|
|
|
|
|
declare module BABYLON {
|
|
declare module BABYLON {
|
|
- class MorphTarget {
|
|
|
|
- name: string;
|
|
|
|
- private _positions;
|
|
|
|
- private _normals;
|
|
|
|
- private _influence;
|
|
|
|
- onInfluenceChanged: Observable<boolean>;
|
|
|
|
- influence: number;
|
|
|
|
- constructor(name: string, influence?: number);
|
|
|
|
- readonly hasNormals: boolean;
|
|
|
|
- setPositions(data: Float32Array | number[]): void;
|
|
|
|
- getPositions(): Float32Array;
|
|
|
|
- setNormals(data: Float32Array | number[]): void;
|
|
|
|
- getNormals(): Float32Array;
|
|
|
|
- /**
|
|
|
|
- * Serializes the current target into a Serialization object.
|
|
|
|
- * Returns the serialized object.
|
|
|
|
- */
|
|
|
|
- serialize(): any;
|
|
|
|
- static Parse(serializationObject: any): MorphTarget;
|
|
|
|
- static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
- class MorphTargetManager {
|
|
|
|
- private _targets;
|
|
|
|
- private _targetObservable;
|
|
|
|
- private _activeTargets;
|
|
|
|
- private _scene;
|
|
|
|
- private _influences;
|
|
|
|
- private _supportsNormals;
|
|
|
|
- private _vertexCount;
|
|
|
|
- private _uniqueId;
|
|
|
|
- constructor(scene?: Scene);
|
|
|
|
- readonly uniqueId: number;
|
|
|
|
- readonly vertexCount: number;
|
|
|
|
- readonly supportsNormals: boolean;
|
|
|
|
- readonly numInfluencers: number;
|
|
|
|
- readonly influences: Float32Array;
|
|
|
|
- getActiveTarget(index: number): MorphTarget;
|
|
|
|
- addTarget(target: MorphTarget): void;
|
|
|
|
- removeTarget(target: MorphTarget): void;
|
|
|
|
- /**
|
|
|
|
- * Serializes the current manager into a Serialization object.
|
|
|
|
- * Returns the serialized object.
|
|
|
|
- */
|
|
|
|
- serialize(): any;
|
|
|
|
- private _onInfluenceChanged(needUpdate);
|
|
|
|
- private _syncActiveTargets(needUpdate);
|
|
|
|
- static Parse(serializationObject: any, scene: Scene): MorphTargetManager;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-declare module BABYLON {
|
|
|
|
class Particle {
|
|
class Particle {
|
|
position: Vector3;
|
|
position: Vector3;
|
|
direction: Vector3;
|
|
direction: Vector3;
|
|
@@ -11725,6 +11671,60 @@ declare module BABYLON {
|
|
}
|
|
}
|
|
|
|
|
|
declare module BABYLON {
|
|
declare module BABYLON {
|
|
|
|
+ class MorphTarget {
|
|
|
|
+ name: string;
|
|
|
|
+ private _positions;
|
|
|
|
+ private _normals;
|
|
|
|
+ private _influence;
|
|
|
|
+ onInfluenceChanged: Observable<boolean>;
|
|
|
|
+ influence: number;
|
|
|
|
+ constructor(name: string, influence?: number);
|
|
|
|
+ readonly hasNormals: boolean;
|
|
|
|
+ setPositions(data: Float32Array | number[]): void;
|
|
|
|
+ getPositions(): Float32Array;
|
|
|
|
+ setNormals(data: Float32Array | number[]): void;
|
|
|
|
+ getNormals(): Float32Array;
|
|
|
|
+ /**
|
|
|
|
+ * Serializes the current target into a Serialization object.
|
|
|
|
+ * Returns the serialized object.
|
|
|
|
+ */
|
|
|
|
+ serialize(): any;
|
|
|
|
+ static Parse(serializationObject: any): MorphTarget;
|
|
|
|
+ static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
|
|
+ class MorphTargetManager {
|
|
|
|
+ private _targets;
|
|
|
|
+ private _targetObservable;
|
|
|
|
+ private _activeTargets;
|
|
|
|
+ private _scene;
|
|
|
|
+ private _influences;
|
|
|
|
+ private _supportsNormals;
|
|
|
|
+ private _vertexCount;
|
|
|
|
+ private _uniqueId;
|
|
|
|
+ constructor(scene?: Scene);
|
|
|
|
+ readonly uniqueId: number;
|
|
|
|
+ readonly vertexCount: number;
|
|
|
|
+ readonly supportsNormals: boolean;
|
|
|
|
+ readonly numInfluencers: number;
|
|
|
|
+ readonly influences: Float32Array;
|
|
|
|
+ getActiveTarget(index: number): MorphTarget;
|
|
|
|
+ addTarget(target: MorphTarget): void;
|
|
|
|
+ removeTarget(target: MorphTarget): void;
|
|
|
|
+ /**
|
|
|
|
+ * Serializes the current manager into a Serialization object.
|
|
|
|
+ * Returns the serialized object.
|
|
|
|
+ */
|
|
|
|
+ serialize(): any;
|
|
|
|
+ private _onInfluenceChanged(needUpdate);
|
|
|
|
+ private _syncActiveTargets(needUpdate);
|
|
|
|
+ static Parse(serializationObject: any, scene: Scene): MorphTargetManager;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+declare module BABYLON {
|
|
interface PhysicsImpostorJoint {
|
|
interface PhysicsImpostorJoint {
|
|
mainImpostor: PhysicsImpostor;
|
|
mainImpostor: PhysicsImpostor;
|
|
connectedImpostor: PhysicsImpostor;
|
|
connectedImpostor: PhysicsImpostor;
|