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

32 lines
752 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::ClearRenderTarget
```cpp
virtual void ClearRenderTarget(void* renderTarget, const float color[4]) = 0;
```
清除指定的渲染目标视图。用给定的颜色值填充整个渲染目标。
**参数:**
- `renderTarget` - 渲染目标视图指针
- `color` - 4 元素浮点数数组,表示 RGBA 清除颜色(范围 0.0-1.0
**返回:** `void`
**异常:**
**线程安全:**
**复杂度:** O(1)
**示例:**
```cpp
float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
cmdList->ClearRenderTarget(renderTarget, color);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览
- [Clear](clear.md) - 清除多个渲染目标
- [SetRenderTargets](set-render-targets.md) - 设置渲染目标