Struct XRTextureDescriptor
Contains a native texture object and includes various metadata about the texture.
Implements
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public struct XRTextureDescriptor : IEquatable<XRTextureDescriptor>
Constructors
XRTextureDescriptor(IntPtr, int, int, int, TextureFormat, int, int, TextureDimension)
Creates a XRTextureDescriptor.
Declaration
[Obsolete("This constructor has been deprecated and replaced with a new constructor in AR Foundation 6.1.")]
public XRTextureDescriptor(IntPtr nativeTexture, int width, int height, int mipmapCount, TextureFormat format, int propertyNameId, int depth, TextureDimension dimension)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | nativeTexture | Pointer to the native texture. |
int | width | Width of the native texture. |
int | height | Height of the native texture. |
int | mipmapCount | Number of mipmaps in the native texture. |
TextureFormat | format | Format of the native texture. |
int | propertyNameId | The unique shader property name ID for the material shader texture. |
int | depth | Depth dimension of the native texture. Should be one for all except 3D textures. |
TextureDimension | dimension | Texture dimension of the native texture object. |
XRTextureDescriptor(IntPtr, int, int, int, TextureFormat, int, int, XRTextureType)
Creates a XRTextureDescriptor.
Declaration
public XRTextureDescriptor(IntPtr nativeTexture, int width, int height, int mipmapCount, TextureFormat format, int propertyNameId, int depth, XRTextureType textureType)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | nativeTexture | Pointer to the native texture. |
int | width | Width of the native texture. |
int | height | Height of the native texture. |
int | mipmapCount | Number of mipmaps in the native texture. |
TextureFormat | format | Format of the native texture. |
int | propertyNameId | The unique shader property name ID for the material shader texture. |
int | depth | Depth dimension of the native texture. Should be one for all except 3D textures. |
XRTextureType | textureType | Whether the native texture object is a texture2D, cubemap, render texture, etc. |
Properties
depth
This specifies the depth dimension of the native texture. For a 3D texture, depth is greater than zero. For any other kind of valid texture, depth is one.
Declaration
public int depth { get; }
Property Value
Type | Description |
---|---|
int | The depth dimension of the native texture object. |
dimension
Get the dimension of the native texture object.
Declaration
[Obsolete("dimension has been deprecated in AR Foundation version 6.1. Use textureType instead.")]
public TextureDimension dimension { get; }
Property Value
Type | Description |
---|---|
TextureDimension | The texture dimension of the native texture object. |
format
Specifies the texture format of the native texture object.
Declaration
public TextureFormat format { get; }
Property Value
Type | Description |
---|---|
TextureFormat | The format of the native texture object. |
height
Specifies the height dimension of the native texture object.
Declaration
public int height { get; }
Property Value
Type | Description |
---|---|
int | The height of the native texture object. |
mipmapCount
Specifies the number of mipmap levels in the native texture object.
Declaration
public int mipmapCount { get; }
Property Value
Type | Description |
---|---|
int | The number of mipmap levels in the native texture object. |
nativeTexture
A pointer to the native texture object.
Declaration
public IntPtr nativeTexture { get; }
Property Value
Type | Description |
---|---|
IntPtr | A pointer to the native texture object. |
propertyNameId
Specifies the unique shader property name ID for the material shader texture.
Declaration
public int propertyNameId { get; }
Property Value
Type | Description |
---|---|
int | The unique shader property name ID for the material shader texture. |
Remarks
Use the static method Shader.PropertyToID(string name)
to get the unique identifier.
textureType
Get the texture type.
Declaration
public XRTextureType textureType { get; }
Property Value
Type | Description |
---|---|
XRTextureType | The texture type. |
Remarks
This property can use data from the deprecated dimension property as a fallback mechanism
for backwards compatibility if the m_TextureType
field is uninitialized.
valid
Determines whether the texture data references a valid texture object with positive width and height.
Declaration
public bool valid { get; }
Property Value
Type | Description |
---|---|
bool | true if the texture data references a valid texture object with positive width and height. Otherwise, false. |
width
Specifies the width dimension of the native texture object.
Declaration
public int width { get; }
Property Value
Type | Description |
---|---|
int | The width of the native texture object. |
Methods
Equals(object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare against. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
Equals(XRTextureDescriptor)
Tests for equality.
Declaration
public bool Equals(XRTextureDescriptor other)
Parameters
Type | Name | Description |
---|---|---|
XRTextureDescriptor | other | The other texture descriptor to compare against. |
Returns
Type | Description |
---|---|
bool | true if every field in |
GetHashCode()
Generates a hash suitable for use with containers like HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code generated from this object's fields. |
Overrides
Reset()
Reset the texture descriptor back to default values.
Declaration
public void Reset()
ToString()
Generates a string suitable for debugging purposes.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string suitable for debug logging. |
Overrides
hasIdenticalTextureMetadata(XRTextureDescriptor)
Determines whether the given texture descriptor has identical texture metadata (dimension, mipmap count, and format).
Declaration
public bool hasIdenticalTextureMetadata(XRTextureDescriptor other)
Parameters
Type | Name | Description |
---|---|---|
XRTextureDescriptor | other | The given texture descriptor with which to compare. |
Returns
Type | Description |
---|---|
bool | true if the texture metadata (dimension, mipmap count, and format) are identical between the current and other texture descriptors. Otherwise, false. |
Operators
operator ==(XRTextureDescriptor, XRTextureDescriptor)
Tests for equality. Equivalent to Equals(XRTextureDescriptor).
Declaration
public static bool operator ==(XRTextureDescriptor lhs, XRTextureDescriptor rhs)
Parameters
Type | Name | Description |
---|---|---|
XRTextureDescriptor | lhs | The left-hand side of the comparison. |
XRTextureDescriptor | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool |
operator !=(XRTextureDescriptor, XRTextureDescriptor)
Tests for inequality. Equivalent to !
Equals(XRTextureDescriptor).
Declaration
public static bool operator !=(XRTextureDescriptor lhs, XRTextureDescriptor rhs)
Parameters
Type | Name | Description |
---|---|---|
XRTextureDescriptor | lhs | The left-hand side of the comparison. |
XRTextureDescriptor | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool |