Browse Source

Add constants file

sebastien 6 years ago
parent
commit
b86c1353cf
71 changed files with 659 additions and 402 deletions
  1. 2 1
      src/Bones/skeleton.ts
  2. 203 0
      src/Engine/constants.ts
  3. 96 94
      src/Engine/engine.ts
  4. 8 7
      src/Engine/nullEngine.ts
  5. 3 3
      src/Helpers/environmentHelper.ts
  6. 3 2
      src/Layer/effectLayer.ts
  7. 4 4
      src/Layer/glowLayer.ts
  8. 10 9
      src/Layer/highlightLayer.ts
  9. 3 2
      src/Layer/layer.ts
  10. 2 2
      src/LensFlare/lensFlare.ts
  11. 2 1
      src/LensFlare/lensFlareSystem.ts
  12. 11 11
      src/Lights/Shadows/shadowGenerator.ts
  13. 2 2
      src/Materials/Background/backgroundMaterial.ts
  14. 2 2
      src/Materials/PBR/pbrBaseMaterial.ts
  15. 11 10
      src/Materials/Textures/baseTexture.ts
  16. 11 10
      src/Materials/Textures/colorGradingTexture.ts
  17. 5 5
      src/Materials/Textures/cubeTexture.ts
  18. 2 1
      src/Materials/Textures/dynamicTexture.ts
  19. 2 1
      src/Materials/Textures/internalTexture.ts
  20. 3 3
      src/Materials/Textures/mirrorTexture.ts
  21. 2 1
      src/Materials/Textures/multiRenderTarget.ts
  22. 3 4
      src/Materials/Textures/rawCubeTexture.ts
  23. 14 13
      src/Materials/Textures/rawTexture.ts
  24. 2 1
      src/Materials/Textures/rawTexture3D.ts
  25. 2 1
      src/Materials/Textures/renderTargetTexture.ts
  26. 36 35
      src/Materials/Textures/texture.ts
  27. 2 1
      src/Materials/material.ts
  28. 2 1
      src/Materials/standardMaterial.ts
  29. 8 7
      src/Mesh/geometry.ts
  30. 8 7
      src/Mesh/mesh.ts
  31. 8 7
      src/Particles/gpuParticleSystem.ts
  32. 6 5
      src/Particles/particleSystem.ts
  33. 4 3
      src/PostProcess/RenderPipeline/Pipelines/defaultRenderingPipeline.ts
  34. 3 3
      src/PostProcess/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts
  35. 18 19
      src/PostProcess/RenderPipeline/Pipelines/standardRenderingPipeline.ts
  36. 2 1
      src/PostProcess/bloomMergePostProcess.ts
  37. 2 1
      src/PostProcess/blurPostProcess.ts
  38. 2 1
      src/PostProcess/chromaticAberrationPostProcess.ts
  39. 2 1
      src/PostProcess/circleOfConfusionPostProcess.ts
  40. 2 1
      src/PostProcess/convolutionPostProcess.ts
  41. 3 2
      src/PostProcess/depthOfFieldBlurPostProcess.ts
  42. 2 1
      src/PostProcess/depthOfFieldMergePostProcess.ts
  43. 2 1
      src/PostProcess/extractHighlightsPostProcess.ts
  44. 2 1
      src/PostProcess/fxaaPostProcess.ts
  45. 2 1
      src/PostProcess/grainPostProcess.ts
  46. 2 1
      src/PostProcess/highlightsPostProcess.ts
  47. 2 1
      src/PostProcess/imageProcessingPostProcess.ts
  48. 4 2
      src/PostProcess/motionBlurPostProcess.ts
  49. 6 3
      src/PostProcess/passPostProcess.ts
  50. 13 11
      src/PostProcess/postProcess.ts
  51. 2 2
      src/PostProcess/postProcessManager.ts
  52. 4 2
      src/PostProcess/sharpenPostProcess.ts
  53. 5 3
      src/PostProcess/tonemapPostProcess.ts
  54. 6 4
      src/PostProcess/volumetricLightScatteringPostProcess.ts
  55. 2 2
      src/Probes/reflectionProbe.ts
  56. 3 3
      src/Rendering/depthRenderer.ts
  57. 3 3
      src/Rendering/depthRendererSceneComponent.ts
  58. 3 3
      src/Rendering/edgesRenderer.ts
  59. 3 3
      src/Rendering/geometryBufferRenderer.ts
  60. 2 1
      src/Rendering/outlineRenderer.ts
  61. 4 4
      src/Rendering/renderingGroup.ts
  62. 3 3
      src/Sprites/spriteManager.ts
  63. 4 3
      src/States/stencilState.ts
  64. 7 7
      src/Tools/HDR/cubemapToSphericalPolynomial.ts
  65. 3 3
      src/Tools/HDR/panoramaToCubemap.ts
  66. 20 18
      src/Tools/dds.ts
  67. 19 19
      src/Tools/environmentTextureTools.ts
  68. 3 3
      src/Tools/sceneSerializer.ts
  69. 2 2
      src/Tools/textureTools.ts
  70. 8 6
      src/Tools/tools.ts
  71. 2 1
      src/scene.ts

+ 2 - 1
src/Bones/skeleton.ts

@@ -11,6 +11,7 @@ import { Animatable } from "Animations/animatable";
 import { AnimationPropertiesOverride } from "Animations/animationPropertiesOverride";
 import { AnimationRange, Animation } from "Animations/animation";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * Class used to handle skinning animations
@@ -423,7 +424,7 @@ import { Engine } from "Engine/engine";
                             this._transformMatrixTexture.dispose();
                         }
 
-                        this._transformMatrixTexture = RawTexture.CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE, Engine.TEXTURETYPE_FLOAT);
+                        this._transformMatrixTexture = RawTexture.CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, Constants.TEXTURE_NEAREST_SAMPLINGMODE, Constants.TEXTURETYPE_FLOAT);
                     }
                 }
 

+ 203 - 0
src/Engine/constants.ts

@@ -0,0 +1,203 @@
+    /** Defines the cross module used constants to avoid circular dependncies */
+export class Constants {
+    /** Defines that alpha blending is disabled */
+    public static readonly ALPHA_DISABLE = 0;
+    /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
+    public static readonly ALPHA_ADD = 1;
+    /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
+    public static readonly ALPHA_COMBINE = 2;
+    /** Defines that alpha blending to DEST - SRC * DEST */
+    public static readonly ALPHA_SUBTRACT = 3;
+    /** Defines that alpha blending to SRC * DEST */
+    public static readonly ALPHA_MULTIPLY = 4;
+    /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
+    public static readonly ALPHA_MAXIMIZED = 5;
+    /** Defines that alpha blending to SRC + DEST */
+    public static readonly ALPHA_ONEONE = 6;
+    /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
+    public static readonly ALPHA_PREMULTIPLIED = 7;
+    /**
+     * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
+     * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
+     */
+    public static readonly ALPHA_PREMULTIPLIED_PORTERDUFF = 8;
+    /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
+    public static readonly ALPHA_INTERPOLATE = 9;
+    /**
+     * Defines that alpha blending to SRC + (1 - SRC) * DEST
+     * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
+     */
+    public static readonly ALPHA_SCREENMODE = 10;
+
+    /** Defines that the ressource is not delayed*/
+    public static readonly DELAYLOADSTATE_NONE = 0;
+    /** Defines that the ressource was successfully delay loaded */
+    public static readonly DELAYLOADSTATE_LOADED = 1;
+    /** Defines that the ressource is currently delay loading */
+    public static readonly DELAYLOADSTATE_LOADING = 2;
+    /** Defines that the ressource is delayed and has not started loading */
+    public static readonly DELAYLOADSTATE_NOTLOADED = 4;
+
+    // Depht or Stencil test Constants.
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
+    public static readonly NEVER = 0x0200;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
+    public static readonly ALWAYS = 0x0207;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
+    public static readonly LESS = 0x0201;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
+    public static readonly EQUAL = 0x0202;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */
+    public static readonly LEQUAL = 0x0203;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
+    public static readonly GREATER = 0x0204;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */
+    public static readonly GEQUAL = 0x0206;
+    /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */
+    public static readonly NOTEQUAL = 0x0205;
+
+    // Stencil Actions Constants.
+    /** Passed to stencilOperation to specify that stencil value must be kept */
+    public static readonly KEEP = 0x1E00;
+    /** Passed to stencilOperation to specify that stencil value must be replaced */
+    public static readonly REPLACE = 0x1E01;
+    /** Passed to stencilOperation to specify that stencil value must be incremented */
+    public static readonly INCR = 0x1E02;
+    /** Passed to stencilOperation to specify that stencil value must be decremented */
+    public static readonly DECR = 0x1E03;
+    /** Passed to stencilOperation to specify that stencil value must be inverted */
+    public static readonly INVERT = 0x150A;
+    /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */
+    public static readonly INCR_WRAP = 0x8507;
+    /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */
+    public static readonly DECR_WRAP = 0x8508;
+
+    /** Texture is not repeating outside of 0..1 UVs */
+    public static readonly TEXTURE_CLAMP_ADDRESSMODE = 0;
+    /** Texture is repeating outside of 0..1 UVs */
+    public static readonly TEXTURE_WRAP_ADDRESSMODE = 1;
+    /** Texture is repeating and mirrored */
+    public static readonly TEXTURE_MIRROR_ADDRESSMODE = 2;
+
+    /** ALPHA */
+    public static readonly TEXTUREFORMAT_ALPHA = 0;
+    /** LUMINANCE */
+    public static readonly TEXTUREFORMAT_LUMINANCE = 1;
+    /** LUMINANCE_ALPHA */
+    public static readonly TEXTUREFORMAT_LUMINANCE_ALPHA = 2;
+    /** RGB */
+    public static readonly TEXTUREFORMAT_RGB = 4;
+    /** RGBA */
+    public static readonly TEXTUREFORMAT_RGBA = 5;
+    /** RED */
+    public static readonly TEXTUREFORMAT_RED = 6;
+    /** RED (2nd reference) */
+    public static readonly TEXTUREFORMAT_R = 6;
+    /** RG */
+    public static readonly TEXTUREFORMAT_RG = 7;
+    /** RED_INTEGER */
+    public static readonly TEXTUREFORMAT_RED_INTEGER = 8;
+    /** RED_INTEGER (2nd reference) */
+    public static readonly TEXTUREFORMAT_R_INTEGER = 8;
+    /** RG_INTEGER */
+    public static readonly TEXTUREFORMAT_RG_INTEGER = 9;
+    /** RGB_INTEGER */
+    public static readonly TEXTUREFORMAT_RGB_INTEGER = 10;
+    /** RGBA_INTEGER */
+    public static readonly TEXTUREFORMAT_RGBA_INTEGER = 11;
+
+    /** UNSIGNED_BYTE */
+    public static readonly TEXTURETYPE_UNSIGNED_BYTE = 0;
+    /** UNSIGNED_BYTE (2nd reference) */
+    public static readonly TEXTURETYPE_UNSIGNED_INT = 0;
+    /** FLOAT */
+    public static readonly TEXTURETYPE_FLOAT = 1;
+    /** HALF_FLOAT */
+    public static readonly TEXTURETYPE_HALF_FLOAT = 2;
+    /** BYTE */
+    public static readonly TEXTURETYPE_BYTE = 3;
+    /** SHORT */
+    public static readonly TEXTURETYPE_SHORT = 4;
+    /** UNSIGNED_SHORT */
+    public static readonly TEXTURETYPE_UNSIGNED_SHORT = 5;
+    /** INT */
+    public static readonly TEXTURETYPE_INT = 6;
+    /** UNSIGNED_INT */
+    public static readonly TEXTURETYPE_UNSIGNED_INTEGER = 7;
+    /** UNSIGNED_SHORT_4_4_4_4 */
+    public static readonly TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;
+    /** UNSIGNED_SHORT_5_5_5_1 */
+    public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;
+    /** UNSIGNED_SHORT_5_6_5 */
+    public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;
+    /** UNSIGNED_INT_2_10_10_10_REV */
+    public static readonly TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;
+    /** UNSIGNED_INT_24_8 */
+    public static readonly TEXTURETYPE_UNSIGNED_INT_24_8 = 12;
+    /** UNSIGNED_INT_10F_11F_11F_REV */
+    public static readonly TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;
+    /** UNSIGNED_INT_5_9_9_9_REV */
+    public static readonly TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;
+    /** FLOAT_32_UNSIGNED_INT_24_8_REV */
+    public static readonly TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;
+
+    /** nearest is mag = nearest and min = nearest and mip = linear */
+    public static readonly TEXTURE_NEAREST_SAMPLINGMODE = 1;
+    /** Bilinear is mag = linear and min = linear and mip = nearest */
+    public static readonly TEXTURE_BILINEAR_SAMPLINGMODE = 2;
+    /** Trilinear is mag = linear and min = linear and mip = linear */
+    public static readonly TEXTURE_TRILINEAR_SAMPLINGMODE = 3;
+    /** nearest is mag = nearest and min = nearest and mip = linear */
+    public static readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1;
+    /** Bilinear is mag = linear and min = linear and mip = nearest */
+    public static readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2;
+    /** Trilinear is mag = linear and min = linear and mip = linear */
+    public static readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;
+    /** mag = nearest and min = nearest and mip = nearest */
+    public static readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;
+    /** mag = nearest and min = linear and mip = nearest */
+    public static readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;
+    /** mag = nearest and min = linear and mip = linear */
+    public static readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;
+    /** mag = nearest and min = linear and mip = none */
+    public static readonly TEXTURE_NEAREST_LINEAR = 7;
+    /** mag = nearest and min = nearest and mip = none */
+    public static readonly TEXTURE_NEAREST_NEAREST = 8;
+    /** mag = linear and min = nearest and mip = nearest */
+    public static readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;
+    /** mag = linear and min = nearest and mip = linear */
+    public static readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;
+    /** mag = linear and min = linear and mip = none */
+    public static readonly TEXTURE_LINEAR_LINEAR = 11;
+    /** mag = linear and min = nearest and mip = none */
+    public static readonly TEXTURE_LINEAR_NEAREST = 12;
+
+    /** Explicit coordinates mode */
+    public static readonly TEXTURE_EXPLICIT_MODE = 0;
+    /** Spherical coordinates mode */
+    public static readonly TEXTURE_SPHERICAL_MODE = 1;
+    /** Planar coordinates mode */
+    public static readonly TEXTURE_PLANAR_MODE = 2;
+    /** Cubic coordinates mode */
+    public static readonly TEXTURE_CUBIC_MODE = 3;
+    /** Projection coordinates mode */
+    public static readonly TEXTURE_PROJECTION_MODE = 4;
+    /** Skybox coordinates mode */
+    public static readonly TEXTURE_SKYBOX_MODE = 5;
+    /** Inverse Cubic coordinates mode */
+    public static readonly TEXTURE_INVCUBIC_MODE = 6;
+    /** Equirectangular coordinates mode */
+    public static readonly TEXTURE_EQUIRECTANGULAR_MODE = 7;
+    /** Equirectangular Fixed coordinates mode */
+    public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;
+    /** Equirectangular Fixed Mirrored coordinates mode */
+    public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;
+
+    // Texture rescaling mode
+    /** Defines that texture rescaling will use a floor to find the closer power of 2 size */
+    public static readonly SCALEMODE_FLOOR = 1;
+    /** Defines that texture rescaling will look for the nearest power of 2 size */
+    public static readonly SCALEMODE_NEAREST = 2;
+    /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
+    public static readonly SCALEMODE_CEILING = 3;
+}

+ 96 - 94
src/Engine/engine.ts

@@ -19,9 +19,6 @@ import { IInternalTextureTracker, DummyInternalTextureTracker } from "Materials/
 import { IInternalTextureLoader } from "Materials/Textures/internalTextureLoader";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { BaseTexture } from "Materials/Textures/baseTexture";
-import { Texture } from "Materials/Textures/texture";
-import { VideoTexture } from "Materials/Textures/videoTexture";
-import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { IMultiRenderTargetOptions } from "Materials/Textures/multiRenderTarget";
 import { PostProcess } from "PostProcess/postProcess";
 import { PassPostProcess } from "PostProcess/passPostProcess";
@@ -30,6 +27,11 @@ import { IAudioEngine } from "Audio/audioEngine";
 import { IOfflineProvider } from "Offline/IOfflineProvider";
 import { ILoadingScreen, DefaultLoadingScreen } from "Loading/loadingScreen";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "./constants";
+declare type Texture = import("Materials/Textures/texture").Texture;
+declare type VideoTexture = import("Materials/Textures/videoTexture").VideoTexture;
+declare type RenderTargetTexture = import("Materials/Textures/renderTargetTexture").RenderTargetTexture;
+
     /**
      * Keeps track of all the buffer info used in engine.
      */
@@ -308,205 +310,205 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 
         // Const statics
         /** Defines that alpha blending is disabled */
-        public static readonly ALPHA_DISABLE = 0;
+        public static readonly ALPHA_DISABLE = Constants.ALPHA_DISABLE;
         /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
-        public static readonly ALPHA_ADD = 1;
+        public static readonly ALPHA_ADD = Constants.ALPHA_ADD;
         /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
-        public static readonly ALPHA_COMBINE = 2;
+        public static readonly ALPHA_COMBINE = Constants.ALPHA_COMBINE;
         /** Defines that alpha blending to DEST - SRC * DEST */
-        public static readonly ALPHA_SUBTRACT = 3;
+        public static readonly ALPHA_SUBTRACT = Constants.ALPHA_SUBTRACT;
         /** Defines that alpha blending to SRC * DEST */
-        public static readonly ALPHA_MULTIPLY = 4;
+        public static readonly ALPHA_MULTIPLY = Constants.ALPHA_MULTIPLY;
         /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
-        public static readonly ALPHA_MAXIMIZED = 5;
+        public static readonly ALPHA_MAXIMIZED = Constants.ALPHA_MAXIMIZED;
         /** Defines that alpha blending to SRC + DEST */
-        public static readonly ALPHA_ONEONE = 6;
+        public static readonly ALPHA_ONEONE = Constants.ALPHA_ONEONE;
         /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
-        public static readonly ALPHA_PREMULTIPLIED = 7;
+        public static readonly ALPHA_PREMULTIPLIED = Constants.ALPHA_PREMULTIPLIED;
         /**
          * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
          * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
          */
-        public static readonly ALPHA_PREMULTIPLIED_PORTERDUFF = 8;
+        public static readonly ALPHA_PREMULTIPLIED_PORTERDUFF = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;
         /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
-        public static readonly ALPHA_INTERPOLATE = 9;
+        public static readonly ALPHA_INTERPOLATE = Constants.ALPHA_INTERPOLATE;
         /**
          * Defines that alpha blending to SRC + (1 - SRC) * DEST
          * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
          */
-        public static readonly ALPHA_SCREENMODE = 10;
+        public static readonly ALPHA_SCREENMODE = Constants.ALPHA_SCREENMODE;
 
         /** Defines that the ressource is not delayed*/
