forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabylon.d.ts
More file actions
7260 lines (7123 loc) · 294 KB
/
babylon.d.ts
File metadata and controls
7260 lines (7123 loc) · 294 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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.