Class MutableRuntimeReferenceImageLibrary
A reference image library that can be constructed and modified at runtime. By contrast, an XRReferenceImageLibrary can only be constructed at edit-time and is immutable at runtime.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public abstract class MutableRuntimeReferenceImageLibrary : RuntimeReferenceImageLibrary, IReferenceImageLibrary
Remarks
Subsystem providers must implement this class for their provider if
supportsMutableLibrary
is true
to provide the functionality to support runtime mutable libraries.
This is not something consumers of the ARSubsystems package should implement.
Properties
supportedTextureFormatCount
The number of texture formats that are supported for image addition.
Declaration
public abstract int supportedTextureFormatCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
GetEnumerator()
Gets an enumerator for this collection of reference images. This allows this image library to act as a collection in a foreach
statement.
The MutableRuntimeReferenceImageLibrary.Enumerator is a struct
, so no garbage is generated.
Declaration
public MutableRuntimeReferenceImageLibrary.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
MutableRuntimeReferenceImageLibrary.Enumerator | An enumerator that can be used in a |
GetSupportedTextureFormatAt(Int32)
Returns the supported texture format at index
. Useful for enumerating the supported texture formats for image addition.
Declaration
public TextureFormat GetSupportedTextureFormatAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the format to retrieve. |
Returns
Type | Description |
---|---|
TextureFormat | The supported format at |
GetSupportedTextureFormatAtImpl(Int32)
Derived methods should return the TextureFormat at the given index
.
index
has already been validated to be within [0..supportedTextureFormatCount).
Declaration
protected abstract TextureFormat GetSupportedTextureFormatAtImpl(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the format to retrieve. |
Returns
Type | Description |
---|---|
TextureFormat | The supported format at |
IsTextureFormatSupported(TextureFormat)
Determines whether the given format
is supported.
Declaration
public bool IsTextureFormatSupported(TextureFormat format)
Parameters
Type | Name | Description |
---|---|---|
TextureFormat | format | The TextureFormat to test. |
Returns
Type | Description |
---|---|
Boolean |
|
ScheduleAddImageJob(NativeSlice<Byte>, Vector2Int, TextureFormat, XRReferenceImage, JobHandle)
Asynchronously adds an image to this library.
Declaration
public JobHandle ScheduleAddImageJob(NativeSlice<byte> imageBytes, Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps = null)
Parameters
Type | Name | Description |
---|---|---|
NativeSlice<Byte> | imageBytes | The raw image bytes in |
Vector2Int | sizeInPixels | The width and height of the image, in pixels. |
TextureFormat | format | The format of |
XRReferenceImage | referenceImage | The XRReferenceImage data associated with the image to add to the library.
This includes information like physical dimensions, associated |
JobHandle | inputDeps | (Optional) input dependencies for the add image job. |
Returns
Type | Description |
---|---|
JobHandle | A JobHandle which can be used to chain together multiple tasks or to query for completion. May be safely discarded. |
Remarks
Image addition can take some time (several frames) due to extra processing that must occur to insert the image into the library. This is done using the Unity Job System. The returned JobHandle can be used to chain together multiple tasks or to query for completion, but may be safely discarded if you do not need it.
This job, like all Unity jobs, can have dependencies (using the inputDeps
). This can be useful,
for example, if imageBytes
is the output of another job. If you are adding multiple
images to the library, it is not necessary to pass a previous ScheduleAddImageJob
JobHandle as the input
dependency to the next ScheduleAddImageJob
; they can be processed concurrently.
The imageBytes
must be valid until this job completes. The caller is responsible for managing its memory.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
ArgumentException | Thrown if |
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
InvalidOperationException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
ScheduleAddImageJobImpl(NativeSlice<Byte>, Vector2Int, TextureFormat, XRReferenceImage, JobHandle)
Declaration
protected abstract JobHandle ScheduleAddImageJobImpl(NativeSlice<byte> imageBytes, Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps)
Parameters
Type | Name | Description |
---|---|---|
NativeSlice<Byte> | imageBytes | |
Vector2Int | sizeInPixels | |
TextureFormat | format | |
XRReferenceImage | referenceImage | |
JobHandle | inputDeps |
Returns
Type | Description |
---|---|
JobHandle |