-        public static readonly DELAYLOADSTATE_NONE = 0;
+        public static readonly DELAYLOADSTATE_NONE = Constants.DELAYLOADSTATE_NONE;
         /** Defines that the ressource was successfully delay loaded */
-        public static readonly DELAYLOADSTATE_LOADED = 1;
+        public static readonly DELAYLOADSTATE_LOADED = Constants.DELAYLOADSTATE_LOADED;
         /** Defines that the ressource is currently delay loading */
-        public static readonly DELAYLOADSTATE_LOADING = 2;
+        public static readonly DELAYLOADSTATE_LOADING = Constants.DELAYLOADSTATE_LOADING;
         /** Defines that the ressource is delayed and has not started loading */
-        public static readonly DELAYLOADSTATE_NOTLOADED = 4;
+        public static readonly DELAYLOADSTATE_NOTLOADED = Constants.DELAYLOADSTATE_NOTLOADED;
 
         // Depht or Stencil test Constants.
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
-        public static readonly NEVER = 0x0200;
+        public static readonly NEVER = Constants.NEVER;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
-        public static readonly ALWAYS = _StencilState.ALWAYS;
+        public static readonly ALWAYS = Constants.ALWAYS;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
-        public static readonly LESS = 0x0201;
+        public static readonly LESS = Constants.LESS;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
-        public static readonly EQUAL = 0x0202;
+        public static readonly EQUAL = Constants.EQUAL;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */
-        public static readonly LEQUAL = 0x0203;
+        public static readonly LEQUAL = Constants.LEQUAL;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
-        public static readonly GREATER = 0x0204;
+        public static readonly GREATER = Constants.GREATER;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */
-        public static readonly GEQUAL = 0x0206;
+        public static readonly GEQUAL = Constants.GEQUAL;
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */
-        public static readonly NOTEQUAL = 0x0205;
+        public static readonly NOTEQUAL = Constants.NOTEQUAL;
 
         // Stencil Actions Constants.
         /** Passed to stencilOperation to specify that stencil value must be kept */
-        public static readonly KEEP = _StencilState.KEEP;
+        public static readonly KEEP = Constants.KEEP;
         /** Passed to stencilOperation to specify that stencil value must be replaced */
-        public static readonly REPLACE = _StencilState.REPLACE;
+        public static readonly REPLACE = Constants.REPLACE;
         /** Passed to stencilOperation to specify that stencil value must be incremented */
-        public static readonly INCR = 0x1E02;
+        public static readonly INCR = Constants.INCR;
         /** Passed to stencilOperation to specify that stencil value must be decremented */
-        public static readonly DECR = 0x1E03;
+        public static readonly DECR = Constants.DECR;
         /** Passed to stencilOperation to specify that stencil value must be inverted */
-        public static readonly INVERT = 0x150A;
+        public static readonly INVERT = Constants.INVERT;
         /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */
-        public static readonly INCR_WRAP = 0x8507;
+        public static readonly INCR_WRAP = Constants.INCR_WRAP;
         /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */
-        public static readonly DECR_WRAP = 0x8508;
+        public static readonly DECR_WRAP = Constants.DECR_WRAP;
 
         /** Texture is not repeating outside of 0..1 UVs */
-        public static readonly TEXTURE_CLAMP_ADDRESSMODE = 0;
+        public static readonly TEXTURE_CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;
         /** Texture is repeating outside of 0..1 UVs */
-        public static readonly TEXTURE_WRAP_ADDRESSMODE = 1;
+        public static readonly TEXTURE_WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;
         /** Texture is repeating and mirrored */
-        public static readonly TEXTURE_MIRROR_ADDRESSMODE = 2;
+        public static readonly TEXTURE_MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;
 
         /** ALPHA */
-        public static readonly TEXTUREFORMAT_ALPHA = 0;
+        public static readonly TEXTUREFORMAT_ALPHA = Constants.TEXTUREFORMAT_ALPHA;
         /** LUMINANCE */
-        public static readonly TEXTUREFORMAT_LUMINANCE = 1;
+        public static readonly TEXTUREFORMAT_LUMINANCE = Constants.TEXTUREFORMAT_LUMINANCE;
         /** LUMINANCE_ALPHA */
-        public static readonly TEXTUREFORMAT_LUMINANCE_ALPHA = 2;
+        public static readonly TEXTUREFORMAT_LUMINANCE_ALPHA = Constants.TEXTUREFORMAT_LUMINANCE_ALPHA;
         /** RGB */
-        public static readonly TEXTUREFORMAT_RGB = 4;
+        public static readonly TEXTUREFORMAT_RGB = Constants.TEXTUREFORMAT_RGB;
         /** RGBA */
-        public static readonly TEXTUREFORMAT_RGBA = 5;
+        public static readonly TEXTUREFORMAT_RGBA = Constants.TEXTUREFORMAT_RGBA;
         /** RED */
-        public static readonly TEXTUREFORMAT_RED = 6;
+        public static readonly TEXTUREFORMAT_RED = Constants.TEXTUREFORMAT_RED;
         /** RED (2nd reference) */
-        public static readonly TEXTUREFORMAT_R = 6;
+        public static readonly TEXTUREFORMAT_R = Constants.TEXTUREFORMAT_R;
         /** RG */
-        public static readonly TEXTUREFORMAT_RG = 7;
+        public static readonly TEXTUREFORMAT_RG = Constants.TEXTUREFORMAT_RG;
         /** RED_INTEGER */
-        public static readonly TEXTUREFORMAT_RED_INTEGER = 8;
+        public static readonly TEXTUREFORMAT_RED_INTEGER = Constants.TEXTUREFORMAT_RED_INTEGER;
         /** RED_INTEGER (2nd reference) */
-        public static readonly TEXTUREFORMAT_R_INTEGER = 8;
+        public static readonly TEXTUREFORMAT_R_INTEGER = Constants.TEXTUREFORMAT_R_INTEGER;
         /** RG_INTEGER */
-        public static readonly TEXTUREFORMAT_RG_INTEGER = 9;
+        public static readonly TEXTUREFORMAT_RG_INTEGER = Constants.TEXTUREFORMAT_RG_INTEGER;
         /** RGB_INTEGER */
-        public static readonly TEXTUREFORMAT_RGB_INTEGER = 10;
+        public static readonly TEXTUREFORMAT_RGB_INTEGER = Constants.TEXTUREFORMAT_RGB_INTEGER;
         /** RGBA_INTEGER */
-        public static readonly TEXTUREFORMAT_RGBA_INTEGER = 11;
+        public static readonly TEXTUREFORMAT_RGBA_INTEGER = Constants.TEXTUREFORMAT_RGBA_INTEGER;
 
         /** UNSIGNED_BYTE */
-        public static readonly TEXTURETYPE_UNSIGNED_BYTE = 0;
+        public static readonly TEXTURETYPE_UNSIGNED_BYTE = Constants.TEXTURETYPE_UNSIGNED_BYTE;
         /** UNSIGNED_BYTE (2nd reference) */
-        public static readonly TEXTURETYPE_UNSIGNED_INT = 0;
+        public static readonly TEXTURETYPE_UNSIGNED_INT = Constants.TEXTURETYPE_UNSIGNED_INT;
         /** FLOAT */
-        public static readonly TEXTURETYPE_FLOAT = 1;
+        public static readonly TEXTURETYPE_FLOAT = Constants.TEXTURETYPE_FLOAT;
         /** HALF_FLOAT */
-        public static readonly TEXTURETYPE_HALF_FLOAT = 2;
+        public static readonly TEXTURETYPE_HALF_FLOAT = Constants.TEXTURETYPE_HALF_FLOAT;
         /** BYTE */
-        public static readonly TEXTURETYPE_BYTE = 3;
+        public static readonly TEXTURETYPE_BYTE = Constants.TEXTURETYPE_BYTE;
         /** SHORT */
-        public static readonly TEXTURETYPE_SHORT = 4;
+        public static readonly TEXTURETYPE_SHORT = Constants.TEXTURETYPE_SHORT;
         /** UNSIGNED_SHORT */
-        public static readonly TEXTURETYPE_UNSIGNED_SHORT = 5;
+        public static readonly TEXTURETYPE_UNSIGNED_SHORT = Constants.TEXTURETYPE_UNSIGNED_SHORT;
         /** INT */
-        public static readonly TEXTURETYPE_INT = 6;
+        public static readonly TEXTURETYPE_INT = Constants.TEXTURETYPE_INT;
         /** UNSIGNED_INT */
-        public static readonly TEXTURETYPE_UNSIGNED_INTEGER = 7;
+        public static readonly TEXTURETYPE_UNSIGNED_INTEGER = Constants.TEXTURETYPE_UNSIGNED_INTEGER;
         /** UNSIGNED_SHORT_4_4_4_4 */
-        public static readonly TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;
+        public static readonly TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;
         /** UNSIGNED_SHORT_5_5_5_1 */
-        public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;
+        public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;
         /** UNSIGNED_SHORT_5_6_5 */
-        public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;
+        public static readonly TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;
         /** UNSIGNED_INT_2_10_10_10_REV */
-        public static readonly TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;
+        public static readonly TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;
         /** UNSIGNED_INT_24_8 */
-        public static readonly TEXTURETYPE_UNSIGNED_INT_24_8 = 12;
+        public static readonly TEXTURETYPE_UNSIGNED_INT_24_8 = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;
         /** UNSIGNED_INT_10F_11F_11F_REV */
-        public static readonly TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;
+        public static readonly TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;
         /** UNSIGNED_INT_5_9_9_9_REV */
-        public static readonly TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;
+        public static readonly TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;
         /** FLOAT_32_UNSIGNED_INT_24_8_REV */
-        public static readonly TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;
+        public static readonly TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;
 
         /** nearest is mag = nearest and min = nearest and mip = linear */
-        public static readonly TEXTURE_NEAREST_SAMPLINGMODE = 1;
+        public static readonly TEXTURE_NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
         /** Bilinear is mag = linear and min = linear and mip = nearest */
-        public static readonly TEXTURE_BILINEAR_SAMPLINGMODE = 2;
+        public static readonly TEXTURE_BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
         /** Trilinear is mag = linear and min = linear and mip = linear */
-        public static readonly TEXTURE_TRILINEAR_SAMPLINGMODE = 3;
+        public static readonly TEXTURE_TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
         /** nearest is mag = nearest and min = nearest and mip = linear */
-        public static readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR = 1;
+        public static readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR;
         /** Bilinear is mag = linear and min = linear and mip = nearest */
-        public static readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST = 2;
+        public static readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;
         /** Trilinear is mag = linear and min = linear and mip = linear */
-        public static readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;
+        public static readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;
         /** mag = nearest and min = nearest and mip = nearest */
-        public static readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;
+        public static readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
         /** mag = nearest and min = linear and mip = nearest */
-        public static readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;
+        public static readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
         /** mag = nearest and min = linear and mip = linear */
-        public static readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;
+        public static readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
         /** mag = nearest and min = linear and mip = none */
-        public static readonly TEXTURE_NEAREST_LINEAR = 7;
+        public static readonly TEXTURE_NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;
         /** mag = nearest and min = nearest and mip = none */
-        public static readonly TEXTURE_NEAREST_NEAREST = 8;
+        public static readonly TEXTURE_NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;
         /** mag = linear and min = nearest and mip = nearest */
-        public static readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;
+        public static readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
         /** mag = linear and min = nearest and mip = linear */
-        public static readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;
+        public static readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
         /** mag = linear and min = linear and mip = none */
-        public static readonly TEXTURE_LINEAR_LINEAR = 11;
+        public static readonly TEXTURE_LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;
         /** mag = linear and min = nearest and mip = none */
-        public static readonly TEXTURE_LINEAR_NEAREST = 12;
+        public static readonly TEXTURE_LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;
 
         /** Explicit coordinates mode */
-        public static readonly TEXTURE_EXPLICIT_MODE = 0;
+        public static readonly TEXTURE_EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;
         /** Spherical coordinates mode */
-        public static readonly TEXTURE_SPHERICAL_MODE = 1;
+        public static readonly TEXTURE_SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;
         /** Planar coordinates mode */
-        public static readonly TEXTURE_PLANAR_MODE = 2;
+        public static readonly TEXTURE_PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;
         /** Cubic coordinates mode */
-        public static readonly TEXTURE_CUBIC_MODE = 3;
+        public static readonly TEXTURE_CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;
         /** Projection coordinates mode */
-        public static readonly TEXTURE_PROJECTION_MODE = 4;
+        public static readonly TEXTURE_PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;
         /** Skybox coordinates mode */
-        public static readonly TEXTURE_SKYBOX_MODE = 5;
+        public static readonly TEXTURE_SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;
         /** Inverse Cubic coordinates mode */
-        public static readonly TEXTURE_INVCUBIC_MODE = 6;
+        public static readonly TEXTURE_INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;
         /** Equirectangular coordinates mode */
-        public static readonly TEXTURE_EQUIRECTANGULAR_MODE = 7;
+        public static readonly TEXTURE_EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;
         /** Equirectangular Fixed coordinates mode */
-        public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;
+        public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
         /** Equirectangular Fixed Mirrored coordinates mode */
-        public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;
+        public static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
 
         // Texture rescaling mode
         /** Defines that texture rescaling will use a floor to find the closer power of 2 size */
-        public static readonly SCALEMODE_FLOOR = 1;
+        public static readonly SCALEMODE_FLOOR = Constants.SCALEMODE_FLOOR;
         /** Defines that texture rescaling will look for the nearest power of 2 size */
-        public static readonly SCALEMODE_NEAREST = 2;
+        public static readonly SCALEMODE_NEAREST = Constants.SCALEMODE_NEAREST;
         /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
-        public static readonly SCALEMODE_CEILING = 3;
+        public static readonly SCALEMODE_CEILING = Constants.SCALEMODE_CEILING;
 
         /**
          * Returns the current version of the framework

+ 8 - 7
src/Engine/nullEngine.ts

@@ -8,6 +8,7 @@ import { InternalTexture } from "Materials/Textures/internalTexture";
 import { Effect } from "Materials/effect";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "./constants";
     /**
      * Options to create the null engine
      */
@@ -286,10 +287,10 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 return;
             }
 
-            this._alphaState.alphaBlend = (mode !== Engine.ALPHA_DISABLE);
+            this._alphaState.alphaBlend = (mode !== Constants.ALPHA_DISABLE);
 
             if (!noDepthWriteChange) {
-                this.setDepthWrite(mode === Engine.ALPHA_DISABLE);
+                this.setDepthWrite(mode === Constants.ALPHA_DISABLE);
             }
             this._alphaMode = mode;
         }
@@ -335,7 +336,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         public _releaseTexture(texture: InternalTexture): void {
         }
 
-        public createTexture(urlArg: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode: number = Engine.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 {
+        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 url = String(urlArg);
 
@@ -369,14 +370,14 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 fullOptions.generateMipMaps = options.generateMipMaps;
                 fullOptions.generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;
                 fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && options.generateStencilBuffer;
-                fullOptions.type = options.type === undefined ? Engine.TEXTURETYPE_UNSIGNED_INT : options.type;
-                fullOptions.samplingMode = options.samplingMode === undefined ? Engine.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
+                fullOptions.type = options.type === undefined ? Constants.TEXTURETYPE_UNSIGNED_INT : options.type;
+                fullOptions.samplingMode = options.samplingMode === undefined ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : options.samplingMode;
             } else {
                 fullOptions.generateMipMaps = <boolean>options;
                 fullOptions.generateDepthBuffer = true;
                 fullOptions.generateStencilBuffer = false;
-                fullOptions.type = Engine.TEXTURETYPE_UNSIGNED_INT;
-                fullOptions.samplingMode = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;
+                fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
+                fullOptions.samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
             }
             var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RENDERTARGET);
 

+ 3 - 3
src/Helpers/environmentHelper.ts

@@ -3,7 +3,6 @@ import { Nullable } from "types";
 import { ArcRotateCamera } from "Cameras/arcRotateCamera";
 import { Scene } from "scene";
 import { Vector3, Color3, Color4, Plane } from "Math/math";
-import { Engine } from "Engine/engine";
 import { AbstractMesh } from "Mesh/abstractMesh";
 import { Mesh } from "Mesh/mesh";
 import { BaseTexture } from "Materials/Textures/baseTexture";
@@ -13,6 +12,7 @@ import { CubeTexture } from "Materials/Textures/cubeTexture";
 import { BackgroundMaterial } from "Materials/Background/backgroundMaterial";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * Represents the different options available during the creation of
      * a Environment helper.
@@ -221,7 +221,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 groundMirrorAmount: 1,
                 groundMirrorFresnelWeight: 1,
                 groundMirrorFallOffDistance: 0,
-                groundMirrorTextureType: Engine.TEXTURETYPE_UNSIGNED_INT,
+                groundMirrorTextureType: Constants.TEXTURETYPE_UNSIGNED_INT,
 
                 groundYBias: 0.00001,
 
@@ -547,7 +547,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 this._groundMaterial = new BackgroundMaterial("BackgroundPlaneMaterial", this._scene);
             }
             this._groundMaterial.alpha = this._options.groundOpacity;
-            this._groundMaterial.alphaMode = Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;
+            this._groundMaterial.alphaMode = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;
             this._groundMaterial.shadowLevel = this._options.groundShadowLevel;
             this._groundMaterial.primaryColor = this._options.groundColor;
             this._groundMaterial.useRGBColor = false;

+ 3 - 2
src/Layer/effectLayer.ts

@@ -22,6 +22,7 @@ import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { Effect } from "Materials/effect";
 import { Material } from "Materials/material";
 import { MaterialHelper } from "Materials/materialHelper";
