浏览代码

code docs and whats new

Trevor Baron 7 年之前
父节点
当前提交
d0d5a9f8e0

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

@@ -89,6 +89,7 @@
 - EnvironmentHelper has no an onError observable to handle errors when loading the textures ([RaananW](https://github.com/RaananW))
 - (Viewer) Viewer supports model animations ([RaananW](https://github.com/RaananW))
 - Tests for sharpen, chromatic aberration, default pipeline and enable/disable post processes ([trevordev](https://github.com/trevordev))
+- Added setTextureFromPostProcessOutput to bind the output of a postprocess into an effect ([trevordev](https://github.com/trevordev))
 
 ## Bug fixes
 

+ 5 - 0
src/Engine/babylon.engine.ts

@@ -5222,6 +5222,11 @@
             this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);
         }
 
+        /**
+         * Binds the output of the passed in post process to the texture channel specified
+         * @param channel The channel the texture should be bound to
+         * @param postProcess The post process which's output should be bound
+         */
         public setTextureFromPostProcessOutput(channel: number, postProcess: Nullable<PostProcess>): void {
             this._bindTexture(channel, postProcess ? postProcess._outputTexture : null);
         }

+ 7 - 1
src/Materials/babylon.effect.ts

@@ -937,7 +937,8 @@
         }
 
         /**
-         * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)
+         * (Warning! setTextureFromPostProcessOutput may be desired instead)
+         * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)
          * @param channel Name of the sampler variable.
          * @param postProcess Post process to get the input texture from.
          */
@@ -945,6 +946,11 @@
             this._engine.setTextureFromPostProcess(this._samplers.indexOf(channel), postProcess);
         }
 
+        /**
+         * Sets the output texture of the passed in post process to be input of this effect.
+         * @param channel Name of the sampler variable.
+         * @param postProcess Post process to get the output texture from.
+         */
         public setTextureFromPostProcessOutput(channel: string, postProcess: Nullable<PostProcess>): void {
             this._engine.setTextureFromPostProcessOutput(this._samplers.indexOf(channel), postProcess);
         }

+ 4 - 0
src/PostProcess/babylon.postProcess.ts

@@ -15,6 +15,9 @@
         */
         public height = -1;
 
+        /**
+        * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)
+        */
         public _outputTexture: Nullable<InternalTexture> = null;
 
         /**
@@ -353,6 +356,7 @@
          * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.
          * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)
          * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)
+         * @returns The target texture that was bound to be written to. 
          */
         public activate(camera: Nullable<Camera>, sourceTexture: Nullable<InternalTexture> = null, forceDepthStencil?: boolean): InternalTexture {
             camera = camera || this._camera;