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

32 lines
752 B
Markdown
Raw Normal View History

# RHICommandList::ClearRenderTarget
```cpp
virtual void ClearRenderTarget(void* renderTarget, const float color[4]) = 0;
```
2026-03-20 02:35:45 +08:00
清除指定的渲染目标视图。用给定的颜色值填充整个渲染目标。
**参数:**
2026-03-20 02:35:45 +08:00
- `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) - 返回类总览
2026-03-20 02:35:45 +08:00
- [Clear](clear.md) - 清除多个渲染目标
- [SetRenderTargets](set-render-targets.md) - 设置渲染目标