+import { Constants } from "Engine/constants";
 
     /**
      * Effect layer options. This helps customizing the behaviour
@@ -232,7 +233,7 @@ import { MaterialHelper } from "Materials/materialHelper";
             // Adapt options
             this._effectLayerOptions = {
                 mainTextureRatio: 0.5,
-                alphaBlendingMode: Engine.ALPHA_COMBINE,
+                alphaBlendingMode: Constants.ALPHA_COMBINE,
                 camera: null,
                 renderingGroupId: -1,
                 ...options,
@@ -309,7 +310,7 @@ import { MaterialHelper } from "Materials/materialHelper";
                 this._scene,
                 false,
                 true,
-                Engine.TEXTURETYPE_UNSIGNED_INT);
+                Constants.TEXTURETYPE_UNSIGNED_INT);
             this._mainTexture.activeCamera = this._effectLayerOptions.camera;
             this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;
             this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;

+ 4 - 4
src/Layer/glowLayer.ts

@@ -4,7 +4,6 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { Scene } from "scene";
 import { Vector2, Color4 } from "Math/math";
-import { Engine } from "Engine/engine";
 import { VertexBuffer } from "Mesh/buffer";
 import { SubMesh } from "Mesh/subMesh";
 import { AbstractMesh } from "Mesh/abstractMesh";
@@ -17,6 +16,7 @@ import { PostProcess } from "PostProcess/postProcess";
 import { BlurPostProcess } from "PostProcess/blurPostProcess";
 import { EffectLayer } from "./effectLayer";
 import { AbstractScene } from "abstractScene";
+import { Constants } from "Engine/constants";
 
 declare module "abstractScene" {
     export interface AbstractScene {
@@ -181,7 +181,7 @@ declare module "abstractScene" {
 
             // Initialize the layer
             this._init({
-                alphaBlendingMode: Engine.ALPHA_ADD,
+                alphaBlendingMode: Constants.ALPHA_ADD,
                 camera: this._options.camera,
                 mainTextureFixedSize: this._options.mainTextureFixedSize,
                 mainTextureRatio: this._options.mainTextureRatio,
@@ -222,10 +222,10 @@ declare module "abstractScene" {
 
             var textureType = 0;
             if (this._engine.getCaps().textureHalfFloatRender) {
-                textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                textureType = Constants.TEXTURETYPE_HALF_FLOAT;
             }
             else {
-                textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+                textureType = Constants.TEXTURETYPE_UNSIGNED_INT;
             }
 
             this._blurTexture1 = new RenderTargetTexture("GlowLayerBlurRTT",

+ 10 - 9
src/Layer/highlightLayer.ts

@@ -21,6 +21,7 @@ import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 import { EffectLayer } from "./effectLayer";
 import { AbstractScene } from "abstractScene";
+import { Constants } from "Engine/constants";
 
 declare module "abstractScene" {
     export interface AbstractScene {
@@ -272,7 +273,7 @@ declare module "abstractScene" {
                 blurTextureSizeRatio: 0.5,
                 blurHorizontalSize: 1.0,
                 blurVerticalSize: 1.0,
-                alphaBlendingMode: Engine.ALPHA_COMBINE,
+                alphaBlendingMode: Constants.ALPHA_COMBINE,
                 camera: null,
                 renderingGroupId: -1,
                 ...options,
@@ -324,10 +325,10 @@ declare module "abstractScene" {
 
             var textureType = 0;
             if (this._engine.getCaps().textureHalfFloatRender) {
-                textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                textureType = Constants.TEXTURETYPE_HALF_FLOAT;
             }
             else {
-                textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+                textureType = Constants.TEXTURETYPE_UNSIGNED_INT;
             }
 
             this._blurTexture = new RenderTargetTexture("HighlightLayerBlurRTT",
@@ -348,7 +349,7 @@ declare module "abstractScene" {
 
             this._textures = [this._blurTexture];
 
-            if (this._options.alphaBlendingMode === Engine.ALPHA_COMBINE) {
+            if (this._options.alphaBlendingMode === Constants.ALPHA_COMBINE) {
                 this._downSamplePostprocess = new PassPostProcess("HighlightLayerPPP", this._options.blurTextureSizeRatio,
                     null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine());
                 this._downSamplePostprocess.onApplyObservable.add((effect) => {
@@ -458,9 +459,9 @@ declare module "abstractScene" {
             var previousStencilReference = engine.getStencilFunctionReference();
 
             // Stencil operations
-            engine.setStencilOperationPass(Engine.REPLACE);
-            engine.setStencilOperationFail(Engine.KEEP);
-            engine.setStencilOperationDepthFail(Engine.KEEP);
+            engine.setStencilOperationPass(Constants.REPLACE);
+            engine.setStencilOperationFail(Constants.KEEP);
+            engine.setStencilOperationDepthFail(Constants.KEEP);
 
             // Draw order
             engine.setStencilMask(0x00);
@@ -470,12 +471,12 @@ declare module "abstractScene" {
             // 2 passes inner outer
             if (this.outerGlow) {
                 effect.setFloat("offset", 0);
-                engine.setStencilFunction(Engine.NOTEQUAL);
+                engine.setStencilFunction(Constants.NOTEQUAL);
                 engine.drawElementsType(Material.TriangleFillMode, 0, 6);
             }
             if (this.innerGlow) {
                 effect.setFloat("offset", 1);
-                engine.setStencilFunction(Engine.EQUAL);
+                engine.setStencilFunction(Constants.EQUAL);
                 engine.drawElementsType(Material.TriangleFillMode, 0, 6);
             }
 

+ 3 - 2
src/Layer/layer.ts

@@ -11,6 +11,7 @@ import { SceneComponentConstants } from "sceneComponent";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 import { LayerSceneComponent } from "./layerSceneComponent";
+import { Constants } from "Engine/constants";
     /**
      * This represents a full screen 2d layer.
      * This can be usefull to display a picture in the  background of your scene for instance.
@@ -45,7 +46,7 @@ import { LayerSceneComponent } from "./layerSceneComponent";
         /**
          * Define the alpha blending mode used in the layer in case the texture or color has an alpha.
          */
-        public alphaBlendingMode = Engine.ALPHA_COMBINE;
+        public alphaBlendingMode = Constants.ALPHA_COMBINE;
 
         /**
          * Define if the layer should alpha test or alpha blend with the rest of the scene.
@@ -238,7 +239,7 @@ import { LayerSceneComponent } from "./layerSceneComponent";
             if (!this.alphaTest) {
                 engine.setAlphaMode(this.alphaBlendingMode);
                 engine.drawElementsType(Material.TriangleFillMode, 0, 6);
-                engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                engine.setAlphaMode(Constants.ALPHA_DISABLE);
             }
             else {
                 engine.drawElementsType(Material.TriangleFillMode, 0, 6);

+ 2 - 2
src/LensFlare/lensFlare.ts

@@ -1,10 +1,10 @@
 import { Nullable } from "types";
 import { Color3 } from "Math/math";
-import { Engine } from "Engine/engine";
 import { Texture } from "Materials/Textures/texture";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 import { LensFlareSystem } from "./lensFlareSystem";
+import { Constants } from "Engine/constants";
     /**
      * This represents one of the lens effect in a `lensFlareSystem`.
      * It controls one of the indiviual texture used in the effect.
@@ -24,7 +24,7 @@ import { LensFlareSystem } from "./lensFlareSystem";
         /**
          * Define the alpha mode to render this particular lens.
          */
-        public alphaMode: number = Engine.ALPHA_ONEONE;
+        public alphaMode: number = Constants.ALPHA_ONEONE;
 
         private _system: LensFlareSystem;
 

+ 2 - 1
src/LensFlare/lensFlareSystem.ts

@@ -14,6 +14,7 @@ import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 import { LensFlare } from "./lensFlare";
 import { LensFlareSystemSceneComponent } from "./lensFlareSystemSceneComponent";
+import { Constants } from "Engine/constants";
 
     /**
      * This represents a Lens Flare System or the shiny effect created by the light reflection on the  camera lenses.
@@ -335,7 +336,7 @@ import { LensFlareSystemSceneComponent } from "./lensFlareSystemSceneComponent";
             }
 
             engine.setDepthBuffer(true);
-            engine.setAlphaMode(Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Constants.ALPHA_DISABLE);
             return true;
         }
 

+ 11 - 11
src/Lights/Shadows/shadowGenerator.ts

@@ -2,7 +2,6 @@ import { SmartArray } from "Tools/smartArray";
 import { Nullable } from "types";
 import { Scene } from "scene";
 import { Matrix, Vector3, Vector2, Color4 } from "Math/math";
-import { Engine } from "Engine/engine";
 import { VertexBuffer } from "Mesh/buffer";
 import { SubMesh } from "Mesh/subMesh";
 import { AbstractMesh } from "Mesh/abstractMesh";
@@ -24,6 +23,7 @@ import { BlurPostProcess } from "PostProcess/blurPostProcess";
 import { SceneComponentConstants } from "sceneComponent";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * Interface to implement to create a shadow generator compatible with BJS.
      */
@@ -691,23 +691,23 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 
             if (!useFullFloatFirst) {
                 if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {
-                    this._textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                    this._textureType = Constants.TEXTURETYPE_HALF_FLOAT;
                 }
                 else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {
-                    this._textureType = Engine.TEXTURETYPE_FLOAT;
+                    this._textureType = Constants.TEXTURETYPE_FLOAT;
                 }
                 else {
-                    this._textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+                    this._textureType = Constants.TEXTURETYPE_UNSIGNED_INT;
                 }
             } else {
                 if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {
-                    this._textureType = Engine.TEXTURETYPE_FLOAT;
+                    this._textureType = Constants.TEXTURETYPE_FLOAT;
                 }
                 else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {
-                    this._textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                    this._textureType = Constants.TEXTURETYPE_HALF_FLOAT;
                 }
                 else {
-                    this._textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+                    this._textureType = Constants.TEXTURETYPE_UNSIGNED_INT;
                 }
             }
 
