Files
XCEngine/docs/api/rhi/command-list/clear.md
2026-03-20 02:35:45 +08:00

34 lines
891 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RHICommandList::Clear
```cpp
virtual void Clear(float r, float g, float b, float a, uint32_t buffers) = 0;
```
清除多个渲染目标。可同时清除颜色、深度和模板缓冲区。
**参数:**
- `r` - 清除颜色红色分量(范围 0.0-1.0
- `g` - 清除颜色绿色分量(范围 0.0-1.0
- `b` - 清除颜色蓝色分量(范围 0.0-1.0
- `a` - 清除颜色 Alpha 分量(范围 0.0-1.0
- `buffers` - 要清除的缓冲区标志位ClearFlags 枚举组合)
**返回:** `void`
**异常:**
**线程安全:**
**复杂度:** O(n)
**示例:**
```cpp
cmdList->Clear(0.0f, 0.0f, 0.0f, 1.0f, 0x1); // 清除颜色缓冲
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览
- [ClearRenderTarget](clear-render-target.md) - 清除渲染目标
- [ClearDepthStencil](clear-depth-stencil.md) - 清除深度模板