PostProcessStageComposite

PostProcessStages或其他后处理复合阶段的集合,逻辑上一起执行。

所有阶段按照数组的顺序执行。输入纹理根据inputPreviousStageTexture的值变化。如果inputPreviousStageTexturetrue,则每个阶段的输入是场景或在其之前执行的阶段渲染到的输出纹理。如果inputPreviousStageTexturefalse,则复合材料中每个阶段的输入纹理都相同。输入纹理是由场景或上一阶段的输出纹理渲染到的纹理。

new PostProcessStageComposite(options)
Parameters:
options (Object) 一个
Name Description
options.stages
Array
按顺序执行的PostProcessStages或复合物数组。
options.inputPreviousStageTexture
Boolean
default true
是否执行每个后处理阶段,其中一个阶段的输入是前一个阶段的输出。否则,对每个包含的阶段的输入是在组合之前执行的阶段的输出。
options.name
String
default createGuid()
此后处理阶段的唯一名称,供其他复合材料参考。如果未提供名称,将生成一个GUID。
options.uniforms
Object
后处理阶段结构的别名。
Examples
// Example 1: separable blur filter
// The input to blurXDirection is the texture rendered to by the scene or the output of the previous stage.
// The input to blurYDirection is the texture rendered to by blurXDirection.
scene.postProcessStages.add(new bmgl.PostProcessStageComposite({
    stages : [blurXDirection, blurYDirection]
}));
// Example 2: referencing the output of another post-process stage
scene.postProcessStages.add(new bmgl.PostProcessStageComposite({
    inputPreviousStageTexture : false,
    stages : [
        // The same as Example 1.
        new bmgl.PostProcessStageComposite({
            inputPreviousStageTexture : true
            stages : [blurXDirection, blurYDirection],
            name : 'blur'
        }),
        // The input texture for this stage is the same input texture to blurXDirection since inputPreviousStageTexture is false
        new bmgl.PostProcessStage({
            fragmentShader : compositeShader,
            uniforms : {
                blurTexture : 'blur' // The output of the composite with name 'blur' (the texture that blurYDirection rendered to).
            }
        })
    ]
});
// Example 3: create a uniform alias
var uniforms = {};
bmgl.defineProperties(uniforms, {
    filterSize : {
        get : function() {
            return blurXDirection.uniforms.filterSize;
        },
        set : function(value) {
            blurXDirection.uniforms.filterSize = blurYDirection.uniforms.filterSize = value;
        }
    }
});
scene.postProcessStages.add(new bmgl.PostProcessStageComposite({
    stages : [blurXDirection, blurYDirection],
    uniforms : uniforms
}));
Throws
See:

Members

enabled : Boolean

准备好后是否执行此后期处理阶段。

(readonly) inputPreviousStageTexture : Boolean

所有后期处理阶段都按数组的顺序执行。输入纹理根据inputPreviousStageTexture的值变化。如果inputPreviousStageTexturetrue,则每个阶段的输入是场景或在其之前执行的阶段渲染到的输出纹理。如果inputPreviousStageTexturefalse,则复合材料中每个阶段的输入纹理都相同。输入纹理是由场景或上一阶段的输出纹理渲染到的纹理。

(readonly) length : Number

此组合中的后期处理阶段数。

(readonly) name : String

此后处理阶段的唯一名称,供后处理阶段复合中的其他阶段参考。

(readonly) ready : Boolean

确定此后处理阶段是否准备好执行。

selected : Array

为应用后期处理选择的功能。

uniforms : Object

后处理阶段的统一值的别名。可能是undefined,在这种情况下,让每个阶段设置统一的值。

Methods

destroy()
销毁此对象持有的WebGL资源。销毁对象允许确定地释放WebGL资源,而不是依赖垃圾收集器来销毁此对象。

一旦对象被破坏,就不应使用它;调用除isDestroyed以外的任何函数都将导致DeveloperError异常。因此,将返回值(undefined)赋给对象,如示例中所述。

Throws
See:
get(index) → {PostProcessStage|PostProcessStageComposite}
index处获取后期处理阶段
Parameters:
index (Number) 后处理阶段或组合的索引。
Throws
isDestroyed() → {Boolean}
如果此对象被破坏,则返回true;否则返回false。

如果此对象被破坏,则不应使用它;调用除isDestroyed以外的任何函数都将导致DeveloperError异常。

See: