Class MutableRuntimeReferenceImageLibrary
A reference image library that can be constructed and modified at runtime.
Implements
Inherited Members
Namespace: UnityEngine .XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public abstract class MutableRuntimeReferenceImageLibrary : RuntimeReferenceImageLibrary, IReferenceImageLibrary
Remarks
This differs from an XRReference
Important
Implementors: XRImagetrue
to provide the functionality
to support runtime mutable libraries.
This is not something consumers of the Unity
Properties
supportedTextureFormatCount
The number of texture formats that are supported for image addition.
Declaration
public abstract int supportedTextureFormatCount { get; }
Property Value
Type | Description |
---|---|
int |
See Also
supportsValidation
(Read Only) True
if this Mutable
Declaration
public virtual bool supportsValidation { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Important
Implementors: If this is true
, then your implementation must also override:
See Also
Methods
CreateAddJobState(IntPtr, JobHandle)
Derived classes should call this to create an Add
Declaration
protected AddReferenceImageJobState CreateAddJobState(IntPtr handle, JobHandle jobHandle)
Parameters
Type | Name | Description |
---|---|---|
Int |
handle | A handle to the job state. This should be unique to this job state. |
Job |
jobHandle | The Job |
Returns
Type | Description |
---|---|
Add |
Returns a new Add |
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if supports |
See Also
GetAddReferenceImageJobStatus(AddReferenceImageJobState)
Get the status of an Add
Declaration
protected virtual AddReferenceImageJobStatus GetAddReferenceImageJobStatus(AddReferenceImageJobState state)
Parameters
Type | Name | Description |
---|---|---|
Add |
state | The state whose status should be retrieved. |
Returns
Type | Description |
---|---|
Add |
Returns the Add |
Remarks
Important
Implementors: If supportstrue
, then you must also implement this method.
Exceptions
Type | Condition |
---|---|
Not |
Thrown if the |
See Also
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 Mutablestruct
, so no garbage is generated.
Declaration
public MutableRuntimeReferenceImageLibrary.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
Mutable |
An enumerator that can be used in a |
See Also
GetSupportedTextureFormatAt(int)
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 |
---|---|---|
int | index | The index of the format to retrieve. |
Returns
Type | Description |
---|---|
Texture |
The supported format at |
See Also
GetSupportedTextureFormatAtImpl(int)
Derived methods should return the Textureindex
.
index
has already been validated to be within [0..supported
Declaration
protected abstract TextureFormat GetSupportedTextureFormatAtImpl(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the format to retrieve. |
Returns
Type | Description |
---|---|
Texture |
The supported format at |
See Also
IsTextureFormatSupported(TextureFormat)
Determines whether the given format
is supported.
Declaration
public bool IsTextureFormatSupported(TextureFormat format)
Parameters
Type | Name | Description |
---|---|---|
Texture |
format | The Texture |
Returns
Type | Description |
---|---|
bool |
|
See Also
ScheduleAddImageJobImpl(NativeSlice<byte>, Vector2Int, TextureFormat, XRReferenceImage, JobHandle)
This method should schedule a Unity Job which adds an image to this reference image library.
Declaration
protected abstract JobHandle ScheduleAddImageJobImpl(NativeSlice<byte> imageBytes, Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps)
Parameters
Type | Name | Description |
---|---|---|
Native |
imageBytes | The raw image bytes in |
Vector2Int | sizeInPixels | The width and height of the image, in pixels. |
Texture |
format | The format of |
XRReference |
referenceImage | The XRReference |
Job |
inputDeps | Input dependencies for the add image job. |
Returns
Type | Description |
---|---|
Job |
A Job |
See Also
ScheduleAddImageWithValidationJob(NativeSlice<byte>, Vector2Int, TextureFormat, XRReferenceImage, JobHandle)
Asynchronously adds an image to this library.
Declaration
public AddReferenceImageJobState ScheduleAddImageWithValidationJob(NativeSlice<byte> imageBytes, Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps = default)
Parameters
Type | Name | Description |
---|---|---|
Native |
imageBytes | The raw image bytes in |
Vector2Int | sizeInPixels | The width and height of the image, in pixels. |
Texture |
format | The format of |
XRReference |
referenceImage | The XRReference |
Job |
inputDeps | (Optional) Input dependencies for the add image job. |
Returns
Type | Description |
---|---|
Add |
Returns an Add |
Remarks
Image addition can take some time (for example, several frames) due to the processing that must occur to
insert the image into the library. This is done using the [Unity Job System]
(https://docs.unity3d.com/Manual/JobSystem.html). The returned Add
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 ScheduleJobHandle
as the input dependency to the next
Schedule
The imageBytes
must be valid until this job completes. The caller is responsible for
managing its memory. You can use the resulting JobHandle
to schedule a job that deallocates the
imageBytes
.
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if |
Argument |
|
Argument |
Thrown if |
Argument |
Thrown if |
Invalid |
Thrown if the |
Argument |
Thrown if |
See Also
ScheduleAddImageWithValidationJobImpl(NativeSlice<byte>, Vector2Int, TextureFormat, XRReferenceImage, JobHandle)
This method should schedule a Unity Job which adds an image to this reference image library.
Declaration
protected virtual AddReferenceImageJobState ScheduleAddImageWithValidationJobImpl(NativeSlice<byte> imageBytes, Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps)
Parameters
Type | Name | Description |
---|---|---|
Native |
imageBytes | The raw image bytes in |
Vector2Int | sizeInPixels | The width and height of the image, in pixels. |
Texture |
format | The format of |
XRReference |
referenceImage | The XRReference |
Job |
inputDeps | A Job |
Returns
Type | Description |
---|---|
Add |
Returns an Add |
Exceptions
Type | Condition |
---|---|
Not |
Thrown by this base class implementation. If
supports |