Преглед на файлове

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

David Catuhe преди 5 години
родител
ревизия
aa55dcc30a

+ 46 - 34
src/Engines/Extensions/engine.renderTarget.ts

@@ -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
@@ -39,52 +46,57 @@ ThinEngine.prototype.createRenderTargetCubeTexture = function(size: number, opti
     var gl = this._gl;
 
     var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);
-    this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
+    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";

+ 1 - 96
src/Engines/engine.ts

@@ -1,7 +1,7 @@
 import { Observable } from "../Misc/observable";
 import { Nullable, IndicesArray } from "../types";
 import { Scene } from "../scene";
-import { InternalTexture, InternalTextureSource } from "../Materials/Textures/internalTexture";
+import { InternalTexture } from "../Materials/Textures/internalTexture";
 import { _TimeToken } from "../Instrumentation/timeToken";
 import { IAudioEngine } from "../Audio/audioEngine";
 import { IOfflineProvider } from "../Offline/IOfflineProvider";
@@ -15,10 +15,8 @@ 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';
 
@@ -1761,99 +1759,6 @@ 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
-     */
-    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;
-        }
-
-        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_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");
-        }
-
-        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);
-
-        if (fullOptions.generateMipMaps) {
-            this._gl.generateMipmap(this._gl.TEXTURE_2D);
-        }
-
-        // 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;
-    }
-
-    /**
      * Updates the sample count of a render target texture
      * @see http://doc.babylonjs.com/features/webgl2#multisample-render-targets
      * @param texture defines the texture to update

+ 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;

+ 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
      */

+ 1 - 1
src/Misc/environmentTextureTools.ts

@@ -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";

+ 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;
 
 /**

+ 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;