Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
An object with the following properties:
|
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 the OES_texture_float extension. Check context.floatingPointTexture.
Example:
var fs =
'uniform sampler2D colorTexture;\n' +
'varying vec2 v_textureCoordinates;\n' +
'uniform float scale;\n' +
'uniform vec3 offset;\n' +
'void main() {\n' +
' vec4 color = texture2D(colorTexture, v_textureCoordinates);\n' +
' gl_FragColor = vec4(color.rgb * scale + offset, 1.0);\n' +
'}\n';
scene.postProcessStages.add(new Cesium.PostProcessStage({
fragmentShader : fs,
uniforms : {
scale : 1.1,
offset : function() {
return new Cesium.Cartesian3(0.1, 0.2, 0.3);
}
}
}));
See:
Members
readonlyclearColor : Color
The shader must contain a sampler uniform declaration for colorTexture
, depthTexture
,
or both.
The shader must contain a vec2
varying declaration for v_textureCoordinates
for sampling
the texture uniforms.
PostProcessStageComposite
.
readonlypixelFormat : PixelFormat
ready
and PostProcessStage#enabled
are true
. A stage will not be ready while it is waiting on textures
to load.
readonlysampleMode : PostProcessStageSampleMode
readonlyscissorRectangle : BoundingRectangle
BoundingRectangle
to use for the scissor test. A default bounding rectangle will disable the scissor test.
The object property values can be either a constant or a function. The function will be called each frame before the post-process stage is executed.
A constant value can also be a URI to an image, a data URI, or an HTML element that can be used as a texture, such as HTMLImageElement or HTMLCanvasElement.
If this post-process stage is part of a PostProcessStageComposite
that does not execute in series, the constant value can also be
the name of another stage in a composite. This will set the uniform to the output texture the stage with that name.
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
.
A post process stage is not supported when it requires a depth texture and the WEBGL_depth_texture extension is not supported.
Name | Type | Description |
---|---|---|
scene |
Scene | The scene. |