| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
具有下列属性的天体:
|
Throws:
-
DeveloperError : options.textureScale must be greater than 0.0 and less than or equal to 1.0.
-
DeveloperError : options.pixelFormat must be a color format.
-
DeveloperError : When options.pixelDatatype is FLOAT, this WebGL implementation must support floating point textures. Check context.floatingPointTexture.
Examples:
// Simple stage to change the color
const fs =`
uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
uniform float scale;
uniform vec3 offset;
void main() {
vec4 color = texture(colorTexture, v_textureCoordinates);
out_FragColor = vec4(color.rgb * scale + offset, 1.0);
}`;
scene.postProcessStages.add(new Cesium.PostProcessStage({
fragmentShader : fs,
uniforms : {
scale : 1.1,
offset : function() {
return new Cesium.Cartesian3(0.1, 0.2, 0.3);
}
}
}));
// Simple stage to change the color of what is selected.
// If czm_selected returns true, the current fragment belongs to geometry in the selected array.
const fs =`
uniform sampler2D colorTexture;
in vec2 v_textureCoordinates;
uniform vec4 highlight;
void main() {
vec4 color = texture(colorTexture, v_textureCoordinates);
if (czm_selected()) {
vec3 highlighted = highlight.a * highlight.rgb + (1.0 - highlight.a) * color.rgb;
out_FragColor = vec4(highlighted, 1.0);
} else {
out_FragColor = color;
}
}`;
const stage = scene.postProcessStages.add(new Cesium.PostProcessStage({
fragmentShader : fs,
uniforms : {
highlight : function() {
return new Cesium.Color(1.0, 0.0, 0.0, 0.5);
}
}
}));
stage.selected = [cesium3DTileFeature];
See:
Members
readonly clearColor : Color
遮蔽器必须包含一个采样器的统一声明,用于: colorTexture , 深Texture ,
or both.
The shader must contain a vec2 varying declaration for v_textureCoordinates for sampling
纹理制服.
PostProcessStageComposite.
readonly pixelDatatype : PixelDatatype
readonly pixelFormat : PixelFormat
PostProcessStage#enabled are true. A stage will not be ready while it is waiting on textures
to load.
readonly sampleMode : PostProcessStageSampleMode
readonly scissorRectangle : BoundingRectangle
BoundingRectangle to use for the scissor test. A default bounding rectangle will disable the scissor test.
在片段阴影中,使用 NT 0 czm select NT 1 确定是否应用后处理
跳到那个碎片。 例如:
如果(czm sselect(v 文字坐标)){
// 应用后处理阶段
} else {
out_FragColor = texture(colorTexture, v_textureCoordinates);
}
对象属性值可以是常数,也可以是函数. 函数将调用 后进程阶段执行前的每个框架.
恒定值也可以是图像的 URI ,数据 URI ,或者可以用作纹理的 HTML 元素,如HTMLImageElement或HTMLCanvasElement.
If this post-process stage is part of a PostProcessStageComposite that does not execute in series, the constant value can also be
在复合材料中另一个阶段的名称。 这将设置用于输出纹理的制服 舞台带有这个名称.
Methods
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.
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.