返回介绍

RenderTexture.RenderTexture 渲染纹理

发布于 2019-12-18 15:38:27 字数 2810 浏览 942 评论 0 收藏 0

JavaScript => public RenderTexture(width: int, height: int, depth: int);
JavaScript => public RenderTexture(width: int, height: int, depth: int, format: RenderTextureFormat);
JavaScript => public RenderTexture(width: int, height: int, depth: int, format: RenderTextureFormat, readWrite: RenderTextureReadWrite);
C# => public RenderTexture(int width, int height, int depth);
C# => public RenderTexture(int width, int height, int depth, RenderTextureFormat format);
C# => public RenderTexture(int width, int height, int depth, RenderTextureFormat format, RenderTextureReadWrite readWrite);

Parameters 参数

widthTexture width in pixels.
heightTexture height in pixels.
depthNumber of bits in depth buffer (0, 16 or 24). Note that only 24 bit depth has stencil buffer.
formatTexture color format.
readWriteHow or if color space conversions should be done on texture read/write.

Description 描述

reates a new RenderTexture object.

创建一个新的渲染纹理对象。

The render texture is created with width by height size, with a depth buffer of depth bits (depth can be 0, 16 or 24), and in format format and with sRGB read / write on or off.

渲染纹理由宽度与高度大小与深度缓冲区的位深度 (深度可以是 0、 16 或 24),并在格式上为format和与 sRGB读 / 写打开或关闭。

Note that constructing a RenderTexture object does not create the hardware representation immediately. The actual render texture is created upon first use or when Create is called manually. So after constructing the render texture, it is possible to set additional variables, like format, isCubemap and so on.

注意渲染纹理对象的构造不是立刻创建硬件代表。首次使用或创建手动调用时,则会创建实际渲染纹理。因此在构造渲染纹理之后,它可能设置额外的变量,像format,isCubemap 等等。

JavaScript:

var rt: RenderTexture;
 
function Start () {
	rt = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32);
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public RenderTexture rt;
    void Start() {
        rt = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32);
    }
}

rendertexture

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文