Skip to main content

Editor.Assets.ClearColorOption

Enum

How a Render Target should be cleared every frame Editor.Assets.RenderTarget.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;

// Create a RenderTarget and configure its clear behavior
const rt = assetManager.createNativeAsset(
'RenderTarget', 'ClearDemo', new Editor.Model.SourcePath(new Editor.Path(''), Editor.Model.SourceRootDirectory.Assets)
) as Editor.Assets.RenderTarget;

// Use a custom solid color to clear the target each frame
rt.clearColorOption = Editor.Assets.ClearColorOption.CustomColor;
rt.clearColor = new vec4(0.2, 0.4, 0.8, 1.0);
console.log(`Clear: CustomColor rgba(${rt.clearColor.x}, ${rt.clearColor.y}, ${rt.clearColor.z}, ${rt.clearColor.w})`);

// Switch to no clearing (preserve previous frame)
rt.clearColorOption = Editor.Assets.ClearColorOption.None;
console.log(`Clear: None (${rt.clearColorOption})`);

Enumeration Members

BackgroundTexture

BackgroundTexture: number

The last texture in the render pipeline will be used.


CustomColor

CustomColor: number

The specified color will be used for every pixel at the beginning of the frame.


CustomTexture

CustomTexture: number

The specified texture will replace the Render Target at the beginning of the frame. For example, the texture might be the Editor.Assets.DeviceCameraTexture.


LegacyClearColorEnable

LegacyClearColorEnable: number

Legacy option for enabling clear color behavior.


None

None: number

The Render Target is not cleared at all.