CommandBuffer.SetRenderTarget 的参数
时间: 2023-11-28 19:05:51 浏览: 34
`CommandBuffer.SetRenderTarget`方法的参数如下:
```csharp
public void SetRenderTarget(RenderTargetIdentifier rt);
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel);
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace);
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth);
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice);
```
其中,第一个参数`rt`表示要设置的渲染目标,可以是`RenderTexture`对象、`RenderTargetIdentifier`对象或`BuiltinRenderTextureType`枚举值。第二个参数`mipLevel`表示要渲染的mip等级,仅在`rt`为`RenderTexture`对象时有效。第三个参数`cubemapFace`表示要渲染的立方体贴图面,仅在`rt`为立方体贴图时有效。
当使用多个渲染目标时,可以使用第四个参数`colors`指定多个颜色缓冲区,使用第五个参数`depth`指定深度缓冲区。此时,第二个和第三个参数将用于指定每个颜色缓冲区的mip等级和立方体贴图面,第五个参数还可以用于指定深度缓冲区的分片索引。
需要注意的是,`SetRenderTarget`方法必须在`CommandBuffer`对象中调用。在设置完渲染目标后,需要在`CommandBuffer`对象中执行实际的渲染操作。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)