English中文

PostProcessStageComposite

new Cesium.PostProcessStageComposite(options)

的集合 A collection of PostProcessStage或其他逻辑上一起执行的后处理复合阶段。 s or other post-process composite stages that execute together logically.

所有阶段均按数组顺序执行。输入纹理根据值改变 All stages are executed in the order of the array. The input texture changes based on the value of inputPreviousStageTexture。如果 . If inputPreviousStageTexture is true,每个阶段的输入是由场景或在其之前执行的阶段渲染的输出纹理。如果 , the input to each stage is the output texture rendered to by the scene or of the stage that executed before it. If inputPreviousStageTexture is false,合成中每个阶段的输入纹理都是相同的。输入纹理是场景渲染到的纹理或者前一阶段的输出纹理。 , the input texture is the same for each stage in the composite. The input texture is the texture rendered to by the scene or the output texture of the previous stage.

名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: An object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
stages Array 一个数组 An array of PostProcessStage按顺序执行的 s 或组合。 s or composites to be executed in order.
inputPreviousStageTexture boolean true 可选 optional 是否执行每个后处理阶段,其中一个阶段的输入是前一个阶段的输出。否则,每个包含阶段的输入是复合之前执行的阶段的输出。 Whether to execute each post-process stage where the input to one stage is the output of the previous. Otherwise, the input to each contained stage is the output of the stage that executed before the composite.
name string createGuid() 可选 optional 此后处理阶段的唯一名称,供其他复合材料参考。如果未提供名称,将生成 GUID。 The unique name of this post-process stage for reference by other composites. If a name is not supplied, a GUID will be generated.
uniforms object 可选 optional 后处理阶段制服的别名。 An alias to the uniforms of post-process stages.
抛出: Throws:
  • DeveloperError :options.stages.length 必须大于 0.0。 : options.stages.length must be greater than 0.0.
示例: 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 Cesium.PostProcessStageComposite({
    stages : [blurXDirection, blurYDirection]
}));
// Example 2: referencing the output of another post-process stage
scene.postProcessStages.add(new Cesium.PostProcessStageComposite({
    inputPreviousStageTexture : false,
    stages : [
        // The same as Example 1.
        new Cesium.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 Cesium.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
const uniforms = {};
Cesium.defineProperties(uniforms, {
    filterSize : {
        get : function() {
            return blurXDirection.uniforms.filterSize;
        },
        set : function(value) {
            blurXDirection.uniforms.filterSize = blurYDirection.uniforms.filterSize = value;
        }
    }
});
scene.postProcessStages.add(new Cesium.PostProcessStageComposite({
    stages : [blurXDirection, blurYDirection],
    uniforms : uniforms
}));
另见: See:

成员 Members

准备好后是否执行此后处理阶段。 Whether or not to execute this post-process stage when ready.

readonly inputPreviousStageTexture : boolean

所有后处理阶段均按数组顺序执行。输入纹理根据值变化 All post-process stages are executed in the order of the array. The input texture changes based on the value of inputPreviousStageTexture。如果 . If inputPreviousStageTexture is true,每个阶段的输入是由场景或在其之前执行的阶段渲染的输出纹理。如果 , the input to each stage is the output texture rendered to by the scene or of the stage that executed before it. If inputPreviousStageTexture is false,合成中每个阶段的输入纹理都是相同的。输入纹理是场景渲染到的纹理或者前一阶段的输出纹理。 , the input texture is the same for each stage in the composite. The input texture is the texture rendered to by the scene or the output texture of the previous stage.
该合成中的后处理阶段的数量。 The number of post-process stages in this composite.
此后处理阶段的唯一名称,供 PostProcessStageComposite 中的其他阶段参考。 The unique name of this post-process stage for reference by other stages in a PostProcessStageComposite.
确定此后处理阶段是否准备好执行。 Determines if this post-process stage is ready to be executed.
选择用于应用后处理的特征。 The features selected for applying the post-process.
后处理阶段统一值的别名。可能是 An alias to the uniform values of the post-process stages. May be undefined;在这种情况下,让每个阶段设置统一的值。 ; in which case, get each stage to set uniform values.

方法 Methods

销毁该对象持有的 WebGL 资源。销毁对象可以确定性地释放 WebGL 资源,而不是依赖垃圾收集器来销毁该对象。 Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.

抛出: Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
另见: See:
获取后处理阶段 Gets the post-process stage at index
名称 Name 类型 Type 说明 Description
index number 后处理阶段或复合的索引。 The index of the post-process stage or composite.
返回: Returns:
后处理阶段或索引处的复合。 The post-process stage or composite at index.
抛出: Throws:
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.

如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError exception.

返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.