Преглед изворни кода

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

Jaskar пре 5 година
родитељ
комит
969940f423
57 измењених фајлова са 2739 додато и 2231 уклоњено
  1. 165 134
      Playground/babylon.d.txt
  2. 2 2
      Viewer/src/labs/texture.ts
  3. 168 137
      dist/preview release/babylon.d.ts
  4. 2 2
      dist/preview release/babylon.js
  5. 712 643
      dist/preview release/babylon.max.js
  6. 1 1
      dist/preview release/babylon.max.js.map
  7. 357 283
      dist/preview release/babylon.module.d.ts
  8. 168 137
      dist/preview release/documentation.d.ts
  9. 2 2
      dist/preview release/inspector/babylon.inspector.bundle.js
  10. 2 2
      dist/preview release/inspector/babylon.inspector.bundle.max.js
  11. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.max.js.map
  12. 34 32
      dist/preview release/nodeEditor/babylon.nodeEditor.d.ts
  13. 7 7
      dist/preview release/nodeEditor/babylon.nodeEditor.js
  14. 92 49
      dist/preview release/nodeEditor/babylon.nodeEditor.max.js
  15. 1 1
      dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map
  16. 71 67
      dist/preview release/nodeEditor/babylon.nodeEditor.module.d.ts
  17. 1 1
      dist/preview release/packagesSizeBaseLine.json
  18. 357 283
      dist/preview release/viewer/babylon.module.d.ts
  19. 93 89
      dist/preview release/viewer/babylon.viewer.js
  20. 2 2
      dist/preview release/viewer/babylon.viewer.max.js
  21. 1 0
      dist/preview release/what's new.md
  22. 1 1
      inspector/src/components/sceneExplorer/entities/sceneTreeItemComponent.tsx
  23. 4 0
      inspector/src/components/sceneExplorer/sceneExplorer.scss
  24. 1 1
      nodeEditor/src/components/diagram/input/inputNodePropertyComponent.tsx
  25. 67 17
      nodeEditor/src/components/diagram/texture/texturePropertyTabComponent.tsx
  26. 4 1
      nodeEditor/src/components/preview/previewManager.ts
  27. 3 2
      nodeEditor/src/components/propertyTab/propertyTab.scss
  28. 6 3
      nodeEditor/src/sharedComponents/floatLineComponent.tsx
  29. 2 2
      src/Cameras/XR/webXRSessionManager.ts
  30. 8 7
      src/Engines/Extensions/engine.cubeTexture.ts
  31. 2 2
      src/Engines/Extensions/engine.dynamicTexture.ts
  32. 3 3
      src/Engines/Extensions/engine.multiRender.ts
  33. 2 2
      src/Engines/Extensions/engine.multiview.ts
  34. 6 6
      src/Engines/Extensions/engine.rawTexture.ts
  35. 48 36
      src/Engines/Extensions/engine.renderTarget.ts
  36. 92 0
      src/Engines/Extensions/engine.renderTargetCube.ts
  37. 1 0
      src/Engines/Extensions/index.ts
  38. 55 83
      src/Engines/engine.ts
  39. 6 5
      src/Engines/nativeEngine.ts
  40. 3 3
      src/Engines/nullEngine.ts
  41. 59 111
      src/Engines/thinEngine.ts
  42. 7 2
      src/Materials/Node/Blocks/Dual/reflectionTextureBlock.ts
  43. 2 2
      src/Materials/Textures/MultiviewRenderTarget.ts
  44. 1 0
      src/Materials/Textures/Procedurals/proceduralTexture.ts
  45. 6 3
      src/Materials/Textures/htmlElementTexture.ts
  46. 48 43
      src/Materials/Textures/internalTexture.ts
  47. 3 3
      src/Materials/Textures/rawCubeTexture.ts
  48. 1 0
      src/Materials/Textures/renderTargetTexture.ts
  49. 7 5
      src/Materials/effectRenderer.ts
  50. 18 3
      src/Meshes/mesh.ts
  51. 2 2
      src/Misc/basis.ts
  52. 3 3
      src/Misc/dds.ts
  53. 4 4
      src/Misc/environmentTextureTools.ts
  54. 18 0
      src/Misc/interfaces/iWebRequest.ts
  55. 2 0
      src/Misc/rgbdTextureTools.ts
  56. 3 1
      src/Misc/webRequest.ts
  57. 2 0
      src/PostProcesses/postProcess.ts

+ 165 - 134
Playground/babylon.d.txt

