Version: 2021.3
言語: 日本語
public static Texture2D CreateExternalTexture (int width, int height, TextureFormat format, bool mipChain, bool linear, IntPtr nativeTex);

パラメーター

nativeTex ネイティブの 2D テクスチャオブジェクト
width ピクセル単位でのテクスチャの幅
height ピクセル単位でのテクスチャの高さ
format 下地となるテクスチャオブジェクトの形式
mipmap テクスチャにミップマップがあるかどうか
linear テクスチャがリニアカラー空間を使用しているかどうか

説明

Creates a Unity Texture out of an externally created native texture object.

This function is mostly useful for native code plugins that create platform specific texture objects outside of Unity, and need to use these textures in Unity Scenes. It is also possible to create a texture in Unity and get a pointer to the underlying platform representation; see Texture.GetNativeTexturePtr.

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

For Direct3D-like devices, the nativeTex parameter is a pointer to the underlying Direct3D base type, from which a texture can be created. They can be:

D3D11: ID3D11ShaderResourceView* or ID3D11Texture2D*
D3D12: ID3D12Texture2D*

For OpenGL/OpenGL ES, the nativeTex parameter is a GLuint.

For Metal, the nativeTex parameter is an id<MTLTexture>.

For Vulkan, the nativeTex parameter is a VkImage*.

See Also: UpdateExternalTexture, Texture.GetNativeTexturePtr.

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