PostProcessStage
s或其他后處理復(fù)合階段的集合,邏輯上一起執(zhí)行。所有階段按照數(shù)組的順序執(zhí)行。輸入紋理根據(jù)inputPreviousStageTexture
的值變化。如果inputPreviousStageTexture
是true
,則每個(gè)階段的輸入是場(chǎng)景或在其之前執(zhí)行的階段渲染到的輸出紋理。如果inputPreviousStageTexture
為false
,則復(fù)合材料中每個(gè)階段的輸入紋理都相同。輸入紋理是由場(chǎng)景或上一階段的輸出紋理渲染到的紋理。
Parameters:
options
(Object)
一個(gè)
Name | Description |
---|---|
options.stages
Array
|
按順序執(zhí)行的PostProcessStage s或復(fù)合物數(shù)組。
|
options.inputPreviousStageTexture
Boolean
default true
|
是否執(zhí)行每個(gè)后處理階段,其中一個(gè)階段的輸入是前一個(gè)階段的輸出。否則,對(duì)每個(gè)包含的階段的輸入是在組合之前執(zhí)行的階段的輸出。 |
options.name
String
default createGuid()
|
此后處理階段的唯一名稱,供其他復(fù)合材料參考。如果未提供名稱,將生成一個(gè)GUID。 |
options.uniforms
Object
|
后處理階段結(jié)構(gòu)的別名。 |
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
準(zhǔn)備好后是否執(zhí)行此后期處理階段。
(readonly) inputPreviousStageTexture : Boolean
所有后期處理階段都按數(shù)組的順序執(zhí)行。輸入紋理根據(jù)
inputPreviousStageTexture
的值變化。如果inputPreviousStageTexture
是true
,則每個(gè)階段的輸入是場(chǎng)景或在其之前執(zhí)行的階段渲染到的輸出紋理。如果inputPreviousStageTexture
為false
,則復(fù)合材料中每個(gè)階段的輸入紋理都相同。輸入紋理是由場(chǎng)景或上一階段的輸出紋理渲染到的紋理。
(readonly) length : Number
此組合中的后期處理階段數(shù)。
(readonly) name : String
此后處理階段的唯一名稱,供后處理階段復(fù)合中的其他階段參考。
(readonly) ready : Boolean
確定此后處理階段是否準(zhǔn)備好執(zhí)行。
selected : Array
為應(yīng)用后期處理選擇的功能。
uniforms : Object
后處理階段的統(tǒng)一值的別名。可能是
undefined
,在這種情況下,讓每個(gè)階段設(shè)置統(tǒng)一的值。
Methods
destroy()
銷毀此對(duì)象持有的WebGL資源。銷毀對(duì)象允許確定地釋放WebGL資源,而不是依賴?yán)占鱽?lái)銷毀此對(duì)象。
一旦對(duì)象被破壞,就不應(yīng)使用它;調(diào)用除isDestroyed
以外的任何函數(shù)都將導(dǎo)致DeveloperError
異常。因此,將返回值(undefined
)賦給對(duì)象,如示例中所述。
Throws
-
DeveloperError : 此對(duì)象已被銷毀,即調(diào)用destroy()。
在
index
處獲取后期處理階段
Parameters:
index
(Number)
后處理階段或組合的索引。
Throws
-
DeveloperError : 索引必須大于或等于0。
如果此對(duì)象被破壞,則返回true;否則返回false。
如果此對(duì)象被破壞,則不應(yīng)使用它;調(diào)用除isDestroyed
以外的任何函數(shù)都將導(dǎo)致DeveloperError
異常。