Version: 2020.3

Texture3D.CreateExternalTexture

切换到手册
public static Texture3D CreateExternalTexture (int width, int height, int depth, TextureFormat format, bool mipChain, IntPtr nativeTex);

参数

nativeTex Native 3D texture object.
width 纹理宽度(以像素为单位)。
height 纹理高度(以像素为单位)。
depth Depth of texture in pixels
format 底层纹理对象的格式。
mipmap 该纹理是否有多级渐进纹理?

描述

基于外部创建的原生纹理对象创建一个 Unity 纹理。

此函数最适用于原生代码插件,这些插件在 Unity 外部创建平台特定的纹理 对象,并且需要在 Unity 场景中使用这些纹理。也可以在 Unity 中创建纹理, 然后获取指向底层平台表示的指针;请参阅 Texture.GetNativeTexturePtr

Parameters passed to CreateExternalTexture should match what the texture actually is; and the underlying texture should be 3D.

Direct3D 类设备上的原生纹理对象是一个指向基本类型的指针,可通过该指针创建纹理:

D3D11: ID3D11ShaderResourceView* or ID3D11Texture3D*
D3D12: ID3D12Texture3D*

OpenGL/OpenGL ES 中为 GLuint

Metal 中为 id<MTLTexture>

另请参阅:UpdateExternalTextureTexture.GetNativeTexturePtr

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961