Files
XCEngine/docs/api/rhi/command-list/clear.md

34 lines
891 B
Markdown
Raw Normal View History

# RHICommandList::Clear
```cpp
virtual void Clear(float r, float g, float b, float a, uint32_t buffers) = 0;
```
2026-03-20 02:35:45 +08:00
清除多个渲染目标。可同时清除颜色、深度和模板缓冲区。
**参数:**
2026-03-20 02:35:45 +08:00
- `r` - 清除颜色红色分量(范围 0.0-1.0
- `g` - 清除颜色绿色分量(范围 0.0-1.0
- `b` - 清除颜色蓝色分量(范围 0.0-1.0
- `a` - 清除颜色 Alpha 分量(范围 0.0-1.0
- `buffers` - 要清除的缓冲区标志位ClearFlags 枚举组合)
2026-03-20 02:35:45 +08:00
**返回:** `void`
**异常:** 无
**线程安全:** ❌
**复杂度:** O(n)
**示例:**
```cpp
cmdList->Clear(0.0f, 0.0f, 0.0f, 1.0f, 0x1); // 清除颜色缓冲
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览
2026-03-20 02:35:45 +08:00
- [ClearRenderTarget](clear-render-target.md) - 清除渲染目标
- [ClearDepthStencil](clear-depth-stencil.md) - 清除深度模板