|
@@ -319,6 +319,7 @@ declare module BABYLON {
|
|
|
setTextureFromPostProcess(channel: number, postProcess: PostProcess): void;
|
|
|
unbindAllTextures(): void;
|
|
|
setTexture(channel: number, texture: BaseTexture): void;
|
|
|
+ setTextureArray(channel: number, textures: BaseTexture[]): void;
|
|
|
_setAnisotropicLevel(key: number, texture: BaseTexture): void;
|
|
|
readPixels(x: number, y: number, width: number, height: number): Uint8Array;
|
|
|
/**
|
|
@@ -2431,247 +2432,6 @@ 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;
|
|
|
- _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: number[] | Int32Array, 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: Int32Array;
|
|
|
- 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 {
|
|
|
/**
|
|
|
* Stores 2D Bounding Information.
|
|
|
* This class handles a circle area and a bounding rectangle one.
|
|
@@ -5247,140 +5007,381 @@ declare module BABYLON {
|
|
|
private _invertY;
|
|
|
private _alignToPixel;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-declare module BABYLON {
|
|
|
- class Text2DRenderCache extends ModelRenderCache {
|
|
|
- effectsReady: boolean;
|
|
|
- vb: WebGLBuffer;
|
|
|
- ib: WebGLBuffer;
|
|
|
- instancingAttributes: InstancingAttributeInfo[];
|
|
|
- fontTexture: FontTexture;
|
|
|
- effect: Effect;
|
|
|
- effectInstanced: Effect;
|
|
|
- render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
|
|
|
- dispose(): boolean;
|
|
|
+}
|
|
|
+
|
|
|
+declare module BABYLON {
|
|
|
+ class Text2DRenderCache extends ModelRenderCache {
|
|
|
+ effectsReady: boolean;
|
|
|
+ vb: WebGLBuffer;
|
|
|
+ ib: WebGLBuffer;
|
|
|
+ instancingAttributes: InstancingAttributeInfo[];
|
|
|
+ fontTexture: FontTexture;
|
|
|
+ effect: Effect;
|
|
|
+ effectInstanced: Effect;
|
|
|
+ render(instanceInfo: GroupInstanceInfo, context: Render2DContext): boolean;
|
|
|
+ dispose(): boolean;
|
|
|
+ }
|
|
|
+ class Text2DInstanceData extends InstanceDataBase {
|
|
|
+ constructor(partId: number, dataElementCount: number);
|
|
|
+ topLeftUV: Vector2;
|
|
|
+ sizeUV: Vector2;
|
|
|
+ textureSize: Vector2;
|
|
|
+ color: Color4;
|
|
|
+ superSampleFactor: number;
|
|
|
+ }
|
|
|
+ class Text2D extends RenderablePrim2D {
|
|
|
+ static TEXT2D_MAINPARTID: number;
|
|
|
+ static fontProperty: Prim2DPropInfo;
|
|
|
+ static defaultFontColorProperty: Prim2DPropInfo;
|
|
|
+ static textProperty: Prim2DPropInfo;
|
|
|
+ static sizeProperty: Prim2DPropInfo;
|
|
|
+ fontName: string;
|
|
|
+ defaultFontColor: Color4;
|
|
|
+ text: string;
|
|
|
+ size: Size;
|
|
|
+ /**
|
|
|
+ * Get the actual size of the Text2D primitive
|
|
|
+ */
|
|
|
+ actualSize: Size;
|
|
|
+ /**
|
|
|
+ * Get the area that bounds the text associated to the primitive
|
|
|
+ */
|
|
|
+ textSize: Size;
|
|
|
+ protected fontTexture: FontTexture;
|
|
|
+ /**
|
|
|
+ * Dispose the primitive, remove it from its parent
|
|
|
+ */
|
|
|
+ dispose(): boolean;
|
|
|
+ protected updateLevelBoundingInfo(): void;
|
|
|
+ /**
|
|
|
+ * Create a Text primitive
|
|
|
+ * @param text the text to display
|
|
|
+ * @param settings a combination of settings, possible ones are
|
|
|
+ * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
|
|
|
+ * - children: an array of direct children
|
|
|
+ * - id a text identifier, for information purpose
|
|
|
+ * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
|
|
|
+ * - rotation: the initial rotation (in radian) of the primitive. default is 0
|
|
|
+ * - scale: the initial scale of the primitive. default is 1
|
|
|
+ * - origin: define the normalized origin point location, default [0.5;0.5]
|
|
|
+ * - fontName: the name/size/style of the font to use, following the CSS notation. Default is "12pt Arial".
|
|
|
+ * - fontSuperSample: if true the text will be rendered with a superSampled font (the font is twice the given size). Use this settings if the text lies in world space or if it's scaled in.
|
|
|
+ * - defaultColor: the color by default to apply on each letter of the text to display, default is plain white.
|
|
|
+ * - areaSize: the size of the area in which to display the text, default is auto-fit from text content.
|
|
|
+ * - tabulationSize: number of space character to insert when a tabulation is encountered, default is 4
|
|
|
+ * - isVisible: true if the text must be visible, false for hidden. Default is true.
|
|
|
+ * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
|
|
|
+ * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
|
|
|
+ * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
|
|
|
+ * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
|
|
|
+ * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
+ * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
|
|
|
+ */
|
|
|
+ constructor(text: string, settings?: {
|
|
|
+ parent?: Prim2DBase;
|
|
|
+ children?: Array<Prim2DBase>;
|
|
|
+ id?: string;
|
|
|
+ position?: Vector2;
|
|
|
+ x?: number;
|
|
|
+ y?: number;
|
|
|
+ rotation?: number;
|
|
|
+ scale?: number;
|
|
|
+ origin?: Vector2;
|
|
|
+ fontName?: string;
|
|
|
+ fontSuperSample?: boolean;
|
|
|
+ defaultFontColor?: Color4;
|
|
|
+ size?: Size;
|
|
|
+ tabulationSize?: number;
|
|
|
+ isVisible?: boolean;
|
|
|
+ marginTop?: number | string;
|
|
|
+ marginLeft?: number | string;
|
|
|
+ marginRight?: number | string;
|
|
|
+ marginBottom?: number | string;
|
|
|
+ margin?: number | string;
|
|
|
+ marginHAlignment?: number;
|
|
|
+ marginVAlignment?: number;
|
|
|
+ marginAlignment?: string;
|
|
|
+ paddingTop?: number | string;
|
|
|
+ paddingLeft?: number | string;
|
|
|
+ paddingRight?: number | string;
|
|
|
+ paddingBottom?: number | string;
|
|
|
+ padding?: string;
|
|
|
+ });
|
|
|
+ protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
|
|
|
+ protected createModelRenderCache(modelKey: string): ModelRenderCache;
|
|
|
+ protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Text2DRenderCache;
|
|
|
+ protected createInstanceDataParts(): InstanceDataBase[];
|
|
|
+ protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
|
|
|
+ protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
|
|
|
+ protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
|
|
|
+ private _updateCharCount();
|
|
|
+ private _fontTexture;
|
|
|
+ private _tabulationSize;
|
|
|
+ private _charCount;
|
|
|
+ private _fontName;
|
|
|
+ private _fontSuperSample;
|
|
|
+ private _defaultFontColor;
|
|
|
+ private _text;
|
|
|
+ private _textSize;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+declare module BABYLON {
|
|
|
+ /**
|
|
|
+ * This is the class that is used to display a World Space Canvas into a 3D scene
|
|
|
+ */
|
|
|
+ class WorldSpaceCanvas2DNode extends Mesh {
|
|
|
+ constructor(name: string, scene: Scene, canvas: Canvas2D);
|
|
|
+ dispose(): void;
|
|
|
+ private _canvas;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+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;
|
|
|
+ _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: number[] | Int32Array, 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: Int32Array;
|
|
|
+ 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);
|
|
|
}
|
|
|
- class Text2DInstanceData extends InstanceDataBase {
|
|
|
- constructor(partId: number, dataElementCount: number);
|
|
|
- topLeftUV: Vector2;
|
|
|
- sizeUV: Vector2;
|
|
|
- textureSize: Vector2;
|
|
|
- color: Color4;
|
|
|
- superSampleFactor: number;
|
|
|
+ interface ICollisionDetector {
|
|
|
+ onInit(payload: InitPayload): void;
|
|
|
+ onUpdate(payload: UpdatePayload): void;
|
|
|
+ onCollision(payload: CollidePayload): void;
|
|
|
}
|
|
|
- class Text2D extends RenderablePrim2D {
|
|
|
- static TEXT2D_MAINPARTID: number;
|
|
|
- static fontProperty: Prim2DPropInfo;
|
|
|
- static defaultFontColorProperty: Prim2DPropInfo;
|
|
|
- static textProperty: Prim2DPropInfo;
|
|
|
- static sizeProperty: Prim2DPropInfo;
|
|
|
- fontName: string;
|
|
|
- defaultFontColor: Color4;
|
|
|
- text: string;
|
|
|
- size: Size;
|
|
|
- /**
|
|
|
- * Get the actual size of the Text2D primitive
|
|
|
- */
|
|
|
- actualSize: Size;
|
|
|
- /**
|
|
|
- * Get the area that bounds the text associated to the primitive
|
|
|
- */
|
|
|
- textSize: Size;
|
|
|
- protected fontTexture: FontTexture;
|
|
|
- /**
|
|
|
- * Dispose the primitive, remove it from its parent
|
|
|
- */
|
|
|
- dispose(): boolean;
|
|
|
- protected updateLevelBoundingInfo(): void;
|
|
|
- /**
|
|
|
- * Create a Text primitive
|
|
|
- * @param text the text to display
|
|
|
- * @param settings a combination of settings, possible ones are
|
|
|
- * - parent: the parent primitive/canvas, must be specified if the primitive is not constructed as a child of another one (i.e. as part of the children array setting)
|
|
|
- * - children: an array of direct children
|
|
|
- * - id a text identifier, for information purpose
|
|
|
- * - position: the X & Y positions relative to its parent. Alternatively the x and y properties can be set. Default is [0;0]
|
|
|
- * - rotation: the initial rotation (in radian) of the primitive. default is 0
|
|
|
- * - scale: the initial scale of the primitive. default is 1
|
|
|
- * - origin: define the normalized origin point location, default [0.5;0.5]
|
|
|
- * - fontName: the name/size/style of the font to use, following the CSS notation. Default is "12pt Arial".
|
|
|
- * - fontSuperSample: if true the text will be rendered with a superSampled font (the font is twice the given size). Use this settings if the text lies in world space or if it's scaled in.
|
|
|
- * - defaultColor: the color by default to apply on each letter of the text to display, default is plain white.
|
|
|
- * - areaSize: the size of the area in which to display the text, default is auto-fit from text content.
|
|
|
- * - tabulationSize: number of space character to insert when a tabulation is encountered, default is 4
|
|
|
- * - isVisible: true if the text must be visible, false for hidden. Default is true.
|
|
|
- * - marginTop: top margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - marginLeft: left margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - marginRight: right margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - marginBottom: bottom margin, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - margin: top, left, right and bottom margin formatted as a single string (see PrimitiveThickness.fromString)
|
|
|
- * - marginHAlignment: one value of the PrimitiveAlignment type's static properties
|
|
|
- * - marginVAlignment: one value of the PrimitiveAlignment type's static properties
|
|
|
- * - marginAlignment: a string defining the alignment, see PrimitiveAlignment.fromString
|
|
|
- * - paddingTop: top padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - paddingLeft: left padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - paddingRight: right padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - paddingBottom: bottom padding, can be a number (will be pixels) or a string (see PrimitiveThickness.fromString)
|
|
|
- * - padding: top, left, right and bottom padding formatted as a single string (see PrimitiveThickness.fromString)
|
|
|
- */
|
|
|
- constructor(text: string, settings?: {
|
|
|
- parent?: Prim2DBase;
|
|
|
- children?: Array<Prim2DBase>;
|
|
|
- id?: string;
|
|
|
- position?: Vector2;
|
|
|
- x?: number;
|
|
|
- y?: number;
|
|
|
- rotation?: number;
|
|
|
- scale?: number;
|
|
|
- origin?: Vector2;
|
|
|
- fontName?: string;
|
|
|
- fontSuperSample?: boolean;
|
|
|
- defaultFontColor?: Color4;
|
|
|
- size?: Size;
|
|
|
- tabulationSize?: number;
|
|
|
- isVisible?: boolean;
|
|
|
- marginTop?: number | string;
|
|
|
- marginLeft?: number | string;
|
|
|
- marginRight?: number | string;
|
|
|
- marginBottom?: number | string;
|
|
|
- margin?: number | string;
|
|
|
- marginHAlignment?: number;
|
|
|
- marginVAlignment?: number;
|
|
|
- marginAlignment?: string;
|
|
|
- paddingTop?: number | string;
|
|
|
- paddingLeft?: number | string;
|
|
|
- paddingRight?: number | string;
|
|
|
- paddingBottom?: number | string;
|
|
|
- padding?: string;
|
|
|
- });
|
|
|
- protected levelIntersect(intersectInfo: IntersectInfo2D): boolean;
|
|
|
- protected createModelRenderCache(modelKey: string): ModelRenderCache;
|
|
|
- protected setupModelRenderCache(modelRenderCache: ModelRenderCache): Text2DRenderCache;
|
|
|
- protected createInstanceDataParts(): InstanceDataBase[];
|
|
|
- protected beforeRefreshForLayoutConstruction(part: InstanceDataBase): any;
|
|
|
- protected afterRefreshForLayoutConstruction(part: InstanceDataBase, obj: any): void;
|
|
|
- protected refreshInstanceDataPart(part: InstanceDataBase): boolean;
|
|
|
- private _updateCharCount();
|
|
|
- private _fontTexture;
|
|
|
- private _tabulationSize;
|
|
|
- private _charCount;
|
|
|
- private _fontName;
|
|
|
- private _fontSuperSample;
|
|
|
- private _defaultFontColor;
|
|
|
- private _text;
|
|
|
- private _textSize;
|
|
|
+ class CollisionDetectorTransferable implements ICollisionDetector {
|
|
|
+ private _collisionCache;
|
|
|
+ onInit(payload: InitPayload): void;
|
|
|
+ onUpdate(payload: UpdatePayload): void;
|
|
|
+ onCollision(payload: CollidePayload): void;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
declare module BABYLON {
|
|
|
- /**
|
|
|
- * This is the class that is used to display a World Space Canvas into a 3D scene
|
|
|
- */
|
|
|
- class WorldSpaceCanvas2DNode extends Mesh {
|
|
|
- constructor(name: string, scene: Scene, canvas: Canvas2D);
|
|
|
- dispose(): void;
|
|
|
- private _canvas;
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -6124,6 +6125,7 @@ declare module BABYLON {
|
|
|
isSupported: boolean;
|
|
|
_bindTexture(channel: string, texture: WebGLTexture): void;
|
|
|
setTexture(channel: string, texture: BaseTexture): void;
|
|
|
+ setTextureArray(channel: string, textures: BaseTexture[]): void;
|
|
|
setTextureFromPostProcess(channel: string, postProcess: PostProcess): void;
|
|
|
_cacheMatrix(uniformName: string, matrix: Matrix): boolean;
|
|
|
_cacheFloat2(uniformName: string, x: number, y: number): boolean;
|
|
@@ -6576,6 +6578,7 @@ declare module BABYLON {
|
|
|
private _shaderPath;
|
|
|
private _options;
|
|
|
private _textures;
|
|
|
+ private _textureArrays;
|
|
|
private _floats;
|
|
|
private _floatsArrays;
|
|
|
private _colors3;
|
|
@@ -6593,6 +6596,7 @@ declare module BABYLON {
|
|
|
needAlphaTesting(): boolean;
|
|
|
private _checkUniform(uniformName);
|
|
|
setTexture(name: string, texture: Texture): ShaderMaterial;
|
|
|
+ setTextureArray(name: string, textures: Texture[]): ShaderMaterial;
|
|
|
setFloat(name: string, value: number): ShaderMaterial;
|
|
|
setFloats(name: string, value: number[]): ShaderMaterial;
|
|
|
setColor3(name: string, value: Color3): ShaderMaterial;
|
|
@@ -11286,46 +11290,6 @@ declare module BABYLON {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-declare module BABYLON.Internals {
|
|
|
- class _AlphaState {
|
|
|
- private _isAlphaBlendDirty;
|
|
|
- private _isBlendFunctionParametersDirty;
|
|
|
- private _alphaBlend;
|
|
|
- private _blendFunctionParameters;
|
|
|
- isDirty: boolean;
|
|
|
- alphaBlend: boolean;
|
|
|
- setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
|
|
|
- reset(): void;
|
|
|
- apply(gl: WebGLRenderingContext): void;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-declare module BABYLON.Internals {
|
|
|
- class _DepthCullingState {
|
|
|
- private _isDepthTestDirty;
|
|
|
- private _isDepthMaskDirty;
|
|
|
- private _isDepthFuncDirty;
|
|
|
- private _isCullFaceDirty;
|
|
|
- private _isCullDirty;
|
|
|
- private _isZOffsetDirty;
|
|
|
- private _depthTest;
|
|
|
- private _depthMask;
|
|
|
- private _depthFunc;
|
|
|
- private _cull;
|
|
|
- private _cullFace;
|
|
|
- private _zOffset;
|
|
|
- isDirty: boolean;
|
|
|
- zOffset: number;
|
|
|
- cullFace: number;
|
|
|
- cull: boolean;
|
|
|
- depthFunc: number;
|
|
|
- depthMask: boolean;
|
|
|
- depthTest: boolean;
|
|
|
- reset(): void;
|
|
|
- apply(gl: WebGLRenderingContext): void;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
declare module BABYLON {
|
|
|
class Sprite {
|
|
|
name: string;
|
|
@@ -11395,6 +11359,46 @@ declare module BABYLON {
|
|
|
}
|
|
|
|
|
|
declare module BABYLON.Internals {
|
|
|
+ class _AlphaState {
|
|
|
+ private _isAlphaBlendDirty;
|
|
|
+ private _isBlendFunctionParametersDirty;
|
|
|
+ private _alphaBlend;
|
|
|
+ private _blendFunctionParameters;
|
|
|
+ isDirty: boolean;
|
|
|
+ alphaBlend: boolean;
|
|
|
+ setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void;
|
|
|
+ reset(): void;
|
|
|
+ apply(gl: WebGLRenderingContext): void;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+declare module BABYLON.Internals {
|
|
|
+ class _DepthCullingState {
|
|
|
+ private _isDepthTestDirty;
|
|
|
+ private _isDepthMaskDirty;
|
|
|
+ private _isDepthFuncDirty;
|
|
|
+ private _isCullFaceDirty;
|
|
|
+ private _isCullDirty;
|
|
|
+ private _isZOffsetDirty;
|
|
|
+ private _depthTest;
|
|
|
+ private _depthMask;
|
|
|
+ private _depthFunc;
|
|
|
+ private _cull;
|
|
|
+ private _cullFace;
|
|
|
+ private _zOffset;
|
|
|
+ isDirty: boolean;
|
|
|
+ zOffset: number;
|
|
|
+ cullFace: number;
|
|
|
+ cull: boolean;
|
|
|
+ depthFunc: number;
|
|
|
+ depthMask: boolean;
|
|
|
+ depthTest: boolean;
|
|
|
+ reset(): void;
|
|
|
+ apply(gl: WebGLRenderingContext): void;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+declare module BABYLON.Internals {
|
|
|
class AndOrNotEvaluator {
|
|
|
static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean;
|
|
|
private static _HandleParenthesisContent(parenthesisContent, evaluateCallback);
|