sebastien 7 سال پیش
والد
کامیت
4395bcea4b
2فایلهای تغییر یافته به همراه12 افزوده شده و 9 حذف شده
  1. 1 0
      dist/preview release/what's new.md
  2. 11 9
      src/Layer/babylon.glowlayer.ts

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

@@ -11,6 +11,7 @@
 - Introduced [Projection Texture on SpotLight](http://doc.babylonjs.com/babylon101/lights#projection-texture) ([lostink](https://github.com/lostink))
 - Introduced support for [local cubemaps](http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode) ([deltakosh](https://github.com/deltakosh))
 - Added [VideoDome](http://doc.babylonjs.com/how_to/360videodome) class to easily support 360 videos ([DavidHGillen](https://github.com/DavidHGillen))
+- Added [GlowLayer](https://doc.babylonjs.com/how_to/glow_layer) to easily support glow from emissive materials ([sebavan](https://github.com/sebavan))
 
 ## Updates
 

+ 11 - 9
src/Layer/babylon.glowlayer.ts

@@ -16,7 +16,7 @@
         mainTextureFixedSize?: number;
 
         /**
-         * How big is the kernem of the blur texture.
+         * How big is the kernel of the blur texture.
          */
         blurKernelSize: number;
 
@@ -36,10 +36,12 @@
      * 
      * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
      * glowy meshes to your scene.
+     * 
+     * Documentation: https://doc.babylonjs.com/how_to/glow_layer
      */
     export class GlowLayer extends EffectLayer {
         /**
-         * Effect Name of the highlight layer.
+         * Effect Name of the layer.
          */
         public static readonly EffectName = "GlowLayer";
 
@@ -150,7 +152,7 @@
         }
 
         /**
-         * Creates the render target textures and post processes used in the highlight layer.
+         * Creates the render target textures and post processes used in the glow layer.
          */
         protected _createTextureAndPostProcesses(): void {
             var blurTextureWidth = this._mainTextureDesiredSize.width;
@@ -158,7 +160,7 @@
             blurTextureWidth = this._engine.needPOTTextures ? Tools.GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;
             blurTextureHeight = this._engine.needPOTTextures ? Tools.GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;
 
-            this._blurTexture1 = new RenderTargetTexture("HighlightLayerBlurRTT",
+            this._blurTexture1 = new RenderTargetTexture("GlowLayerBlurRTT",
                 {
                     width: blurTextureWidth,
                     height: blurTextureHeight
@@ -176,7 +178,7 @@
             var blurTextureWidth2 = Math.floor(blurTextureWidth / 2);
             var blurTextureHeight2 = Math.floor(blurTextureHeight / 2);
 
-            this._blurTexture2 = new RenderTargetTexture("HighlightLayerBlurRTT2",
+            this._blurTexture2 = new RenderTargetTexture("GlowLayerBlurRTT2",
                 {
                     width: blurTextureWidth2,
                     height: blurTextureHeight2
@@ -193,7 +195,7 @@
 
             this._textures = [ this._blurTexture1, this._blurTexture2 ];
 
-            this._horizontalBlurPostprocess1 = new BlurPostProcess("HighlightLayerHBP1", new Vector2(1.0, 0), this._options.blurKernelSize / 2, {
+            this._horizontalBlurPostprocess1 = new BlurPostProcess("GlowLayerHBP1", new Vector2(1.0, 0), this._options.blurKernelSize / 2, {
                     width:  blurTextureWidth,
                     height: blurTextureHeight
                 },
@@ -204,13 +206,13 @@
                 effect.setTexture("textureSampler", this._mainTexture);
             });
 
-            this._verticalBlurPostprocess1 = new BlurPostProcess("HighlightLayerVBP1", new Vector2(0, 1.0), this._options.blurKernelSize / 2, {
+            this._verticalBlurPostprocess1 = new BlurPostProcess("GlowLayerVBP1", new Vector2(0, 1.0), this._options.blurKernelSize / 2, {
                     width:  blurTextureWidth,
                     height: blurTextureHeight
                 },
                 null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, Engine.TEXTURETYPE_HALF_FLOAT);
 
-            this._horizontalBlurPostprocess2 = new BlurPostProcess("HighlightLayerHBP2", new Vector2(1.0, 0), this._options.blurKernelSize / 2, {
+            this._horizontalBlurPostprocess2 = new BlurPostProcess("GlowLayerHBP2", new Vector2(1.0, 0), this._options.blurKernelSize / 2, {
                     width:  blurTextureWidth2,
                     height: blurTextureHeight2
                 },
@@ -221,7 +223,7 @@
                 effect.setTexture("textureSampler", this._blurTexture1);
             });
 
-            this._verticalBlurPostprocess2 = new BlurPostProcess("HighlightLayerVBP2", new Vector2(0, 1.0), this._options.blurKernelSize / 2, {
+            this._verticalBlurPostprocess2 = new BlurPostProcess("GlowLayerVBP2", new Vector2(0, 1.0), this._options.blurKernelSize / 2, {
                     width:  blurTextureWidth2,
                     height: blurTextureHeight2
                 },