PostProcessStage
s或其他后處理復合階段的集合,邏輯上一起執行。所有階段按照數組的順序執行。輸入紋理根據inputPreviousStageTexture
的值變化。如果inputPreviousStageTexture
是true
,則每個階段的輸入是場景或在其之前執行的階段渲染到的輸出紋理。如果inputPreviousStageTexture
為false
,則復合材料中每個階段的輸入紋理都相同。輸入紋理是由場景或上一階段的輸出紋理渲染到的紋理。
Parameters:
options
(Object)
一個
Name | Description |
---|---|
options.stages
Array
|
按順序執行的PostProcessStage s或復合物數組。
|
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
-
DeveloperError : options.stages.length必須大于0.0。
See:
Members
enabled : Boolean
準備好后是否執行此后期處理階段。
(readonly) inputPreviousStageTexture : Boolean
所有后期處理階段都按數組的順序執行。輸入紋理根據
inputPreviousStageTexture
的值變化。如果inputPreviousStageTexture
是true
,則每個階段的輸入是場景或在其之前執行的階段渲染到的輸出紋理。如果inputPreviousStageTexture
為false
,則復合材料中每個階段的輸入紋理都相同。輸入紋理是由場景或上一階段的輸出紋理渲染到的紋理。
(readonly) length : Number
此組合中的后期處理階段數。
(readonly) name : String
此后處理階段的唯一名稱,供后處理階段復合中的其他階段參考。
(readonly) ready : Boolean
確定此后處理階段是否準備好執行。
selected : Array
為應用后期處理選擇的功能。
uniforms : Object
后處理階段的統一值的別名。可能是
undefined
,在這種情況下,讓每個階段設置統一的值。
Methods
destroy()
銷毀此對象持有的WebGL資源。銷毀對象允許確定地釋放WebGL資源,而不是依賴垃圾收集器來銷毀此對象。
一旦對象被破壞,就不應使用它;調用除isDestroyed
以外的任何函數都將導致DeveloperError
異常。因此,將返回值(undefined
)賦給對象,如示例中所述。
Throws
-
DeveloperError : 此對象已被銷毀,即調用destroy()。
在
index
處獲取后期處理階段
Parameters:
index
(Number)
后處理階段或組合的索引。
Throws
-
DeveloperError : 索引必須大于或等于0。
如果此對象被破壞,則返回true;否則返回false。
如果此對象被破壞,則不應使用它;調用除isDestroyed
以外的任何函數都將導致DeveloperError
異常。