UNPKG

declarations

Version:

[![npm version](https://badge.fury.io/js/declarations.svg)](https://www.npmjs.com/package/declarations)

1,198 lines (1,189 loc) 301 kB
// Type definitions for BabylonJS v2.3 // Project: http://www.babylonjs.com/ // Definitions by: David Catuhe <https://github.com/deltakosh/> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace BABYLON { 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; } 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; } class EngineCapabilities { maxTexturesImageUnits: number; maxTextureSize: number; maxCubemapTextureSize: number; maxRenderTextureSize: number; standardDerivatives: boolean; s3tc: any; textureFloat: boolean; textureAnisotropicFilterExtension: any; maxAnisotropy: number; instancedArrays: any; uintIndices: boolean; highPrecisionShaderSupported: boolean; fragmentDepthSupported: boolean; drawBuffersExtension: any; } /** * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. */ class Engine { private static _ALPHA_DISABLE; private static _ALPHA_ADD; private static _ALPHA_COMBINE; private static _ALPHA_SUBTRACT; private static _ALPHA_MULTIPLY; private static _ALPHA_MAXIMIZED; private static _ALPHA_ONEONE; private static _DELAYLOADSTATE_NONE; private static _DELAYLOADSTATE_LOADED; private static _DELAYLOADSTATE_LOADING; private static _DELAYLOADSTATE_NOTLOADED; private static _TEXTUREFORMAT_ALPHA; private static _TEXTUREFORMAT_LUMINANCE; private static _TEXTUREFORMAT_LUMINANCE_ALPHA; private static _TEXTUREFORMAT_RGB; private static _TEXTUREFORMAT_RGBA; private static _TEXTURETYPE_UNSIGNED_INT; private static _TEXTURETYPE_FLOAT; static ALPHA_DISABLE: number; static ALPHA_ONEONE: number; static ALPHA_ADD: number; static ALPHA_COMBINE: number; static ALPHA_SUBTRACT: number; static ALPHA_MULTIPLY: number; static ALPHA_MAXIMIZED: number; static DELAYLOADSTATE_NONE: number; static DELAYLOADSTATE_LOADED: number; static DELAYLOADSTATE_LOADING: number; static DELAYLOADSTATE_NOTLOADED: number; static TEXTUREFORMAT_ALPHA: number; static TEXTUREFORMAT_LUMINANCE: number; static TEXTUREFORMAT_LUMINANCE_ALPHA: number; static TEXTUREFORMAT_RGB: number; static TEXTUREFORMAT_RGBA: number; static TEXTURETYPE_UNSIGNED_INT: number; static TEXTURETYPE_FLOAT: number; static Version: string; static Epsilon: number; static CollisionsEpsilon: number; static CodeRepository: string; static ShadersRepository: string; isFullscreen: boolean; isPointerLock: boolean; cullBackFaces: boolean; renderEvenInBackground: boolean; enableOfflineSupport: boolean; scenes: Scene[]; _gl: WebGLRenderingContext; private _renderingCanvas; private _windowIsBackground; private _webGLVersion; static audioEngine: AudioEngine; private _onBlur; private _onFocus; private _onFullscreenChange; private _onPointerLockChange; private _hardwareScalingLevel; private _caps; private _pointerLockRequested; private _alphaTest; private _loadingScreen; private _drawCalls; private _glVersion; private _glRenderer; private _glVendor; private _videoTextureSupported; private _renderingQueueLaunched; private _activeRenderLoops; private fpsRange; private previousFramesDuration; private fps; private deltaTime; private _depthCullingState; private _alphaState; private _alphaMode; private _loadedTexturesCache; private _maxTextureChannels; private _activeTexturesCache; private _currentEffect; private _compiledEffects; private _vertexAttribArrays; private _cachedViewport; private _cachedVertexBuffers; private _cachedIndexBuffer; private _cachedEffectForVertexBuffers; private _currentRenderTarget; private _uintIndicesCurrentlySet; private _workingCanvas; private _workingContext; private _bindedRenderFunction; /** * @constructor * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering * @param {boolean} [antialias] - enable antialias * @param options - further options to be sent to the getContext function */ constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: { antialias?: boolean; preserveDrawingBuffer?: boolean; }, adaptToDeviceRatio?: boolean); webGLVersion: string; private _prepareWorkingCanvas(); resetTextureCache(): void; getGlInfo(): { vendor: string; renderer: string; version: string; }; getAspectRatio(camera: Camera, useScreen?: boolean): number; getRenderWidth(useScreen?: boolean): number; getRenderHeight(useScreen?: boolean): number; getRenderingCanvas(): HTMLCanvasElement; getRenderingCanvasClientRect(): ClientRect; setHardwareScalingLevel(level: number): void; getHardwareScalingLevel(): number; getLoadedTexturesCache(): WebGLTexture[]; getCaps(): EngineCapabilities; drawCalls: number; resetDrawCalls(): void; setDepthFunctionToGreater(): void; setDepthFunctionToGreaterOrEqual(): void; setDepthFunctionToLess(): void; setDepthFunctionToLessOrEqual(): void; /** * stop executing a render loop function and remove it from the execution array * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. */ stopRenderLoop(renderFunction?: () => void): void; _renderLoop(): void; /** * Register and execute a render loop. The engine can have more than one render function. * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. * @example * engine.runRenderLoop(function () { * scene.render() * }) */ runRenderLoop(renderFunction: () => void): void; /** * Toggle full screen mode. * @param {boolean} requestPointerLock - should a pointer lock be requested from the user */ switchFullscreen(requestPointerLock: boolean): void; clear(color: any, backBuffer: boolean, depthStencil: boolean): void; /** * Set the WebGL's viewport * @param {BABYLON.Viewport} viewport - the viewport element to be used. * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. */ setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; setDirectViewport(x: number, y: number, width: number, height: number): void; beginFrame(): void; endFrame(): void; /** * resize the view according to the canvas' size. * @example * window.addEventListener("resize", function () { * engine.resize(); * }); */ resize(): void; /** * force a specific size of the canvas * @param {number} width - the new canvas' width * @param {number} height - the new canvas' height */ setSize(width: number, height: number): void; bindFramebuffer(texture: WebGLTexture, faceIndex?: number): void; unBindFramebuffer(texture: WebGLTexture, disableGenerateMipMaps?: boolean): void; generateMipMapsForCubemap(texture: WebGLTexture): void; flushFramebuffer(): void; restoreDefaultFramebuffer(): void; private _resetVertexBufferBinding(); createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer; createDynamicVertexBuffer(capacity: number): WebGLBuffer; updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number): void; private _resetIndexBufferBinding(); createIndexBuffer(indices: number[] | Int32Array): WebGLBuffer; bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; _releaseBuffer(buffer: WebGLBuffer): boolean; createInstancesBuffer(capacity: number): WebGLBuffer; deleteInstancesBuffer(buffer: WebGLBuffer): void; updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; applyStates(): void; draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; drawUnIndexed(useTriangles: boolean, verticesStart: number, verticesCount: number, instancesCount?: number): void; _releaseEffect(effect: Effect): void; createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; enableEffect(effect: Effect): void; setArray(uniform: WebGLUniformLocation, array: number[]): void; setArray2(uniform: WebGLUniformLocation, array: number[]): void; setArray3(uniform: WebGLUniformLocation, array: number[]): void; setArray4(uniform: WebGLUniformLocation, array: number[]): void; setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; setFloat(uniform: WebGLUniformLocation, value: number): void; setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; setBool(uniform: WebGLUniformLocation, bool: number): void; setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; setColor3(uniform: WebGLUniformLocation, color3: Color3): void; setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; setState(culling: boolean, zOffset?: number, force?: boolean, reverseSide?: boolean): void; setDepthBuffer(enable: boolean): void; getDepthWrite(): boolean; setDepthWrite(enable: boolean): void; setColorWrite(enable: boolean): void; setAlphaMode(mode: number): void; getAlphaMode(): number; setAlphaTesting(enable: boolean): void; getAlphaTesting(): boolean; wipeCaches(): void; setSamplingMode(texture: WebGLTexture, samplingMode: number): void; createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; createRenderTargetTexture(size: any, options: any): WebGLTexture; createRenderTargetCubeTexture(size: number, options?: any): WebGLTexture; createCubeTexture(rootUrl: string, scene: Scene, files: string[], noMipmap?: boolean): WebGLTexture; _releaseTexture(texture: WebGLTexture): void; bindSamplers(effect: Effect): void; _bindTexture(channel: number, texture: WebGLTexture): void; setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; unbindAllTextures(): void; setTexture(channel: number, texture: BaseTexture): void; _setAnisotropicLevel(key: number, texture: BaseTexture): void; readPixels(x: number, y: number, width: number, height: number): Uint8Array; releaseInternalTexture(texture: WebGLTexture): void; dispose(): void; displayLoadingUI(): void; hideLoadingUI(): void; loadingScreen: ILoadingScreen; loadingUIText: string; loadingUIBackgroundColor: string; getFps(): number; getDeltaTime(): number; private _measureFps(); static isSupported(): boolean; } } interface Window { mozIndexedDB(func: any): any; webkitIndexedDB(func: any): any; IDBTransaction(func: any): any; webkitIDBTransaction(func: any): any; msIDBTransaction(func: any): any; IDBKeyRange(func: any): any; webkitIDBKeyRange(func: any): any; msIDBKeyRange(func: any): any; webkitURL: HTMLURL; webkitRequestAnimationFrame(func: any): any; mozRequestAnimationFrame(func: any): any; oRequestAnimationFrame(func: any): any; WebGLRenderingContext: WebGLRenderingContext; MSGesture: MSGesture; CANNON: any; SIMD: any; AudioContext: AudioContext; webkitAudioContext: AudioContext; PointerEvent: any; } interface HTMLURL { createObjectURL(param1: any, param2?: any): any; } interface Document { exitFullscreen(): void; webkitCancelFullScreen(): void; mozCancelFullScreen(): void; msCancelFullScreen(): void; mozFullScreen: boolean; msIsFullScreen: boolean; fullscreen: boolean; mozPointerLockElement: HTMLElement; msPointerLockElement: HTMLElement; webkitPointerLockElement: HTMLElement; } interface HTMLCanvasElement { requestPointerLock(): void; msRequestPointerLock(): void; mozRequestPointerLock(): void; webkitRequestPointerLock(): void; } interface CanvasRenderingContext2D { imageSmoothingEnabled: boolean; mozImageSmoothingEnabled: boolean; oImageSmoothingEnabled: boolean; webkitImageSmoothingEnabled: boolean; } interface WebGLTexture { isReady: boolean; isCube: boolean; url: string; noMipmap: boolean; samplingMode: number; references: number; generateMipMaps: boolean; _size: number; _baseWidth: number; _baseHeight: number; _width: number; _height: number; _workingCanvas: HTMLCanvasElement; _workingContext: CanvasRenderingContext2D; _framebuffer: WebGLFramebuffer; _depthBuffer: WebGLRenderbuffer; _cachedCoordinatesMode: number; _cachedWrapU: number; _cachedWrapV: number; _isDisabled: boolean; } interface WebGLBuffer { references: number; capacity: number; is32Bits: boolean; } interface MouseEvent { mozMovementX: number; mozMovementY: number; webkitMovementX: number; webkitMovementY: number; msMovementX: number; msMovementY: number; } interface MSStyleCSSProperties { webkitTransform: string; webkitTransition: string; } interface Navigator { getVRDevices: () => any; mozGetVRDevices: (any: any) => any; isCocoonJS: boolean; } interface Screen { orientation: string; mozOrientation: string; } interface HTMLMediaElement { crossOrigin: string; } declare namespace BABYLON { /** * Node is the basic class for all scene objects (Mesh, Light Camera). */ class Node { parent: Node; name: string; id: string; uniqueId: number; state: string; animations: Animation[]; private _ranges; onReady: (node: Node) => void; private _childrenFlag; private _isEnabled; private _isReady; _currentRenderId: number; private _parentRenderId; _waitingParentId: string; private _scene; _cache: any; /** * @constructor * @param {string} name - the name and id to be given to this node * @param {BABYLON.Scene} the scene this node will be added to */ constructor(name: string, scene: Scene); getScene(): Scene; getEngine(): Engine; getWorldMatrix(): Matrix; _initCache(): void; updateCache(force?: boolean): void; _updateCache(ignoreParentClass?: boolean): void; _isSynchronized(): boolean; _markSyncedWithParent(): void; isSynchronizedWithParent(): boolean; isSynchronized(updateCache?: boolean): boolean; hasNewParent(update?: boolean): boolean; /** * Is this node ready to be used/rendered * @return {boolean} is it ready */ isReady(): boolean; /** * Is this node enabled. * If the node has a parent and is enabled, the parent will be inspected as well. * @return {boolean} whether this node (and its parent) is enabled. * @see setEnabled */ isEnabled(): boolean; /** * Set the enabled state of this node. * @param {boolean} value - the new enabled state * @see isEnabled */ setEnabled(value: boolean): void; /** * Is this node a descendant of the given node. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. * @param {BABYLON.Node} ancestor - The parent node to inspect * @see parent */ isDescendantOf(ancestor: Node): boolean; _getDescendants(list: Node[], results: Node[]): void; /** * Will return all nodes that have this node as parent. * @return {BABYLON.Node[]} all children nodes of all types. */ getDescendants(): Node[]; _setReady(state: boolean): void; getAnimationByName(name: string): Animation; createAnimationRange(name: string, from: number, to: number): void; deleteAnimationRange(name: string, deleteFrames?: boolean): void; getAnimationRange(name: string): AnimationRange; beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): void; serializeAnimationRanges(): any; static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void; } } declare namespace BABYLON { interface IDisposable { dispose(): void; } /** * Represents a scene to be rendered by the engine. * @see http://doc.babylonjs.com/page.php?p=21911 */ class Scene { private static _FOGMODE_NONE; private static _FOGMODE_EXP; private static _FOGMODE_EXP2; private static _FOGMODE_LINEAR; static MinDeltaTime: number; static MaxDeltaTime: number; static FOGMODE_NONE: number; static FOGMODE_EXP: number; static FOGMODE_EXP2: number; static FOGMODE_LINEAR: number; autoClear: boolean; clearColor: any; ambientColor: Color3; /** * A function to be executed before rendering this scene * @type {Function} */ beforeRender: () => void; /** * A function to be executed after rendering this scene * @type {Function} */ afterRender: () => void; /** * A function to be executed when this scene is disposed. * @type {Function} */ onDispose: () => void; beforeCameraRender: (camera: Camera) => void; afterCameraRender: (camera: Camera) => void; forceWireframe: boolean; forcePointsCloud: boolean; forceShowBoundingBoxes: boolean; clipPlane: Plane; animationsEnabled: boolean; constantlyUpdateMeshUnderPointer: boolean; private _onPointerMove; private _onPointerDown; private _onPointerUp; onPointerMove: (evt: PointerEvent, pickInfo: PickingInfo) => void; onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; onPointerPick: (evt: PointerEvent, pickInfo: PickingInfo) => void; cameraToUseForPointers: Camera; private _pointerX; private _pointerY; private _meshUnderPointer; private _startingPointerPosition; private _startingPointerTime; _mirroredCameraPosition: Vector3; private _onKeyDown; private _onKeyUp; /** * is fog enabled on this scene. * @type {boolean} */ fogEnabled: boolean; fogMode: number; fogColor: Color3; fogDensity: number; fogStart: number; fogEnd: number; /** * is shadow enabled on this scene. * @type {boolean} */ shadowsEnabled: boolean; /** * is light enabled on this scene. * @type {boolean} */ lightsEnabled: boolean; /** * All of the lights added to this scene. * @see BABYLON.Light * @type {BABYLON.Light[]} */ lights: Light[]; onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; onLightRemoved: (removedLight?: Light) => void; /** * All of the cameras added to this scene. * @see BABYLON.Camera * @type {BABYLON.Camera[]} */ cameras: Camera[]; onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; onCameraRemoved: (removedCamera?: Camera) => void; activeCameras: Camera[]; activeCamera: Camera; /** * All of the (abstract) meshes added to this scene. * @see BABYLON.AbstractMesh * @type {BABYLON.AbstractMesh[]} */ meshes: AbstractMesh[]; onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; onMeshRemoved: (removedMesh?: AbstractMesh) => void; private _geometries; onGeometryAdded: (newGeometry?: Geometry) => void; onGeometryRemoved: (removedGeometry?: Geometry) => void; materials: Material[]; multiMaterials: MultiMaterial[]; defaultMaterial: StandardMaterial; texturesEnabled: boolean; textures: BaseTexture[]; particlesEnabled: boolean; particleSystems: ParticleSystem[]; spritesEnabled: boolean; spriteManagers: SpriteManager[]; layers: Layer[]; skeletonsEnabled: boolean; skeletons: Skeleton[]; lensFlaresEnabled: boolean; lensFlareSystems: LensFlareSystem[]; collisionsEnabled: boolean; private _workerCollisions; collisionCoordinator: ICollisionCoordinator; gravity: Vector3; postProcessesEnabled: boolean; postProcessManager: PostProcessManager; postProcessRenderPipelineManager: PostProcessRenderPipelineManager; renderTargetsEnabled: boolean; dumpNextRenderTargets: boolean; customRenderTargets: RenderTargetTexture[]; useDelayedTextureLoading: boolean; importedMeshesFiles: String[]; probesEnabled: boolean; reflectionProbes: ReflectionProbe[]; database: any; /** * This scene's action manager * @type {BABYLON.ActionManager} */ actionManager: ActionManager; _actionManagers: ActionManager[]; private _meshesForIntersections; proceduralTexturesEnabled: boolean; _proceduralTextures: ProceduralTexture[]; mainSoundTrack: SoundTrack; soundTracks: SoundTrack[]; private _audioEnabled; private _headphone; simplificationQueue: SimplificationQueue; private _engine; private _totalVertices; _activeIndices: number; _activeParticles: number; private _lastFrameDuration; private _evaluateActiveMeshesDuration; private _renderTargetsDuration; _particlesDuration: number; private _renderDuration; _spritesDuration: number; private _animationRatio; private _animationStartDate; _cachedMaterial: Material; private _renderId; private _executeWhenReadyTimeoutId; _toBeDisposed: SmartArray<IDisposable>; private _onReadyCallbacks; private _pendingData; private _onBeforeRenderCallbacks; private _onAfterRenderCallbacks; private _activeMeshes; private _processedMaterials; private _renderTargets; _activeParticleSystems: SmartArray<ParticleSystem>; private _activeSkeletons; private _softwareSkinnedMeshes; _activeBones: number; private _renderingManager; private _physicsEngine; _activeAnimatables: Animatable[]; private _transformMatrix; private _pickWithRayInverseMatrix; private _edgesRenderers; private _boundingBoxRenderer; private _outlineRenderer; private _viewMatrix; private _projectionMatrix; private _frustumPlanes; private _selectionOctree; private _pointerOverMesh; private _debugLayer; private _depthRenderer; private _uniqueIdCounter; private _pickedMeshName; /** * @constructor * @param {BABYLON.Engine} engine - the engine to be used to render this scene. */ constructor(engine: Engine); debugLayer: DebugLayer; workerCollisions: boolean; SelectionOctree: Octree<AbstractMesh>; /** * The mesh that is currently under the pointer. * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. */ meshUnderPointer: AbstractMesh; /** * Current on-screen X position of the pointer * @return {number} X position of the pointer */ pointerX: number; /** * Current on-screen Y position of the pointer * @return {number} Y position of the pointer */ pointerY: number; getCachedMaterial(): Material; getBoundingBoxRenderer(): BoundingBoxRenderer; getOutlineRenderer(): OutlineRenderer; getEngine(): Engine; getTotalVertices(): number; getActiveIndices(): number; getActiveParticles(): number; getActiveBones(): number; getLastFrameDuration(): number; getEvaluateActiveMeshesDuration(): number; getActiveMeshes(): SmartArray<Mesh>; getRenderTargetsDuration(): number; getRenderDuration(): number; getParticlesDuration(): number; getSpritesDuration(): number; getAnimationRatio(): number; getRenderId(): number; incrementRenderId(): void; private _updatePointerPosition(evt); attachControl(): void; detachControl(): void; isReady(): boolean; resetCachedMaterial(): void; registerBeforeRender(func: () => void): void; unregisterBeforeRender(func: () => void): void; registerAfterRender(func: () => void): void; unregisterAfterRender(func: () => void): void; _addPendingData(data: any): void; _removePendingData(data: any): void; getWaitingItemsCount(): number; /** * Registers a function to be executed when the scene is ready. * @param {Function} func - the function to be executed. */ executeWhenReady(func: () => void): void; _checkIsReady(): void; /** * Will start the animation sequence of a given target * @param target - the target * @param {number} from - from which frame should animation start * @param {number} to - till which frame should animation run. * @param {boolean} [loop] - should the animation loop * @param {number} [speedRatio] - the speed in which to run the animation * @param {Function} [onAnimationEnd] function to be executed when the animation ended. * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. * @return {BABYLON.Animatable} the animatable object created for this animation * @see BABYLON.Animatable * @see http://doc.babylonjs.com/page.php?p=22081 */ beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; getAnimatableByTarget(target: any): Animatable; Animatables: Animatable[]; /** * Will stop the animation of the given target * @param target - the target * @see beginAnimation */ stopAnimation(target: any): void; private _animate(); getViewMatrix(): Matrix; getProjectionMatrix(): Matrix; getTransformMatrix(): Matrix; setTransformMatrix(view: Matrix, projection: Matrix): void; addMesh(newMesh: AbstractMesh): void; removeMesh(toRemove: AbstractMesh): number; removeSkeleton(toRemove: Skeleton): number; removeLight(toRemove: Light): number; removeCamera(toRemove: Camera): number; addLight(newLight: Light): void; addCamera(newCamera: Camera): void; /** * Switch active camera * @param {Camera} newCamera - new active camera * @param {boolean} attachControl - call attachControl for the new active camera (default: true) */ swithActiveCamera(newCamera: Camera, attachControl?: boolean): void; /** * sets the active camera of the scene using its ID * @param {string} id - the camera's ID * @return {BABYLON.Camera|null} the new active camera or null if none found. * @see activeCamera */ setActiveCameraByID(id: string): Camera; /** * sets the active camera of the scene using its name * @param {string} name - the camera's name * @return {BABYLON.Camera|null} the new active camera or null if none found. * @see activeCamera */ setActiveCameraByName(name: string): Camera; /** * get a material using its id * @param {string} the material's ID * @return {BABYLON.Material|null} the material or null if none found. */ getMaterialByID(id: string): Material; /** * get a material using its name * @param {string} the material's name * @return {BABYLON.Material|null} the material or null if none found. */ getMaterialByName(name: string): Material; getLensFlareSystemByName(name: string): LensFlareSystem; getCameraByID(id: string): Camera; getCameraByUniqueID(uniqueId: number): Camera; /** * get a camera using its name * @param {string} the camera's name * @return {BABYLON.Camera|null} the camera or null if none found. */ getCameraByName(name: string): Camera; /** * get a bone using its id * @param {string} the bone's id * @return {BABYLON.Bone|null} the bone or null if not found */ getBoneByID(id: string): Bone; /** * get a bone using its id * @param {string} the bone's name * @return {BABYLON.Bone|null} the bone or null if not found */ getBoneByName(name: string): Bone; /** * get a light node using its name * @param {string} the light's name * @return {BABYLON.Light|null} the light or null if none found. */ getLightByName(name: string): Light; /** * get a light node using its ID * @param {string} the light's id * @return {BABYLON.Light|null} the light or null if none found. */ getLightByID(id: string): Light; /** * get a light node using its scene-generated unique ID * @param {number} the light's unique id * @return {BABYLON.Light|null} the light or null if none found. */ getLightByUniqueID(uniqueId: number): Light; /** * get a particle system by id * @param id {number} the particle system id * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found. */ getParticleSystemByID(id: string): ParticleSystem; /** * get a geometry using its ID * @param {string} the geometry's id * @return {BABYLON.Geometry|null} the geometry or null if none found. */ getGeometryByID(id: string): Geometry; /** * add a new geometry to this scene. * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. * @param {boolean} [force] - force addition, even if a geometry with this ID already exists * @return {boolean} was the geometry added or not */ pushGeometry(geometry: Geometry, force?: boolean): boolean; /** * Removes an existing geometry * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. * @return {boolean} was the geometry removed or not */ removeGeometry(geometry: Geometry): boolean; getGeometries(): Geometry[]; /** * Get the first added mesh found of a given ID * @param {string} id - the id to search for * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. */ getMeshByID(id: string): AbstractMesh; /** * Get a mesh with its auto-generated unique id * @param {number} uniqueId - the unique id to search for * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. */ getMeshByUniqueID(uniqueId: number): AbstractMesh; /** * Get a the last added mesh found of a given ID * @param {string} id - the id to search for * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. */ getLastMeshByID(id: string): AbstractMesh; /** * Get a the last added node (Mesh, Camera, Light) found of a given ID * @param {string} id - the id to search for * @return {BABYLON.Node|null} the node found or null if not found at all. */ getLastEntryByID(id: string): Node; getNodeByID(id: string): Node; getNodeByName(name: string): Node; getMeshByName(name: string): AbstractMesh; getSoundByName(name: string): Sound; getLastSkeletonByID(id: string): Skeleton; getSkeletonById(id: string): Skeleton; getSkeletonByName(name: string): Skeleton; isActiveMesh(mesh: Mesh): boolean; private _evaluateSubMesh(subMesh, mesh); private _evaluateActiveMeshes(); private _activeMesh(mesh); updateTransformMatrix(force?: boolean): void; private _renderForCamera(camera); private _processSubCameras(camera); private _checkIntersections(); render(): void; private _updateAudioParameters(); audioEnabled: boolean; private _disableAudio(); private _enableAudio(); headphone: boolean; private _switchAudioModeForHeadphones(); private _switchAudioModeForNormalSpeakers(); enableDepthRenderer(): DepthRenderer; disableDepthRenderer(): void; freezeMaterials(): void; unfreezeMaterials(): void; dispose(): void; disposeSounds(): void; getWorldExtends(): { min: Vector3; max: Vector3; }; createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>; createPickingRay(x: number, y: number, world: Matrix, camera: Camera, cameraViewSpace?: boolean): Ray; createPickingRayInCameraSpace(x: number, y: number, camera: Camera): Ray; private _internalPick(rayFunction, predicate, fastCheck?); private _internalPickSprites(ray, predicate?, fastCheck?, camera?); pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; pickSprite(x: number, y: number, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; setPointerOverMesh(mesh: AbstractMesh): void; getPointerOverMesh(): AbstractMesh; getPhysicsEngine(): PhysicsEngine; /** * Enables physics to the current scene * @param {BABYLON.Vector3} [gravity] - the scene's gravity for the physics engine * @param {BABYLON.IPhysicsEnginePlugin} [plugin] - The physics engine to be used. defaults to OimoJS. * @return {boolean} was the physics engine initialized */ enablePhysics(gravity?: Vector3, plugin?: IPhysicsEnginePlugin): boolean; disablePhysicsEngine(): void; isPhysicsEnabled(): boolean; /** * Sets the gravity of the physics engine (and NOT of the scene) * @param {BABYLON.Vector3} [gravity] - the new gravity to be used */ setGravity(gravity: Vector3): void; createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; deleteCompoundImpostor(compound: any): void; createDefaultCameraOrLight(): void; private _getByTags(list, tagsQuery, forEach?); getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; } } declare namespace BABYLON { class Action { triggerOptions: any; trigger: number; _actionManager: ActionManager; private _nextActiveAction; private _child; private _condition; private _triggerParameter; constructor(triggerOptions: any, condition?: Condition); _prepare(): void; getTriggerParameter(): any; _executeCurrent(evt: ActionEvent): void; execute(evt: ActionEvent): void; skipToNextActiveAction(): void; then(action: Action): Action; _getProperty(propertyPath: string): string; _getEffectiveTarget(target: any, propertyPath: string): any; } } declare namespace BABYLON { /** * ActionEvent is the event beint sent when an action is triggered. */ class ActionEvent { source: any; pointerX: number; pointerY: number; meshUnderPointer: AbstractMesh; sourceEvent: any; additionalData: any; /** * @constructor * @param source The mesh or sprite that triggered the action. * @param pointerX The X mouse cursor position at the time of the event * @param pointerY The Y mouse cursor position at the time of the event * @param meshUnderPointer The mesh that is currently pointed at (can be null) * @param sourceEvent the original (browser) event that triggered the ActionEvent */ constructor(source: any, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); /** * Helper function to auto-create an ActionEvent from a source mesh. * @param source The source mesh that triggered the event * @param evt {Event} The original (browser) event */ static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; /** * Helper function to auto-create an ActionEvent from a source mesh. * @param source The source sprite that triggered the event * @param scene Scene associated with the sprite * @param evt {Event} The original (browser) event */ static CreateNewFromSprite(source: Sprite, scene: Scene, evt?: Event, additionalData?: any): ActionEvent; /** * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew * @param scene the scene where the event occurred * @param evt {Event} The original (browser) event */ static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; } /** * Action Manager manages all events to be triggered on a given mesh or the global scene. * A single scene can have many Action Managers to handle predefined actions on specific meshes. */ class ActionManager { private static _NothingTrigger; private static _OnPickTrigger; private static _OnLeftPickTrigger; private static _OnRightPickTrigger; private static _OnCenterPickTrigger; private static _OnPickDownTrigger; private static _OnPickUpTrigger; private static _OnLongPressTrigger; private static _OnPointerOverTrigger; private static _OnPointerOutTrigger; private static _OnEveryFrameTrigger; private static _OnIntersectionEnterTrigger; private static _OnIntersectionExitTrigger; private static _OnKeyDownTrigger; private static _OnKeyUpTrigger; static NothingTrigger: number; static OnPickTrigger: number; static OnLeftPickTrigger: number; static OnRightPickTrigger: number; static OnCenterPickTrigger: number; static OnPickDownTrigger: number; static OnPickUpTrigger: number; static OnLongPressTrigger: number; static OnPointerOverTrigger: number; static OnPointerOutTrigger: number; static OnEveryFrameTrigger: number; static OnIntersectionEnterTrigger: number; static OnIntersectionExitTrigger: number; static OnKeyDownTrigger: number; static OnKeyUpTrigger: number; static DragMovementThreshold: number; static LongPressDelay: number; actions: Action[]; private _scene; constructor(scene: Scene); dispose(): void; getScene(): Scene; /** * Does this action manager handles actions of any of the given triggers * @param {number[]} triggers - the triggers to be tested * @return {boolean} whether one (or more) of the triggers is handeled */ hasSpecificTriggers(triggers: number[]): boolean; /** * Does this action manager handles actions of a given trigger * @param {number} trigger - the trigger to be tested * @return {boolean} whether the trigger is handeled */ hasSpecificTrigger(trigger: number): boolean; /** * Does this action manager has pointer triggers * @return {boolean} whether or not it has pointer triggers */ hasPointerTriggers: boolean; /** * Does this action manager has pick triggers * @return {boolean} whether or not it has pick triggers */ hasPickTriggers: boolean; /** * Registers an action to this action manager * @param {BABYLON.Action} action - the action to be registered * @return {BABYLON.Action} the action amended (prepared) after registration */ registerAction(action: Action): Action; /** * Process a specific trigger * @param {number} trigger - the trigger to process * @param evt {BABYLON.ActionEvent} the event details to be processed */ processTrigger(trigger: number, evt: ActionEvent): void; _getEffectiveTarget(target: any, propertyPath: string): any; _getProperty(propertyPath: string): string; static Parse(parsedActions: any, object: AbstractMesh, scene: Scene): void; } } declare namespace BABYLON { class Condition { _actionManager: ActionManager; _evaluationId: number; _currentResult: boolean; constructor(actionManager: ActionManager); isValid(): boolean; _getProperty(propertyPath: string): string; _getEffectiveTarget(target: any, propertyPath: string): any; } class ValueCondition extends Condition { propertyPath: string; value: any; operator: number; private static _IsEqual; private static _IsDifferent; private static _IsGreater; private static _IsLesser; static IsEqual: number; static IsDifferent: number; static IsGreater: number; static IsLesser: number; _actionManager: ActionManager; private _target; private _property; constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); isValid(): boolean; } class PredicateCondition extends Condition { predicate: () => boolean; _actionManager: ActionManager; constructor(actionManager: ActionManager, predicate: () => boolean); isValid(): boolean; } class StateCondition extends Condition { value: string; _actionManager: ActionManager; private _target; constructor(actionManager: ActionManager, target: any, value: string); isValid(): boolean; } } declare namespace BABYLON { class SwitchBooleanAction extends Action { propertyPath: string; private _target; private _property; constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); _prepare(): void; execute(): void; } class SetStateAction extends Action { value: string; private _target; constructor(triggerOptions: any, target: any, value: string, condition?: Condition); execute(): void; } class SetValueAction extends Action { propertyPath: string; value: any; private _target; private _property; constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); _prepare(): void; execute(): void; } class IncrementValueAction extends Action { propertyPath: string; value: any; private _target; private _property; constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); _prepare(): void; execute(): void; } class PlayAnimationAction extends Action { from: number;