Class
ClearColor
View sourceExtendsColor
Provides the color that the WebGL renderer uses to clear its color buffer.
ClearColor is a world resource built on Color. Registering
WebglRendererPlugin adds this world resource and
initializes it as opaque black with { r: 0, g: 0, b: 0, a: 1 }. The
renderer reads the resource before drawing, so changing its color changes
the background used by subsequent WebGL frames.
Examples
import { ClearColor } from '@wimaengine/render-webgl'
// WebglRendererPlugin must be registered so the resource exists.
function setBackground(world) {
const clearColor = world.getResource(ClearColor)
clearColor.set(0.08, 0.12, 0.2, 1)
}Constructor
View source
Methods
staticdefault(): ClearColor
View sourcestaticserialize(value: ClearColor): ColorLike
View sourceConverts a ClearColor into plain serializable color data.
The returned ColorLike object contains the r, g, b, and a
channels without changing the source resource.
Use ClearColor.deserialize to restore the returned
data to a clear-color resource.
staticdeserialize(value: ColorLike, out?: ClearColor): ClearColor
View sourceRestores serialized color channels in a ClearColor resource.
When out is supplied, its r, g, b, and a channels are replaced
and the same resource is returned. When it is omitted, a new
ClearColor is created before its channels are restored.
Use ClearColor.serialize to produce the corresponding
plain color data.