@@ -725,7 +725,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
             let engine = this._scene.getEngine();
             if (engine.webGLVersion > 1) {
                 this._shadowMap = new RenderTargetTexture(this._light.name + "_shadowMap", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube(), undefined, false, false);
-                this._shadowMap.createDepthStencilTexture(Engine.LESS, true);
+                this._shadowMap.createDepthStencilTexture(Constants.LESS, true);
             }
             else {
                 this._shadowMap = new RenderTargetTexture(this._light.name + "_shadowMap", this._mapSize, this._scene, false, true, this._textureType, this._light.needCube());
@@ -766,7 +766,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
             // Clear according to the chosen filter.
             var clearZero = new Color4(0, 0, 0, 0);
             var clearOne = new Color4(1.0, 1.0, 1.0, 1.0);
-            this._shadowMap.onClearObservable.add((engine: Engine) => {
+            this._shadowMap.onClearObservable.add((engine) => {
                 if (this._filter === ShadowGenerator.FILTER_PCF) {
                     engine.clear(clearOne, false, true, false);
                 }
@@ -803,7 +803,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 this._kernelBlurXPostprocess.autoClear = false;
                 this._kernelBlurYPostprocess.autoClear = false;
 
-                if (this._textureType === Engine.TEXTURETYPE_UNSIGNED_INT) {
+                if (this._textureType === Constants.TEXTURETYPE_UNSIGNED_INT) {
                     (<BlurPostProcess>this._kernelBlurXPostprocess).packedFloat = true;
                     (<BlurPostProcess>this._kernelBlurYPostprocess).packedFloat = true;
                 }
@@ -1031,7 +1031,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         public isReady(subMesh: SubMesh, useInstances: boolean): boolean {
             var defines = [];
 
-            if (this._textureType !== Engine.TEXTURETYPE_UNSIGNED_INT) {
+            if (this._textureType !== Constants.TEXTURETYPE_UNSIGNED_INT) {
                 defines.push("#define FLOAT");
             }
 

+ 2 - 2
src/Materials/Background/backgroundMaterial.ts

@@ -5,7 +5,6 @@ import { Tools } from "Tools/tools";
 import { Nullable, int, float } from "types";
 import { Scene } from "scene";
 import { Matrix, Vector3, Color3, Vector4 } from "Math/math";
-import { Engine } from "Engine/engine";
 import { VertexBuffer } from "Mesh/buffer";
 import { SubMesh } from "Mesh/subMesh";
 import { AbstractMesh } from "Mesh/abstractMesh";
@@ -26,6 +25,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 
 import "Shaders/background.fragment";
 import "Shaders/background.vertex";
+import { Constants } from "Engine/constants";
 
     /**
      * Background material defines definition.
@@ -788,7 +788,7 @@ import "Shaders/background.vertex";
                     }
                 }
 
-                defines.PREMULTIPLYALPHA = (this.alphaMode === Engine.ALPHA_PREMULTIPLIED || this.alphaMode === Engine.ALPHA_PREMULTIPLIED_PORTERDUFF);
+                defines.PREMULTIPLYALPHA = (this.alphaMode === Constants.ALPHA_PREMULTIPLIED || this.alphaMode === Constants.ALPHA_PREMULTIPLIED_PORTERDUFF);
                 defines.USERGBCOLOR = this._useRGBColor;
                 defines.NOISE = this._enableNoise;
             }

+ 2 - 2
src/Materials/PBR/pbrBaseMaterial.ts

@@ -7,7 +7,6 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { Scene } from "scene";
 import { Matrix, Color3, Vector4, Tmp } from "Math/math";
-import { Engine } from "Engine/engine";
 import { VertexBuffer } from "Mesh/buffer";
 import { SubMesh } from "Mesh/subMesh";
 import { AbstractMesh } from "Mesh/abstractMesh";
@@ -31,6 +30,7 @@ import { StandardMaterial } from "Materials/standardMaterial";
 
 import "Shaders/pbr.fragment";
 import "Shaders/pbr.vertex";
+import { Constants } from "Engine/constants";
 
     /**
      * Manages the defines for the PBR Material.
@@ -1349,7 +1349,7 @@ import "Shaders/pbr.vertex";
                 }
 
                 defines.ALPHATESTVALUE = `${this._alphaCutOff}${this._alphaCutOff % 1 === 0 ? "." : ""}`;
-                defines.PREMULTIPLYALPHA = (this.alphaMode === Engine.ALPHA_PREMULTIPLIED || this.alphaMode === Engine.ALPHA_PREMULTIPLIED_PORTERDUFF);
+                defines.PREMULTIPLYALPHA = (this.alphaMode === Constants.ALPHA_PREMULTIPLIED || this.alphaMode === Constants.ALPHA_PREMULTIPLIED_PORTERDUFF);
                 defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);
                 defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;
                 defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;

+ 11 - 10
src/Materials/Textures/baseTexture.ts

@@ -12,6 +12,7 @@ import { InternalTexture } from "Materials/Textures/internalTexture";
 import { Animation } from "Animations/animation";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * Base class of all the textures in babylon.
      * It groups all the common properties the materials, post process, lights... might need
@@ -82,7 +83,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         public coordinatesIndex = 0;
 
         @serialize("coordinatesMode")
-        private _coordinatesMode = Engine.TEXTURE_EXPLICIT_MODE;
+        private _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;
 
         /**
         * How a texture is mapped.
@@ -121,7 +122,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         * | 2     | MIRROR_ADDRESSMODE |             |
         */
         @serialize()
-        public wrapU = Engine.TEXTURE_WRAP_ADDRESSMODE;
+        public wrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;
 
         /**
         * | Value | Type               | Description |
@@ -131,7 +132,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         * | 2     | MIRROR_ADDRESSMODE |             |
         */
         @serialize()
-        public wrapV = Engine.TEXTURE_WRAP_ADDRESSMODE;
+        public wrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;
 
         /**
         * | Value | Type               | Description |
@@ -141,7 +142,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         * | 2     | MIRROR_ADDRESSMODE |             |
         */
         @serialize()
-        public wrapR = Engine.TEXTURE_WRAP_ADDRESSMODE;
+        public wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;
 
         /**
          * With compliant hardware and browser (supporting anisotropic filtering)
@@ -273,7 +274,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
         /**
          * Define the current state of the loading sequence when in delayed load mode.
          */
-        public delayLoadState = Engine.DELAYLOADSTATE_NONE;
+        public delayLoadState = Constants.DELAYLOADSTATE_NONE;
 
         private _scene: Nullable<Scene>;
 
@@ -351,7 +352,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          * @returns true if fully ready
          */
         public isReady(): boolean {
-            if (this.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) {
+            if (this.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {
                 this.delayLoad();
                 return false;
             }
@@ -462,10 +463,10 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          */
         public get textureType(): number {
             if (!this._texture) {
-                return Engine.TEXTURETYPE_UNSIGNED_INT;
+                return Constants.TEXTURETYPE_UNSIGNED_INT;
             }
 
-            return (this._texture.type !== undefined) ? this._texture.type : Engine.TEXTURETYPE_UNSIGNED_INT;
+            return (this._texture.type !== undefined) ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_INT;
         }
 
         /**
@@ -473,10 +474,10 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          */
         public get textureFormat(): number {
             if (!this._texture) {
-                return Engine.TEXTUREFORMAT_RGBA;
+                return Constants.TEXTUREFORMAT_RGBA;
             }
 
-            return (this._texture.format !== undefined) ? this._texture.format : Engine.TEXTUREFORMAT_RGBA;
+            return (this._texture.format !== undefined) ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;
         }
 
         /**

+ 11 - 10
src/Materials/Textures/colorGradingTexture.ts

@@ -6,6 +6,7 @@ import { InternalTexture } from "Materials/Textures/internalTexture";
 import { BaseTexture } from "Materials/Textures/baseTexture";
 import { _TimeToken } from "Instrumentation";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
      * It can help converting any input color in a desired output one. This can then be used to create effects
@@ -52,9 +53,9 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
             this.hasAlpha = false;
             this.isCube = false;
             this.is3D = this._engine.webGLVersion > 1;
-            this.wrapU = Engine.TEXTURE_CLAMP_ADDRESSMODE;
-            this.wrapV = Engine.TEXTURE_CLAMP_ADDRESSMODE;
-            this.wrapR = Engine.TEXTURE_CLAMP_ADDRESSMODE;
+            this.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;
+            this.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;
+            this.wrapR = Constants.TEXTURE_CLAMP_ADDRESSMODE;
 
             this.anisotropicFilteringLevel = 1;
 
@@ -64,7 +65,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                 if (!scene.useDelayedTextureLoading) {
                     this.loadTexture();
                 } else {
-                    this.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+                    this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
                 }
             }
         }
@@ -84,10 +85,10 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
             var engine = this._engine;
             var texture: InternalTexture;
             if (engine.webGLVersion === 1) {
-                texture = engine.createRawTexture(null, 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_BILINEAR_SAMPLINGMODE);
+                texture = engine.createRawTexture(null, 1, 1, Constants.TEXTUREFORMAT_RGBA, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
             }
             else {
-                texture = engine.createRawTexture3D(null, 1, 1, 1, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_BILINEAR_SAMPLINGMODE);
+                texture = engine.createRawTexture3D(null, 1, 1, 1, Constants.TEXTUREFORMAT_RGBA, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
             }
 
             this._texture = texture;
@@ -180,11 +181,11 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 
                 if (texture.is3D) {
                     texture.updateSize(size, size, size);
-                    engine.updateRawTexture3D(texture, data, Engine.TEXTUREFORMAT_RGBA, false);
+                    engine.updateRawTexture3D(texture, data, Constants.TEXTUREFORMAT_RGBA, false);
                 }
                 else {
                     texture.updateSize(size * size, size);
-                    engine.updateRawTexture(texture, data, Engine.TEXTUREFORMAT_RGBA, false);
+                    engine.updateRawTexture(texture, data, Constants.TEXTUREFORMAT_RGBA, false);
                 }
             };
 
@@ -224,11 +225,11 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          * Called during delayed load for textures.
          */
         public delayLoad(): void {
-            if (this.delayLoadState !== Engine.DELAYLOADSTATE_NOTLOADED) {
+            if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
 
-            this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
+            this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
             this._texture = this._getFromCache(this.url, true);
 
             if (!this._texture) {

+ 5 - 5
src/Materials/Textures/cubeTexture.ts

@@ -3,13 +3,13 @@ import { Tools } from "Tools/tools";
 import { Nullable } from "types";
 import { Scene } from "scene";
 import { Matrix, Vector3 } from "Math/math";
-import { Engine } from "Engine/engine";
 import { Material } from "Materials/material";
 import { BaseTexture } from "Materials/Textures/baseTexture";
 import { Texture } from "Materials/Textures/texture";
 import { Animation } from "Animations/animation";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * Class for creating a cube texture
      */
@@ -125,7 +125,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          * @return the cube texture
          */
         constructor(rootUrl: string, scene: Scene, extensions: Nullable<string[]> = null, noMipmap: boolean = false, files: Nullable<string[]> = null,
-            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA, prefiltered = false,
+            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Constants.TEXTUREFORMAT_RGBA, prefiltered = false,
             forcedExtension: any = null, createPolynomials: boolean = false,
             lodScale: number = 0.8, lodOffset: number = 0) {
             super(scene);
@@ -189,7 +189,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                         this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, this._format, forcedExtension, false, lodScale, lodOffset);
                     }
                 } else {
-                    this.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+                    this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
                 }
             } else if (onLoad) {
                 if (this._texture.isReady) {
@@ -204,7 +204,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          * Delays loading of the cube texture
          */
         public delayLoad(): void {
-            if (this.delayLoadState !== Engine.DELAYLOADSTATE_NOTLOADED) {
+            if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
 
@@ -213,7 +213,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
             if (!scene) {
                 return;
             }
-            this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
+            this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
             this._texture = this._getFromCache(this.url, this._noMipmap);
 
             if (!this._texture) {

+ 2 - 1
src/Materials/Textures/dynamicTexture.ts

@@ -6,6 +6,7 @@ import { Engine } from "Engine/engine";
 import { Texture } from "Materials/Textures/texture";
 import { _TimeToken } from "Instrumentation/timeToken";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
     /**
      * A class extending Texture allowing drawing on a texture
      * @see http://doc.babylonjs.com/how_to/dynamictexture
@@ -26,7 +27,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
          * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)
          */
 
-        constructor(name: string, options: any, scene: Nullable<Scene> = null, generateMipMaps: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, format: number = Engine.TEXTUREFORMAT_RGBA) {
+        constructor(name: string, options: any, scene: Nullable<Scene> = null, generateMipMaps: boolean, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, format: number = Constants.TEXTUREFORMAT_RGBA) {
             super(null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format);
 
             this.name = name;

+ 2 - 1
src/Materials/Textures/internalTexture.ts

@@ -5,6 +5,7 @@ import { Engine, RenderTargetCreationOptions } from "Engine/engine";
 import { IInternalTextureTracker } from "Materials/Textures/internalTextureTracker";
 import { _TimeToken } from "Instrumentation";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+import { Constants } from "Engine/constants";
 
 declare type BaseTexture = import("Materials/Textures/baseTexture").BaseTexture;
 
@@ -354,7 +355,7 @@ declare type BaseTexture = import("Materials/Textures/baseTexture").BaseTexture;
                     return;
                 case InternalTexture.DATASOURCE_DEPTHTEXTURE:
                     let depthTextureOptions = {
-                        bilinearFiltering: this.samplingMode !== Engine.TEXTURE_BILINEAR_SAMPLINGMODE,
+                        bilinearFiltering: this.samplingMode !== Constants.TEXTURE_BILINEAR_SAMPLINGMODE,
                         comparisonFunction: this._comparisonFunction,
                         generateStencil: this._generateStencilBuffer,
                         isCube: this.isCube

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

@@ -3,11 +3,11 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { Scene } from "scene";
 import { Matrix, Vector3, Vector2, Plane } from "Math/math";
-import { Engine } from "Engine/engine";
 import { Texture } from "Materials/Textures/texture";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { ImageProcessingConfiguration } from "Materials/imageProcessingConfiguration";
 import { BlurPostProcess } from "PostProcess/blurPostProcess";
+import { Constants } from "Engine/constants";
     /**
      * Mirror texture can be used to simulate the view from a mirror in a scene.
      * It will dynamically be rendered every frame to adapt to the camera point of view.
@@ -145,7 +145,7 @@ import { BlurPostProcess } from "PostProcess/blurPostProcess";
          * @param samplingMode
          * @param generateDepthBuffer
          */
-        constructor(name: string, size: number | { width: number, height: number } | { ratio: number }, private scene: Scene, generateMipMaps?: boolean, type: number = Engine.TEXTURETYPE_UNSIGNED_INT, samplingMode = Texture.BILINEAR_SAMPLINGMODE, generateDepthBuffer = true) {
+        constructor(name: string, size: number | { width: number, height: number } | { ratio: number }, private scene: Scene, generateMipMaps?: boolean, type: number = Constants.TEXTURETYPE_UNSIGNED_INT, samplingMode = Texture.BILINEAR_SAMPLINGMODE, generateDepthBuffer = true) {
             super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);
 
             this.ignoreCameraViewport = true;
@@ -185,7 +185,7 @@ import { BlurPostProcess } from "PostProcess/blurPostProcess";
             if (this._blurKernelX && this._blurKernelY) {
                 var engine = (<Scene>this.getScene()).getEngine();
 
-                var textureType = engine.getCaps().textureFloatRender ? Engine.TEXTURETYPE_FLOAT : Engine.TEXTURETYPE_HALF_FLOAT;
+                var textureType = engine.getCaps().textureFloatRender ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;
 
                 this._blurX = new BlurPostProcess("horizontal blur", new Vector2(1.0, 0), this._blurKernelX, this._blurRatio, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, textureType);
                 this._blurX.autoClear = false;

+ 2 - 1
src/Materials/Textures/multiRenderTarget.ts

@@ -3,6 +3,7 @@ import { Engine } from "Engine/engine";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { Texture } from "Materials/Textures/texture";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
+import { Constants } from "Engine/constants";
 
     /**
      * Creation options of the multi render target texture.
@@ -136,7 +137,7 @@ import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
                 if (options && options.types && options.types[i] !== undefined) {
                     types.push(options.types[i]);
                 } else {
-                    types.push(options && options.defaultType ? options.defaultType : Engine.TEXTURETYPE_UNSIGNED_INT);
+                    types.push(options && options.defaultType ? options.defaultType : Constants.TEXTURETYPE_UNSIGNED_INT);
                 }
 
                 if (options && options.samplingModes && options.samplingModes[i] !== undefined) {

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

@@ -3,10 +3,9 @@ import { EnvironmentTextureTools } from "Tools/environmentTextureTools";
 import { Nullable } from "types";
 import { Scene } from "scene";
 import { SphericalPolynomial } from "Math/sphericalPolynomial";
-import { Engine } from "Engine/engine";
 import { InternalTexture } from "Materials/Textures/internalTexture";
-import { Texture } from "Materials/Textures/texture";
 import { CubeTexture } from "Materials/Textures/cubeTexture";
+import { Constants } from "Engine/constants";
     /**
      * Raw cube texture where the raw buffers are passed in
      */
@@ -24,8 +23,8 @@ import { CubeTexture } from "Materials/Textures/cubeTexture";
          * @param compression defines the compression used (null by default)
          */
         constructor(scene: Scene, data: Nullable<ArrayBufferView[]>, size: number,
-                    format: number = Engine.TEXTUREFORMAT_RGBA, type: number = Engine.TEXTURETYPE_UNSIGNED_INT,
-                    generateMipMaps: boolean = false, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
+                    format: number = Constants.TEXTUREFORMAT_RGBA, type: number = Constants.TEXTURETYPE_UNSIGNED_INT,
+                    generateMipMaps: boolean = false, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
                     compression: Nullable<string> = null) {
             super("", scene);
 

+ 14 - 13
src/Materials/Textures/rawTexture.ts

@@ -1,6 +1,7 @@
 import { Scene } from "scene";
 import { Engine } from "Engine/engine";
 import { Texture } from "Materials/Textures/texture";
+import { Constants } from "Engine/constants";
     /**
      * Raw texture can help creating a texture directly from an array of data.
      * This can be super useful if you either get the data from an uncompressed source or
@@ -29,7 +30,7 @@ import { Texture } from "Materials/Textures/texture";
              * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)
              */
             public format: number,
-            scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
+            scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, type: number = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(null, scene, !generateMipMaps, invertY);
             this._engine = scene.getEngine();
             this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
@@ -57,8 +58,8 @@ import { Texture } from "Materials/Textures/texture";
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
          * @returns the luminance texture
          */
-        public static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_LUMINANCE, scene, generateMipMaps, invertY, samplingMode);
+        public static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE, scene, generateMipMaps, invertY, samplingMode);
         }
 
         /**
@@ -72,8 +73,8 @@ import { Texture } from "Materials/Textures/texture";
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
          * @returns the luminance alpha texture
          */
-        public static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_LUMINANCE_ALPHA, scene, generateMipMaps, invertY, samplingMode);
+        public static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE_ALPHA, scene, generateMipMaps, invertY, samplingMode);
         }
 
         /**
@@ -87,8 +88,8 @@ import { Texture } from "Materials/Textures/texture";
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
          * @returns the alpha texture
          */
-        public static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
+        public static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
         }
 
         /**
@@ -103,8 +104,8 @@ import { Texture } from "Materials/Textures/texture";
          * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the RGB alpha texture
          */
-        public static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);
+        public static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, type: number = Constants.TEXTURETYPE_UNSIGNED_INT): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);
         }
 
         /**
@@ -119,8 +120,8 @@ import { Texture } from "Materials/Textures/texture";
          * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the RGBA texture
          */
-        public static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
+        public static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, type: number = Constants.TEXTURETYPE_UNSIGNED_INT): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
         }
 
         /**
@@ -135,7 +136,7 @@ import { Texture } from "Materials/Textures/texture";
          * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the R texture
          */
-        public static CreateRTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_FLOAT): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_R, scene, generateMipMaps, invertY, samplingMode, type);
+        public static CreateRTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Constants.TEXTURETYPE_FLOAT): RawTexture {
+            return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, scene, generateMipMaps, invertY, samplingMode, type);
         }
     }

+ 2 - 1
src/Materials/Textures/rawTexture3D.ts

@@ -1,6 +1,7 @@
 import { Scene } from "scene";
 import { Engine } from "Engine/engine";
 import { Texture } from "Materials/Textures/texture";
+import { Constants } from "Engine/constants";
     /**
      * Class used to store 3D textures containing user data
      */
@@ -26,7 +27,7 @@ import { Texture } from "Materials/Textures/texture";
                     generateMipMaps: boolean = true,
                     invertY: boolean = false,
                     samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
-                    textureType = Engine.TEXTURETYPE_UNSIGNED_INT) {
+                    textureType = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(null, scene, !generateMipMaps, invertY);
             this._engine = scene.getEngine();
 

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

@@ -14,6 +14,7 @@ import { Texture } from "Materials/Textures/texture";
 import { PostProcessManager } from "PostProcess/postProcessManager";
 import { PostProcess } from "PostProcess/postProcess";
 import { RenderingManager } from "Rendering/renderingManager";
+import { Constants } from "Engine/constants";
     /**
      * This Helps creating a texture that will be created from a camera in your scene.
      * It is basically a dynamic texture that could be used to create special effects for instance.
@@ -277,7 +278,7 @@ import { RenderingManager } from "Rendering/renderingManager";
          * @param format The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)
          * @param delayAllocation if the texture allocation should be delayed (default: false)
          */
-        constructor(name: string, size: number | { width: number, height: number } | { ratio: number }, scene: Nullable<Scene>, generateMipMaps?: boolean, doNotChangeAspectRatio: boolean = true, type: number = Engine.TEXTURETYPE_UNSIGNED_INT, public isCube = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, generateDepthBuffer = true, generateStencilBuffer = false, isMulti = false, format = Engine.TEXTUREFORMAT_RGBA, delayAllocation = false) {
+        constructor(name: string, size: number | { width: number, height: number } | { ratio: number }, scene: Nullable<Scene>, generateMipMaps?: boolean, doNotChangeAspectRatio: boolean = true, type: number = Constants.TEXTURETYPE_UNSIGNED_INT, public isCube = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, generateDepthBuffer = true, generateStencilBuffer = false, isMulti = false, format = Constants.TEXTUREFORMAT_RGBA, delayAllocation = false) {
             super(null, scene, !generateMipMaps);
             scene = this.getScene();
 

+ 36 - 35
src/Materials/Textures/texture.ts

@@ -4,9 +4,10 @@ import { Tools } from "Tools/tools";
 import { Nullable } from "types";
 import { Scene } from "scene";
 import { Matrix, Vector3 } from "Math/math";
-import { Engine } from "Engine/engine";
+//import { Engine } from "Engine/engine";
 import { Material } from "Materials/material";
 import { BaseTexture } from "Materials/Textures/baseTexture";
+import { Constants } from "Engine/constants";
 
 // import { Animation } from "Animations/animation";
 // import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
@@ -19,66 +20,66 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
      */
     export class Texture extends BaseTexture {
         /** nearest is mag = nearest and min = nearest and mip = linear */
-        public static readonly NEAREST_SAMPLINGMODE = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
+        public static readonly NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
         /** nearest is mag = nearest and min = nearest and mip = linear */
-        public static readonly NEAREST_NEAREST_MIPLINEAR = Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear
+        public static readonly NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear
 
         /** Bilinear is mag = linear and min = linear and mip = nearest */
-        public static readonly BILINEAR_SAMPLINGMODE = Engine.TEXTURE_BILINEAR_SAMPLINGMODE;
+        public static readonly BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
         /** Bilinear is mag = linear and min = linear and mip = nearest */
-        public static readonly LINEAR_LINEAR_MIPNEAREST = Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest
+        public static readonly LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest
 
         /** Trilinear is mag = linear and min = linear and mip = linear */
-        public static readonly TRILINEAR_SAMPLINGMODE = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;
+        public static readonly TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
         /** Trilinear is mag = linear and min = linear and mip = linear */
-        public static readonly LINEAR_LINEAR_MIPLINEAR = Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear
+        public static readonly LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear
 
         /** mag = nearest and min = nearest and mip = nearest */
-        public static readonly NEAREST_NEAREST_MIPNEAREST = Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
+        public static readonly NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
         /** mag = nearest and min = linear and mip = nearest */
-        public static readonly NEAREST_LINEAR_MIPNEAREST = Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
+        public static readonly NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
         /** mag = nearest and min = linear and mip = linear */
-        public static readonly NEAREST_LINEAR_MIPLINEAR = Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
+        public static readonly NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
         /** mag = nearest and min = linear and mip = none */
-        public static readonly NEAREST_LINEAR = Engine.TEXTURE_NEAREST_LINEAR;
+        public static readonly NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;
         /** mag = nearest and min = nearest and mip = none */
-        public static readonly NEAREST_NEAREST = Engine.TEXTURE_NEAREST_NEAREST;
+        public static readonly NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;
         /** mag = linear and min = nearest and mip = nearest */
-        public static readonly LINEAR_NEAREST_MIPNEAREST = Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
+        public static readonly LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
         /** mag = linear and min = nearest and mip = linear */
-        public static readonly LINEAR_NEAREST_MIPLINEAR = Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
+        public static readonly LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
         /** mag = linear and min = linear and mip = none */
-        public static readonly LINEAR_LINEAR = Engine.TEXTURE_LINEAR_LINEAR;
+        public static readonly LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;
         /** mag = linear and min = nearest and mip = none */
-        public static readonly LINEAR_NEAREST = Engine.TEXTURE_LINEAR_NEAREST;
+        public static readonly LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;
 
         /** Explicit coordinates mode */
-        public static readonly EXPLICIT_MODE = Engine.TEXTURE_EXPLICIT_MODE;
+        public static readonly EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;
         /** Spherical coordinates mode */
-        public static readonly SPHERICAL_MODE = Engine.TEXTURE_SPHERICAL_MODE;
+        public static readonly SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;
         /** Planar coordinates mode */
-        public static readonly PLANAR_MODE = Engine.TEXTURE_PLANAR_MODE;
+        public static readonly PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;
         /** Cubic coordinates mode */
-        public static readonly CUBIC_MODE = Engine.TEXTURE_CUBIC_MODE;
+        public static readonly CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;
         /** Projection coordinates mode */
-        public static readonly PROJECTION_MODE = Engine.TEXTURE_PROJECTION_MODE;
+        public static readonly PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;
         /** Inverse Cubic coordinates mode */
-        public static readonly SKYBOX_MODE = Engine.TEXTURE_SKYBOX_MODE;
+        public static readonly SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;
         /** Inverse Cubic coordinates mode */
-        public static readonly INVCUBIC_MODE = Engine.TEXTURE_INVCUBIC_MODE;
+        public static readonly INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;
         /** Equirectangular coordinates mode */
-        public static readonly EQUIRECTANGULAR_MODE = Engine.TEXTURE_EQUIRECTANGULAR_MODE;
+        public static readonly EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;
         /** Equirectangular Fixed coordinates mode */
-        public static readonly FIXED_EQUIRECTANGULAR_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
+        public static readonly FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
         /** Equirectangular Fixed Mirrored coordinates mode */
-        public static readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
+        public static readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
 
         /** Texture is not repeating outside of 0..1 UVs */
-        public static readonly CLAMP_ADDRESSMODE = Engine.TEXTURE_CLAMP_ADDRESSMODE;
+        public static readonly CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;
         /** Texture is repeating outside of 0..1 UVs */
-        public static readonly WRAP_ADDRESSMODE = Engine.TEXTURE_WRAP_ADDRESSMODE;
+        public static readonly WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;
         /** Texture is repeating and mirrored */
-        public static readonly MIRROR_ADDRESSMODE = Engine.TEXTURE_MIRROR_ADDRESSMODE;
+        public static readonly MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;
 
         /**
          * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file
@@ -289,7 +290,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
                         delete this._buffer;
                     }
                 } else {
-                    this.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+                    this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
 
                     this._delayedOnLoad = load;
                     this._delayedOnError = onError;
@@ -315,7 +316,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
 
             this.url = url;
             this._buffer = buffer;
-            this.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+            this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
             this.delayLoad();
         }
 
@@ -324,7 +325,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
          * @hidden
          */
         public delayLoad(): void {
-            if (this.delayLoadState !== Engine.DELAYLOADSTATE_NOTLOADED) {
+            if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
 
@@ -334,7 +335,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
                 return;
             }
 
-            this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
+            this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
             this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
 
             if (!this._texture) {
@@ -692,7 +693,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
          * @returns the created texture
          */
         public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
-            onLoad: Nullable<() => void> = null, onError: Nullable<() => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
+            onLoad: Nullable<() => void> = null, onError: Nullable<() => void> = null, format: number = Constants.TEXTUREFORMAT_RGBA): Texture {
             return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);
         }
 
@@ -712,7 +713,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
          * @returns the created texture
          */
         public static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer: boolean = false, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
-            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
+            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Constants.TEXTUREFORMAT_RGBA): Texture {
             if (name.substr(0, 5) !== "data:") {
                 name = "data:" + name;
             }

+ 2 - 1
src/Materials/material.ts

@@ -16,6 +16,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { Animation } from "Animations/animation";
 import { MaterialDefines } from "./materialDefines";
+import { Constants } from "Engine/constants";
 
 declare var BABYLON: any;
 
@@ -348,7 +349,7 @@ declare var BABYLON: any;
          * Stores the value of the alpha mode
          */
         @serialize("alphaMode")
-        private _alphaMode: number = Engine.ALPHA_COMBINE;
+        private _alphaMode: number = Constants.ALPHA_COMBINE;
 
         /**
          * Sets the value of the alpha mode.

+ 2 - 1
src/Materials/standardMaterial.ts

@@ -24,6 +24,7 @@ import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 
 import "Shaders/default.fragment";
 import "Shaders/default.vertex";
+import { Constants } from "Engine/constants";
 
     /** @hidden */
     export class StandardMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {
@@ -957,7 +958,7 @@ import "Shaders/default.vertex";
 
                 defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;
 
-                defines.PREMULTIPLYALPHA = (this.alphaMode === Engine.ALPHA_PREMULTIPLIED || this.alphaMode === Engine.ALPHA_PREMULTIPLIED_PORTERDUFF);
+                defines.PREMULTIPLYALPHA = (this.alphaMode === Constants.ALPHA_PREMULTIPLIED || this.alphaMode === Constants.ALPHA_PREMULTIPLIED_PORTERDUFF);
             }
 
             if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {

+ 8 - 7
src/Mesh/geometry.ts

@@ -11,6 +11,7 @@
     import { Effect } from "Materials/effect";
     import { SceneLoader } from "Loading/sceneLoader";
     import { BoundingInfo } from "Culling/boundingInfo";
+    import { Constants } from "Engine/constants";
     /**
      * Class used to store geometry data (vertex buffers + index buffer)
      */
@@ -23,7 +24,7 @@
         /**
          * Gets the delay loading state of the geometry (none by default which means not delayed)
          */
-        public delayLoadState = Engine.DELAYLOADSTATE_NONE;
+        public delayLoadState = Constants.DELAYLOADSTATE_NONE;
         /**
          * Gets the file containing the data to load when running in delay load state
          */
@@ -162,7 +163,7 @@
          * @returns true if the geometry is ready to be used
          */
         public isReady(): boolean {
-            return this.delayLoadState === Engine.DELAYLOADSTATE_LOADED || this.delayLoadState === Engine.DELAYLOADSTATE_NONE;
+            return this.delayLoadState === Constants.DELAYLOADSTATE_LOADED || this.delayLoadState === Constants.DELAYLOADSTATE_NONE;
         }
 
         /**
@@ -734,7 +735,7 @@
          * @param onLoaded defines a callback called when the geometry is loaded
          */
         public load(scene: Scene, onLoaded?: () => void): void {
-            if (this.delayLoadState === Engine.DELAYLOADSTATE_LOADING) {
+            if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {
                 return;
             }
 
@@ -745,7 +746,7 @@
                 return;
             }
 
-            this.delayLoadState = Engine.DELAYLOADSTATE_LOADING;
+            this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;
 
             this._queueLoad(scene, onLoaded);
         }
@@ -763,7 +764,7 @@
 
                 this._delayLoadingFunction(JSON.parse(data as string), this);
 
-                this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
+                this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
                 this._delayInfo = [];
 
                 scene._removePendingData(this);
@@ -885,7 +886,7 @@
             this._indexBuffer = null;
             this._indices = [];
 
-            this.delayLoadState = Engine.DELAYLOADSTATE_NONE;
+            this.delayLoadState = Constants.DELAYLOADSTATE_NONE;
             this.delayLoadingFile = null;
             this._delayLoadingFunction = null;
             this._delayInfo = [];
@@ -1407,7 +1408,7 @@
             }
 
             if (parsedVertexData.delayLoadingFile) {
-                geometry.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+                geometry.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
                 geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;
                 geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));
 

+ 8 - 7
src/Mesh/mesh.ts

@@ -22,6 +22,7 @@ import { SceneLoader } from "Loading/sceneLoader";
 import { Skeleton } from "Bones/skeleton";
 import { MorphTargetManager } from "Morph/morphTargetManager";
 import { PhysicsImpostor } from "Physics/physicsImpostor";
+import { Constants } from "Engine/constants";
 
 declare type LinesMesh = import("./linesMesh").LinesMesh;
 declare type InstancedMesh = import("./instancedMesh").InstancedMesh;
@@ -180,7 +181,7 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
          * Gets the delay loading state of the mesh (when delay loading is turned on)
          * @see http://doc.babylonjs.com/how_to/using_the_incremental_loading_system
          */
-        public delayLoadState = Engine.DELAYLOADSTATE_NONE;
+        public delayLoadState = Constants.DELAYLOADSTATE_NONE;
 
         /**
          * Gets the list of instances created from this mesh
@@ -790,7 +791,7 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
          * @returns true if all associated assets are ready (material, textures, shaders)
          */
         public isReady(completeCheck = false, forceInstanceSupport = false): boolean {
-            if (this.delayLoadState === Engine.DELAYLOADSTATE_LOADING) {
+            if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {
                 return false;
             }
 
@@ -1773,8 +1774,8 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
             if (this._geometry) {
                 this._geometry.load(scene);
             }
-            else if (this.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) {
-                this.delayLoadState = Engine.DELAYLOADSTATE_LOADING;
+            else if (this.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {
+                this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;
 
                 this._queueLoad(scene);
             }
@@ -1799,7 +1800,7 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
                     instance._syncSubMeshes();
                 });
 
-                this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
+                this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;
                 scene._removePendingData(this);
 
             }, () => { }, scene.offlineProvider, getBinaryData);
@@ -1813,7 +1814,7 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
          * @returns true if the mesh is in the frustum planes
          */
         public isInFrustum(frustumPlanes: Plane[]): boolean {
-            if (this.delayLoadState === Engine.DELAYLOADSTATE_LOADING) {
+            if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {
                 return false;
             }
 
@@ -2754,7 +2755,7 @@ declare type GroundMesh = import("./groundMesh").GroundMesh;
             mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;
 
             if (parsedMesh.delayLoadingFile) {
-                mesh.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+                mesh.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
                 mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;
                 mesh._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));
 

+ 8 - 7
src/Particles/gpuParticleSystem.ts

@@ -18,6 +18,7 @@ import { MaterialHelper } from "Materials/MaterialHelper";
 import { ImageProcessingConfiguration } from "Materials/imageProcessingConfiguration";
 import { Texture } from "Materials/Textures/texture";
 import { RawTexture } from "Materials/Textures/rawTexture";
+import { Constants } from "Engine/constants";
 
     /**
      * This represents a GPU particle system in Babylon
@@ -670,7 +671,7 @@ import { RawTexture } from "Materials/Textures/rawTexture";
                 d.push(Math.random());
                 d.push(Math.random());
             }
-            this._randomTexture = new RawTexture(new Float32Array(d), maxTextureSize, 1, Engine.TEXTUREFORMAT_RGBA, this._scene, false, false, Texture.NEAREST_SAMPLINGMODE, Engine.TEXTURETYPE_FLOAT);
+            this._randomTexture = new RawTexture(new Float32Array(d), maxTextureSize, 1, Constants.TEXTUREFORMAT_RGBA, this._scene, false, false, Constants.TEXTURE_NEAREST_SAMPLINGMODE, Constants.TEXTURETYPE_FLOAT);
             this._randomTexture.wrapU = Texture.WRAP_ADDRESSMODE;
             this._randomTexture.wrapV = Texture.WRAP_ADDRESSMODE;
 
@@ -681,7 +682,7 @@ import { RawTexture } from "Materials/Textures/rawTexture";
                 d.push(Math.random());
                 d.push(Math.random());
             }
-            this._randomTexture2 = new RawTexture(new Float32Array(d), maxTextureSize, 1, Engine.TEXTUREFORMAT_RGBA, this._scene, false, false, Texture.NEAREST_SAMPLINGMODE, Engine.TEXTURETYPE_FLOAT);
+            this._randomTexture2 = new RawTexture(new Float32Array(d), maxTextureSize, 1, Constants.TEXTUREFORMAT_RGBA, this._scene, false, false, Constants.TEXTURE_NEAREST_SAMPLINGMODE, Constants.TEXTURETYPE_FLOAT);
             this._randomTexture2.wrapU = Texture.WRAP_ADDRESSMODE;
             this._randomTexture2.wrapV = Texture.WRAP_ADDRESSMODE;
 
@@ -1319,16 +1320,16 @@ import { RawTexture } from "Materials/Textures/rawTexture";
                 // Draw order
                 switch (this.blendMode) {
                     case ParticleSystem.BLENDMODE_ADD:
-                        this._engine.setAlphaMode(Engine.ALPHA_ADD);
+                        this._engine.setAlphaMode(Constants.ALPHA_ADD);
                         break;
                     case ParticleSystem.BLENDMODE_ONEONE:
-                        this._engine.setAlphaMode(Engine.ALPHA_ONEONE);
+                        this._engine.setAlphaMode(Constants.ALPHA_ONEONE);
                         break;
                     case ParticleSystem.BLENDMODE_STANDARD:
-                        this._engine.setAlphaMode(Engine.ALPHA_COMBINE);
+                        this._engine.setAlphaMode(Constants.ALPHA_COMBINE);
                         break;
                     case ParticleSystem.BLENDMODE_MULTIPLY:
-                        this._engine.setAlphaMode(Engine.ALPHA_MULTIPLY);
+                        this._engine.setAlphaMode(Constants.ALPHA_MULTIPLY);
                         break;
                 }
 
@@ -1341,7 +1342,7 @@ import { RawTexture } from "Materials/Textures/rawTexture";
 
                 // Render
                 this._engine.drawArraysType(Material.TriangleFanDrawMode, 0, 4, this._currentActiveCount);
-                this._engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                this._engine.setAlphaMode(Constants.ALPHA_DISABLE);
             }
             // Switch VAOs
             this._targetIndex++;

+ 6 - 5
src/Particles/particleSystem.ts

@@ -21,6 +21,7 @@ import { IParticleSystem } from "./IParticleSystem";
 import { BaseParticleSystem } from "./baseParticleSystem";
 import { Particle } from "./particle";
 import { SubEmitter, SubEmitterType } from "./subEmitter";
+import { Constants } from "Engine/constants";
 
     /**
      * This represents a particle system in Babylon.
@@ -1765,16 +1766,16 @@ import { SubEmitter, SubEmitterType } from "./subEmitter";
             // Draw order
             switch (blendMode) {
                 case ParticleSystem.BLENDMODE_ADD:
-                    engine.setAlphaMode(Engine.ALPHA_ADD);
+                    engine.setAlphaMode(Constants.ALPHA_ADD);
                     break;
                 case ParticleSystem.BLENDMODE_ONEONE:
-                    engine.setAlphaMode(Engine.ALPHA_ONEONE);
+                    engine.setAlphaMode(Constants.ALPHA_ONEONE);
                     break;
                 case ParticleSystem.BLENDMODE_STANDARD:
-                    engine.setAlphaMode(Engine.ALPHA_COMBINE);
+                    engine.setAlphaMode(Constants.ALPHA_COMBINE);
                     break;
                 case ParticleSystem.BLENDMODE_MULTIPLY:
-                    engine.setAlphaMode(Engine.ALPHA_MULTIPLY);
+                    engine.setAlphaMode(Constants.ALPHA_MULTIPLY);
                     break;
             }
 
@@ -1812,7 +1813,7 @@ import { SubEmitter, SubEmitterType } from "./subEmitter";
             outparticles = this._render(this.blendMode);
 
             engine.unbindInstanceAttributes();
-            engine.setAlphaMode(Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Constants.ALPHA_DISABLE);
 
             return outparticles;
         }

+ 4 - 3
src/PostProcess/RenderPipeline/Pipelines/defaultRenderingPipeline.ts

@@ -6,6 +6,7 @@ import { Camera } from "Cameras/camera";
 import { ImageProcessingConfiguration } from "Materials/imageProcessingConfiguration";
 import { Texture } from "Materials/Textures/texture";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { IDisposable } from "scene";
 import { GlowLayer } from "Layer/glowLayer";
 import { Scene } from "scene";
@@ -404,13 +405,13 @@ import { BloomEffect } from "PostProcess/bloomEffect";
             // Misc
             if (this._hdr) {
                 if (caps.textureHalfFloatRender) {
-                    this._defaultPipelineTextureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                    this._defaultPipelineTextureType = Constants.TEXTURETYPE_HALF_FLOAT;
                 }
                 else if (caps.textureFloatRender) {
-                    this._defaultPipelineTextureType = Engine.TEXTURETYPE_FLOAT;
+                    this._defaultPipelineTextureType = Constants.TEXTURETYPE_FLOAT;
                 }
             } else {
-                this._defaultPipelineTextureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+                this._defaultPipelineTextureType = Constants.TEXTURETYPE_UNSIGNED_INT;
             }
 
             // Attach

+ 3 - 3
src/PostProcess/RenderPipeline/Pipelines/ssaoRenderingPipeline.ts

@@ -9,7 +9,7 @@ import { PostProcessRenderPipeline } from "PostProcess/RenderPipeline/postProces
 import { PostProcessRenderEffect } from "PostProcess/RenderPipeline/postProcessRenderEffect";
 import { PassPostProcess } from "PostProcess/passPostProcess";
 import { BlurPostProcess } from "PostProcess/blurPostProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { serialize } from "Tools/decorators";
 import { Scene } from "scene";
 
@@ -162,8 +162,8 @@ import { Scene } from "scene";
         private _createBlurPostProcess(ratio: number): void {
             var size = 16;
 
-            this._blurHPostProcess = new BlurPostProcess("BlurH", new Vector2(1, 0), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, Engine.TEXTURETYPE_UNSIGNED_INT);
-            this._blurVPostProcess = new BlurPostProcess("BlurV", new Vector2(0, 1), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, Engine.TEXTURETYPE_UNSIGNED_INT);
+            this._blurHPostProcess = new BlurPostProcess("BlurH", new Vector2(1, 0), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, Constants.TEXTURETYPE_UNSIGNED_INT);
+            this._blurVPostProcess = new BlurPostProcess("BlurV", new Vector2(0, 1), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, Constants.TEXTURETYPE_UNSIGNED_INT);
 
             this._blurHPostProcess.onActivateObservable.add(() => {
                 let dw = this._blurHPostProcess.width / this._scene.getEngine().getRenderWidth();

+ 18 - 19
src/PostProcess/RenderPipeline/Pipelines/standardRenderingPipeline.ts

@@ -11,14 +11,13 @@ import { PostProcessRenderPipeline } from "PostProcess/RenderPipeline/postProces
 import { PostProcessRenderEffect } from "PostProcess/RenderPipeline/postProcessRenderEffect";
 import { BlurPostProcess } from "PostProcess/blurPostProcess";
 import { FxaaPostProcess } from "PostProcess/fxaaPostProcess";
-import { Engine } from "Engine/engine";
 import { IDisposable } from "scene";
 import { SpotLight } from "Lights/spotLight";
 import { DirectionalLight } from "Lights/directionalLight";
 import { GeometryBufferRenderer } from "Rendering/geometryBufferRenderer";
 import { Scene } from "scene";
 import { Animation } from "Animations/animation";
-
+import { Constants } from "Engine/constants";
     /**
      * Standard rendering pipeline
      * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.
@@ -482,7 +481,7 @@ import { Animation } from "Animations/animation";
             this._ratio = ratio;
 
             // Misc
-            this._floatTextureType = scene.getEngine().getCaps().textureFloatRender ? Engine.TEXTURETYPE_FLOAT : Engine.TEXTURETYPE_HALF_FLOAT;
+            this._floatTextureType = scene.getEngine().getCaps().textureFloatRender ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;
 
             // Finish
             scene.postProcessRenderPipelineManager.addPipeline(this);
@@ -498,7 +497,7 @@ import { Animation } from "Animations/animation";
 
             // Create pass post-process
             if (!this._basePostProcess) {
-                this.originalPostProcess = new PostProcess("HDRPass", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", this._floatTextureType);
+                this.originalPostProcess = new PostProcess("HDRPass", "standard", [], [], ratio, null, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", this._floatTextureType);
                 this.originalPostProcess.onApply = () => {
                     this._currentDepthOfFieldSource = this.originalPostProcess;
                 };
@@ -527,7 +526,7 @@ import { Animation } from "Animations/animation";
                 this._createTextureAdderPostProcess(scene, ratio);
 
                 // Create depth-of-field source post-process
-                this.textureAdderFinalPostProcess = new PostProcess("HDRDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Engine.TEXTURETYPE_UNSIGNED_INT);
+                this.textureAdderFinalPostProcess = new PostProcess("HDRDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Constants.TEXTURETYPE_UNSIGNED_INT);
                 this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRBaseDepthOfFieldSource", () => { return this.textureAdderFinalPostProcess; }, true));
             }
 
@@ -536,7 +535,7 @@ import { Animation } from "Animations/animation";
                 this._createVolumetricLightPostProcess(scene, ratio);
 
                 // Create volumetric light final post-process
-                this.volumetricLightFinalPostProcess = new PostProcess("HDRVLSFinal", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Engine.TEXTURETYPE_UNSIGNED_INT);
+                this.volumetricLightFinalPostProcess = new PostProcess("HDRVLSFinal", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Constants.TEXTURETYPE_UNSIGNED_INT);
                 this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRVLSFinal", () => { return this.volumetricLightFinalPostProcess; }, true));
             }
 
@@ -545,7 +544,7 @@ import { Animation } from "Animations/animation";
                 this._createLensFlarePostProcess(scene, ratio);
 
                 // Create depth-of-field source post-process post lens-flare and disable it now
-                this.lensFlareFinalPostProcess = new PostProcess("HDRPostLensFlareDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Engine.TEXTURETYPE_UNSIGNED_INT);
+                this.lensFlareFinalPostProcess = new PostProcess("HDRPostLensFlareDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Constants.TEXTURETYPE_UNSIGNED_INT);
                 this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRPostLensFlareDepthOfFieldSource", () => { return this.lensFlareFinalPostProcess; }, true));
             }
 
@@ -557,7 +556,7 @@ import { Animation } from "Animations/animation";
                 this._createHdrPostProcess(scene, ratio);
 
                 // Create depth-of-field source post-process post hdr and disable it now
-                this.hdrFinalPostProcess = new PostProcess("HDRPostHDReDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Engine.TEXTURETYPE_UNSIGNED_INT);
+                this.hdrFinalPostProcess = new PostProcess("HDRPostHDReDepthOfFieldSource", "standard", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define PASS_POST_PROCESS", Constants.TEXTURETYPE_UNSIGNED_INT);
                 this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRPostHDReDepthOfFieldSource", () => { return this.hdrFinalPostProcess; }, true));
             }
 
@@ -576,7 +575,7 @@ import { Animation } from "Animations/animation";
 
             if (this._fxaaEnabled) {
                 // Create fxaa post-process
-                this.fxaaPostProcess = new FxaaPostProcess("fxaa", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Engine.TEXTURETYPE_UNSIGNED_INT);
+                this.fxaaPostProcess = new FxaaPostProcess("fxaa", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Constants.TEXTURETYPE_UNSIGNED_INT);
                 this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRFxaa", () => { return this.fxaaPostProcess; }, true));
             }
 
@@ -592,7 +591,7 @@ import { Animation } from "Animations/animation";
         // Down Sample X4 Post-Processs
         private _createDownSampleX4PostProcess(scene: Scene, ratio: number): void {
             var downSampleX4Offsets = new Array<number>(32);
-            this.downSampleX4PostProcess = new PostProcess("HDRDownSampleX4", "standard", ["dsOffsets"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DOWN_SAMPLE_X4", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.downSampleX4PostProcess = new PostProcess("HDRDownSampleX4", "standard", ["dsOffsets"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DOWN_SAMPLE_X4", Constants.TEXTURETYPE_UNSIGNED_INT);
 
             this.downSampleX4PostProcess.onApply = (effect: Effect) => {
                 var id = 0;
@@ -617,7 +616,7 @@ import { Animation } from "Animations/animation";
         // Brightpass Post-Process
         private _createBrightPassPostProcess(scene: Scene, ratio: number): void {
             var brightOffsets = new Array<number>(8);
-            this.brightPassPostProcess = new PostProcess("HDRBrightPass", "standard", ["dsOffsets", "brightThreshold"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define BRIGHT_PASS", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.brightPassPostProcess = new PostProcess("HDRBrightPass", "standard", ["dsOffsets", "brightThreshold"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define BRIGHT_PASS", Constants.TEXTURETYPE_UNSIGNED_INT);
 
             this.brightPassPostProcess.onApply = (effect: Effect) => {
                 var sU = (1.0 / (<PostProcess>this.brightPassPostProcess).width);
@@ -644,8 +643,8 @@ import { Animation } from "Animations/animation";
         private _createBlurPostProcesses(scene: Scene, ratio: number, indice: number, blurWidthKey: string = "blurWidth"): void {
             var engine = scene.getEngine();
 
-            var blurX = new BlurPostProcess("HDRBlurH" + "_" + indice, new Vector2(1, 0), (<any>this)[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Engine.TEXTURETYPE_UNSIGNED_INT);
-            var blurY = new BlurPostProcess("HDRBlurV" + "_" + indice, new Vector2(0, 1), (<any>this)[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Engine.TEXTURETYPE_UNSIGNED_INT);
+            var blurX = new BlurPostProcess("HDRBlurH" + "_" + indice, new Vector2(1, 0), (<any>this)[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Constants.TEXTURETYPE_UNSIGNED_INT);
+            var blurY = new BlurPostProcess("HDRBlurV" + "_" + indice, new Vector2(0, 1), (<any>this)[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, Constants.TEXTURETYPE_UNSIGNED_INT);
 
             blurX.onActivateObservable.add(() => {
                 let dw = blurX.width / engine.getRenderWidth();
@@ -666,7 +665,7 @@ import { Animation } from "Animations/animation";
 
         // Create texture adder post-process
         private _createTextureAdderPostProcess(scene: Scene, ratio: number): void {
-            this.textureAdderPostProcess = new PostProcess("HDRTextureAdder", "standard", ["exposure"], ["otherSampler", "lensSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define TEXTURE_ADDER", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.textureAdderPostProcess = new PostProcess("HDRTextureAdder", "standard", ["exposure"], ["otherSampler", "lensSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define TEXTURE_ADDER", Constants.TEXTURETYPE_UNSIGNED_INT);
             this.textureAdderPostProcess.onApply = (effect: Effect) => {
                 effect.setTextureFromPostProcess("otherSampler", this._vlsEnabled ? this._currentDepthOfFieldSource : this.originalPostProcess);
                 effect.setTexture("lensSampler", this.lensTexture);
@@ -820,7 +819,7 @@ import { Animation } from "Animations/animation";
 
         // Create HDR post-process
         private _createHdrPostProcess(scene: Scene, ratio: number): void {
-            this.hdrPostProcess = new PostProcess("HDR", "standard", ["averageLuminance"], ["textureAdderSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define HDR", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.hdrPostProcess = new PostProcess("HDR", "standard", ["averageLuminance"], ["textureAdderSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define HDR", Constants.TEXTURETYPE_UNSIGNED_INT);
 
             var outputLiminance = 1;
             var time = 0;
@@ -861,12 +860,12 @@ import { Animation } from "Animations/animation";
 
         // Create lens flare post-process
         private _createLensFlarePostProcess(scene: Scene, ratio: number): void {
-            this.lensFlarePostProcess = new PostProcess("HDRLensFlare", "standard", ["strength", "ghostDispersal", "haloWidth", "resolution", "distortionStrength"], ["lensColorSampler"], ratio / 2, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define LENS_FLARE", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.lensFlarePostProcess = new PostProcess("HDRLensFlare", "standard", ["strength", "ghostDispersal", "haloWidth", "resolution", "distortionStrength"], ["lensColorSampler"], ratio / 2, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define LENS_FLARE", Constants.TEXTURETYPE_UNSIGNED_INT);
             this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRLensFlare", () => { return this.lensFlarePostProcess; }, true));
 
             this._createBlurPostProcesses(scene, ratio / 4, 2);
 
-            this.lensFlareComposePostProcess = new PostProcess("HDRLensFlareCompose", "standard", ["lensStarMatrix"], ["otherSampler", "lensDirtSampler", "lensStarSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define LENS_FLARE_COMPOSE", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.lensFlareComposePostProcess = new PostProcess("HDRLensFlareCompose", "standard", ["lensStarMatrix"], ["otherSampler", "lensDirtSampler", "lensStarSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define LENS_FLARE_COMPOSE", Constants.TEXTURETYPE_UNSIGNED_INT);
             this.addEffect(new PostProcessRenderEffect(scene.getEngine(), "HDRLensFlareCompose", () => { return this.lensFlareComposePostProcess; }, true));
 
             var resolution = new Vector2(0, 0);
@@ -934,7 +933,7 @@ import { Animation } from "Animations/animation";
 
         // Create depth-of-field post-process
         private _createDepthOfFieldPostProcess(scene: Scene, ratio: number): void {
-            this.depthOfFieldPostProcess = new PostProcess("HDRDepthOfField", "standard", ["distance"], ["otherSampler", "depthSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DEPTH_OF_FIELD", Engine.TEXTURETYPE_UNSIGNED_INT);
+            this.depthOfFieldPostProcess = new PostProcess("HDRDepthOfField", "standard", ["distance"], ["otherSampler", "depthSampler"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define DEPTH_OF_FIELD", Constants.TEXTURETYPE_UNSIGNED_INT);
             this.depthOfFieldPostProcess.onApply = (effect: Effect) => {
                 effect.setTextureFromPostProcess("otherSampler", this._currentDepthOfFieldSource);
                 effect.setTexture("depthSampler", this._getDepthTexture());
@@ -951,7 +950,7 @@ import { Animation } from "Animations/animation";
             this.motionBlurPostProcess = new PostProcess("HDRMotionBlur", "standard",
                 ["inverseViewProjection", "prevViewProjection", "screenSize", "motionScale", "motionStrength"],
                 ["depthSampler"],
-                ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + this.motionBlurSamples.toFixed(1), Engine.TEXTURETYPE_UNSIGNED_INT);
+                ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, "#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES " + this.motionBlurSamples.toFixed(1), Constants.TEXTURETYPE_UNSIGNED_INT);
 
             var motionScale: number = 0;
             var prevViewProjection = Matrix.Identity();

+ 2 - 1
src/PostProcess/bloomMergePostProcess.ts

@@ -3,6 +3,7 @@ import { Nullable } from "types";
 import { Engine } from "Engine/engine";
 import { Effect } from "Materials/effect";
 import { Camera } from "Cameras/camera";
+import { Constants } from "Engine/constants";
 
     /**
      * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.
@@ -26,7 +27,7 @@ import { Camera } from "Cameras/camera";
             /** Weight of the bloom to be added to the original input. */
             public weight: number,
             options: number | PostProcessOptions,
-            camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+            camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "bloomMerge", ["bloomWeight"], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2", "bloomBlur"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);
             this.onApplyObservable.add((effect: Effect) => {
                 effect.setTextureFromPostProcess("textureSampler", originalFromInput);

+ 2 - 1
src/PostProcess/blurPostProcess.ts

@@ -5,6 +5,7 @@ import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
 import { Texture } from "Materials/Textures/texture";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * The Blur Post Process which blurs an image based on a kernel and direction.
@@ -74,7 +75,7 @@ import { Engine } from "Engine/engine";
         constructor(name: string,
             /** The direction in which to blur the image. */
             public direction: Vector2,
-            kernel: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, defines = "", private blockCompilation = false) {
+            kernel: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, defines = "", private blockCompilation = false) {
             super(name, "kernelBlur", ["delta", "direction", "cameraMinMaxZ"], ["circleOfConfusionSampler"], options, camera, samplingMode, engine, reusable, null, textureType, "kernelBlur", {varyingCount: 0, depCount: 0}, true);
             this._staticDefines = defines;
             this.onApplyObservable.add((effect: Effect) => {

+ 2 - 1
src/PostProcess/chromaticAberrationPostProcess.ts

@@ -4,6 +4,7 @@ import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Effect } from "Materials/effect";
 import { Camera } from "Cameras/camera";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen
@@ -42,7 +43,7 @@ import { Engine } from "Engine/engine";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, screenWidth: number, screenHeight: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, screenWidth: number, screenHeight: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);
             this.onApplyObservable.add((effect: Effect) => {
                 effect.setFloat('chromatic_aberration', this.aberrationAmount);

+ 2 - 1
src/PostProcess/circleOfConfusionPostProcess.ts

@@ -5,6 +5,7 @@ import { Effect } from "Materials/effect";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { Camera } from "Cameras/camera";
 import { Tools } from "Tools/tools";
+import { Constants } from "Engine/constants";
 
     /**
      * The CircleOfConfusionPostProcess computes the circle of confusion value for each pixel given required lens parameters. See https://en.wikipedia.org/wiki/Circle_of_confusion
@@ -40,7 +41,7 @@ import { Tools } from "Tools/tools";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, depthTexture: Nullable<RenderTargetTexture>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, depthTexture: Nullable<RenderTargetTexture>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "circleOfConfusion", ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], ["depthSampler"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);
             this._depthTexture = depthTexture;
             this.onApplyObservable.add((effect: Effect) => {

+ 2 - 1
src/PostProcess/convolutionPostProcess.ts

@@ -3,6 +3,7 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { Engine } from "Engine/engine";
 import { Effect } from "Materials/effect";
+import { Constants } from "Engine/constants";
 
     /**
      * The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the
@@ -24,7 +25,7 @@ import { Effect } from "Materials/effect";
         constructor(name: string,
             /** Array of 9 values corrisponding to the 3x3 kernel to be applied */
             public kernel: number[],
-            options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
+            options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(name, "convolution", ["kernel", "screenSize"], null, options, camera, samplingMode, engine, reusable, null, textureType);
 
             this.onApply = (effect: Effect) => {

+ 3 - 2
src/PostProcess/depthOfFieldBlurPostProcess.ts

@@ -7,6 +7,7 @@ import { PostProcess, PostProcessOptions } from "./postProcess";
 import { BlurPostProcess } from "./blurPostProcess";
 import { Engine } from "Engine/engine";
 import { Scene } from "scene";
+import { Constants } from "Engine/constants";
 
     /**
      * The DepthOfFieldBlurPostProcess applied a blur in a give direction.
@@ -31,8 +32,8 @@ import { Scene } from "scene";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, scene: Scene, public direction: Vector2, kernel: number, options: number | PostProcessOptions, camera: Nullable<Camera>, circleOfConfusion: PostProcess, imageToBlur: Nullable<PostProcess> = null, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
-            super(name, direction, kernel, options, camera, samplingMode = Texture.BILINEAR_SAMPLINGMODE, engine, reusable, textureType = Engine.TEXTURETYPE_UNSIGNED_INT, `#define DOF 1\r\n`, blockCompilation);
+        constructor(name: string, scene: Scene, public direction: Vector2, kernel: number, options: number | PostProcessOptions, camera: Nullable<Camera>, circleOfConfusion: PostProcess, imageToBlur: Nullable<PostProcess> = null, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+            super(name, direction, kernel, options, camera, samplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE, engine, reusable, textureType = Constants.TEXTURETYPE_UNSIGNED_INT, `#define DOF 1\r\n`, blockCompilation);
 
             this.onApplyObservable.add((effect: Effect) => {
                 if (imageToBlur != null) {

+ 2 - 1
src/PostProcess/depthOfFieldMergePostProcess.ts

@@ -3,6 +3,7 @@ import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
     /**
      * Options to be set when merging outputs from the default pipeline.
      */
@@ -45,7 +46,7 @@ import { Engine } from "Engine/engine";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, originalFromInput: PostProcess, circleOfConfusion: PostProcess, private blurSteps: Array<PostProcess>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, originalFromInput: PostProcess, circleOfConfusion: PostProcess, private blurSteps: Array<PostProcess>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "blurStep0", "blurStep1", "blurStep2"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);
             this.onApplyObservable.add((effect: Effect) => {
                 effect.setTextureFromPostProcess("textureSampler", originalFromInput);

+ 2 - 1
src/PostProcess/extractHighlightsPostProcess.ts

@@ -4,6 +4,7 @@ import { Effect } from "Materials/effect";
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
 import { ToGammaSpace } from "Math/math";
+import { Constants } from "Engine/constants";
 
     /**
      * The extract highlights post process sets all pixels to black except pixels above the specified luminance threshold. Used as the first step for a bloom effect.
@@ -21,7 +22,7 @@ import { ToGammaSpace } from "Math/math";
          * @hidden
          */
         public _inputPostProcess: Nullable<PostProcess> = null;
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "extractHighlights", ["threshold", "exposure"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);
             this.onApplyObservable.add((effect: Effect) => {
                 if (this._inputPostProcess) {

+ 2 - 1
src/PostProcess/fxaaPostProcess.ts

@@ -4,6 +4,7 @@ import { Effect } from "Materials/effect";
 import { Texture } from "Materials/Textures/texture";
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * Fxaa post process
@@ -15,7 +16,7 @@ import { Engine } from "Engine/engine";
         /** @hidden */
         public texelHeight: number;
 
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(name, "fxaa", ["texelSize"], null, options, camera, samplingMode || Texture.BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, "fxaa", undefined, true);
 
             const defines = this._getDefines();

+ 2 - 1
src/PostProcess/grainPostProcess.ts

@@ -3,6 +3,7 @@ import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * The GrainPostProcess adds noise to the image at mid luminance levels
@@ -28,7 +29,7 @@ import { Engine } from "Engine/engine";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "grain", ["intensity", "animatedSeed"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);
             this.onApplyObservable.add((effect: Effect) => {
                 effect.setFloat('intensity', this.intensity);

+ 2 - 1
src/PostProcess/highlightsPostProcess.ts

@@ -2,6 +2,7 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * Extracts highlights from the image
@@ -19,7 +20,7 @@ import { Engine } from "Engine/engine";
          * @param reusable If the post process can be reused on the same frame. (default: false)
          * @param textureType Type of texture for the post process (default: Engine.TEXTURETYPE_UNSIGNED_INT)
          */
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(name, "highlights", null, null, options, camera, samplingMode, engine, reusable, null, textureType);
         }
     }

+ 2 - 1
src/PostProcess/imageProcessingPostProcess.ts

@@ -10,6 +10,7 @@ import { ImageProcessingConfiguration, IImageProcessingConfigurationDefines } fr
 import { PostProcess, PostProcessOptions } from "./postProcess";
 import { Engine } from "Engine/engine";
 import { Scene } from "scene";
+import { Constants } from "Engine/constants";
 
     /**
      * ImageProcessingPostProcess
@@ -331,7 +332,7 @@ import { Scene } from "scene";
             EXPOSURE: false,
         };
 
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, imageProcessingConfiguration?: ImageProcessingConfiguration) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, imageProcessingConfiguration?: ImageProcessingConfiguration) {
             super(name, "imageProcessing", [], [], options, camera, samplingMode, engine, reusable,
                 null, textureType, "postprocess", null, true);
 

+ 4 - 2
src/PostProcess/motionBlurPostProcess.ts

@@ -4,10 +4,12 @@ import { Vector2 } from "Math/math";
 import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
 import { PostProcess, PostProcessOptions } from "./postProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { GeometryBufferRenderer } from "Rendering/geometryBufferRenderer";
 import { Scene } from "scene";
 
+declare type Engine = import("Engine/engine").Engine;
+
     /**
      * The Motion Blur Post Process which blurs an image based on the objects velocity in scene.
      * Velocity can be affected by each object's rotation, position and scale depending on the transformation speed.
@@ -59,7 +61,7 @@ import { Scene } from "scene";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, scene: Scene, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, scene: Scene, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "motionBlur", ["motionStrength", "motionScale", "screenSize"], ["velocitySampler"], options, camera, samplingMode, engine, reusable, "#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0", textureType, undefined, null, blockCompilation);
 
             this._geometryBufferRenderer = scene.enableGeometryBufferRenderer();

+ 6 - 3
src/PostProcess/passPostProcess.ts

@@ -1,7 +1,10 @@
 import { Nullable } from "types";
+import { Constants } from "Engine/constants";
 import { Camera } from "Cameras/camera";
 import { PostProcess, PostProcessOptions } from "./postProcess";
-import { Engine } from "Engine/engine";
+
+declare type Engine = import("Engine/engine").Engine;
+
     /**
      * PassPostProcess which produces an output the same as it's input
      */
@@ -17,7 +20,7 @@ import { Engine } from "Engine/engine";
          * @param textureType The type of texture to be used when performing the post processing.
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "pass", null, null, options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation);
         }
     }
@@ -80,7 +83,7 @@ import { Engine } from "Engine/engine";
          * @param textureType The type of texture to be used when performing the post processing.
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "passCube", null, null, options, camera, samplingMode, engine, reusable, "#define POSITIVEX", textureType, undefined, null, blockCompilation);
         }
     }

+ 13 - 11
src/PostProcess/postProcess.ts

@@ -4,13 +4,15 @@ import { SmartArray } from "Tools/smartArray";
 import { Observable, Observer } from "Tools/observable";
 import { Color4, Vector2 } from "Math/math";
 import { Camera } from "Cameras/camera";
-//import { WebVRFreeCamera } from "Cameras/VR/webVRCamera";
 import { Effect } from "Materials/effect";
-import { Texture } from "Materials/Textures/texture";
-import { InternalTexture } from "Materials/Textures/internalTexture";
-import { Engine } from "Engine/engine";
 import { Scene } from "scene";
 import { Animation } from "Animations/animation";
+import { Constants } from "Engine/constants";
+
+declare type InternalTexture  = import("Materials/Textures/internalTexture").InternalTexture;
+declare type WebVRFreeCamera = import("Cameras/VR/webVRCamera").WebVRFreeCamera;
+declare type Engine = import("Engine/engine").Engine;
+
     /**
      * Size options for a post process
      */
@@ -52,7 +54,7 @@ import { Animation } from "Animations/animation";
         /**
         * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)
         */
-        public alphaMode = Engine.ALPHA_DISABLE;
+        public alphaMode = Constants.ALPHA_DISABLE;
         /**
         * Sets the setAlphaBlendConstants of the babylon engine
         */
@@ -83,7 +85,7 @@ import { Animation } from "Animations/animation";
         * | 3     | SCALEMODE_CEILING                   | [engine.scalemode_ceiling](http://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |
 	*
         */
-        public scaleMode = Engine.SCALEMODE_FLOOR;
+        public scaleMode = Constants.SCALEMODE_FLOOR;
         /**
         * Force textures to be a power of two (default: false)
         */
@@ -281,7 +283,7 @@ import { Animation } from "Animations/animation";
             /** Name of the PostProcess. */
             public name: string,
             fragmentUrl: string, parameters: Nullable<string[]>, samplers: Nullable<string[]>, options: number | PostProcessOptions, camera: Nullable<Camera>,
-            samplingMode: number = Texture.NEAREST_SAMPLINGMODE, engine?: Engine, reusable?: boolean, defines: Nullable<string> = null, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, vertexUrl: string = "postprocess", indexParameters?: any, blockCompilation = false) {
+            samplingMode: number = Constants.TEXTURE_NEAREST_SAMPLINGMODE, engine?: Engine, reusable?: boolean, defines: Nullable<string> = null, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, vertexUrl: string = "postprocess", indexParameters?: any, blockCompilation = false) {
             if (camera != null) {
                 this._camera = camera;
                 this._scene = camera.getScene();
@@ -296,7 +298,7 @@ import { Animation } from "Animations/animation";
             }
 
             this._options = options;
-            this.renderTargetSamplingMode = samplingMode ? samplingMode : Texture.NEAREST_SAMPLINGMODE;
+            this.renderTargetSamplingMode = samplingMode ? samplingMode : Constants.TEXTURE_NEAREST_SAMPLINGMODE;
             this._reusable = reusable || false;
             this._textureType = textureType;
 
@@ -412,7 +414,7 @@ import { Animation } from "Animations/animation";
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * <number>this._options) | 0;
 
             // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
-            var webVRCamera = (<any>camera.parent);
+            var webVRCamera = (<WebVRFreeCamera>camera.parent);
             if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
                 requiredWidth /= 2;
             }
@@ -431,7 +433,7 @@ import { Animation } from "Animations/animation";
                     }
                 }
 
-                if (this.renderTargetSamplingMode === Texture.TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) {
+                if (this.renderTargetSamplingMode === Constants.TEXTURE_TRILINEAR_SAMPLINGMODE || this.alwaysForcePOT) {
                     if (!(<PostProcessOptions>this._options).width) {
                         desiredWidth = engine.needPOTTextures ? Tools.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;
                     }
@@ -504,7 +506,7 @@ import { Animation } from "Animations/animation";
             this.onActivateObservable.notifyObservers(camera);
 
             // Clear
-            if (this.autoClear && this.alphaMode === Engine.ALPHA_DISABLE) {
+            if (this.autoClear && this.alphaMode === Constants.ALPHA_DISABLE) {
                 this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);
             }
 

+ 2 - 2
src/PostProcess/postProcessManager.ts

@@ -2,9 +2,9 @@ import { Nullable } from "types";
 import { Material } from "Materials/material";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { PostProcess } from "./postProcess";
-import { Engine } from "Engine/engine";
 import { Scene } from "scene";
 import { VertexBuffer } from "Mesh/buffer";
+import { Constants } from "Engine/constants";
     /**
 	 * PostProcessManager is used to manage one or more post processes or post process pipelines
      * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses
@@ -195,7 +195,7 @@ import { VertexBuffer } from "Mesh/buffer";
             // Restore states
             engine.setDepthBuffer(true);
             engine.setDepthWrite(true);
-            engine.setAlphaMode(Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Constants.ALPHA_DISABLE);
         }
 
         /**

+ 4 - 2
src/PostProcess/sharpenPostProcess.ts

@@ -2,7 +2,9 @@ import { Nullable } from "types";
 import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
 import { PostProcess, PostProcessOptions } from "./postProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
+
+declare type Engine = import("Engine/engine").Engine;
     /**
      * The SharpenPostProcess applies a sharpen kernel to every pixel
      * See http://en.wikipedia.org/wiki/Kernel_(image_processing)
@@ -27,7 +29,7 @@ import { Engine } from "Engine/engine";
          * @param textureType Type of textures used when performing the post process. (default: 0)
          * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
          */
-        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
+        constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT, blockCompilation = false) {
             super(name, "sharpen", ["sharpnessAmounts", "screenSize"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);
 
             this.onApply = (effect: Effect) => {

+ 5 - 3
src/PostProcess/tonemapPostProcess.ts

@@ -1,8 +1,10 @@
 import { Camera } from "Cameras/camera";
 import { Effect } from "Materials/effect";
-import { Texture } from "Materials/Textures/texture";
 import { PostProcess } from "./postProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
+
+declare type Engine = import("Engine/engine").Engine;
+
     /** Defines operator used for tonemapping */
     export enum TonemappingOperator {
         /** Hable */
@@ -32,7 +34,7 @@ import { Engine } from "Engine/engine";
          */
         constructor(name: string, private _operator: TonemappingOperator,
             /** Defines the required exposure adjustement */
-            public exposureAdjustment: number, camera: Camera, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, textureFormat = Engine.TEXTURETYPE_UNSIGNED_INT) {
+            public exposureAdjustment: number, camera: Camera, samplingMode: number = Constants.TEXTURE_BILINEAR_SAMPLINGMODE, engine?: Engine, textureFormat = Constants.TEXTURETYPE_UNSIGNED_INT) {
             super(name, "tonemap", ["_ExposureAdjustment"], null, 1.0, camera, samplingMode, engine, true, null, textureFormat);
 
             var defines = "#define ";

+ 6 - 4
src/PostProcess/volumetricLightScatteringPostProcess.ts

@@ -13,9 +13,11 @@ import { StandardMaterial } from "Materials/standardMaterial";
 import { Texture } from "Materials/Textures/texture";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { PostProcess } from "./postProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { Scene } from "scene";
 
+declare type Engine = import("Engine/engine").Engine;
+
     /**
      *  Inspired by http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html
      */
@@ -262,7 +264,7 @@ import { Scene } from "scene";
         private _createPass(scene: Scene, ratio: number): void {
             var engine = scene.getEngine();
 
-            this._volumetricLightScatteringRTT = new RenderTargetTexture("volumetricLightScatteringMap", { width: engine.getRenderWidth() * ratio, height: engine.getRenderHeight() * ratio }, scene, false, true, Engine.TEXTURETYPE_UNSIGNED_INT);
+            this._volumetricLightScatteringRTT = new RenderTargetTexture("volumetricLightScatteringMap", { width: engine.getRenderWidth() * ratio, height: engine.getRenderHeight() * ratio }, scene, false, true, Constants.TEXTURETYPE_UNSIGNED_INT);
             this._volumetricLightScatteringRTT.wrapU = Texture.CLAMP_ADDRESSMODE;
             this._volumetricLightScatteringRTT.wrapV = Texture.CLAMP_ADDRESSMODE;
             this._volumetricLightScatteringRTT.renderList = null;
@@ -413,11 +415,11 @@ import { Scene } from "scene";
                     });
 
                     // Render sub meshes
-                    engine.setAlphaMode(Engine.ALPHA_COMBINE);
+                    engine.setAlphaMode(Constants.ALPHA_COMBINE);
                     for (index = 0; index < sortedArray.length; index++) {
                         renderSubMesh(sortedArray[index]);
                     }
-                    engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                    engine.setAlphaMode(Constants.ALPHA_DISABLE);
                 }
             };
         }

+ 2 - 2
src/Probes/reflectionProbe.ts

@@ -3,7 +3,7 @@ import { Matrix, Vector3 } from "Math/math";
 import { AbstractMesh } from "Mesh/abstractMesh";
 import { Nullable } from "types";
 import { Scene } from "scene";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
 declare module "scene" {
     export interface Scene {
@@ -53,7 +53,7 @@ declare module "scene" {
             }
             this._scene.reflectionProbes.push(this);
 
-            this._renderTargetTexture = new RenderTargetTexture(name, size, scene, generateMipMaps, true, useFloat ? Engine.TEXTURETYPE_FLOAT : Engine.TEXTURETYPE_UNSIGNED_INT, true);
+            this._renderTargetTexture = new RenderTargetTexture(name, size, scene, generateMipMaps, true, useFloat ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_UNSIGNED_INT, true);
 
             this._renderTargetTexture.onBeforeRenderObservable.add((faceIndex: number) => {
                 switch (faceIndex) {

+ 3 - 3
src/Rendering/depthRenderer.ts

@@ -9,7 +9,7 @@ import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { Effect } from "Materials/effect";
 import { Material } from "Materials/material";
 import { Camera } from "Cameras/camera";
-import { Engine } from "Engine";
+import { Constants } from "Engine/constants";
 import { SceneComponentConstants } from "sceneComponent";
 import { DepthRendererSceneComponent } from "./depthRendererSceneComponent";
 
@@ -38,7 +38,7 @@ import { DepthRendererSceneComponent } from "./depthRendererSceneComponent";
          * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)
          * @param camera The camera to be used to render the depth map (default: scene's active camera)
          */
-        constructor(scene: Scene, type: number = Engine.TEXTURETYPE_FLOAT, camera: Nullable<Camera> = null) {
+        constructor(scene: Scene, type: number = Constants.TEXTURETYPE_FLOAT, camera: Nullable<Camera> = null) {
             this._scene = scene;
             // Register the G Buffer component to the scene.
             let component = scene._getComponent(SceneComponentConstants.NAME_DEPTHRENDERER) as DepthRendererSceneComponent;
@@ -64,7 +64,7 @@ import { DepthRendererSceneComponent } from "./depthRendererSceneComponent";
             this._depthMap.useCameraPostProcesses = false;
 
             // set default depth value to 1.0 (far away)
-            this._depthMap.onClearObservable.add((engine: Engine) => {
+            this._depthMap.onClearObservable.add((engine) => {
                 engine.clear(new Color4(1.0, 1.0, 1.0, 1.0), true, true, true);
             });
 

+ 3 - 3
src/Rendering/depthRendererSceneComponent.ts

@@ -3,7 +3,7 @@ import { Scene } from "scene";
 import { SmartArrayNoDuplicate } from "Tools/smartArray";
 import { DepthRenderer } from "./depthRenderer";
 import { Camera } from "Cameras/camera";
-import { Engine } from "Engine";
+import { Constants } from "Engine/constants";
 import { ISceneComponent, SceneComponentConstants } from "sceneComponent";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 
@@ -38,10 +38,10 @@ declare module "scene" {
         if (!this._depthRenderer[camera.id]) {
             var textureType = 0;
             if (this.getEngine().getCaps().textureHalfFloatRender) {
-                textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                textureType = Constants.TEXTURETYPE_HALF_FLOAT;
             }
             else if (this.getEngine().getCaps().textureFloatRender) {
-                textureType = Engine.TEXTURETYPE_FLOAT;
+                textureType = Constants.TEXTURETYPE_FLOAT;
             } else {
                 throw "Depth renderer does not support int texture type";
             }

+ 3 - 3
src/Rendering/edgesRenderer.ts

@@ -9,7 +9,7 @@ import { Effect } from "Materials/effect";
 import { Material } from "Materials/material";
 import { ShaderMaterial } from "Materials/shaderMaterial";
 import { Camera } from "Cameras/camera";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { Node } from "node";
 import { LineEdgesRenderer } from "./lineEdgesRenderer";
 
@@ -475,9 +475,9 @@ declare module "Mesh/LinesMesh" {
             this._lineShader._preBind();
 
             if (this._source.edgesColor.a !== 1) {
-                engine.setAlphaMode(Engine.ALPHA_COMBINE);
+                engine.setAlphaMode(Constants.ALPHA_COMBINE);
             } else {
-                engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                engine.setAlphaMode(Constants.ALPHA_DISABLE);
             }
 
             // VBOs

+ 3 - 3
src/Rendering/geometryBufferRenderer.ts

@@ -2,7 +2,7 @@ import { Matrix, Color4 } from "Math/math";
 import { VertexBuffer } from "Mesh/buffer";
 import { SubMesh } from "Mesh/subMesh";
 import { Mesh } from "Mesh/mesh";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { SmartArray } from "Tools/smartArray";
 import { Texture } from "Materials/Textures/texture";
 import { MultiRenderTarget } from "Materials/Textures/multiRenderTarget";
@@ -270,7 +270,7 @@ import { SceneComponentConstants } from "sceneComponent";
 
             this._multiRenderTarget = new MultiRenderTarget("gBuffer",
                 { width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio }, count, this._scene,
-                { generateMipMaps: false, generateDepthTexture: true, defaultType: Engine.TEXTURETYPE_FLOAT });
+                { generateMipMaps: false, generateDepthTexture: true, defaultType: Constants.TEXTURETYPE_FLOAT });
             if (!this.isSupported) {
                 return;
             }
@@ -281,7 +281,7 @@ import { SceneComponentConstants } from "sceneComponent";
             this._multiRenderTarget.renderList = null;
 
             // set default depth value to 1.0 (far away)
-            this._multiRenderTarget.onClearObservable.add((engine: Engine) => {
+            this._multiRenderTarget.onClearObservable.add((engine) => {
                 engine.clear(new Color4(0.0, 0.0, 0.0, 1.0), true, true, true);
             });
 

+ 2 - 1
src/Rendering/outlineRenderer.ts

@@ -4,6 +4,7 @@ import { _InstancesBatch } from "Mesh/mesh";
 import { AbstractMesh } from "Mesh/abstractMesh";
 import { Scene } from "scene";
 import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { ISceneComponent, SceneComponentConstants } from "sceneComponent";
 import { Effect } from "Materials/effect";
 import { Material } from "Materials/material";
@@ -291,7 +292,7 @@ declare module "Mesh/AbstractMesh" {
             // Overlay
             if (mesh.renderOverlay) {
                 var currentMode = this._engine.getAlphaMode();
-                this._engine.setAlphaMode(Engine.ALPHA_COMBINE);
+                this._engine.setAlphaMode(Constants.ALPHA_COMBINE);
                 this.render(subMesh, batch, true);
                 this._engine.setAlphaMode(currentMode);
             }

+ 4 - 4
src/Rendering/renderingGroup.ts

@@ -6,7 +6,7 @@ import { Vector3 } from "Math/math";
 import { IParticleSystem } from "Particles/IParticleSystem";
 import { IEdgesRenderer } from "./edgesRenderer";
 import { ISpriteManager } from "Sprites/spriteManager";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { Material } from "Materials/material";
 import { Scene } from "scene";
 import { Camera } from "Cameras/camera";
@@ -148,7 +148,7 @@ import { Camera } from "Cameras/camera";
             // Transparent
             if (this._transparentSubMeshes.length !== 0) {
                 this._renderTransparent(this._transparentSubMeshes);
-                engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                engine.setAlphaMode(Constants.ALPHA_DISABLE);
             }
 
             // Set back stencil to false in case it changes before the edge renderer.
@@ -160,7 +160,7 @@ import { Camera } from "Cameras/camera";
                     this._edgesRenderers.data[edgesRendererIndex].render();
                 }
 
-                engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                engine.setAlphaMode(Constants.ALPHA_DISABLE);
             }
 
             // Restore Stencil state.
@@ -223,7 +223,7 @@ import { Camera } from "Cameras/camera";
                     if (material && material.needDepthPrePass) {
                         let engine = material.getScene().getEngine();
                         engine.setColorWrite(false);
-                        engine.setAlphaMode(Engine.ALPHA_DISABLE);
+                        engine.setAlphaMode(Constants.ALPHA_DISABLE);
                         subMesh.render(false);
                         engine.setColorWrite(true);
                     }

+ 3 - 3
src/Sprites/spriteManager.ts

@@ -13,7 +13,7 @@ import { Texture } from "Materials/Textures/texture";
 import { Effect } from "Materials/effect";
 import { Material } from "Materials/material";
 import { SceneComponentConstants } from "sceneComponent";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * Defines the minimum interface to fullfil in order to be a sprite manager.
@@ -361,9 +361,9 @@ import { Engine } from "Engine/engine";
             engine.setColorWrite(true);
             effect.setBool("alphaTest", false);
 
-            engine.setAlphaMode(Engine.ALPHA_COMBINE);
+            engine.setAlphaMode(Constants.ALPHA_COMBINE);
             engine.drawElementsType(Material.TriangleFillMode, 0, (offset / 4) * 6);
-            engine.setAlphaMode(Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Constants.ALPHA_DISABLE);
         }
 
         /**

+ 4 - 3
src/States/stencilState.ts

@@ -1,13 +1,14 @@
+import { Constants } from "Engine/constants";
     /**
      * @hidden
      **/
     export class _StencilState {
         /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
-        public static readonly ALWAYS = 0x0207;
+        public static readonly ALWAYS = Constants.ALWAYS;
         /** Passed to stencilOperation to specify that stencil value must be kept */
-        public static readonly KEEP = 0x1E00;
+        public static readonly KEEP = Constants.KEEP;
         /** Passed to stencilOperation to specify that stencil value must be replaced */
-        public static readonly REPLACE = 0x1E01;
+        public static readonly REPLACE = Constants.REPLACE;
 
         private _isStencilTestDirty = false;
         private _isStencilMaskDirty = false;

+ 7 - 7
src/Tools/HDR/cubemapToSphericalPolynomial.ts

@@ -3,7 +3,7 @@ import { Scalar } from "Math/math.scalar";
 import { SphericalPolynomial, SphericalHarmonics } from "Math/sphericalPolynomial";
 import { BaseTexture } from "Materials/Textures/baseTexture";
 import { Nullable } from "types";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { CubeMapInfo } from "./panoramaToCubemap";
 
     class FileFaceOrientation {
@@ -68,10 +68,10 @@ import { CubeMapInfo } from "./panoramaToCubemap";
 
             var gammaSpace = texture.gammaSpace;
             // Always read as RGBA.
-            var format = Engine.TEXTUREFORMAT_RGBA;
-            var type = Engine.TEXTURETYPE_UNSIGNED_INT;
-            if (texture.textureType && texture.textureType !== Engine.TEXTURETYPE_UNSIGNED_INT) {
-                type = Engine.TEXTURETYPE_FLOAT;
+            var format = Constants.TEXTUREFORMAT_RGBA;
+            var type = Constants.TEXTURETYPE_UNSIGNED_INT;
+            if (texture.textureType && texture.textureType !== Constants.TEXTURETYPE_UNSIGNED_INT) {
+                type = Constants.TEXTURETYPE_FLOAT;
             }
 
             var cubeInfo: CubeMapInfo = {
@@ -116,7 +116,7 @@ import { CubeMapInfo } from "./panoramaToCubemap";
                 // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).
                 // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.
                 // Because SP is still linear, so summation is fine in that basis.
-                const stride = cubeInfo.format === Engine.TEXTUREFORMAT_RGBA ? 4 : 3;
+                const stride = cubeInfo.format === Constants.TEXTUREFORMAT_RGBA ? 4 : 3;
                 for (var y = 0; y < cubeInfo.size; y++) {
                     var u = minUV;
 
@@ -135,7 +135,7 @@ import { CubeMapInfo } from "./panoramaToCubemap";
                         var b = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 2];
 
                         // Handle Integer types.
-                        if (cubeInfo.type === Engine.TEXTURETYPE_UNSIGNED_INT) {
+                        if (cubeInfo.type === Constants.TEXTURETYPE_UNSIGNED_INT) {
                             r /= 255;
                             g /= 255;
                             b /= 255;

+ 3 - 3
src/Tools/HDR/panoramaToCubemap.ts

@@ -1,6 +1,6 @@
 import { Nullable } from "types";
 import { Vector3 } from "Math/math";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 
     /**
      * CubeMap information grouping all the data for each faces as well as the cubemap size.
@@ -144,8 +144,8 @@ import { Engine } from "Engine/engine";
                 up: textureUp,
                 down: textureDown,
                 size: size,
-                type: Engine.TEXTURETYPE_FLOAT,
-                format: Engine.TEXTUREFORMAT_RGB,
+                type: Constants.TEXTURETYPE_FLOAT,
+                format: Constants.TEXTUREFORMAT_RGB,
                 gammaSpace: false,
             };
         }

+ 20 - 18
src/Tools/dds.ts

@@ -1,11 +1,13 @@
 import { Scalar } from "Math/math.scalar";
 import { SphericalPolynomial } from "Math/sphericalPolynomial";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { Nullable } from "types";
 import { Tools } from "./tools";
 import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalPolynomial";
 
+declare type Engine = import("Engine/engine").Engine;
+
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // All values and structures referenced from:
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/
@@ -173,18 +175,18 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
 
             var fourCC = header[off_pfFourCC];
             var dxgiFormat = (fourCC === FOURCC_DX10) ? extendedHeader[off_dxgiFormat] : 0;
-            var textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
+            var textureType = Constants.TEXTURETYPE_UNSIGNED_INT;
 
             switch (fourCC) {
                 case FOURCC_D3DFMT_R16G16B16A16F:
-                    textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                    textureType = Constants.TEXTURETYPE_HALF_FLOAT;
                     break;
                 case FOURCC_D3DFMT_R32G32B32A32F:
-                    textureType = Engine.TEXTURETYPE_FLOAT;
+                    textureType = Constants.TEXTURETYPE_FLOAT;
                     break;
                 case FOURCC_DX10:
                     if (dxgiFormat === DXGI_FORMAT_R16G16B16A16_FLOAT) {
-                        textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                        textureType = Constants.TEXTURETYPE_HALF_FLOAT;
                         break;
                     }
             }
@@ -540,7 +542,7 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
                         const i = (lodIndex === -1) ? mip : 0;
 
                         if (!info.isCompressed && info.isFourCC) {
-                            texture.format = Engine.TEXTUREFORMAT_RGBA;
+                            texture.format = Constants.TEXTUREFORMAT_RGBA;
                             dataLength = width * height * 4;
                             var floatArray: Nullable<ArrayBufferView> = null;
 
@@ -558,23 +560,23 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
                                     }
                                 }
 
-                                texture.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+                                texture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
                             }
                             else {
                                 if (bpp === 128) {
-                                    texture.type = Engine.TEXTURETYPE_FLOAT;
+                                    texture.type = Constants.TEXTURETYPE_FLOAT;
                                     floatArray = DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                     if (sphericalPolynomialFaces && i == 0) {
                                         sphericalPolynomialFaces.push(floatArray);
                                     }
                                 } else if (bpp === 64 && !engine.getCaps().textureHalfFloat) {
-                                    texture.type = Engine.TEXTURETYPE_FLOAT;
+                                    texture.type = Constants.TEXTURETYPE_FLOAT;
                                     floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                     if (sphericalPolynomialFaces && i == 0) {
                                         sphericalPolynomialFaces.push(floatArray);
                                     }
                                 } else { // 64
-                                    texture.type = Engine.TEXTURETYPE_HALF_FLOAT;
+                                    texture.type = Constants.TEXTURETYPE_HALF_FLOAT;
                                     floatArray = DDSTools._GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                     if (sphericalPolynomialFaces && i == 0) {
                                         sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));
@@ -586,14 +588,14 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
                                 engine._uploadDataToTextureDirectly(texture, floatArray, face, i);
                             }
                         } else if (info.isRGB) {
-                            texture.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+                            texture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
                             if (bpp === 24) {
-                                texture.format = Engine.TEXTUREFORMAT_RGB;
+                                texture.format = Constants.TEXTUREFORMAT_RGB;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);
                                 engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             } else { // 32
-                                texture.format = Engine.TEXTUREFORMAT_RGBA;
+                                texture.format = Constants.TEXTUREFORMAT_RGBA;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);
                                 engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
@@ -605,15 +607,15 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
                             dataLength = paddedRowSize * (height - 1) + unpaddedRowSize;
 
                             byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
-                            texture.format = Engine.TEXTUREFORMAT_LUMINANCE;
-                            texture.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+                            texture.format = Constants.TEXTUREFORMAT_LUMINANCE;
+                            texture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
 
                             engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                         } else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
                             byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);
 
-                            texture.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+                            texture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
                             engine._uploadCompressedDataToTextureDirectly(texture, internalCompressedFormat, width, height, byteArray, face, i);
                         }
                     }
@@ -639,8 +641,8 @@ import { CubeMapToSphericalPolynomialTools } from "Tools/HDR/cubemapToSphericalP
                     down: sphericalPolynomialFaces[3],
                     front: sphericalPolynomialFaces[4],
                     back: sphericalPolynomialFaces[5],
-                    format: Engine.TEXTUREFORMAT_RGBA,
-                    type: Engine.TEXTURETYPE_FLOAT,
+                    format: Constants.TEXTUREFORMAT_RGBA,
+                    type: Constants.TEXTURETYPE_FLOAT,
                     gammaSpace: false,
                 });
             } else {

+ 19 - 19
src/Tools/environmentTextureTools.ts

@@ -6,7 +6,7 @@ import { SphericalPolynomial } from "Math/sphericalPolynomial";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { BaseTexture } from "Materials/Textures/baseTexture";
 import { CubeTexture } from "Materials/Textures/cubeTexture";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { Scene } from "scene";
 import { PostProcess } from "PostProcess/postProcess";
 
@@ -152,7 +152,7 @@ import { PostProcess } from "PostProcess/postProcess";
                 return Promise.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.");
             }
 
-            if (texture.textureType === Engine.TEXTURETYPE_UNSIGNED_INT) {
+            if (texture.textureType === Constants.TEXTURETYPE_UNSIGNED_INT) {
                 return Promise.reject("The cube texture should allow HDR (Full Float or Half Float).");
             }
 
@@ -161,9 +161,9 @@ import { PostProcess } from "PostProcess/postProcess";
                 return Promise.reject("Env texture can only be created when the engine is associated to a canvas.");
             }
 
-            let textureType = Engine.TEXTURETYPE_FLOAT;
+            let textureType = Constants.TEXTURETYPE_FLOAT;
             if (!engine.getCaps().textureFloatRender) {
-                textureType = Engine.TEXTURETYPE_HALF_FLOAT;
+                textureType = Constants.TEXTURETYPE_HALF_FLOAT;
                 if (!engine.getCaps().textureHalfFloatRender) {
                     return Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.");
                 }
@@ -185,10 +185,10 @@ import { PostProcess } from "PostProcess/postProcess";
                     let data = texture.readPixels(face, i);
 
                     // Creates a temp texture with the face data.
-                    let tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, Engine.TEXTUREFORMAT_RGBA, false, false, Engine.TEXTURE_NEAREST_SAMPLINGMODE, null, textureType);
+                    let tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, Constants.TEXTUREFORMAT_RGBA, false, false, Constants.TEXTURE_NEAREST_SAMPLINGMODE, null, textureType);
                     // And rgbdEncode them.
                     let promise = new Promise<void>((resolve, reject) => {
-                        let rgbdPostProcess = new PostProcess("rgbdEncode", "rgbdEncode", null, null, 1, null, Engine.TEXTURE_NEAREST_SAMPLINGMODE, engine, false, undefined, Engine.TEXTURETYPE_UNSIGNED_INT, undefined, null, false);
+                        let rgbdPostProcess = new PostProcess("rgbdEncode", "rgbdEncode", null, null, 1, null, Constants.TEXTURE_NEAREST_SAMPLINGMODE, engine, false, undefined, Constants.TEXTURETYPE_UNSIGNED_INT, undefined, null, false);
                         rgbdPostProcess.getEffect().executeWhenCompiled(() => {
                             rgbdPostProcess.onApply = (effect) => {
                                 effect._bindTexture("textureSampler", tempTexture);
@@ -377,10 +377,10 @@ import { PostProcess } from "PostProcess/postProcess";
             let lodTextures: Nullable<{ [lod: number]: BaseTexture }> = null;
             let caps = engine.getCaps();
 
-            texture.format = Engine.TEXTUREFORMAT_RGBA;
-            texture.type = Engine.TEXTURETYPE_UNSIGNED_INT;
+            texture.format = Constants.TEXTUREFORMAT_RGBA;
+            texture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
             texture.generateMipMaps = true;
-            engine.updateTextureSamplingMode(Engine.TEXTURE_TRILINEAR_SAMPLINGMODE, texture);
+            engine.updateTextureSamplingMode(Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, texture);
 
             // Add extra process if texture lod is not supported
             if (!caps.textureLOD) {
@@ -395,18 +395,18 @@ import { PostProcess } from "PostProcess/postProcess";
             // If half float available we can uncompress the texture
             else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {
                 expandTexture = true;
-                texture.type = Engine.TEXTURETYPE_HALF_FLOAT;
+                texture.type = Constants.TEXTURETYPE_HALF_FLOAT;
             }
             // If full float available we can uncompress the texture
             else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {
                 expandTexture = true;
-                texture.type = Engine.TEXTURETYPE_FLOAT;
+                texture.type = Constants.TEXTURETYPE_FLOAT;
             }
 
             // Expand the texture if possible
             if (expandTexture) {
                 // Simply run through the decode PP
-                rgbdPostProcess = new PostProcess("rgbdDecode", "rgbdDecode", null, null, 1, null, Engine.TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, texture.type, undefined, null, false);
+                rgbdPostProcess = new PostProcess("rgbdDecode", "rgbdDecode", null, null, 1, null, Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, engine, false, undefined, texture.type, undefined, null, false);
 
                 texture._isRGBD = false;
                 texture.invertY = false;
@@ -414,9 +414,9 @@ import { PostProcess } from "PostProcess/postProcess";
                     generateDepthBuffer: false,
                     generateMipMaps: true,
                     generateStencilBuffer: false,
-                    samplingMode: Engine.TEXTURE_TRILINEAR_SAMPLINGMODE,
+                    samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
                     type: texture.type,
-                    format: Engine.TEXTUREFORMAT_RGBA
+                    format: Constants.TEXTUREFORMAT_RGBA
                 });
             }
             else {
@@ -444,7 +444,7 @@ import { PostProcess } from "PostProcess/postProcess";
                         glTextureFromLod.isCube = true;
                         glTextureFromLod.invertY = true;
                         glTextureFromLod.generateMipMaps = false;
-                        engine.updateTextureSamplingMode(Engine.TEXTURE_LINEAR_LINEAR, glTextureFromLod);
+                        engine.updateTextureSamplingMode(Constants.TEXTURE_LINEAR_LINEAR, glTextureFromLod);
 
                         // Wrap in a base texture for easy binding.
                         let lodTexture = new BaseTexture(null);
@@ -483,7 +483,7 @@ import { PostProcess } from "PostProcess/postProcess";
                     let promise = new Promise<void>((resolve, reject) => {
                         image.onload = () => {
                             if (expandTexture) {
-                                let tempTexture = engine.createTexture(null, true, true, null, Engine.TEXTURE_NEAREST_SAMPLINGMODE, null,
+                                let tempTexture = engine.createTexture(null, true, true, null, Constants.TEXTURE_NEAREST_SAMPLINGMODE, null,
                                     (message) => {
                                         reject(message);
                                     },
@@ -532,15 +532,15 @@ import { PostProcess } from "PostProcess/postProcess";
                 const size = Math.pow(2, mipmapsCount - 1 - imageData.length);
                 const dataLength = size * size * 4;
                 switch (texture.type) {
-                    case Engine.TEXTURETYPE_UNSIGNED_INT: {
+                    case Constants.TEXTURETYPE_UNSIGNED_INT: {
                         data = new Uint8Array(dataLength);
                         break;
                     }
-                    case Engine.TEXTURETYPE_HALF_FLOAT: {
+                    case Constants.TEXTURETYPE_HALF_FLOAT: {
                         data = new Uint16Array(dataLength);
                         break;
                     }
-                    case Engine.TEXTURETYPE_FLOAT: {
+                    case Constants.TEXTURETYPE_FLOAT: {
                         data = new Float32Array(dataLength);
                         break;
                     }

+ 3 - 3
src/Tools/sceneSerializer.ts

@@ -2,7 +2,7 @@ import { Geometry, BoxGeometry, SphereGeometry, CylinderGeometry, TorusGeometry,
 import { Mesh } from "Mesh/mesh";
 import { Plane } from "Math/math";
 import { Animation } from "Animations/animation";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { MultiMaterial } from "Materials/multiMaterial";
 import { Material } from "Materials/material";
 import { Scene } from "scene";
@@ -71,7 +71,7 @@ import { Light } from "Lights/light";
 
     var finalizeSingleMesh = (mesh: Mesh, serializationObject: any) => {
         //only works if the mesh is already loaded
-        if (mesh.delayLoadState === Engine.DELAYLOADSTATE_LOADED || mesh.delayLoadState === Engine.DELAYLOADSTATE_NONE) {
+        if (mesh.delayLoadState === Constants.DELAYLOADSTATE_LOADED || mesh.delayLoadState === Constants.DELAYLOADSTATE_NONE) {
             //serialize material
             if (mesh.material) {
                 if (mesh.material instanceof MultiMaterial) {
@@ -286,7 +286,7 @@ import { Light } from "Lights/light";
                 if (abstractMesh instanceof Mesh) {
                     var mesh = abstractMesh;
                     if (!mesh.doNotSerialize) {
-                        if (mesh.delayLoadState === Engine.DELAYLOADSTATE_LOADED || mesh.delayLoadState === Engine.DELAYLOADSTATE_NONE) {
+                        if (mesh.delayLoadState === Constants.DELAYLOADSTATE_LOADED || mesh.delayLoadState === Constants.DELAYLOADSTATE_NONE) {
                             serializationObject.meshes.push(serializeMesh(mesh, serializationObject));
                         }
                     }

+ 2 - 2
src/Tools/textureTools.ts

@@ -3,7 +3,7 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
 import { Texture } from "Materials/Textures/texture";
 import { RenderTargetTexture } from "Materials/Textures/renderTargetTexture";
 import { PassPostProcess } from "PostProcess/passPostProcess";
-import { Engine } from "Engine/engine";
+import { Constants } from "Engine/constants";
 import { Scene } from "scene";
 
     /**
@@ -52,7 +52,7 @@ import { Scene } from "scene";
             texture.wrapU = Texture.CLAMP_ADDRESSMODE;
             texture.wrapV = Texture.CLAMP_ADDRESSMODE;
 
-            let passPostProcess = new PassPostProcess("pass", 1, null, useBilinearMode ? Texture.BILINEAR_SAMPLINGMODE : Texture.NEAREST_SAMPLINGMODE, engine, false, Engine.TEXTURETYPE_UNSIGNED_INT);
+            let passPostProcess = new PassPostProcess("pass", 1, null, useBilinearMode ? Texture.BILINEAR_SAMPLINGMODE : Texture.NEAREST_SAMPLINGMODE, engine, false, Constants.TEXTURETYPE_UNSIGNED_INT);
             passPostProcess.getEffect().executeWhenCompiled(() => {
                 passPostProcess.onApply = function(effect) {
                     effect.setTexture("textureSampler", texture);

+ 8 - 6
src/Tools/tools.ts

@@ -2,7 +2,6 @@ import { FloatArray, IndicesArray, Nullable } from "types";
 import { Animation } from "Animations/animation";
 import { Color4, Color3, Vector2, Vector3 } from "Math/math";
 import { Scalar } from "Math/math.scalar";
-import { Engine } from "Engine/engine";
 import { IOfflineProvider } from "Offline/IOfflineProvider";
 import { Camera } from "Cameras/camera";
 import { Texture } from "Materials/Textures/texture";
@@ -11,6 +10,9 @@ import { FxaaPostProcess } from "PostProcess/fxaaPostProcess";
 import { Observable } from "./observable";
 import { FilesInput } from "./filesInput";
 import { TGATools } from "./tga";
+import { Constants } from "Engine/constants";
+
+declare type Engine = import("Engine/engine").Engine;
 
     /**
      * Interface for any object that can request an animation frame
@@ -406,17 +408,17 @@ import { TGATools } from "./tga";
          * @param mode defines how to define the closest value
          * @returns closest exponent of two of the given value
          */
-        public static GetExponentOfTwo(value: number, max: number, mode = Engine.SCALEMODE_NEAREST): number {
+        public static GetExponentOfTwo(value: number, max: number, mode = Constants.SCALEMODE_NEAREST): number {
             let pot;
 
             switch (mode) {
-                case Engine.SCALEMODE_FLOOR:
+                case Constants.SCALEMODE_FLOOR:
                     pot = Tools.FloorPOT(value);
                     break;
-                case Engine.SCALEMODE_NEAREST:
+                case Constants.SCALEMODE_NEAREST:
                     pot = Tools.NearestPOT(value);
                     break;
-                case Engine.SCALEMODE_CEILING:
+                case Constants.SCALEMODE_CEILING:
                 default:
                     pot = Tools.CeilingPOT(value);
                     break;
@@ -1527,7 +1529,7 @@ import { TGATools } from "./tga";
             scene.render();
 
             // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)
-            var texture = new RenderTargetTexture("screenShot", size, scene, false, false, Engine.TEXTURETYPE_UNSIGNED_INT, false, Texture.NEAREST_SAMPLINGMODE);
+            var texture = new RenderTargetTexture("screenShot", size, scene, false, false, Constants.TEXTURETYPE_UNSIGNED_INT, false, Texture.NEAREST_SAMPLINGMODE);
             texture.renderList = null;
             texture.samples = samples;
             if (antialiasing) {

+ 2 - 1
src/scene.ts

@@ -45,6 +45,7 @@ import { Engine } from "Engine/engine";
 import { Ray } from "Culling/ray";
 import { Node } from "node";
 import { MorphTarget } from "Morph/morphTarget";
+import { Constants } from "Engine/constants";
 
     /**
      * Define an interface for all classes that will hold resources
@@ -2293,7 +2294,7 @@ import { MorphTarget } from "Morph/morphTarget";
             for (index = 0; index < this.geometries.length; index++) {
                 var geometry = this.geometries[index];
 
-                if (geometry.delayLoadState === Engine.DELAYLOADSTATE_LOADING) {
+                if (geometry.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {
                     return false;
                 }
             }