@@ -406,9 +406,28 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Interface used to define the mechanism to get data from the network
+     */
+    export interface IWebRequest {
+        /**
+         * Returns client's response url
+         */
+        responseURL: string;
+        /**
+         * Returns client's status
+         */
+        status: number;
+        /**
+         * Returns client's status as a text
+         */
+        statusText: string;
+    }
+}
+declare module BABYLON {
+    /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest {
+    export class WebRequest implements IWebRequest {
         private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
@@ -8286,6 +8305,20 @@ declare module BABYLON {
     };
 }
 declare module BABYLON {
+        interface ThinEngine {
+            /**
+             * Creates a new render target texture
+             * @param size defines the size of the texture
+             * @param options defines the options used to create the texture
+             * @returns a new render target texture stored in an InternalTexture
+             */
+            createRenderTargetTexture(size: number | {
+                width: number;
+                height: number;
+            }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        }
+}
+declare module BABYLON {
     /** Defines supported spaces */
     export enum Space {
         /** Local (object) space */
@@ -28298,86 +28331,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * This class is used to track a performance counter which is number based.
-     * The user has access to many properties which give statistics of different nature.
-     *
-     * The implementer can track two kinds of Performance Counter: time and count.
-     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
-     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
-     */
-    export class PerfCounter {
-        /**
-         * Gets or sets a global boolean to turn on and off all the counters
-         */
-        static Enabled: boolean;
-        /**
-         * Returns the smallest value ever
-         */
-        readonly min: number;
-        /**
-         * Returns the biggest value ever
-         */
-        readonly max: number;
-        /**
-         * Returns the average value since the performance counter is running
-         */
-        readonly average: number;
-        /**
-         * Returns the average value of the last second the counter was monitored
-         */
-        readonly lastSecAverage: number;
-        /**
-         * Returns the current value
-         */
-        readonly current: number;
-        /**
-         * Gets the accumulated total
-         */
-        readonly total: number;
-        /**
-         * Gets the total value count
-         */
-        readonly count: number;
-        /**
-         * Creates a new counter
-         */
-        constructor();
-        /**
-         * Call this method to start monitoring a new frame.
-         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
-         */
-        fetchNewFrame(): void;
-        /**
-         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
-         * @param newCount the count value to add to the monitored count
-         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
-         */
-        addCount(newCount: number, fetchResult: boolean): void;
-        /**
-         * Start monitoring this performance counter
-         */
-        beginMonitoring(): void;
-        /**
-         * Compute the time lapsed since the previous beginMonitoring() call.
-         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
-         */
-        endMonitoring(newFrame?: boolean): void;
-        private _fetchResult;
-        private _startMonitoringTime;
-        private _min;
-        private _max;
-        private _average;
-        private _current;
-        private _totalValueCount;
-        private _totalAccumulated;
-        private _lastSecAverage;
-        private _lastSecAccumulated;
-        private _lastSecTime;
-        private _lastSecValueCount;
-    }
-}
-declare module BABYLON {
-    /**
      * @hidden
      **/
     export class DepthCullingState {
@@ -28790,7 +28743,6 @@ declare module BABYLON {
         /** @hidden */
private _caps: EngineCapabilities;
         private _isStencilEnable;
         protected _colorWrite: boolean;
-        /** @hidden */
private _drawCalls: PerfCounter;
         private _glVersion;
         private _glRenderer;
         private _glVendor;
@@ -28849,7 +28801,7 @@ declare module BABYLON {
         protected _cachedEffectForVertexBuffers: Nullable<Effect>;
         /** @hidden */
private _currentRenderTarget: Nullable<InternalTexture>;
         private _uintIndicesCurrentlySet;
-        private _currentBoundBuffer;
+        protected _currentBoundBuffer: Nullable<WebGLBuffer>[];
         /** @hidden */
         protected _currentFramebuffer: Nullable<WebGLFramebuffer>;
         private _currentBufferPointers;
@@ -29082,13 +29034,6 @@ declare module BABYLON {
          */
         createDynamicVertexBuffer(data: DataArray): DataBuffer;
         /**
-         * Update a dynamic index buffer
-         * @param indexBuffer defines the target index buffer
-         * @param indices defines the data to update
-         * @param offset defines the offset in the target index buffer where update should start
-         */
-        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
-        /**
          * Updates a dynamic vertex buffer.
          * @param vertexBuffer the vertex buffer to update
          * @param data the data used to update the vertex buffer
@@ -29096,7 +29041,7 @@ declare module BABYLON {
          * @param byteLength the byte length of the data
          */
         updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
-        private _resetIndexBufferBinding;
+        protected _resetIndexBufferBinding(): void;
         /**
          * Creates a new index buffer
          * @param indices defines the content of the index buffer
@@ -29110,7 +29055,7 @@ declare module BABYLON {
          * @param buffer defines the buffer to bind
          */
         bindArrayBuffer(buffer: Nullable<DataBuffer>): void;
-        private bindIndexBuffer;
+        protected bindIndexBuffer(buffer: Nullable<DataBuffer>): void;
         private bindBuffer;
         /**
          * update the bound buffer with the given data
@@ -29230,6 +29175,8 @@ declare module BABYLON {
          */
         drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
         private _drawMode;
+        /** @hidden */
+        protected _reportDrawCall(): void;
         /** @hidden */
private _releaseEffect(effect: Effect): void;
         /** @hidden */
private _deletePipelineContext(pipelineContext: IPipelineContext): void;
         /**
@@ -29577,12 +29524,6 @@ declare module BABYLON {
          * @returns The texture
          */
         private _createDepthStencilTexture;
-        /**
-         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
-         * @param renderTarget The render target to set the frame buffer for
-         */
-        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
-        /** @hidden */
private _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
         /** @hidden */
private _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex?: number, lod?: number): void;
         /** @hidden */
private _uploadDataToTextureDirectly(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number, babylonInternalFormat?: number, useTextureWidthAndHeight?: boolean): void;
         /** @hidden */
private _uploadArrayBufferViewToTexture(texture: InternalTexture, imageData: ArrayBufferView, faceIndex?: number, lod?: number): void;
@@ -29592,6 +29533,7 @@ declare module BABYLON {
          */
private _setCubeMapTextureParams(loadMipmap: boolean): void;
         protected _prepareWebGLTextureContinuation(texture: InternalTexture, scene: Nullable<ISceneLike>, noMipmap: boolean, isCompressed: boolean, samplingMode: number): void;
         private _prepareWebGLTexture;
+        /** @hidden */
private _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
         /** @hidden */
private _releaseFramebufferObjects(texture: InternalTexture): void;
         /** @hidden */
private _releaseTexture(texture: InternalTexture): void;
         protected _deleteTexture(texture: Nullable<WebGLTexture>): void;
@@ -29666,7 +29608,7 @@ declare module BABYLON {
         /** @hidden */
private _getInternalFormat(format: number): number;
         /** @hidden */
private _getRGBABufferInternalSizedFormat(type: number, format?: number): number;
         /** @hidden */
private _getRGBAMultiSampleBufferFormat(type: number): number;
-        /** @hidden */
private _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
+        /** @hidden */
private _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest;
         /**
          * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)
          * @returns true if the engine can be created
@@ -29710,63 +29652,68 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * Class used to store data associated with WebGL texture data for the engine
-     * This class should not be used directly
+     * Defines the source of the internal texture
      */
-    export class InternalTexture {
-        /** @hidden */
private static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
+    export enum InternalTextureSource {
         /**
          * The source of the texture data is unknown
          */
-        static DATASOURCE_UNKNOWN: number;
+        Unknown = 0,
         /**
-         * Texture data comes from an URL
-         */
-        static DATASOURCE_URL: number;
+        * Texture data comes from an URL
+        */
+        Url = 1,
         /**
          * Texture data is only used for temporary storage
          */
-        static DATASOURCE_TEMP: number;
+        Temp = 2,
         /**
          * Texture data comes from raw data (ArrayBuffer)
          */
-        static DATASOURCE_RAW: number;
+        Raw = 3,
         /**
          * Texture content is dynamic (video or dynamic texture)
          */
-        static DATASOURCE_DYNAMIC: number;
+        Dynamic = 4,
         /**
          * Texture content is generated by rendering to it
          */
-        static DATASOURCE_RENDERTARGET: number;
+        RenderTarget = 5,
         /**
          * Texture content is part of a multi render target process
          */
-        static DATASOURCE_MULTIRENDERTARGET: number;
+        MultiRenderTarget = 6,
         /**
          * Texture data comes from a cube data file
          */
-        static DATASOURCE_CUBE: number;
+        Cube = 7,
         /**
          * Texture data comes from a raw cube data
          */
-        static DATASOURCE_CUBERAW: number;
+        CubeRaw = 8,
         /**
          * Texture data come from a prefiltered cube data file
          */
-        static DATASOURCE_CUBEPREFILTERED: number;
+        CubePrefiltered = 9,
         /**
          * Texture content is raw 3D data
          */
-        static DATASOURCE_RAW3D: number;
+        Raw3D = 10,
         /**
          * Texture content is a depth texture
          */
-        static DATASOURCE_DEPTHTEXTURE: number;
+        Depth = 11,
         /**
          * Texture data comes from a raw cube data encoded with RGBD
          */
-        static DATASOURCE_CUBERAW_RGBD: number;
+        CubeRawRGBD = 12
+    }
+    /**
+     * Class used to store data associated with WebGL texture data for the engine
+     * This class should not be used directly
+     */
+    export class InternalTexture {
+        /** @hidden */
private static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
         /**
          * Defines if the texture is ready
          */
@@ -29841,7 +29788,7 @@ declare module BABYLON {
         invertY: boolean;
         /** @hidden */
private _invertVScale: boolean;
         /** @hidden */
private _associatedChannel: number;
-        /** @hidden */
private _dataSource: number;
+        /** @hidden */
private _source: InternalTextureSource;
         /** @hidden */
private _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>;
         /** @hidden */
private _bufferView: Nullable<ArrayBufferView>;
         /** @hidden */
private _bufferViewArray: Nullable<ArrayBufferView[]>;
@@ -29886,16 +29833,16 @@ declare module BABYLON {
          */
         getEngine(): ThinEngine;
         /**
-         * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)
+         * Gets the data source type of the texture
          */
-        readonly dataSource: number;
+        readonly source: InternalTextureSource;
         /**
          * Creates a new InternalTexture
          * @param engine defines the engine to use
-         * @param dataSource defines the type of data that will be used
+         * @param source defines the type of data that will be used
          * @param delayAllocation if the texture allocation should be delayed (default: false)
          */
-        constructor(engine: ThinEngine, dataSource: number, delayAllocation?: boolean);
+        constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation?: boolean);
         /**
          * Increments the number of references (ie. the number of Texture that point to it)
          */
@@ -30372,6 +30319,86 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * This class is used to track a performance counter which is number based.
+     * The user has access to many properties which give statistics of different nature.
+     *
+     * The implementer can track two kinds of Performance Counter: time and count.
+     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
+     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
+     */
+    export class PerfCounter {
+        /**
+         * Gets or sets a global boolean to turn on and off all the counters
+         */
+        static Enabled: boolean;
+        /**
+         * Returns the smallest value ever
+         */
+        readonly min: number;
+        /**
+         * Returns the biggest value ever
+         */
+        readonly max: number;
+        /**
+         * Returns the average value since the performance counter is running
+         */
+        readonly average: number;
+        /**
+         * Returns the average value of the last second the counter was monitored
+         */
+        readonly lastSecAverage: number;
+        /**
+         * Returns the current value
+         */
+        readonly current: number;
+        /**
+         * Gets the accumulated total
+         */
+        readonly total: number;
+        /**
+         * Gets the total value count
+         */
+        readonly count: number;
+        /**
+         * Creates a new counter
+         */
+        constructor();
+        /**
+         * Call this method to start monitoring a new frame.
+         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
+         */
+        fetchNewFrame(): void;
+        /**
+         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
+         * @param newCount the count value to add to the monitored count
+         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
+         */
+        addCount(newCount: number, fetchResult: boolean): void;
+        /**
+         * Start monitoring this performance counter
+         */
+        beginMonitoring(): void;
+        /**
+         * Compute the time lapsed since the previous beginMonitoring() call.
+         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
+         */
+        endMonitoring(newFrame?: boolean): void;
+        private _fetchResult;
+        private _startMonitoringTime;
+        private _min;
+        private _max;
+        private _average;
+        private _current;
+        private _totalValueCount;
+        private _totalAccumulated;
+        private _lastSecAverage;
+        private _lastSecAccumulated;
+        private _lastSecTime;
+        private _lastSecValueCount;
+    }
+}
+declare module BABYLON {
+    /**
      * Defines the interface used by display changed events
      */
     export interface IDisplayChangedEventArgs {
@@ -30708,6 +30735,7 @@ declare module BABYLON {
         protected readonly _supportsHardwareTextureRescaling: boolean;
         private _fps;
         private _deltaTime;
+        /** @hidden */
private _drawCalls: PerfCounter;
         /**
          * Turn this value on if you want to pause FPS computation when in background
          */
@@ -31008,6 +31036,7 @@ declare module BABYLON {
          * Disable previously set scissor test rectangle
          */
         disableScissor(): void;
+        protected _reportDrawCall(): void;
         /**
          * Initializes a webVR display and starts listening to display change events
          * The onVRDisplayChangedObservable will be notified upon these changes
@@ -31153,15 +31182,17 @@ declare module BABYLON {
         getDeltaTime(): number;
         private _measureFps;
         /**
-         * Creates a new render target texture
-         * @param size defines the size of the texture
-         * @param options defines the options used to create the texture
-         * @returns a new render target texture stored in an InternalTexture
+         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
+         * @param renderTarget The render target to set the frame buffer for
          */
-        createRenderTargetTexture(size: number | {
-            width: number;
-            height: number;
-        }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
+        /**
+         * Update a dynamic index buffer
+         * @param indexBuffer defines the target index buffer
+         * @param indices defines the data to update
+         * @param offset defines the offset in the target index buffer where update should start
+         */
+        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
         /**
          * Updates the sample count of a render target texture
          * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets
@@ -51628,7 +51659,7 @@ declare module BABYLON {
         /**
          * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.
          */
-        engine: Nullable<Engine>;
+        engine: Nullable<ThinEngine>;
         /**
          * Defines the scene the texture belongs to. It is not mandatory if you define an engine.
          */
@@ -54649,7 +54680,7 @@ declare module BABYLON {
          * @param engine the engine to use for rendering
          * @param options defines the options of the effect renderer
          */
-        constructor(engine: Engine, options?: IEffectRendererOptions);
+        constructor(engine: ThinEngine, options?: IEffectRendererOptions);
         /**
          * Sets the current viewport in normalized coordinates 0-1
          * @param viewport Defines the viewport to set (defaults to 0 0 1 1)
@@ -54689,7 +54720,7 @@ declare module BABYLON {
         /**
          * Engine to use to create the effect
          */
-        engine: Engine;
+        engine: ThinEngine;
         /**
          * Fragment shader for the effect
          */

+ 2 - 2
Viewer/src/labs/texture.ts

@@ -1,6 +1,6 @@
 import { Scene } from "babylonjs/scene";
 import { CubeTexture } from "babylonjs/Materials/Textures/cubeTexture";
-import { InternalTexture } from "babylonjs/Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "babylonjs/Materials/Textures/internalTexture";
 import { Scalar } from "babylonjs/Maths/math.scalar";
 import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
 import { Texture } from "babylonjs/Materials/Textures/texture";
@@ -219,7 +219,7 @@ export class TextureUtils {
 
             babylonTexture.gammaSpace = false;
 
-            let internalTexture = new InternalTexture(scene.getEngine(), InternalTexture.DATASOURCE_CUBERAW);
+            let internalTexture = new InternalTexture(scene.getEngine(), InternalTextureSource.CubeRaw);
             let glTexture = internalTexture._webGLTexture;
             //babylon properties
             internalTexture.isCube = true;

+ 168 - 137
dist/preview release/babylon.d.ts

@@ -407,9 +407,28 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Interface used to define the mechanism to get data from the network
+     */
+    export interface IWebRequest {
+        /**
+         * Returns client's response url
+         */
+        responseURL: string;
+        /**
+         * Returns client's status
+         */
+        status: number;
+        /**
+         * Returns client's status as a text
+         */
+        statusText: string;
+    }
+}
+declare module BABYLON {
+    /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest {
+    export class WebRequest implements IWebRequest {
         private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
@@ -8338,6 +8357,20 @@ declare module BABYLON {
     };
 }
 declare module BABYLON {
+        interface ThinEngine {
+            /**
+             * Creates a new render target texture
+             * @param size defines the size of the texture
+             * @param options defines the options used to create the texture
+             * @returns a new render target texture stored in an InternalTexture
+             */
+            createRenderTargetTexture(size: number | {
+                width: number;
+                height: number;
+            }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        }
+}
+declare module BABYLON {
     /** Defines supported spaces */
     export enum Space {
         /** Local (object) space */
@@ -28811,86 +28844,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * This class is used to track a performance counter which is number based.
-     * The user has access to many properties which give statistics of different nature.
-     *
-     * The implementer can track two kinds of Performance Counter: time and count.
-     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
-     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
-     */
-    export class PerfCounter {
-        /**
-         * Gets or sets a global boolean to turn on and off all the counters
-         */
-        static Enabled: boolean;
-        /**
-         * Returns the smallest value ever
-         */
-        readonly min: number;
-        /**
-         * Returns the biggest value ever
-         */
-        readonly max: number;
-        /**
-         * Returns the average value since the performance counter is running
-         */
-        readonly average: number;
-        /**
-         * Returns the average value of the last second the counter was monitored
-         */
-        readonly lastSecAverage: number;
-        /**
-         * Returns the current value
-         */
-        readonly current: number;
-        /**
-         * Gets the accumulated total
-         */
-        readonly total: number;
-        /**
-         * Gets the total value count
-         */
-        readonly count: number;
-        /**
-         * Creates a new counter
-         */
-        constructor();
-        /**
-         * Call this method to start monitoring a new frame.
-         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
-         */
-        fetchNewFrame(): void;
-        /**
-         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
-         * @param newCount the count value to add to the monitored count
-         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
-         */
-        addCount(newCount: number, fetchResult: boolean): void;
-        /**
-         * Start monitoring this performance counter
-         */
-        beginMonitoring(): void;
-        /**
-         * Compute the time lapsed since the previous beginMonitoring() call.
-         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
-         */
-        endMonitoring(newFrame?: boolean): void;
-        private _fetchResult;
-        private _startMonitoringTime;
-        private _min;
-        private _max;
-        private _average;
-        private _current;
-        private _totalValueCount;
-        private _totalAccumulated;
-        private _lastSecAverage;
-        private _lastSecAccumulated;
-        private _lastSecTime;
-        private _lastSecValueCount;
-    }
-}
-declare module BABYLON {
-    /**
      * @hidden
      **/
     export class DepthCullingState {
@@ -29314,8 +29267,6 @@ declare module BABYLON {
         _caps: EngineCapabilities;
         private _isStencilEnable;
         protected _colorWrite: boolean;
-        /** @hidden */
-        _drawCalls: PerfCounter;
         private _glVersion;
         private _glRenderer;
         private _glVendor;
@@ -29378,7 +29329,7 @@ declare module BABYLON {
         /** @hidden */
         _currentRenderTarget: Nullable<InternalTexture>;
         private _uintIndicesCurrentlySet;
-        private _currentBoundBuffer;
+        protected _currentBoundBuffer: Nullable<WebGLBuffer>[];
         /** @hidden */
         protected _currentFramebuffer: Nullable<WebGLFramebuffer>;
         private _currentBufferPointers;
@@ -29620,13 +29571,6 @@ declare module BABYLON {
          */
         createDynamicVertexBuffer(data: DataArray): DataBuffer;
         /**
-         * Update a dynamic index buffer
-         * @param indexBuffer defines the target index buffer
-         * @param indices defines the data to update
-         * @param offset defines the offset in the target index buffer where update should start
-         */
-        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
-        /**
          * Updates a dynamic vertex buffer.
          * @param vertexBuffer the vertex buffer to update
          * @param data the data used to update the vertex buffer
@@ -29634,7 +29578,7 @@ declare module BABYLON {
          * @param byteLength the byte length of the data
          */
         updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
-        private _resetIndexBufferBinding;
+        protected _resetIndexBufferBinding(): void;
         /**
          * Creates a new index buffer
          * @param indices defines the content of the index buffer
@@ -29648,7 +29592,7 @@ declare module BABYLON {
          * @param buffer defines the buffer to bind
          */
         bindArrayBuffer(buffer: Nullable<DataBuffer>): void;
-        private bindIndexBuffer;
+        protected bindIndexBuffer(buffer: Nullable<DataBuffer>): void;
         private bindBuffer;
         /**
          * update the bound buffer with the given data
@@ -29770,6 +29714,8 @@ declare module BABYLON {
         drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
         private _drawMode;
         /** @hidden */
+        protected _reportDrawCall(): void;
+        /** @hidden */
         _releaseEffect(effect: Effect): void;
         /** @hidden */
         _deletePipelineContext(pipelineContext: IPipelineContext): void;
@@ -30127,13 +30073,6 @@ declare module BABYLON {
          * @returns The texture
          */
         private _createDepthStencilTexture;
-        /**
-         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
-         * @param renderTarget The render target to set the frame buffer for
-         */
-        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
-        /** @hidden */
-        _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
         /** @hidden */
         _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex?: number, lod?: number): void;
         /** @hidden */
@@ -30149,6 +30088,8 @@ declare module BABYLON {
         protected _prepareWebGLTextureContinuation(texture: InternalTexture, scene: Nullable<ISceneLike>, noMipmap: boolean, isCompressed: boolean, samplingMode: number): void;
         private _prepareWebGLTexture;
         /** @hidden */
+        _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
+        /** @hidden */
         _releaseFramebufferObjects(texture: InternalTexture): void;
         /** @hidden */
         _releaseTexture(texture: InternalTexture): void;
@@ -30232,7 +30173,7 @@ declare module BABYLON {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest;
         /**
          * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)
          * @returns true if the engine can be created
@@ -30276,64 +30217,69 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * Class used to store data associated with WebGL texture data for the engine
-     * This class should not be used directly
+     * Defines the source of the internal texture
      */
-    export class InternalTexture {
-        /** @hidden */
-        static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
+    export enum InternalTextureSource {
         /**
          * The source of the texture data is unknown
          */
-        static DATASOURCE_UNKNOWN: number;
+        Unknown = 0,
         /**
-         * Texture data comes from an URL
-         */
-        static DATASOURCE_URL: number;
+        * Texture data comes from an URL
+        */
+        Url = 1,
         /**
          * Texture data is only used for temporary storage
          */
-        static DATASOURCE_TEMP: number;
+        Temp = 2,
         /**
          * Texture data comes from raw data (ArrayBuffer)
          */
-        static DATASOURCE_RAW: number;
+        Raw = 3,
         /**
          * Texture content is dynamic (video or dynamic texture)
          */
-        static DATASOURCE_DYNAMIC: number;
+        Dynamic = 4,
         /**
          * Texture content is generated by rendering to it
          */
-        static DATASOURCE_RENDERTARGET: number;
+        RenderTarget = 5,
         /**
          * Texture content is part of a multi render target process
          */
-        static DATASOURCE_MULTIRENDERTARGET: number;
+        MultiRenderTarget = 6,
         /**
          * Texture data comes from a cube data file
          */
-        static DATASOURCE_CUBE: number;
+        Cube = 7,
         /**
          * Texture data comes from a raw cube data
          */
-        static DATASOURCE_CUBERAW: number;
+        CubeRaw = 8,
         /**
          * Texture data come from a prefiltered cube data file
          */
-        static DATASOURCE_CUBEPREFILTERED: number;
+        CubePrefiltered = 9,
         /**
          * Texture content is raw 3D data
          */
-        static DATASOURCE_RAW3D: number;
+        Raw3D = 10,
         /**
          * Texture content is a depth texture
          */
-        static DATASOURCE_DEPTHTEXTURE: number;
+        Depth = 11,
         /**
          * Texture data comes from a raw cube data encoded with RGBD
          */
-        static DATASOURCE_CUBERAW_RGBD: number;
+        CubeRawRGBD = 12
+    }
+    /**
+     * Class used to store data associated with WebGL texture data for the engine
+     * This class should not be used directly
+     */
+    export class InternalTexture {
+        /** @hidden */
+        static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
         /**
          * Defines if the texture is ready
          */
@@ -30411,7 +30357,7 @@ declare module BABYLON {
         /** @hidden */
         _associatedChannel: number;
         /** @hidden */
-        _dataSource: number;
+        _source: InternalTextureSource;
         /** @hidden */
         _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>;
         /** @hidden */
@@ -30493,16 +30439,16 @@ declare module BABYLON {
          */
         getEngine(): ThinEngine;
         /**
-         * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)
+         * Gets the data source type of the texture
          */
-        readonly dataSource: number;
+        readonly source: InternalTextureSource;
         /**
          * Creates a new InternalTexture
          * @param engine defines the engine to use
-         * @param dataSource defines the type of data that will be used
+         * @param source defines the type of data that will be used
          * @param delayAllocation if the texture allocation should be delayed (default: false)
          */
-        constructor(engine: ThinEngine, dataSource: number, delayAllocation?: boolean);
+        constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation?: boolean);
         /**
          * Increments the number of references (ie. the number of Texture that point to it)
          */
@@ -30981,6 +30927,86 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * This class is used to track a performance counter which is number based.
+     * The user has access to many properties which give statistics of different nature.
+     *
+     * The implementer can track two kinds of Performance Counter: time and count.
+     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
+     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
+     */
+    export class PerfCounter {
+        /**
+         * Gets or sets a global boolean to turn on and off all the counters
+         */
+        static Enabled: boolean;
+        /**
+         * Returns the smallest value ever
+         */
+        readonly min: number;
+        /**
+         * Returns the biggest value ever
+         */
+        readonly max: number;
+        /**
+         * Returns the average value since the performance counter is running
+         */
+        readonly average: number;
+        /**
+         * Returns the average value of the last second the counter was monitored
+         */
+        readonly lastSecAverage: number;
+        /**
+         * Returns the current value
+         */
+        readonly current: number;
+        /**
+         * Gets the accumulated total
+         */
+        readonly total: number;
+        /**
+         * Gets the total value count
+         */
+        readonly count: number;
+        /**
+         * Creates a new counter
+         */
+        constructor();
+        /**
+         * Call this method to start monitoring a new frame.
+         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
+         */
+        fetchNewFrame(): void;
+        /**
+         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
+         * @param newCount the count value to add to the monitored count
+         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
+         */
+        addCount(newCount: number, fetchResult: boolean): void;
+        /**
+         * Start monitoring this performance counter
+         */
+        beginMonitoring(): void;
+        /**
+         * Compute the time lapsed since the previous beginMonitoring() call.
+         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
+         */
+        endMonitoring(newFrame?: boolean): void;
+        private _fetchResult;
+        private _startMonitoringTime;
+        private _min;
+        private _max;
+        private _average;
+        private _current;
+        private _totalValueCount;
+        private _totalAccumulated;
+        private _lastSecAverage;
+        private _lastSecAccumulated;
+        private _lastSecTime;
+        private _lastSecValueCount;
+    }
+}
+declare module BABYLON {
+    /**
      * Defines the interface used by display changed events
      */
     export interface IDisplayChangedEventArgs {
@@ -31318,6 +31344,8 @@ declare module BABYLON {
         protected readonly _supportsHardwareTextureRescaling: boolean;
         private _fps;
         private _deltaTime;
+        /** @hidden */
+        _drawCalls: PerfCounter;
         /**
          * Turn this value on if you want to pause FPS computation when in background
          */
@@ -31618,6 +31646,7 @@ declare module BABYLON {
          * Disable previously set scissor test rectangle
          */
         disableScissor(): void;
+        protected _reportDrawCall(): void;
         /**
          * Initializes a webVR display and starts listening to display change events
          * The onVRDisplayChangedObservable will be notified upon these changes
@@ -31773,15 +31802,17 @@ declare module BABYLON {
         getDeltaTime(): number;
         private _measureFps;
         /**
-         * Creates a new render target texture
-         * @param size defines the size of the texture
-         * @param options defines the options used to create the texture
-         * @returns a new render target texture stored in an InternalTexture
+         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
+         * @param renderTarget The render target to set the frame buffer for
          */
-        createRenderTargetTexture(size: number | {
-            width: number;
-            height: number;
-        }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
+        /**
+         * Update a dynamic index buffer
+         * @param indexBuffer defines the target index buffer
+         * @param indices defines the data to update
+         * @param offset defines the offset in the target index buffer where update should start
+         */
+        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
         /**
          * Updates the sample count of a render target texture
          * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets
@@ -52425,7 +52456,7 @@ declare module BABYLON {
         /**
          * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.
          */
-        engine: Nullable<Engine>;
+        engine: Nullable<ThinEngine>;
         /**
          * Defines the scene the texture belongs to. It is not mandatory if you define an engine.
          */
@@ -55494,7 +55525,7 @@ declare module BABYLON {
          * @param engine the engine to use for rendering
          * @param options defines the options of the effect renderer
          */
-        constructor(engine: Engine, options?: IEffectRendererOptions);
+        constructor(engine: ThinEngine, options?: IEffectRendererOptions);
         /**
          * Sets the current viewport in normalized coordinates 0-1
          * @param viewport Defines the viewport to set (defaults to 0 0 1 1)
@@ -55534,7 +55565,7 @@ declare module BABYLON {
         /**
          * Engine to use to create the effect
          */
-        engine: Engine;
+        engine: ThinEngine;
         /**
          * Fragment shader for the effect
          */

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/babylon.js


Разлика између датотеке није приказан због своје велике величине
+ 712 - 643
dist/preview release/babylon.max.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/babylon.max.js.map


Разлика између датотеке није приказан због своје велике величине
+ 357 - 283
dist/preview release/babylon.module.d.ts


+ 168 - 137
dist/preview release/documentation.d.ts

@@ -407,9 +407,28 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Interface used to define the mechanism to get data from the network
+     */
+    export interface IWebRequest {
+        /**
+         * Returns client's response url
+         */
+        responseURL: string;
+        /**
+         * Returns client's status
+         */
+        status: number;
+        /**
+         * Returns client's status as a text
+         */
+        statusText: string;
+    }
+}
+declare module BABYLON {
+    /**
      * Extended version of XMLHttpRequest with support for customizations (headers, ...)
      */
-    export class WebRequest {
+    export class WebRequest implements IWebRequest {
         private _xhr;
         /**
          * Custom HTTP Request Headers to be sent with XMLHttpRequests
@@ -8338,6 +8357,20 @@ declare module BABYLON {
     };
 }
 declare module BABYLON {
+        interface ThinEngine {
+            /**
+             * Creates a new render target texture
+             * @param size defines the size of the texture
+             * @param options defines the options used to create the texture
+             * @returns a new render target texture stored in an InternalTexture
+             */
+            createRenderTargetTexture(size: number | {
+                width: number;
+                height: number;
+            }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        }
+}
+declare module BABYLON {
     /** Defines supported spaces */
     export enum Space {
         /** Local (object) space */
@@ -28811,86 +28844,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * This class is used to track a performance counter which is number based.
-     * The user has access to many properties which give statistics of different nature.
-     *
-     * The implementer can track two kinds of Performance Counter: time and count.
-     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
-     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
-     */
-    export class PerfCounter {
-        /**
-         * Gets or sets a global boolean to turn on and off all the counters
-         */
-        static Enabled: boolean;
-        /**
-         * Returns the smallest value ever
-         */
-        readonly min: number;
-        /**
-         * Returns the biggest value ever
-         */
-        readonly max: number;
-        /**
-         * Returns the average value since the performance counter is running
-         */
-        readonly average: number;
-        /**
-         * Returns the average value of the last second the counter was monitored
-         */
-        readonly lastSecAverage: number;
-        /**
-         * Returns the current value
-         */
-        readonly current: number;
-        /**
-         * Gets the accumulated total
-         */
-        readonly total: number;
-        /**
-         * Gets the total value count
-         */
-        readonly count: number;
-        /**
-         * Creates a new counter
-         */
-        constructor();
-        /**
-         * Call this method to start monitoring a new frame.
-         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
-         */
-        fetchNewFrame(): void;
-        /**
-         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
-         * @param newCount the count value to add to the monitored count
-         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
-         */
-        addCount(newCount: number, fetchResult: boolean): void;
-        /**
-         * Start monitoring this performance counter
-         */
-        beginMonitoring(): void;
-        /**
-         * Compute the time lapsed since the previous beginMonitoring() call.
-         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
-         */
-        endMonitoring(newFrame?: boolean): void;
-        private _fetchResult;
-        private _startMonitoringTime;
-        private _min;
-        private _max;
-        private _average;
-        private _current;
-        private _totalValueCount;
-        private _totalAccumulated;
-        private _lastSecAverage;
-        private _lastSecAccumulated;
-        private _lastSecTime;
-        private _lastSecValueCount;
-    }
-}
-declare module BABYLON {
-    /**
      * @hidden
      **/
     export class DepthCullingState {
@@ -29314,8 +29267,6 @@ declare module BABYLON {
         _caps: EngineCapabilities;
         private _isStencilEnable;
         protected _colorWrite: boolean;
-        /** @hidden */
-        _drawCalls: PerfCounter;
         private _glVersion;
         private _glRenderer;
         private _glVendor;
@@ -29378,7 +29329,7 @@ declare module BABYLON {
         /** @hidden */
         _currentRenderTarget: Nullable<InternalTexture>;
         private _uintIndicesCurrentlySet;
-        private _currentBoundBuffer;
+        protected _currentBoundBuffer: Nullable<WebGLBuffer>[];
         /** @hidden */
         protected _currentFramebuffer: Nullable<WebGLFramebuffer>;
         private _currentBufferPointers;
@@ -29620,13 +29571,6 @@ declare module BABYLON {
          */
         createDynamicVertexBuffer(data: DataArray): DataBuffer;
         /**
-         * Update a dynamic index buffer
-         * @param indexBuffer defines the target index buffer
-         * @param indices defines the data to update
-         * @param offset defines the offset in the target index buffer where update should start
-         */
-        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
-        /**
          * Updates a dynamic vertex buffer.
          * @param vertexBuffer the vertex buffer to update
          * @param data the data used to update the vertex buffer
@@ -29634,7 +29578,7 @@ declare module BABYLON {
          * @param byteLength the byte length of the data
          */
         updateDynamicVertexBuffer(vertexBuffer: DataBuffer, data: DataArray, byteOffset?: number, byteLength?: number): void;
-        private _resetIndexBufferBinding;
+        protected _resetIndexBufferBinding(): void;
         /**
          * Creates a new index buffer
          * @param indices defines the content of the index buffer
@@ -29648,7 +29592,7 @@ declare module BABYLON {
          * @param buffer defines the buffer to bind
          */
         bindArrayBuffer(buffer: Nullable<DataBuffer>): void;
-        private bindIndexBuffer;
+        protected bindIndexBuffer(buffer: Nullable<DataBuffer>): void;
         private bindBuffer;
         /**
          * update the bound buffer with the given data
@@ -29770,6 +29714,8 @@ declare module BABYLON {
         drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void;
         private _drawMode;
         /** @hidden */
+        protected _reportDrawCall(): void;
+        /** @hidden */
         _releaseEffect(effect: Effect): void;
         /** @hidden */
         _deletePipelineContext(pipelineContext: IPipelineContext): void;
@@ -30127,13 +30073,6 @@ declare module BABYLON {
          * @returns The texture
          */
         private _createDepthStencilTexture;
-        /**
-         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
-         * @param renderTarget The render target to set the frame buffer for
-         */
-        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
-        /** @hidden */
-        _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
         /** @hidden */
         _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex?: number, lod?: number): void;
         /** @hidden */
@@ -30149,6 +30088,8 @@ declare module BABYLON {
         protected _prepareWebGLTextureContinuation(texture: InternalTexture, scene: Nullable<ISceneLike>, noMipmap: boolean, isCompressed: boolean, samplingMode: number): void;
         private _prepareWebGLTexture;
         /** @hidden */
+        _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples?: number): Nullable<WebGLRenderbuffer>;
+        /** @hidden */
         _releaseFramebufferObjects(texture: InternalTexture): void;
         /** @hidden */
         _releaseTexture(texture: InternalTexture): void;
@@ -30232,7 +30173,7 @@ declare module BABYLON {
         /** @hidden */
         _getRGBAMultiSampleBufferFormat(type: number): number;
         /** @hidden */
-        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest;
+        _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest;
         /**
          * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)
          * @returns true if the engine can be created
@@ -30276,64 +30217,69 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * Class used to store data associated with WebGL texture data for the engine
-     * This class should not be used directly
+     * Defines the source of the internal texture
      */
-    export class InternalTexture {
-        /** @hidden */
-        static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
+    export enum InternalTextureSource {
         /**
          * The source of the texture data is unknown
          */
-        static DATASOURCE_UNKNOWN: number;
+        Unknown = 0,
         /**
-         * Texture data comes from an URL
-         */
-        static DATASOURCE_URL: number;
+        * Texture data comes from an URL
+        */
+        Url = 1,
         /**
          * Texture data is only used for temporary storage
          */
-        static DATASOURCE_TEMP: number;
+        Temp = 2,
         /**
          * Texture data comes from raw data (ArrayBuffer)
          */
-        static DATASOURCE_RAW: number;
+        Raw = 3,
         /**
          * Texture content is dynamic (video or dynamic texture)
          */
-        static DATASOURCE_DYNAMIC: number;
+        Dynamic = 4,
         /**
          * Texture content is generated by rendering to it
          */
-        static DATASOURCE_RENDERTARGET: number;
+        RenderTarget = 5,
         /**
          * Texture content is part of a multi render target process
          */
-        static DATASOURCE_MULTIRENDERTARGET: number;
+        MultiRenderTarget = 6,
         /**
          * Texture data comes from a cube data file
          */
-        static DATASOURCE_CUBE: number;
+        Cube = 7,
         /**
          * Texture data comes from a raw cube data
          */
-        static DATASOURCE_CUBERAW: number;
+        CubeRaw = 8,
         /**
          * Texture data come from a prefiltered cube data file
          */
-        static DATASOURCE_CUBEPREFILTERED: number;
+        CubePrefiltered = 9,
         /**
          * Texture content is raw 3D data
          */
-        static DATASOURCE_RAW3D: number;
+        Raw3D = 10,
         /**
          * Texture content is a depth texture
          */
-        static DATASOURCE_DEPTHTEXTURE: number;
+        Depth = 11,
         /**
          * Texture data comes from a raw cube data encoded with RGBD
          */
-        static DATASOURCE_CUBERAW_RGBD: number;
+        CubeRawRGBD = 12
+    }
+    /**
+     * Class used to store data associated with WebGL texture data for the engine
+     * This class should not be used directly
+     */
+    export class InternalTexture {
+        /** @hidden */
+        static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number) => Promise<void>;
         /**
          * Defines if the texture is ready
          */
@@ -30411,7 +30357,7 @@ declare module BABYLON {
         /** @hidden */
         _associatedChannel: number;
         /** @hidden */
-        _dataSource: number;
+        _source: InternalTextureSource;
         /** @hidden */
         _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>;
         /** @hidden */
@@ -30493,16 +30439,16 @@ declare module BABYLON {
          */
         getEngine(): ThinEngine;
         /**
-         * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)
+         * Gets the data source type of the texture
          */
-        readonly dataSource: number;
+        readonly source: InternalTextureSource;
         /**
          * Creates a new InternalTexture
          * @param engine defines the engine to use
-         * @param dataSource defines the type of data that will be used
+         * @param source defines the type of data that will be used
          * @param delayAllocation if the texture allocation should be delayed (default: false)
          */
-        constructor(engine: ThinEngine, dataSource: number, delayAllocation?: boolean);
+        constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation?: boolean);
         /**
          * Increments the number of references (ie. the number of Texture that point to it)
          */
@@ -30981,6 +30927,86 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * This class is used to track a performance counter which is number based.
+     * The user has access to many properties which give statistics of different nature.
+     *
+     * The implementer can track two kinds of Performance Counter: time and count.
+     * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.
+     * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.
+     */
+    export class PerfCounter {
+        /**
+         * Gets or sets a global boolean to turn on and off all the counters
+         */
+        static Enabled: boolean;
+        /**
+         * Returns the smallest value ever
+         */
+        readonly min: number;
+        /**
+         * Returns the biggest value ever
+         */
+        readonly max: number;
+        /**
+         * Returns the average value since the performance counter is running
+         */
+        readonly average: number;
+        /**
+         * Returns the average value of the last second the counter was monitored
+         */
+        readonly lastSecAverage: number;
+        /**
+         * Returns the current value
+         */
+        readonly current: number;
+        /**
+         * Gets the accumulated total
+         */
+        readonly total: number;
+        /**
+         * Gets the total value count
+         */
+        readonly count: number;
+        /**
+         * Creates a new counter
+         */
+        constructor();
+        /**
+         * Call this method to start monitoring a new frame.
+         * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.
+         */
+        fetchNewFrame(): void;
+        /**
+         * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)
+         * @param newCount the count value to add to the monitored count
+         * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.
+         */
+        addCount(newCount: number, fetchResult: boolean): void;
+        /**
+         * Start monitoring this performance counter
+         */
+        beginMonitoring(): void;
+        /**
+         * Compute the time lapsed since the previous beginMonitoring() call.
+         * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter
+         */
+        endMonitoring(newFrame?: boolean): void;
+        private _fetchResult;
+        private _startMonitoringTime;
+        private _min;
+        private _max;
+        private _average;
+        private _current;
+        private _totalValueCount;
+        private _totalAccumulated;
+        private _lastSecAverage;
+        private _lastSecAccumulated;
+        private _lastSecTime;
+        private _lastSecValueCount;
+    }
+}
+declare module BABYLON {
+    /**
      * Defines the interface used by display changed events
      */
     export interface IDisplayChangedEventArgs {
@@ -31318,6 +31344,8 @@ declare module BABYLON {
         protected readonly _supportsHardwareTextureRescaling: boolean;
         private _fps;
         private _deltaTime;
+        /** @hidden */
+        _drawCalls: PerfCounter;
         /**
          * Turn this value on if you want to pause FPS computation when in background
          */
@@ -31618,6 +31646,7 @@ declare module BABYLON {
          * Disable previously set scissor test rectangle
          */
         disableScissor(): void;
+        protected _reportDrawCall(): void;
         /**
          * Initializes a webVR display and starts listening to display change events
          * The onVRDisplayChangedObservable will be notified upon these changes
@@ -31773,15 +31802,17 @@ declare module BABYLON {
         getDeltaTime(): number;
         private _measureFps;
         /**
-         * Creates a new render target texture
-         * @param size defines the size of the texture
-         * @param options defines the options used to create the texture
-         * @returns a new render target texture stored in an InternalTexture
+         * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
+         * @param renderTarget The render target to set the frame buffer for
          */
-        createRenderTargetTexture(size: number | {
-            width: number;
-            height: number;
-        }, options: boolean | RenderTargetCreationOptions): InternalTexture;
+        setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void;
+        /**
+         * Update a dynamic index buffer
+         * @param indexBuffer defines the target index buffer
+         * @param indices defines the data to update
+         * @param offset defines the offset in the target index buffer where update should start
+         */
+        updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset?: number): void;
         /**
          * Updates the sample count of a render target texture
          * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets
@@ -52425,7 +52456,7 @@ declare module BABYLON {
         /**
          * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.
          */
-        engine: Nullable<Engine>;
+        engine: Nullable<ThinEngine>;
         /**
          * Defines the scene the texture belongs to. It is not mandatory if you define an engine.
          */
@@ -55494,7 +55525,7 @@ declare module BABYLON {
          * @param engine the engine to use for rendering
          * @param options defines the options of the effect renderer
          */
-        constructor(engine: Engine, options?: IEffectRendererOptions);
+        constructor(engine: ThinEngine, options?: IEffectRendererOptions);
         /**
          * Sets the current viewport in normalized coordinates 0-1
          * @param viewport Defines the viewport to set (defaults to 0 0 1 1)
@@ -55534,7 +55565,7 @@ declare module BABYLON {
         /**
          * Engine to use to create the effect
          */
-        engine: Engine;
+        engine: ThinEngine;
         /**
          * Fragment shader for the effect
          */

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.max.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.max.js.map


+ 34 - 32
dist/preview release/nodeEditor/babylon.nodeEditor.d.ts

@@ -402,16 +402,50 @@ declare module NODEEDITOR {
     }
 }
 declare module NODEEDITOR {
+    class ListLineOption {
+        label: string;
+        value: number | string;
+    }
+    interface IOptionsLineComponentProps {
+        label: string;
+        target: any;
+        className?: string;
+        propertyName?: string;
+        options: ListLineOption[];
+        noDirectUpdate?: boolean;
+        onSelect?: (value: number | string) => void;
+        onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
+        valuesAreStrings?: boolean;
+        defaultIfNull?: number;
+        getSelection?: (target: any) => number;
+    }
+    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
+        value: number | string;
+    }> {
+        private _localChange;
+        private _getValue;
+        constructor(props: IOptionsLineComponentProps);
+        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
+            value: number;
+        }): boolean;
+        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
+        updateValue(valueString: string): void;
+        render(): JSX.Element;
+    }
+}
+declare module NODEEDITOR {
     interface ITexturePropertyTabComponentProps {
         globalState: GlobalState;
         node: TextureNodeModel | ReflectionTextureNodeModel;
     }
     export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps, {
         isEmbedded: boolean;
+        loadAsCubeTexture: boolean;
     }> {
         constructor(props: ITexturePropertyTabComponentProps);
         UNSAFE_componentWillUpdate(nextProps: ITexturePropertyTabComponentProps, nextState: {
             isEmbedded: boolean;
+            loadAsCubeTexture: boolean;
         }): void;
         private _generateRandomForCache;
         updateAfterTextureLoad(): void;
@@ -616,38 +650,6 @@ declare module NODEEDITOR {
     }
 }
 declare module NODEEDITOR {
-    class ListLineOption {
-        label: string;
-        value: number | string;
-    }
-    interface IOptionsLineComponentProps {
-        label: string;
-        target: any;
-        className?: string;
-        propertyName?: string;
-        options: ListLineOption[];
-        noDirectUpdate?: boolean;
-        onSelect?: (value: number | string) => void;
-        onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
-        valuesAreStrings?: boolean;
-        defaultIfNull?: number;
-        getSelection?: (target: any) => number;
-    }
-    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
-        value: number | string;
-    }> {
-        private _localChange;
-        private _getValue;
-        constructor(props: IOptionsLineComponentProps);
-        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
-            value: number;
-        }): boolean;
-        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
-        updateValue(valueString: string): void;
-        render(): JSX.Element;
-    }
-}
-declare module NODEEDITOR {
     export interface IColor3LineComponentProps {
         label: string;
         target: any;

Разлика између датотеке није приказан због своје велике величине
+ 7 - 7
dist/preview release/nodeEditor/babylon.nodeEditor.js


Разлика између датотеке није приказан због своје велике величине
+ 92 - 49
dist/preview release/nodeEditor/babylon.nodeEditor.max.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map


+ 71 - 67
dist/preview release/nodeEditor/babylon.nodeEditor.module.d.ts

@@ -511,6 +511,41 @@ declare module "babylonjs-node-editor/components/diagram/reflectionTexture/refle
         prepare(options: NodeCreationOptions, nodes: Array<DefaultNodeModel>, model: DiagramModel, graphEditor: GraphEditor): void;
     }
 }
+declare module "babylonjs-node-editor/sharedComponents/optionsLineComponent" {
+    import * as React from "react";
+    import { Observable } from "babylonjs/Misc/observable";
+    import { PropertyChangedEvent } from "babylonjs-node-editor/sharedComponents/propertyChangedEvent";
+    class ListLineOption {
+        label: string;
+        value: number | string;
+    }
+    interface IOptionsLineComponentProps {
+        label: string;
+        target: any;
+        className?: string;
+        propertyName?: string;
+        options: ListLineOption[];
+        noDirectUpdate?: boolean;
+        onSelect?: (value: number | string) => void;
+        onPropertyChangedObservable?: Observable<PropertyChangedEvent>;
+        valuesAreStrings?: boolean;
+        defaultIfNull?: number;
+        getSelection?: (target: any) => number;
+    }
+    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
+        value: number | string;
+    }> {
+        private _localChange;
+        private _getValue;
+        constructor(props: IOptionsLineComponentProps);
+        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
+            value: number;
+        }): boolean;
+        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
+        updateValue(valueString: string): void;
+        render(): JSX.Element;
+    }
+}
 declare module "babylonjs-node-editor/components/diagram/texture/texturePropertyTabComponent" {
     import * as React from "react";
     import { GlobalState } from "babylonjs-node-editor/globalState";
@@ -522,10 +557,12 @@ declare module "babylonjs-node-editor/components/diagram/texture/textureProperty
     }
     export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps, {
         isEmbedded: boolean;
+        loadAsCubeTexture: boolean;
     }> {
         constructor(props: ITexturePropertyTabComponentProps);
         UNSAFE_componentWillUpdate(nextProps: ITexturePropertyTabComponentProps, nextState: {
             isEmbedded: boolean;
+            loadAsCubeTexture: boolean;
         }): void;
         private _generateRandomForCache;
         updateAfterTextureLoad(): void;
@@ -759,41 +796,6 @@ declare module "babylonjs-node-editor/components/propertyTab/properties/vector3P
         render(): JSX.Element;
     }
 }
-declare module "babylonjs-node-editor/sharedComponents/optionsLineComponent" {
-    import * as React from "react";
-    import { Observable } from "babylonjs/Misc/observable";
-    import { PropertyChangedEvent } from "babylonjs-node-editor/sharedComponents/propertyChangedEvent";
-    class ListLineOption {
-        label: string;
-        value: number | string;
-    }
-    interface IOptionsLineComponentProps {
-        label: string;
-        target: any;
-        className?: string;
-        propertyName?: string;
-        options: ListLineOption[];
-        noDirectUpdate?: boolean;
-        onSelect?: (value: number | string) => void;
-        onPropertyChangedObservable?: Observable<PropertyChangedEvent>;
-        valuesAreStrings?: boolean;
-        defaultIfNull?: number;
-        getSelection?: (target: any) => number;
-    }
-    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
-        value: number | string;
-    }> {
-        private _localChange;
-        private _getValue;
-        constructor(props: IOptionsLineComponentProps);
-        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
-            value: number;
-        }): boolean;
-        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
-        updateValue(valueString: string): void;
-        render(): JSX.Element;
-    }
-}
 declare module "babylonjs-node-editor/sharedComponents/color3LineComponent" {
     import * as React from "react";
     import { Observable } from "babylonjs/Misc/observable";
@@ -2238,16 +2240,50 @@ declare module NODEEDITOR {
     }
 }
 declare module NODEEDITOR {
+    class ListLineOption {
+        label: string;
+        value: number | string;
+    }
+    interface IOptionsLineComponentProps {
+        label: string;
+        target: any;
+        className?: string;
+        propertyName?: string;
+        options: ListLineOption[];
+        noDirectUpdate?: boolean;
+        onSelect?: (value: number | string) => void;
+        onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
+        valuesAreStrings?: boolean;
+        defaultIfNull?: number;
+        getSelection?: (target: any) => number;
+    }
+    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
+        value: number | string;
+    }> {
+        private _localChange;
+        private _getValue;
+        constructor(props: IOptionsLineComponentProps);
+        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
+            value: number;
+        }): boolean;
+        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
+        updateValue(valueString: string): void;
+        render(): JSX.Element;
+    }
+}
+declare module NODEEDITOR {
     interface ITexturePropertyTabComponentProps {
         globalState: GlobalState;
         node: TextureNodeModel | ReflectionTextureNodeModel;
     }
     export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps, {
         isEmbedded: boolean;
+        loadAsCubeTexture: boolean;
     }> {
         constructor(props: ITexturePropertyTabComponentProps);
         UNSAFE_componentWillUpdate(nextProps: ITexturePropertyTabComponentProps, nextState: {
             isEmbedded: boolean;
+            loadAsCubeTexture: boolean;
         }): void;
         private _generateRandomForCache;
         updateAfterTextureLoad(): void;
@@ -2452,38 +2488,6 @@ declare module NODEEDITOR {
     }
 }
 declare module NODEEDITOR {
-    class ListLineOption {
-        label: string;
-        value: number | string;
-    }
-    interface IOptionsLineComponentProps {
-        label: string;
-        target: any;
-        className?: string;
-        propertyName?: string;
-        options: ListLineOption[];
-        noDirectUpdate?: boolean;
-        onSelect?: (value: number | string) => void;
-        onPropertyChangedObservable?: BABYLON.Observable<PropertyChangedEvent>;
-        valuesAreStrings?: boolean;
-        defaultIfNull?: number;
-        getSelection?: (target: any) => number;
-    }
-    export class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
-        value: number | string;
-    }> {
-        private _localChange;
-        private _getValue;
-        constructor(props: IOptionsLineComponentProps);
-        shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
-            value: number;
-        }): boolean;
-        raiseOnPropertyChanged(newValue: number | string, previousValue: number | string): void;
-        updateValue(valueString: string): void;
-        render(): JSX.Element;
-    }
-}
-declare module NODEEDITOR {
     export interface IColor3LineComponentProps {
         label: string;
         target: any;

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"thinEngineOnly":130582,"engineOnly":166444,"sceneOnly":510325,"minGridMaterial":640570,"minStandardMaterial":771729}
+{"thinEngineOnly":126863,"engineOnly":163772,"sceneOnly":507659,"minGridMaterial":638123,"minStandardMaterial":769282}

Разлика између датотеке није приказан због своје велике величине
+ 357 - 283
dist/preview release/viewer/babylon.module.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 93 - 89
dist/preview release/viewer/babylon.viewer.js


Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 0
dist/preview release/what's new.md

@@ -151,6 +151,7 @@
 - Fixed `CubeTexture` to keep custom `filesList` when serializing/parsing ([julien-moreau](https://github.com/julien-moreau))
 - Fixed `StandardRenderingPipeline` to properly dispose post-processes from attached cameras ([julien-moreau](https://github.com/julien-moreau))
 - Fixed `VolumetricLightScattering` post-process to use a custom vertex shader instead of the depth vertex shader. ([julien-moreau](https://github.com/julien-moreau))
+- Fixed missing check in sceneTreeItemComponent resulting in gizmo to not end drag ([CedricGuillemet](https://github.com/CedricGuillemet))
 - Added missing callback triggers within texture loaders ([PierreLeBlond](https://github.com/PierreLeBlond))
 - Fixed `TextureLinkLineComponent` to no longer invert inspector-loaded textures ([Drigax](https://github.com/drigax))
 

+ 1 - 1
inspector/src/components/sceneExplorer/entities/sceneTreeItemComponent.tsx

@@ -230,7 +230,7 @@ export class SceneTreeItemComponent extends React.Component<ISceneTreeItemCompon
                     if (!this._posDragEnd) {
                         // Record movement for generating replay code
                         this._posDragEnd = manager.gizmos.positionGizmo!.onDragEndObservable.add(() => {
-                            if (manager.gizmos.positionGizmo && manager.gizmos.positionGizmo.attachedMesh) {
+                            if (manager.gizmos.positionGizmo && manager.gizmos.positionGizmo.attachedMesh && manager.gizmos.positionGizmo.attachedMesh.reservedDataStore) {
                                 var lightGizmo: Nullable<LightGizmo> = manager.gizmos.positionGizmo.attachedMesh.reservedDataStore.lightGizmo;
                                 var obj: any = (lightGizmo && lightGizmo.light) ? lightGizmo.light : manager.gizmos.positionGizmo.attachedMesh;
 

+ 4 - 0
inspector/src/components/sceneExplorer/sceneExplorer.scss

@@ -125,6 +125,10 @@
             color:white;    
         }
 
+        input::placeholder {
+            color: lightgray;
+        }
+
         input:focus  {
             box-shadow: none;
             outline: none;

+ 1 - 1
nodeEditor/src/components/diagram/input/inputNodePropertyComponent.tsx

@@ -51,7 +51,7 @@ export class InputPropertyTabComponentProps extends React.Component<IInputProper
                         }        
                         {
                             !cantDisplaySlider &&
-                            <SliderLineComponent label="Value" target={inputBlock} propertyName="value" step={0.1} minimum={inputBlock.min} maximum={inputBlock.max} onChange={() => {
+                            <SliderLineComponent label="Value" target={inputBlock} propertyName="value" step={(inputBlock.max - inputBlock.min) / 100.0} minimum={inputBlock.min} maximum={inputBlock.max} onChange={() => {
                                 this.props.globalState.onUpdateRequiredObservable.notifyObservers();
                             }}/>
                         }

+ 67 - 17
nodeEditor/src/components/diagram/texture/texturePropertyTabComponent.tsx

@@ -15,27 +15,29 @@ import { FloatLineComponent } from '../../../sharedComponents/floatLineComponent
 import { ButtonLineComponent } from '../../../sharedComponents/buttonLineComponent';
 import { ReflectionTextureNodeModel } from '../reflectionTexture/reflectionTextureNodeModel';
 import { CubeTexture } from 'babylonjs/Materials/Textures/cubeTexture';
+import { OptionsLineComponent } from '../../../sharedComponents/optionsLineComponent';
 
 interface ITexturePropertyTabComponentProps {
     globalState: GlobalState;
     node: TextureNodeModel | ReflectionTextureNodeModel;
 }
 
-export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps, {isEmbedded: boolean}> {
+export class TexturePropertyTabComponent extends React.Component<ITexturePropertyTabComponentProps, {isEmbedded: boolean, loadAsCubeTexture: boolean}> {
 
     constructor(props: ITexturePropertyTabComponentProps) {
         super(props);
 
         let texture = this.props.node.texture as BaseTexture;
 
-        this.state = {isEmbedded: !texture || texture.name.substring(0, 4) !== "http"};
+        this.state = {isEmbedded: !texture || texture.name.substring(0, 4) !== "http", loadAsCubeTexture: texture && texture.isCube};
     }
 
-    UNSAFE_componentWillUpdate(nextProps: ITexturePropertyTabComponentProps, nextState: {isEmbedded: boolean}) {
+    UNSAFE_componentWillUpdate(nextProps: ITexturePropertyTabComponentProps, nextState: {isEmbedded: boolean, loadAsCubeTexture: boolean}) {
         if (nextProps.node !== this.props.node) {
             let texture = nextProps.node.texture as BaseTexture;
 
             nextState.isEmbedded = !texture || texture.name.substring(0, 4) !== "http";
+            nextState.loadAsCubeTexture = texture && texture.isCube;
         }
     }
 
@@ -50,6 +52,7 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
     updateAfterTextureLoad() {
         this.props.globalState.onUpdateRequiredObservable.notifyObservers();
         this.props.globalState.onRebuildRequiredObservable.notifyObservers();
+        this.forceUpdate();
     }
 
 	/**
@@ -62,11 +65,18 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
         }
 
         let texture = this.props.node.texture as BaseTexture;
+
+        if (texture && texture.isCube !== this.state.loadAsCubeTexture) {
+            texture.dispose();
+            (texture as any) = null;
+        }
+
         if (!texture) {
 
-            if (this.props.node instanceof TextureNodeModel) {
+            if (!this.state.loadAsCubeTexture) {
                 this.props.node.texture = new Texture(null, this.props.globalState.nodeMaterial.getScene(), false, false);
                 texture = this.props.node.texture;
+                texture.coordinatesMode = Texture.EQUIRECTANGULAR_MODE;
             } else {
                 this.props.node.texture = new CubeTexture("", this.props.globalState.nodeMaterial.getScene());
                 texture = this.props.node.texture;
@@ -82,18 +92,14 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
             reader.onloadend = () => {
                 let base64data = reader.result as string;                
 
-                if (texture.isCube || this.props.node instanceof ReflectionTextureNodeModel) {
-                    let extension: string | undefined = undefined;
-                    if (file.name.toLowerCase().indexOf(".dds") > 0) {
-                        extension = ".dds";
-                    } else if (file.name.toLowerCase().indexOf(".env") > 0) {
-                        extension = ".env";
-                    }
-
-                    (texture as Texture).updateURL(base64data, extension, () => this.updateAfterTextureLoad());
-                } else {
-                    (texture as Texture).updateURL(base64data, null, () => this.updateAfterTextureLoad());
+                let extension: string | undefined = undefined;
+                if (file.name.toLowerCase().indexOf(".dds") > 0) {
+                    extension = ".dds";
+                } else if (file.name.toLowerCase().indexOf(".env") > 0) {
+                    extension = ".env";
                 }
+
+                (texture as Texture).updateURL(base64data, extension, () => this.updateAfterTextureLoad());
             }
         }, undefined, true);
     }
@@ -132,17 +138,56 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
         url = url.replace(/\?nocache=\d+/, "");
 
         let isInReflectionMode = this.props.node instanceof ReflectionTextureNodeModel;
+
+        var reflectionModeOptions: {label: string, value: number}[] = [
+            {
+                label: "Cubic", value: Texture.CUBIC_MODE
+            },
+            {                
+                label: "Equirectangular", value: Texture.EQUIRECTANGULAR_MODE
+            },
+            {
+                label: "Explicit", value: Texture.EXPLICIT_MODE
+            },
+            {
+                label: "Fixed equirectangular", value: Texture.FIXED_EQUIRECTANGULAR_MODE
+            },
+            {
+                label: "Fixed mirrored equirectangular", value: Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE
+            },
+            {
+                label: "Planar", value: Texture.PLANAR_MODE
+            },              
+            {
+                label: "Projection", value: Texture.PROJECTION_MODE
+            },         
+            {
+                label: "Skybox", value: Texture.SKYBOX_MODE
+            },         
+            {
+                label: "Spherical", value: Texture.SPHERICAL_MODE
+            },
+        ];
         
         return (
             <div>
                 <LineContainerComponent title="GENERAL">
-                    <TextLineComponent label="Type" value="Texture" />
+                    <TextLineComponent label="Type" value={this.props.node.block!.getClassName()} />
                     <TextInputLineComponent globalState={this.props.globalState} label="Name" propertyName="name" target={this.props.node.block!} onChange={() => this.props.globalState.onUpdateRequiredObservable.notifyObservers()} />
                 </LineContainerComponent>
                 <LineContainerComponent title="PROPERTIES">
                     <CheckBoxLineComponent label="Auto select UV" propertyName="autoSelectUV" target={this.props.node.block!} onValueChanged={() => {                        
                         this.props.globalState.onUpdateRequiredObservable.notifyObservers();
-                    }}/> {
+                    }}/> 
+                    {
+                        texture && isInReflectionMode &&
+                        <OptionsLineComponent label="Reflection mode" options={reflectionModeOptions} target={texture} propertyName="coordinatesMode" onSelect={(value: any) => {
+                            texture.coordinatesMode = value;
+                            this.forceUpdate();
+                            this.props.globalState.onUpdateRequiredObservable.notifyObservers();
+                        }} />
+                    }                    
+                    {
                         texture && !isInReflectionMode &&
                         <CheckBoxLineComponent label="Gamma space" propertyName="gammaSpace" target={texture} onValueChanged={() => {                        
                             this.props.globalState.onUpdateRequiredObservable.notifyObservers();
@@ -224,6 +269,11 @@ export class TexturePropertyTabComponent extends React.Component<ITexturePropert
                         this.updateAfterTextureLoad();
                     }}/>
                     {
+                        isInReflectionMode &&
+                        <CheckBoxLineComponent label="Load as cube texture" isSelected={() => this.state.loadAsCubeTexture} 
+                            onSelect={value => this.setState({loadAsCubeTexture: value})}/> 
+                    }
+                    {
                         this.state.isEmbedded &&
                         <FileButtonLineComponent label="Upload" onClick={(file) => this.replaceTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
                     }

+ 4 - 1
nodeEditor/src/components/preview/previewManager.ts

@@ -178,7 +178,10 @@ export class PreviewManager {
         
             switch (this._globalState.previewMeshType) {
                 case PreviewMeshType.Box:
-                    this._meshes.push(Mesh.CreateBox("dummy-box", 2, this._scene));
+                    SceneLoader.AppendAsync("https://models.babylonjs.com/", "roundedCube.glb", this._scene).then(() => {     
+                        this._meshes.push(...this._scene.meshes);
+                        this._prepareMeshes();
+                    });     
                     break;
                 case PreviewMeshType.Sphere:
                     this._meshes.push(Mesh.CreateSphere("dummy-sphere", 32, 2, this._scene));

+ 3 - 2
nodeEditor/src/components/propertyTab/propertyTab.scss

@@ -212,8 +212,9 @@
         display: grid;
         grid-template-rows: 100%;
         grid-template-columns: 30px 30px 40px auto 20px 5px;
-        margin-top: 5px;
-        margin-left: 5px;
+        padding-top: 5px;
+        padding-left: 5px;
+        padding-bottom: 5px;
 
         .step {
             grid-row: 1;

+ 6 - 3
nodeEditor/src/sharedComponents/floatLineComponent.tsx

@@ -23,7 +23,7 @@ export class FloatLineComponent extends React.Component<IFloatLineComponentProps
         super(props);
 
         let currentValue = this.props.target[this.props.propertyName];
-        this.state = { value: currentValue ? (this.props.isInteger ? currentValue.toFixed(0) : currentValue.toFixed(this.props.digits || 3)) : "0" };
+        this.state = { value: currentValue ? (this.props.isInteger ? currentValue.toFixed(0) : currentValue.toFixed(this.props.digits || 2)) : "0" };
         this._store = currentValue;
     }
 
@@ -34,7 +34,7 @@ export class FloatLineComponent extends React.Component<IFloatLineComponentProps
         }
 
         const newValue = nextProps.target[nextProps.propertyName];
-        const newValueString = newValue ? this.props.isInteger ? newValue.toFixed(0) : newValue.toFixed(this.props.digits || 3) : "0";
+        const newValueString = newValue ? this.props.isInteger ? newValue.toFixed(0) : newValue.toFixed(this.props.digits || 2) : "0";
 
         if (newValueString !== nextState.value) {
             nextState.value = newValueString;
@@ -65,6 +65,8 @@ export class FloatLineComponent extends React.Component<IFloatLineComponentProps
             return;
         }
 
+        valueString = valueString.replace(/(.+\...).+/, "$1");
+
         let valueAsNumber: number;
 
         if (this.props.isInteger) {
@@ -73,8 +75,9 @@ export class FloatLineComponent extends React.Component<IFloatLineComponentProps
             valueAsNumber = parseFloat(valueString);
         }
 
+
         this._localChange = true;
-        this.setState({ value: valueString });
+        this.setState({ value: valueString});
 
         if (isNaN(valueAsNumber)) {
             return;

+ 2 - 2
src/Cameras/XR/webXRSessionManager.ts

@@ -2,7 +2,7 @@ import { Logger } from "../../Misc/logger";
 import { Observable } from "../../Misc/observable";
 import { Nullable } from "../../types";
 import { IDisposable, Scene } from "../../scene";
-import { InternalTexture } from "../../Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "../../Materials/Textures/internalTexture";
 import { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture";
 /**
  * Manages an XRSession to work with Babylon's engine
@@ -173,7 +173,7 @@ export class WebXRSessionManager implements IDisposable {
             throw "no layer";
         }
         // Create internal texture
-        var internalTexture = new InternalTexture(scene.getEngine(), InternalTexture.DATASOURCE_UNKNOWN, true);
+        var internalTexture = new InternalTexture(scene.getEngine(), InternalTextureSource.Unknown, true);
         internalTexture.width = baseLayer.framebufferWidth;
         internalTexture.height = baseLayer.framebufferHeight;
         internalTexture._framebuffer = baseLayer.framebuffer;

+ 8 - 7
src/Engines/Extensions/engine.cubeTexture.ts

@@ -1,12 +1,12 @@
 import { ThinEngine } from "../../Engines/thinEngine";
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { Logger } from '../../Misc/logger';
 import { Nullable } from '../../types';
 import { Scene } from '../../scene';
 import { IInternalTextureLoader } from '../../Materials/Textures/internalTextureLoader';
-import { WebRequest } from '../../Misc/webRequest';
 import { FileTools } from '../../Misc/fileTools';
 import { DepthTextureCreationOptions } from '../depthTextureCreationOptions';
+import { IWebRequest } from '../../Misc/interfaces/iWebRequest';
 
 declare module "../../Engines/thinEngine" {
     export interface ThinEngine {
@@ -90,7 +90,7 @@ declare module "../../Engines/thinEngine" {
 }
 
 ThinEngine.prototype._createDepthStencilCubeTexture = function(size: number, options: DepthTextureCreationOptions): InternalTexture {
-    var internalTexture = new InternalTexture(this, InternalTexture.DATASOURCE_UNKNOWN);
+    var internalTexture = new InternalTexture(this, InternalTextureSource.Unknown);
     internalTexture.isCube = true;
 
     if (this.webGLVersion === 1) {
@@ -125,7 +125,8 @@ ThinEngine.prototype._createDepthStencilCubeTexture = function(size: number, opt
     return internalTexture;
 };
 
-ThinEngine.prototype._partialLoadFile = function(url: string, index: number, loadedFiles: (string | ArrayBuffer)[], onfinish: (files: (string | ArrayBuffer)[]) => void, onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null): void {
+ThinEngine.prototype._partialLoadFile = function(url: string, index: number, loadedFiles: (string | ArrayBuffer)[],
+        onfinish: (files: (string | ArrayBuffer)[]) => void, onErrorCallBack: Nullable<(message?: string, exception?: any) => void> = null): void {
     var onload = (data: string | ArrayBuffer) => {
         loadedFiles[index] = data;
         (<any>loadedFiles)._internalCount++;
@@ -135,7 +136,7 @@ ThinEngine.prototype._partialLoadFile = function(url: string, index: number, loa
         }
     };
 
-    const onerror = (request?: WebRequest, exception?: any) => {
+    const onerror = (request?: IWebRequest, exception?: any) => {
         if (onErrorCallBack && request) {
             onErrorCallBack(request.status + " " + request.statusText, exception);
         }
@@ -201,7 +202,7 @@ ThinEngine.prototype._partialLoadImg = function(url: string, index: number, load
 ThinEngine.prototype.createCubeTexture = function(rootUrl: string, scene: Nullable<Scene>, files: Nullable<string[]>, noMipmap?: boolean, onLoad: Nullable<(data?: any) => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format?: number, forcedExtension: any = null, createPolynomials: boolean = false, lodScale: number = 0, lodOffset: number = 0, fallback: Nullable<InternalTexture> = null, excludeLoaders: Array<IInternalTextureLoader> = []): InternalTexture {
     var gl = this._gl;
 
-    var texture = fallback ? fallback : new InternalTexture(this, InternalTexture.DATASOURCE_CUBE);
+    var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);
     texture.isCube = true;
     texture.url = rootUrl;
     texture.generateMipMaps = !noMipmap;
@@ -224,7 +225,7 @@ ThinEngine.prototype.createCubeTexture = function(rootUrl: string, scene: Nullab
         }
     }
 
-    let onInternalError = (request?: WebRequest, exception?: any) => {
+    let onInternalError = (request?: IWebRequest, exception?: any) => {
         if (loader) {
             const fallbackUrl = loader.getFallbackTextureUrl(texture.url, this._textureFormatInUse);
             Logger.Warn((loader.constructor as any).name + " failed when trying to load " + texture.url + ", falling back to the next supported loader");

+ 2 - 2
src/Engines/Extensions/engine.dynamicTexture.ts

@@ -1,5 +1,5 @@
 import { ThinEngine } from "../../Engines/thinEngine";
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { Nullable } from '../../types';
 
 declare module "../../Engines/thinEngine" {
@@ -28,7 +28,7 @@ declare module "../../Engines/thinEngine" {
 }
 
 ThinEngine.prototype.createDynamicTexture = function(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture {
-    var texture = new InternalTexture(this, InternalTexture.DATASOURCE_DYNAMIC);
+    var texture = new InternalTexture(this, InternalTextureSource.Dynamic);
     texture.baseWidth = width;
     texture.baseHeight = height;
 

+ 3 - 3
src/Engines/Extensions/engine.multiRender.ts

@@ -1,4 +1,4 @@
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { IMultiRenderTargetOptions } from '../../Materials/Textures/multiRenderTarget';
 import { Logger } from '../../Misc/logger';
 import { Nullable } from '../../types';
@@ -153,7 +153,7 @@ ThinEngine.prototype.createMultipleRenderTarget = function(size: any, options: I
             Logger.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type");
         }
 
-        var texture = new InternalTexture(this, InternalTexture.DATASOURCE_MULTIRENDERTARGET);
+        var texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);
         var attachment = (<any>gl)[this.webGLVersion > 1 ? "COLOR_ATTACHMENT" + i : "COLOR_ATTACHMENT" + i + "_WEBGL"];
 
         textures.push(texture);
@@ -198,7 +198,7 @@ ThinEngine.prototype.createMultipleRenderTarget = function(size: any, options: I
 
     if (generateDepthTexture && this._caps.depthTextureExtension) {
         // Depth texture
-        var depthTexture = new InternalTexture(this, InternalTexture.DATASOURCE_MULTIRENDERTARGET);
+        var depthTexture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);
 
         gl.activeTexture(gl.TEXTURE0);
         gl.bindTexture(gl.TEXTURE_2D, depthTexture._webGLTexture);

+ 2 - 2
src/Engines/Extensions/engine.multiview.ts

@@ -1,7 +1,7 @@
 import { Camera } from "../../Cameras/camera";
 import { Engine } from "../../Engines/engine";
 import { Scene } from "../../scene";
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { Nullable } from '../../types';
 import { RenderTargetTexture } from '../../Materials/Textures/renderTargetTexture';
 import { Matrix, TmpVectors } from '../../Maths/math.vector';
@@ -34,7 +34,7 @@ Engine.prototype.createMultiviewRenderTargetTexture = function(width: number, he
         throw "Multiview is not supported";
     }
 
-    var internalTexture = new InternalTexture(this, InternalTexture.DATASOURCE_UNKNOWN, true);
+    var internalTexture = new InternalTexture(this, InternalTextureSource.Unknown, true);
     internalTexture.width = width;
     internalTexture.height = height;
     internalTexture._framebuffer = gl.createFramebuffer();

+ 6 - 6
src/Engines/Extensions/engine.rawTexture.ts

@@ -1,12 +1,12 @@
 import { Nullable } from "../../types";
 import { _TimeToken } from "../../Instrumentation/timeToken";
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { Logger } from '../../Misc/logger';
 import { Tools } from '../../Misc/tools';
 import { Scene } from '../../scene';
-import { WebRequest } from '../../Misc/webRequest';
 import { Constants } from '../constants';
 import { Engine } from '../engine';
+import { IWebRequest } from '../../Misc/interfaces/iWebRequest';
 
 declare module "../../Engines/engine" {
     export interface Engine {
@@ -214,7 +214,7 @@ Engine.prototype.updateRawTexture = function(texture: Nullable<InternalTexture>,
 };
 
 Engine.prototype.createRawTexture = function(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string> = null, type: number = Constants.TEXTURETYPE_UNSIGNED_INT): InternalTexture {
-    var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RAW);
+    var texture = new InternalTexture(this, InternalTextureSource.Raw);
     texture.baseWidth = width;
     texture.baseHeight = height;
     texture.width = width;
@@ -254,7 +254,7 @@ Engine.prototype.createRawCubeTexture = function(data: Nullable<ArrayBufferView[
     generateMipMaps: boolean, invertY: boolean, samplingMode: number,
     compression: Nullable<string> = null): InternalTexture {
     var gl = this._gl;
-    var texture = new InternalTexture(this, InternalTexture.DATASOURCE_CUBERAW);
+    var texture = new InternalTexture(this, InternalTextureSource.CubeRaw);
     texture.isCube = true;
     texture.format = format;
     texture.type = type;
@@ -389,7 +389,7 @@ Engine.prototype.createRawCubeTextureFromUrl = function(url: string, scene: Scen
     texture.url = url;
     this._internalTexturesCache.push(texture);
 
-    var onerror = (request?: WebRequest, exception?: any) => {
+    var onerror = (request?: IWebRequest, exception?: any) => {
         scene._removePendingData(texture);
         if (onError && request) {
             onError(request.status + " " + request.statusText, exception);
@@ -454,7 +454,7 @@ Engine.prototype.createRawCubeTextureFromUrl = function(url: string, scene: Scen
 };
 
 Engine.prototype.createRawTexture3D = function(data: Nullable<ArrayBufferView>, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string> = null, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT): InternalTexture {
-    var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RAW3D);
+    var texture = new InternalTexture(this, InternalTextureSource.Raw3D);
     texture.baseWidth = width;
     texture.baseHeight = height;
     texture.baseDepth = depth;

+ 48 - 36
src/Engines/Extensions/engine.renderTarget.ts

@@ -1,4 +1,4 @@
-import { InternalTexture } from '../../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
 import { Logger } from '../../Misc/logger';
 import { RenderTargetCreationOptions } from '../../Materials/Textures/renderTargetCreationOptions';
 import { Constants } from '../constants';
@@ -7,26 +7,33 @@ import { ThinEngine } from '../thinEngine';
 declare module "../../Engines/thinEngine" {
     export interface ThinEngine {
         /**
-         * Creates a new render target cube texture
+         * Creates a new render target texture
          * @param size defines the size of the texture
          * @param options defines the options used to create the texture
-         * @returns a new render target cube texture stored in an InternalTexture
+         * @returns a new render target texture stored in an InternalTexture
          */
-        createRenderTargetCubeTexture(size: number, options?: Partial<RenderTargetCreationOptions>): InternalTexture;
+        createRenderTargetTexture(size: number | { width: number, height: number }, options: boolean | RenderTargetCreationOptions): InternalTexture;
     }
 }
 
-ThinEngine.prototype.createRenderTargetCubeTexture = function(size: number, options?: Partial<RenderTargetCreationOptions>): InternalTexture {
-    let fullOptions = {
-        generateMipMaps: true,
-        generateDepthBuffer: true,
-        generateStencilBuffer: false,
-        type: Constants.TEXTURETYPE_UNSIGNED_INT,
-        samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
-        format: Constants.TEXTUREFORMAT_RGBA,
-        ...options
-    };
-    fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;
+ThinEngine.prototype.createRenderTargetTexture = function(this: ThinEngine, size: number | { width: number, height: number }, options: boolean | RenderTargetCreationOptions): InternalTexture {
+    let fullOptions = new RenderTargetCreationOptions();
+
+    if (options !== undefined && typeof options === "object") {
+        fullOptions.generateMipMaps = options.generateMipMaps;
+        fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
+        fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;
+        fullOptions.type = options.type === undefined ? Constants.TEXTURETYPE_UNSIGNED_INT : options.type;
+        fullOptions.samplingMode = options.samplingMode === undefined ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
+        fullOptions.format = options.format === undefined ? Constants.TEXTUREFORMAT_RGBA : options.format;
+    } else {
+        fullOptions.generateMipMaps = <boolean>options;
+        fullOptions.generateDepthBuffer = true;
+        fullOptions.generateStencilBuffer = false;
+        fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
+        fullOptions.samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
+        fullOptions.format = Constants.TEXTUREFORMAT_RGBA;
+    }
 
     if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
         // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
@@ -38,53 +45,58 @@ ThinEngine.prototype.createRenderTargetCubeTexture = function(size: number, opti
     }
     var gl = this._gl;
 
-    var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RENDERTARGET);
-    this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
+    var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);
+    this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);
 
-    var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);
+    var width = (<{ width: number, height: number }>size).width || <number>size;
+    var height = (<{ width: number, height: number }>size).height || <number>size;
+
+    var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);
 
     if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
         fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
-        Logger.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
+        Logger.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type");
     }
 
-    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
-    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
-    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
-    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
 
-    for (var face = 0; face < 6; face++) {
-        gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
-    }
+    gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
 
     // Create the framebuffer
+    var currentFrameBuffer = this._currentFramebuffer;
     var framebuffer = gl.createFramebuffer();
     this._bindUnboundFramebuffer(framebuffer);
+    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
 
-    texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);
+    texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);
 
-    // MipMaps
     if (fullOptions.generateMipMaps) {
-        gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+        this._gl.generateMipmap(this._gl.TEXTURE_2D);
     }
 
     // Unbind
-    this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
+    this._bindTextureDirectly(gl.TEXTURE_2D, null);
     gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-    this._bindUnboundFramebuffer(null);
+    this._bindUnboundFramebuffer(currentFrameBuffer);
 
     texture._framebuffer = framebuffer;
-    texture.width = size;
-    texture.height = size;
+    texture.baseWidth = width;
+    texture.baseHeight = height;
+    texture.width = width;
+    texture.height = height;
     texture.isReady = true;
-    texture.isCube = true;
     texture.samples = 1;
-    texture.generateMipMaps = fullOptions.generateMipMaps;
+    texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;
     texture.samplingMode = fullOptions.samplingMode;
     texture.type = fullOptions.type;
     texture.format = fullOptions.format;
     texture._generateDepthBuffer = fullOptions.generateDepthBuffer;
-    texture._generateStencilBuffer = fullOptions.generateStencilBuffer;
+    texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;
+
+    // this.resetTextureCache();
 
     this._internalTexturesCache.push(texture);
 

+ 92 - 0
src/Engines/Extensions/engine.renderTargetCube.ts

@@ -0,0 +1,92 @@
+import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';
+import { Logger } from '../../Misc/logger';
+import { RenderTargetCreationOptions } from '../../Materials/Textures/renderTargetCreationOptions';
+import { Constants } from '../constants';
+import { ThinEngine } from '../thinEngine';
+
+declare module "../../Engines/thinEngine" {
+    export interface ThinEngine {
+        /**
+         * Creates a new render target cube texture
+         * @param size defines the size of the texture
+         * @param options defines the options used to create the texture
+         * @returns a new render target cube texture stored in an InternalTexture
+         */
+        createRenderTargetCubeTexture(size: number, options?: Partial<RenderTargetCreationOptions>): InternalTexture;
+    }
+}
+
+ThinEngine.prototype.createRenderTargetCubeTexture = function(size: number, options?: Partial<RenderTargetCreationOptions>): InternalTexture {
+    let fullOptions = {
+        generateMipMaps: true,
+        generateDepthBuffer: true,
+        generateStencilBuffer: false,
+        type: Constants.TEXTURETYPE_UNSIGNED_INT,
+        samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
+        format: Constants.TEXTUREFORMAT_RGBA,
+        ...options
+    };
+    fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;
+
+    if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
+        // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
+        fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
+    }
+    else if (fullOptions.type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {
+        // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
+        fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
+    }
+    var gl = this._gl;
+
+    var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);
+    this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
+
+    var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);
+
+    if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
+        fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
+        Logger.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
+    }
+
+    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
+    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
+    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+    gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+
+    for (var face = 0; face < 6; face++) {
+        gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
+    }
+
+    // Create the framebuffer
+    var framebuffer = gl.createFramebuffer();
+    this._bindUnboundFramebuffer(framebuffer);
+
+    texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);
+
+    // MipMaps
+    if (fullOptions.generateMipMaps) {
+        gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+    }
+
+    // Unbind
+    this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
+    gl.bindRenderbuffer(gl.RENDERBUFFER, null);
+    this._bindUnboundFramebuffer(null);
+
+    texture._framebuffer = framebuffer;
+    texture.width = size;
+    texture.height = size;
+    texture.isReady = true;
+    texture.isCube = true;
+    texture.samples = 1;
+    texture.generateMipMaps = fullOptions.generateMipMaps;
+    texture.samplingMode = fullOptions.samplingMode;
+    texture.type = fullOptions.type;
+    texture.format = fullOptions.format;
+    texture._generateDepthBuffer = fullOptions.generateDepthBuffer;
+    texture._generateStencilBuffer = fullOptions.generateStencilBuffer;
+
+    this._internalTexturesCache.push(texture);
+
+    return texture;
+};

+ 1 - 0
src/Engines/Extensions/index.ts

@@ -7,5 +7,6 @@ export * from "./engine.videoTexture";
 export * from "./engine.multiRender";
 export * from "./engine.cubeTexture";
 export * from "./engine.renderTarget";
+export * from "./engine.renderTargetCube";
 export * from "./engine.webVR";
 export * from "./engine.uniformBuffer";

+ 55 - 83
src/Engines/engine.ts

@@ -1,5 +1,5 @@
 import { Observable } from "../Misc/observable";
-import { Nullable } from "../types";
+import { Nullable, IndicesArray } from "../types";
 import { Scene } from "../scene";
 import { InternalTexture } from "../Materials/Textures/internalTexture";
 import { _TimeToken } from "../Instrumentation/timeToken";
@@ -15,10 +15,10 @@ import { ICustomAnimationFrameRequester } from '../Misc/customAnimationFrameRequ
 import { ThinEngine, EngineOptions } from './thinEngine';
 import { Constants } from './constants';
 import { IViewportLike, IColor4Like } from '../Maths/math.like';
-import { RenderTargetCreationOptions } from '../Materials/Textures/renderTargetCreationOptions';
 import { RenderTargetTexture } from '../Materials/Textures/renderTargetTexture';
 import { PerformanceMonitor } from '../Misc/performanceMonitor';
-import { Logger } from '../Misc/logger';
+import { DataBuffer } from '../Meshes/dataBuffer';
+import { PerfCounter } from '../Misc/perfCounter';
 
 declare type Material = import("../Materials/material").Material;
 declare type PostProcess = import("../PostProcesses/postProcess").PostProcess;
@@ -439,6 +439,10 @@ export class Engine extends ThinEngine {
     // FPS
     private _fps = 60;
     private _deltaTime = 0;
+
+    /** @hidden */
+    public _drawCalls = new PerfCounter();
+
     /**
      * Turn this value on if you want to pause FPS computation when in background
      */
@@ -1173,6 +1177,10 @@ export class Engine extends ThinEngine {
         gl.disable(gl.SCISSOR_TEST);
     }
 
+    protected _reportDrawCall() {
+        this._drawCalls.addCount(1, false);
+    }
+
     /**
      * Initializes a webVR display and starts listening to display change events
      * The onVRDisplayChangedObservable will be notified upon these changes
@@ -1694,96 +1702,60 @@ export class Engine extends ThinEngine {
     }
 
     /**
-     * Creates a new render target texture
-     * @param size defines the size of the texture
-     * @param options defines the options used to create the texture
-     * @returns a new render target texture stored in an InternalTexture
+     * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
+     * @param renderTarget The render target to set the frame buffer for
      */
-    public createRenderTargetTexture(size: number | { width: number, height: number }, options: boolean | RenderTargetCreationOptions): InternalTexture {
-        let fullOptions = new RenderTargetCreationOptions();
-
-        if (options !== undefined && typeof options === "object") {
-            fullOptions.generateMipMaps = options.generateMipMaps;
-            fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
-            fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;
-            fullOptions.type = options.type === undefined ? Constants.TEXTURETYPE_UNSIGNED_INT : options.type;
-            fullOptions.samplingMode = options.samplingMode === undefined ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
-            fullOptions.format = options.format === undefined ? Constants.TEXTUREFORMAT_RGBA : options.format;
-        } else {
-            fullOptions.generateMipMaps = <boolean>options;
-            fullOptions.generateDepthBuffer = true;
-            fullOptions.generateStencilBuffer = false;
-            fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
-            fullOptions.samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
-            fullOptions.format = Constants.TEXTUREFORMAT_RGBA;
+    public setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void {
+        // Create the framebuffer
+        var internalTexture = renderTarget.getInternalTexture();
+        if (!internalTexture || !internalTexture._framebuffer || !renderTarget.depthStencilTexture) {
+            return;
         }
 
-        if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
-            // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
-            fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
-        }
-        else if (fullOptions.type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {
-            // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
-            fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
-        }
         var gl = this._gl;
+        var depthStencilTexture = renderTarget.depthStencilTexture;
 
-        var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RENDERTARGET);
-        this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);
-
-        var width = (<{ width: number, height: number }>size).width || <number>size;
-        var height = (<{ width: number, height: number }>size).height || <number>size;
-
-        var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);
-
-        if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
-            fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
-            Logger.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type");
+        this._bindUnboundFramebuffer(internalTexture._framebuffer);
+        if (depthStencilTexture.isCube) {
+            if (depthStencilTexture._generateStencilBuffer) {
+                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);
+            }
+            else {
+                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);
+            }
         }
+        else {
+            if (depthStencilTexture._generateStencilBuffer) {
+                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);
+            }
+            else {
+                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);
+            }
+        }
+        this._bindUnboundFramebuffer(null);
+    }
 
-        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);
-        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);
-        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
-        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
-
-        gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), width, height, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
-
-        // Create the framebuffer
-        var currentFrameBuffer = this._currentFramebuffer;
-        var framebuffer = gl.createFramebuffer();
-        this._bindUnboundFramebuffer(framebuffer);
-        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
-
-        texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);
+    /**
+     * Update a dynamic index buffer
+     * @param indexBuffer defines the target index buffer
+     * @param indices defines the data to update
+     * @param offset defines the offset in the target index buffer where update should start
+     */
+    public updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset: number = 0): void {
+        // Force cache update
+        this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;
+        this.bindIndexBuffer(indexBuffer);
+        var arrayBuffer;
 
-        if (fullOptions.generateMipMaps) {
-            this._gl.generateMipmap(this._gl.TEXTURE_2D);
+        if (indices instanceof Uint16Array || indices instanceof Uint32Array) {
+            arrayBuffer = indices;
+        } else {
+            arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);
         }
 
-        // Unbind
-        this._bindTextureDirectly(gl.TEXTURE_2D, null);
-        gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-        this._bindUnboundFramebuffer(currentFrameBuffer);
-
-        texture._framebuffer = framebuffer;
-        texture.baseWidth = width;
-        texture.baseHeight = height;
-        texture.width = width;
-        texture.height = height;
-        texture.isReady = true;
-        texture.samples = 1;
-        texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;
-        texture.samplingMode = fullOptions.samplingMode;
-        texture.type = fullOptions.type;
-        texture.format = fullOptions.format;
-        texture._generateDepthBuffer = fullOptions.generateDepthBuffer;
-        texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;
-
-        // this.resetTextureCache();
-
-        this._internalTexturesCache.push(texture);
-
-        return texture;
+        this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);
+
+        this._resetIndexBufferBinding();
     }
 
     /**

+ 6 - 5
src/Engines/nativeEngine.ts

@@ -1,7 +1,7 @@
 import { Nullable, IndicesArray, DataArray } from "../types";
 import { Engine } from "../Engines/engine";
 import { VertexBuffer } from "../Meshes/buffer";
-import { InternalTexture } from "../Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
 import { IInternalTextureLoader } from "../Materials/Textures/internalTextureLoader";
 import { Texture } from "../Materials/Textures/texture";
 import { BaseTexture } from "../Materials/Textures/baseTexture";
@@ -22,6 +22,7 @@ import { Logger } from "../Misc/logger";
 import { Constants } from './constants';
 import { ThinEngine } from './thinEngine';
 import { EngineCapabilities } from './engineCapabilities';
+import { IWebRequest } from '../Misc/interfaces/iWebRequest';
 
 interface INativeEngine {
     requestAnimationFrame(callback: () => void): void;
@@ -800,7 +801,7 @@ export class NativeEngine extends Engine {
         var fromBlob = url.substr(0, 5) === "blob:";
         var isBase64 = fromData && url.indexOf("base64") !== -1;
 
-        let texture = fallback ? fallback : new InternalTexture(this, InternalTexture.DATASOURCE_URL);
+        let texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);
 
         // establish the file extension, if possible
         var lastDot = url.lastIndexOf('.');
@@ -988,7 +989,7 @@ export class NativeEngine extends Engine {
         lodOffset: number = 0,
         fallback: Nullable<InternalTexture> = null): InternalTexture
     {
-        var texture = fallback ? fallback : new InternalTexture(this, InternalTexture.DATASOURCE_CUBE);
+        var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);
         texture.isCube = true;
         texture.url = rootUrl;
         texture.generateMipMaps = !noMipmap;
@@ -1042,7 +1043,7 @@ export class NativeEngine extends Engine {
                 throw new Error(`Multi-file loading not yet supported.`);
             }
             else {
-                let onInternalError = (request?: WebRequest, exception?: any) => {
+                let onInternalError = (request?: IWebRequest, exception?: any) => {
                     if (onError && request) {
                         onError(request.status + " " + request.statusText, exception);
                     }
@@ -1131,7 +1132,7 @@ export class NativeEngine extends Engine {
             // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
             fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
         }
-        var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RENDERTARGET);
+        var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);
 
         var width = (<{ width: number, height: number }>size).width || <number>size;
         var height = (<{ width: number, height: number }>size).height || <number>size;

+ 3 - 3
src/Engines/nullEngine.ts

@@ -4,7 +4,7 @@ import { Scene } from "../scene";
 import { Engine } from "../Engines/engine";
 import { RenderTargetCreationOptions } from "../Materials/Textures/renderTargetCreationOptions";
 import { VertexBuffer } from "../Meshes/buffer";
-import { InternalTexture } from "../Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
 import { Effect } from "../Materials/effect";
 import { _TimeToken } from "../Instrumentation/timeToken";
 import { Constants } from "./constants";
@@ -565,7 +565,7 @@ export class NullEngine extends Engine {
     public createTexture(urlArg: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
         onLoad: Nullable<() => void> = null, onError: Nullable<(message: string, exception: any) => void> = null,
         buffer: Nullable<ArrayBuffer | HTMLImageElement> = null, fallBack?: InternalTexture, format?: number): InternalTexture {
-        var texture = new InternalTexture(this, InternalTexture.DATASOURCE_URL);
+        var texture = new InternalTexture(this, InternalTextureSource.Url);
         var url = String(urlArg);
 
         texture.url = url;
@@ -613,7 +613,7 @@ export class NullEngine extends Engine {
             fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
             fullOptions.samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
         }
-        var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RENDERTARGET);
+        var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);
 
         var width = size.width || size;
         var height = size.height || size;

+ 59 - 111
src/Engines/thinEngine.ts

@@ -6,13 +6,12 @@ import { IShaderProcessor } from './Processors/iShaderProcessor';
 import { UniformBuffer } from '../Materials/uniformBuffer';
 import { Nullable, DataArray, IndicesArray } from '../types';
 import { EngineCapabilities } from './engineCapabilities';
-import { PerfCounter } from '../Misc/perfCounter';
 import { Observable } from '../Misc/observable';
 import { DepthCullingState } from '../States/depthCullingState';
 import { StencilState } from '../States/stencilState';
 import { AlphaState } from '../States/alphaCullingState';
 import { Constants } from './constants';
-import { InternalTexture } from '../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../Materials/Textures/internalTexture';
 import { IViewportLike, IColor4Like } from '../Maths/math.like';
 import { DataBuffer } from '../Meshes/dataBuffer';
 import { IFileRequest } from '../Misc/fileRequest';
@@ -24,12 +23,12 @@ import { IPipelineContext } from './IPipelineContext';
 import { WebGLPipelineContext } from './WebGL/webGLPipelineContext';
 import { VertexBuffer } from '../Meshes/buffer';
 import { InstancingAttributeInfo } from './instancingAttributeInfo';
-import { WebRequest } from '../Misc/webRequest';
 import { FileTools } from '../Misc/fileTools';
 import { DepthTextureCreationOptions } from './depthTextureCreationOptions';
 import { BaseTexture } from '../Materials/Textures/baseTexture';
 import { IOfflineProvider } from '../Offline/IOfflineProvider';
 import { IEffectFallbacks } from '../Materials/iEffectFallbacks';
+import { IWebRequest } from '../Misc/interfaces/iWebRequest';
 
 declare type Observer<T> = import("../Misc/observable").Observer<T>;
 declare type VideoTexture = import("../Materials/Textures/videoTexture").VideoTexture;
@@ -253,9 +252,6 @@ export class ThinEngine {
     private _isStencilEnable: boolean;
     protected _colorWrite = true;
 
-    /** @hidden */
-    public _drawCalls = new PerfCounter();
-
     private _glVersion: string;
     private _glRenderer: string;
     private _glVendor: string;
@@ -333,7 +329,7 @@ export class ThinEngine {
     /** @hidden */
     public _currentRenderTarget: Nullable<InternalTexture>;
     private _uintIndicesCurrentlySet = false;
-    private _currentBoundBuffer = new Array<Nullable<WebGLBuffer>>();
+    protected _currentBoundBuffer = new Array<Nullable<WebGLBuffer>>();
     /** @hidden */
     protected _currentFramebuffer: Nullable<WebGLFramebuffer> = null;
     private _currentBufferPointers = new Array<BufferPointer>();
@@ -591,9 +587,6 @@ export class ThinEngine {
             if (!this._gl) {
                 throw new Error("WebGL not supported");
             }
-
-            // Ensures a consistent color space unpacking of textures cross browser.
-            this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
         } else {
             this._gl = <WebGLRenderingContext>canvasOrContext;
             this._renderingCanvas = this._gl.canvas as HTMLCanvasElement;
@@ -608,6 +601,9 @@ export class ThinEngine {
             }
         }
 
+        // Ensures a consistent color space unpacking of textures cross browser.
+        this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
+
         if (options.useHighPrecisionFloats !== undefined) {
             this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;
         }
@@ -892,7 +888,7 @@ export class ThinEngine {
      * @returns "Engine" string
      */
     public getClassName(): string {
-        return "Engine";
+        return "ThinEngine";
     }
 
     /**
@@ -1375,29 +1371,6 @@ export class ThinEngine {
     }
 
     /**
-     * Update a dynamic index buffer
-     * @param indexBuffer defines the target index buffer
-     * @param indices defines the data to update
-     * @param offset defines the offset in the target index buffer where update should start
-     */
-    public updateDynamicIndexBuffer(indexBuffer: DataBuffer, indices: IndicesArray, offset: number = 0): void {
-        // Force cache update
-        this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;
-        this.bindIndexBuffer(indexBuffer);
-        var arrayBuffer;
-
-        if (indices instanceof Uint16Array || indices instanceof Uint32Array) {
-            arrayBuffer = indices;
-        } else {
-            arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);
-        }
-
-        this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);
-
-        this._resetIndexBufferBinding();
-    }
-
-    /**
      * Updates a dynamic vertex buffer.
      * @param vertexBuffer the vertex buffer to update
      * @param data the data used to update the vertex buffer
@@ -1434,7 +1407,7 @@ export class ThinEngine {
         this._resetVertexBufferBinding();
     }
 
-    private _resetIndexBufferBinding(): void {
+    protected _resetIndexBufferBinding(): void {
         this.bindIndexBuffer(null);
         this._cachedIndexBuffer = null;
     }
@@ -1514,7 +1487,7 @@ export class ThinEngine {
         this._gl.uniformBlockBinding(program, uniformLocation, index);
     }
 
-    private bindIndexBuffer(buffer: Nullable<DataBuffer>): void {
+    protected bindIndexBuffer(buffer: Nullable<DataBuffer>): void {
         if (!this._vaoRecordInProgress) {
             this._unbindVertexArrayObject();
         }
@@ -1896,7 +1869,8 @@ export class ThinEngine {
         // Apply states
         this.applyStates();
 
-        this._drawCalls.addCount(1, false);
+        this._reportDrawCall();
+
         // Render
 
         const drawMode = this._drawMode(fillMode);
@@ -1919,7 +1893,8 @@ export class ThinEngine {
     public drawArraysType(fillMode: number, verticesStart: number, verticesCount: number, instancesCount?: number): void {
         // Apply states
         this.applyStates();
-        this._drawCalls.addCount(1, false);
+
+        this._reportDrawCall();
 
         const drawMode = this._drawMode(fillMode);
         if (instancesCount) {
@@ -1956,6 +1931,11 @@ export class ThinEngine {
         }
     }
 
+    /** @hidden */
+    protected _reportDrawCall() {
+        // Will be implemented by children
+    }
+
     // Shaders
 
     /** @hidden */
@@ -2617,6 +2597,7 @@ export class ThinEngine {
 
             this._unpackFlipYCached = null;
 
+            this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
             this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
         }
 
@@ -2762,7 +2743,7 @@ export class ThinEngine {
         var fromBlob = url.substr(0, 5) === "blob:";
         var isBase64 = fromData && url.indexOf(";base64,") !== -1;
 
-        let texture = fallback ? fallback : new InternalTexture(this, InternalTexture.DATASOURCE_URL);
+        let texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);
 
         // establish the file extension, if possible
         var lastDot = url.lastIndexOf('.');
@@ -2848,7 +2829,7 @@ export class ThinEngine {
             };
 
             if (!buffer) {
-                this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, (request?: WebRequest, exception?: any) => {
+                this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, (request?: IWebRequest, exception?: any) => {
                     onInternalError("Unable to load " + (request ? request.responseURL : url, exception));
                 });
             } else {
@@ -2900,7 +2881,7 @@ export class ThinEngine {
                         return false;
                     } else {
                         // Using shaders when possible to rescale because canvas.drawImage is lossy
-                        let source = new InternalTexture(this, InternalTexture.DATASOURCE_TEMP);
+                        let source = new InternalTexture(this, InternalTextureSource.Temp);
                         this._bindTextureDirectly(gl.TEXTURE_2D, source, true);
                         gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);
 
@@ -3149,7 +3130,7 @@ export class ThinEngine {
      * @returns The texture
      */
     private _createDepthStencilTexture(size: number | { width: number, height: number }, options: DepthTextureCreationOptions): InternalTexture {
-        var internalTexture = new InternalTexture(this, InternalTexture.DATASOURCE_DEPTHTEXTURE);
+        var internalTexture = new InternalTexture(this, InternalTextureSource.Depth);
 
         if (!this._caps.depthTextureExtension) {
             Logger.Error("Depth texture is not supported by your browser or hardware.");
@@ -3190,74 +3171,6 @@ export class ThinEngine {
         return internalTexture;
     }
 
-    /**
-     * Sets the frame buffer Depth / Stencil attachement of the render target to the defined depth stencil texture.
-     * @param renderTarget The render target to set the frame buffer for
-     */
-    public setFrameBufferDepthStencilTexture(renderTarget: RenderTargetTexture): void {
-        // Create the framebuffer
-        var internalTexture = renderTarget.getInternalTexture();
-        if (!internalTexture || !internalTexture._framebuffer || !renderTarget.depthStencilTexture) {
-            return;
-        }
-
-        var gl = this._gl;
-        var depthStencilTexture = renderTarget.depthStencilTexture;
-
-        this._bindUnboundFramebuffer(internalTexture._framebuffer);
-        if (depthStencilTexture.isCube) {
-            if (depthStencilTexture._generateStencilBuffer) {
-                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);
-            }
-            else {
-                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X, depthStencilTexture._webGLTexture, 0);
-            }
-        }
-        else {
-            if (depthStencilTexture._generateStencilBuffer) {
-                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);
-            }
-            else {
-                gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, 0);
-            }
-        }
-        this._bindUnboundFramebuffer(null);
-    }
-
-    /** @hidden */
-    public _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples = 1): Nullable<WebGLRenderbuffer> {
-        var depthStencilBuffer: Nullable<WebGLRenderbuffer> = null;
-        var gl = this._gl;
-
-        // Create the depth/stencil buffer
-        if (generateStencilBuffer) {
-            depthStencilBuffer = gl.createRenderbuffer();
-            gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
-
-            if (samples > 1) {
-                gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);
-            } else {
-                gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);
-            }
-
-            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
-        }
-        else if (generateDepthBuffer) {
-            depthStencilBuffer = gl.createRenderbuffer();
-            gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
-
-            if (samples > 1) {
-                gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);
-            } else {
-                gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
-            }
-
-            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
-        }
-
-        return depthStencilBuffer;
-    }
-
     /** @hidden */
     public _uploadCompressedDataToTextureDirectly(texture: InternalTexture, internalFormat: number, width: number, height: number, data: ArrayBufferView, faceIndex: number = 0, lod: number = 0) {
         var gl = this._gl;
@@ -3406,6 +3319,40 @@ export class ThinEngine {
     }
 
     /** @hidden */
+    public _setupFramebufferDepthAttachments(generateStencilBuffer: boolean, generateDepthBuffer: boolean, width: number, height: number, samples = 1): Nullable<WebGLRenderbuffer> {
+        var depthStencilBuffer: Nullable<WebGLRenderbuffer> = null;
+        var gl = this._gl;
+
+        // Create the depth/stencil buffer
+        if (generateStencilBuffer) {
+            depthStencilBuffer = gl.createRenderbuffer();
+            gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
+
+            if (samples > 1) {
+                gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);
+            } else {
+                gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);
+            }
+
+            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
+        }
+        else if (generateDepthBuffer) {
+            depthStencilBuffer = gl.createRenderbuffer();
+            gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);
+
+            if (samples > 1) {
+                gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);
+            } else {
+                gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
+            }
+
+            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);
+        }
+
+        return depthStencilBuffer;
+    }
+
+    /** @hidden */
     public _releaseFramebufferObjects(texture: InternalTexture): void {
         var gl = this._gl;
 
@@ -4247,7 +4194,8 @@ export class ThinEngine {
     }
 
     /** @hidden */
-    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: any) => void): IFileRequest {
+    public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void,
+    offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest {
         let request = FileTools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);
         this._activeRequests.push(request);
         request.onCompleteObservable.add((request) => {

+ 7 - 2
src/Materials/Node/Blocks/Dual/reflectionTextureBlock.ts

@@ -17,6 +17,7 @@ import { Constants } from '../../../../Engines/constants';
 
 import "../../../../Shaders/ShadersInclude/reflectionFunction";
 import { CubeTexture } from '../../../Textures/cubeTexture';
+import { Texture } from '../../../Textures/texture';
 
 /**
  * Block used to read a reflection texture from a sampler
@@ -336,7 +337,6 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
         let view = `${this.view.associatedVariableName}`;
 
         state.compilationString += `vec3 ${this._reflectionColorName};\r\n`;
-        state.compilationString += `#ifdef ${this._define3DName}\r\n`;
         state.compilationString += `#ifdef ${this._defineMirroredEquirectangularFixedName}\r\n`;
         state.compilationString += `    vec3 ${this._reflectionCoordsName} = computeMirroredFixedEquirectangularCoords(${worldPos}, ${worldNormal}, ${direction});\r\n`;
         state.compilationString += `#endif\r\n`;
@@ -377,6 +377,7 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
         state.compilationString += `    vec3 ${this._reflectionCoordsName} = vec3(0, 0, 0);\r\n`;
         state.compilationString += `#endif\r\n`;
 
+        state.compilationString += `#ifdef ${this._define3DName}\r\n`;
         state.compilationString += `${this._reflectionColorName} = textureCube(${this._cubeSamplerName}, ${this._reflectionCoordsName}).rgb;\r\n`;
         state.compilationString += `#else\r\n`;
         state.compilationString += `vec2 ${this._reflection2DCoordsName} = ${this._reflectionCoordsName}.xy;\r\n`;
@@ -412,7 +413,11 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
         super._deserialize(serializationObject, scene, rootUrl);
 
         if (serializationObject.texture) {
-            this.texture = CubeTexture.Parse(serializationObject.texture, scene, rootUrl);
+            if (serializationObject.texture.isCube) {
+                this.texture = CubeTexture.Parse(serializationObject.texture, scene, rootUrl);
+            } else {
+                this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl);
+            }
         }
     }
 }

+ 2 - 2
src/Materials/Textures/MultiviewRenderTarget.ts

@@ -1,6 +1,6 @@
 import { RenderTargetTexture } from '../Textures/renderTargetTexture';
 import { Scene } from '../../scene';
-import { InternalTexture } from '../Textures/internalTexture';
+import { InternalTextureSource } from '../Textures/internalTexture';
 
 /**
  * Renders to multiple views with a single draw call
@@ -13,7 +13,7 @@ export class MultiviewRenderTarget extends RenderTargetTexture {
      * @param size the size of the render target (used for each view)
      */
     constructor(scene: Scene, size: number | { width: number, height: number } | { ratio: number } = 512) {
-        super("multiview rtt", size, scene, false, true, InternalTexture.DATASOURCE_UNKNOWN, false, undefined, false, false, true, undefined, true);
+        super("multiview rtt", size, scene, false, true, InternalTextureSource.Unknown, false, undefined, false, false, true, undefined, true);
         var internalTexture = scene.getEngine().createMultiviewRenderTargetTexture(this.getRenderWidth(), this.getRenderHeight());
         internalTexture.isMultiview = true;
         this._texture = internalTexture;

+ 1 - 0
src/Materials/Textures/Procedurals/proceduralTexture.ts

@@ -16,6 +16,7 @@ import { RenderTargetTexture } from "../../../Materials/Textures/renderTargetTex
 import { ProceduralTextureSceneComponent } from "./proceduralTextureSceneComponent";
 
 import "../../../Engines/Extensions/engine.renderTarget";
+import "../../../Engines/Extensions/engine.renderTargetCube";
 import "../../../Shaders/procedural.vertex";
 import { DataBuffer } from '../../../Meshes/dataBuffer';
 

+ 6 - 3
src/Materials/Textures/htmlElementTexture.ts

@@ -3,7 +3,10 @@ import { BaseTexture } from "../../Materials/Textures/baseTexture";
 import { Constants } from "../../Engines/constants";
 import { Matrix } from '../../Maths/math.vector';
 
-declare type Engine = import("../../Engines/engine").Engine;
+import "../../Engines/Extensions/engine.dynamicTexture";
+import "../../Engines/Extensions/engine.videoTexture";
+
+declare type ThinEngine = import("../../Engines/thinEngine").ThinEngine;
 declare type Scene = import("../../scene").Scene;
 
 /**
@@ -21,7 +24,7 @@ export interface IHtmlElementTextureOptions {
     /**
      * Defines the engine instance to use the texture with. It is not mandatory if you define a scene.
      */
-    engine: Nullable<Engine>;
+    engine: Nullable<ThinEngine>;
     /**
      * Defines the scene the texture belongs to. It is not mandatory if you define an engine.
      */
@@ -51,7 +54,7 @@ export class HtmlElementTexture extends BaseTexture {
     };
 
     private _textureMatrix: Matrix;
-    private _engine: Engine;
+    private _engine: ThinEngine;
     private _isVideo: boolean;
     private _generateMipMaps: boolean;
     private _samplingMode: number;

+ 48 - 43
src/Materials/Textures/internalTexture.ts

@@ -11,68 +11,73 @@ declare type ThinEngine = import("../../Engines/thinEngine").ThinEngine;
 declare type BaseTexture = import("../../Materials/Textures/baseTexture").BaseTexture;
 
 /**
- * Class used to store data associated with WebGL texture data for the engine
- * This class should not be used directly
+ * Defines the source of the internal texture
  */
-export class InternalTexture {
-
-    /** @hidden */
-    public static _UpdateRGBDAsync = (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> => {
-        throw _DevTools.WarnImport("environmentTextureTools");
-    }
-
+export enum InternalTextureSource {
     /**
      * The source of the texture data is unknown
      */
-    public static DATASOURCE_UNKNOWN = 0;
+    Unknown,
     /**
-     * Texture data comes from an URL
-     */
-    public static DATASOURCE_URL = 1;
+    * Texture data comes from an URL
+    */
+    Url,
     /**
      * Texture data is only used for temporary storage
      */
-    public static DATASOURCE_TEMP = 2;
+    Temp,
     /**
      * Texture data comes from raw data (ArrayBuffer)
      */
-    public static DATASOURCE_RAW = 3;
+    Raw,
     /**
      * Texture content is dynamic (video or dynamic texture)
      */
-    public static DATASOURCE_DYNAMIC = 4;
+    Dynamic,
     /**
      * Texture content is generated by rendering to it
      */
-    public static DATASOURCE_RENDERTARGET = 5;
+    RenderTarget,
     /**
      * Texture content is part of a multi render target process
      */
-    public static DATASOURCE_MULTIRENDERTARGET = 6;
+    MultiRenderTarget,
     /**
      * Texture data comes from a cube data file
      */
-    public static DATASOURCE_CUBE = 7;
+    Cube,
     /**
      * Texture data comes from a raw cube data
      */
-    public static DATASOURCE_CUBERAW = 8;
+    CubeRaw,
     /**
      * Texture data come from a prefiltered cube data file
      */
-    public static DATASOURCE_CUBEPREFILTERED = 9;
+    CubePrefiltered,
     /**
      * Texture content is raw 3D data
      */
-    public static DATASOURCE_RAW3D = 10;
+    Raw3D,
     /**
      * Texture content is a depth texture
      */
-    public static DATASOURCE_DEPTHTEXTURE = 11;
+    Depth,
     /**
      * Texture data comes from a raw cube data encoded with RGBD
      */
-    public static DATASOURCE_CUBERAW_RGBD = 12;
+    CubeRawRGBD
+}
+
+/**
+ * Class used to store data associated with WebGL texture data for the engine
+ * This class should not be used directly
+ */
+export class InternalTexture {
+
+    /** @hidden */
+    public static _UpdateRGBDAsync = (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> => {
+        throw _DevTools.WarnImport("environmentTextureTools");
+    }
 
     /**
      * Defines if the texture is ready
@@ -153,7 +158,7 @@ export class InternalTexture {
     /** @hidden */
     public _associatedChannel = -1;
     /** @hidden */
-    public _dataSource = InternalTexture.DATASOURCE_UNKNOWN;
+    public _source = InternalTextureSource.Unknown;
     /** @hidden */
     public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob> = null;
     /** @hidden */
@@ -248,21 +253,21 @@ export class InternalTexture {
     }
 
     /**
-     * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX)
+     * Gets the data source type of the texture
      */
-    public get dataSource(): number {
-        return this._dataSource;
+    public get source(): InternalTextureSource {
+        return this._source;
     }
 
     /**
      * Creates a new InternalTexture
      * @param engine defines the engine to use
-     * @param dataSource defines the type of data that will be used
+     * @param source defines the type of data that will be used
      * @param delayAllocation if the texture allocation should be delayed (default: false)
      */
-    constructor(engine: ThinEngine, dataSource: number, delayAllocation = false) {
+    constructor(engine: ThinEngine, source: InternalTextureSource, delayAllocation = false) {
         this._engine = engine;
-        this._dataSource = dataSource;
+        this._source = source;
 
         if (!delayAllocation) {
             this._webGLTexture = engine._createTexture();
@@ -303,18 +308,18 @@ export class InternalTexture {
         this._cachedWrapV = null;
         this._cachedAnisotropicFilteringLevel = null;
 
-        switch (this._dataSource) {
-            case InternalTexture.DATASOURCE_TEMP:
+        switch (this.source) {
+            case InternalTextureSource.Temp:
                 return;
 
-            case InternalTexture.DATASOURCE_URL:
+            case InternalTextureSource.Url:
                 proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, () => {
                     proxy._swapAndDie(this);
                     this.isReady = true;
                 }, null, this._buffer, undefined, this.format);
                 return;
 
-            case InternalTexture.DATASOURCE_RAW:
+            case InternalTextureSource.Raw:
                 proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps,
                     this.invertY, this.samplingMode, this._compression);
                 proxy._swapAndDie(this);
@@ -322,7 +327,7 @@ export class InternalTexture {
                 this.isReady = true;
                 return;
 
-            case InternalTexture.DATASOURCE_RAW3D:
+            case InternalTextureSource.Raw3D:
                 proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps,
                     this.invertY, this.samplingMode, this._compression);
                 proxy._swapAndDie(this);
@@ -330,7 +335,7 @@ export class InternalTexture {
                 this.isReady = true;
                 return;
 
-            case InternalTexture.DATASOURCE_DYNAMIC:
+            case InternalTextureSource.Dynamic:
                 proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);
                 proxy._swapAndDie(this);
                 this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas()!, this.invertY, undefined, undefined, true);
@@ -338,7 +343,7 @@ export class InternalTexture {
                 // The engine will make sure to update content so no need to flag it as isReady = true
                 return;
 
-            case InternalTexture.DATASOURCE_RENDERTARGET:
+            case InternalTextureSource.RenderTarget:
                 let options = new RenderTargetCreationOptions();
                 options.generateDepthBuffer = this._generateDepthBuffer;
                 options.generateMipMaps = this.generateMipMaps;
@@ -360,7 +365,7 @@ export class InternalTexture {
 
                 this.isReady = true;
                 return;
-            case InternalTexture.DATASOURCE_DEPTHTEXTURE:
+            case InternalTextureSource.Depth:
                 let depthTextureOptions = {
                     bilinearFiltering: this.samplingMode !== Constants.TEXTURE_BILINEAR_SAMPLINGMODE,
                     comparisonFunction: this._comparisonFunction,
@@ -374,20 +379,20 @@ export class InternalTexture {
                 this.isReady = true;
                 return;
 
-            case InternalTexture.DATASOURCE_CUBE:
+            case InternalTextureSource.Cube:
                 proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, () => {
                     proxy._swapAndDie(this);
                     this.isReady = true;
                 }, null, this.format, this._extension);
                 return;
 
-            case InternalTexture.DATASOURCE_CUBERAW:
+            case InternalTextureSource.CubeRaw:
                 proxy = this._engine.createRawCubeTexture(this._bufferViewArray!, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
                 proxy._swapAndDie(this);
                 this.isReady = true;
                 return;
 
-            case InternalTexture.DATASOURCE_CUBERAW_RGBD:
+            case InternalTextureSource.CubeRawRGBD:
                 proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
                 InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(() => {
                     proxy._swapAndDie(this);
@@ -395,7 +400,7 @@ export class InternalTexture {
                 });
                 return;
 
-            case InternalTexture.DATASOURCE_CUBEPREFILTERED:
+            case InternalTextureSource.CubePrefiltered:
                 proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, (proxy) => {
                     if (proxy) {
                         proxy._swapAndDie(this);

+ 3 - 3
src/Materials/Textures/rawCubeTexture.ts

@@ -3,7 +3,7 @@ import { EnvironmentTextureTools } from "../../Misc/environmentTextureTools";
 import { Nullable } from "../../types";
 import { Scene } from "../../scene";
 import { SphericalPolynomial } from "../../Maths/sphericalPolynomial";
-import { InternalTexture } from "./internalTexture";
+import { InternalTexture, InternalTextureSource } from "./internalTexture";
 import { CubeTexture } from "./cubeTexture";
 import { Constants } from "../../Engines/constants";
 import "../../Engines/Extensions/engine.rawTexture";
@@ -71,7 +71,7 @@ export class RawCubeTexture extends CubeTexture {
             const texture = new RawCubeTexture(scene, internalTexture._bufferViewArray!, internalTexture.width, internalTexture.format, internalTexture.type,
                 internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);
 
-            if (internalTexture.dataSource === InternalTexture.DATASOURCE_CUBERAW_RGBD) {
+            if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {
                 texture.updateRGBDAsync(internalTexture._bufferViewArrayArray!, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);
             }
 
@@ -81,7 +81,7 @@ export class RawCubeTexture extends CubeTexture {
 
     /** @hidden */
     public static _UpdateRGBDAsync(internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> {
-        internalTexture._dataSource = InternalTexture.DATASOURCE_CUBERAW_RGBD;
+        internalTexture._source = InternalTextureSource.CubeRawRGBD;
         internalTexture._bufferViewArrayArray = data;
         internalTexture._lodGenerationScale = lodScale;
         internalTexture._lodGenerationOffset = lodOffset;

+ 1 - 0
src/Materials/Textures/renderTargetTexture.ts

@@ -17,6 +17,7 @@ import { RenderingManager } from "../../Rendering/renderingManager";
 import { Constants } from "../../Engines/constants";
 
 import "../../Engines/Extensions/engine.renderTarget";
+import "../../Engines/Extensions/engine.renderTargetCube";
 import { InstancedMesh } from '../../Meshes/instancedMesh';
 import { Engine } from '../../Engines/engine';
 

+ 7 - 5
src/Materials/effectRenderer.ts

@@ -1,6 +1,6 @@
 import { Nullable } from '../types';
 import { Texture } from '../Materials/Textures/texture';
-import { Engine } from '../Engines/engine';
+import { ThinEngine } from '../Engines/thinEngine';
 import { VertexBuffer } from '../Meshes/buffer';
 import { Viewport } from '../Maths/math.viewport';
 import { Constants } from '../Engines/constants';
@@ -8,6 +8,8 @@ import { Observable } from '../Misc/observable';
 import { Effect } from './effect';
 import { DataBuffer } from '../Meshes/dataBuffer';
 
+import "../Engines/Extensions/engine.renderTarget";
+
 // Prevents ES6 Crash if not imported.
 import "../Shaders/postprocess.vertex";
 
@@ -75,7 +77,7 @@ export class EffectRenderer {
      * @param engine the engine to use for rendering
      * @param options defines the options of the effect renderer
      */
-    constructor(private engine: Engine, options: IEffectRendererOptions = EffectRenderer._DefaultOptions) {
+    constructor(private engine: ThinEngine, options: IEffectRendererOptions = EffectRenderer._DefaultOptions) {
         options = {
             ...EffectRenderer._DefaultOptions,
             ...options,
@@ -87,8 +89,8 @@ export class EffectRenderer {
         this._indexBuffer = engine.createIndexBuffer(options.indices!);
 
         // No need here for full screen render.
-        engine.setDepthBuffer(false);
-        engine.setStencilBuffer(false);
+        engine.depthCullingState.depthTest = false;
+        engine.stencilState.stencilTest = false;
     }
 
     /**
@@ -206,7 +208,7 @@ interface EffectWrapperCreationOptions {
     /**
      * Engine to use to create the effect
      */
-    engine: Engine;
+    engine: ThinEngine;
     /**
      * Fragment shader for the effect
      */

+ 18 - 3
src/Meshes/mesh.ts

@@ -1468,7 +1468,10 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
                 batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];
             }
         }
-        batchCache.hardwareInstancedRendering[subMeshId] = this._instanceDataStorage.hardwareInstancedRendering && (batchCache.visibleInstances[subMeshId] !== null) && (batchCache.visibleInstances[subMeshId] !== undefined);
+        batchCache.hardwareInstancedRendering[subMeshId] =
+                        this._instanceDataStorage.hardwareInstancedRendering
+                        && (batchCache.visibleInstances[subMeshId] !== null)
+                        && (batchCache.visibleInstances[subMeshId] !== undefined);
         this._instanceDataStorage.previousBatch = batchCache;
         return batchCache;
     }
@@ -1688,15 +1691,27 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
 
         var sideOrientation: Nullable<number>;
 
-        if (!instanceDataStorage.isFrozen) {
+        if (!instanceDataStorage.isFrozen && this._effectiveMaterial.backFaceCulling) {
+            let mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();
             sideOrientation = this.overrideMaterialSideOrientation;
             if (sideOrientation == null) {
                 sideOrientation = this._effectiveMaterial.sideOrientation;
             }
-            if (effectiveMesh._getWorldMatrixDeterminant() < 0) {
+            if (mainDeterminant < 0) {
                 sideOrientation = (sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation);
             }
             instanceDataStorage.sideOrientation = sideOrientation!;
+
+            let visibleInstances = batch.visibleInstances[subMesh._id];
+            if (visibleInstances) {
+                for (var instance of visibleInstances) {
+                    if (mainDeterminant !== instance._getWorldMatrixDeterminant()) {
+                        this._effectiveMaterial.backFaceCulling = false; // Turn off back face culling as one of the instance is having an incompatible world matrix
+                        break;
+                    }
+                }
+            }
+
         } else {
             sideOrientation = instanceDataStorage.sideOrientation;
         }

+ 2 - 2
src/Misc/basis.ts

@@ -1,7 +1,7 @@
 import { Nullable } from '../types';
 import { Tools } from './tools';
 import { Texture } from '../Materials/Textures/texture';
-import { InternalTexture } from '../Materials/Textures/internalTexture';
+import { InternalTexture, InternalTextureSource } from '../Materials/Textures/internalTexture';
 import { Scalar } from '../Maths/math.scalar';
 import { Constants } from '../Engines/constants';
 import { Engine } from '../Engines/engine';
@@ -192,7 +192,7 @@ export class BasisTools {
 
                 if (engine.webGLVersion < 2 && (Scalar.Log2(rootImage.width) % 1 !== 0 || Scalar.Log2(rootImage.height) % 1 !== 0)) {
                     // Create non power of two texture
-                    let source = new InternalTexture(engine, InternalTexture.DATASOURCE_TEMP);
+                    let source = new InternalTexture(engine, InternalTextureSource.Temp);
 
                     texture._invertVScale = texture.invertY;
                     source.type = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;

+ 3 - 3
src/Misc/dds.ts

@@ -1,7 +1,7 @@
 import { Scalar } from "../Maths/math.scalar";
 import { SphericalPolynomial } from "../Maths/sphericalPolynomial";
 import { Constants } from "../Engines/constants";
-import { InternalTexture } from "../Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
 import { Nullable } from "../types";
 import { Logger } from "../Misc/logger";
 import { CubeMapToSphericalPolynomialTools } from "../Misc/HighDynamicRange/cubemapToSphericalPolynomial";
@@ -717,7 +717,7 @@ ThinEngine.prototype.createPrefilteredCubeTexture = function(rootUrl: string, sc
         else if (loadData.info.sphericalPolynomial) {
             texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
         }
-        texture._dataSource = InternalTexture.DATASOURCE_CUBEPREFILTERED;
+        texture._source = InternalTextureSource.CubePrefiltered;
 
         if (this.getCaps().textureLOD) {
             // Do not add extra process if texture lod is supported.
@@ -747,7 +747,7 @@ ThinEngine.prototype.createPrefilteredCubeTexture = function(rootUrl: string, sc
             let lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
             let mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));
 
-            var glTextureFromLod = new InternalTexture(this, InternalTexture.DATASOURCE_TEMP);
+            var glTextureFromLod = new InternalTexture(this, InternalTextureSource.Temp);
             glTextureFromLod.type = texture.type;
             glTextureFromLod.format = texture.format;
             glTextureFromLod.width = Math.pow(2, Math.max(Scalar.Log2(width) - mipmapIndex, 0));

+ 4 - 4
src/Misc/environmentTextureTools.ts

@@ -3,7 +3,7 @@ import { Tools } from "./tools";
 import { Vector3 } from "../Maths/math.vector";
 import { Scalar } from "../Maths/math.scalar";
 import { SphericalPolynomial } from "../Maths/sphericalPolynomial";
-import { InternalTexture } from "../Materials/Textures/internalTexture";
+import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
 import { BaseTexture } from "../Materials/Textures/baseTexture";
 import { CubeTexture } from "../Materials/Textures/cubeTexture";
 import { Constants } from "../Engines/constants";
@@ -11,7 +11,7 @@ import { Scene } from "../scene";
 import { PostProcess } from "../PostProcesses/postProcess";
 import { Logger } from "../Misc/logger";
 
-import "../Engines/Extensions/engine.renderTarget";
+import "../Engines/Extensions/engine.renderTargetCube";
 
 import "../Shaders/rgbdEncode.fragment";
 import "../Shaders/rgbdDecode.fragment";
@@ -465,7 +465,7 @@ export class EnvironmentTextureTools {
                     let lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
                     let mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));
 
-                    let glTextureFromLod = new InternalTexture(engine, InternalTexture.DATASOURCE_TEMP);
+                    let glTextureFromLod = new InternalTexture(engine, InternalTextureSource.Temp);
                     glTextureFromLod.isCube = true;
                     glTextureFromLod.invertY = true;
                     glTextureFromLod.generateMipMaps = false;
@@ -634,7 +634,7 @@ export class EnvironmentTextureTools {
 
     /** @hidden */
     public static _UpdateRGBDAsync(internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> {
-        internalTexture._dataSource = InternalTexture.DATASOURCE_CUBERAW_RGBD;
+        internalTexture._source = InternalTextureSource.CubeRawRGBD;
         internalTexture._bufferViewArrayArray = data;
         internalTexture._lodGenerationScale = lodScale;
         internalTexture._lodGenerationOffset = lodOffset;

+ 18 - 0
src/Misc/interfaces/iWebRequest.ts

@@ -0,0 +1,18 @@
+
+/**
+ * Interface used to define the mechanism to get data from the network
+ */
+export interface IWebRequest {
+    /**
+     * Returns client's response url
+     */
+    responseURL: string;
+    /**
+     * Returns client's status
+     */
+    status: number;
+    /**
+     * Returns client's status as a text
+     */
+    statusText: string;
+}

+ 2 - 0
src/Misc/rgbdTextureTools.ts

@@ -3,6 +3,8 @@ import { PostProcess } from "../PostProcesses/postProcess";
 import "../Shaders/rgbdDecode.fragment";
 import { Engine } from '../Engines/engine';
 
+import "../Engines/Extensions/engine.renderTarget";
+
 declare type Texture = import("../Materials/Textures/texture").Texture;
 
 /**

+ 3 - 1
src/Misc/webRequest.ts

@@ -1,7 +1,9 @@
+import { IWebRequest } from './interfaces/iWebRequest';
+
 /**
  * Extended version of XMLHttpRequest with support for customizations (headers, ...)
  */
-export class WebRequest {
+export class WebRequest implements IWebRequest {
     private _xhr = new XMLHttpRequest();
 
     /**

+ 2 - 0
src/PostProcesses/postProcess.ts

@@ -10,6 +10,8 @@ import { IInspectable } from '../Misc/iInspectable';
 import { Engine } from '../Engines/engine';
 import { Color4 } from '../Maths/math.color';
 
+import "../Engines/Extensions/engine.renderTarget";
+
 declare type Scene = import("../scene").Scene;
 declare type InternalTexture = import("../Materials/Textures/internalTexture").InternalTexture;
 declare type WebVRFreeCamera = import("../Cameras/VR/webVRCamera").WebVRFreeCamera;