Astra Unity 2.6.6
Astra Unity Plugin
Astra.Asset.TextureManager Class Reference

This is a texture class that handles loading and manipulating textures It is higher level then the TextureUtilities and is async More...

Static Public Member Functions

static void OnTick (MonoBehaviour ctx, float deltaTime)
 Fire this from your update interval via StartCoroutine() More...
 
static TextureJob GetTexture2D (TextureRequest request)
 A generic way to convert from any format to any other (within reason) See TextureRequest's options for the many choices/bits/pieces you can set/toggle You must have a srcXYZ variable set and the output will live in dstTexture2D More...
 
static TextureJob GetTexture2D (PrimitiveTexture pt)
 Efficiently converts a PrimitiveTexture to a Texture2D while minimally blocking main thread More...
 
static TextureJob GetReadable (TextureRequest request)
 Yields a new texture that is readable on the cpu side, as in you can call GetPixels on it NOTE: this is not as efficient as simply getting the data out w/o it being in this format see nativeBuffer More...
 

Static Protected Member Functions

static IEnumerator SendToGPU ()
 Fired as a coroutine ensuring a Texture2D.Apply is called at the end of the frame, avoiding pipeline stalls More...
 
static void EnqueueGPUSend (TextureRequest request)
 Used internally to queue up a Texture2D.Apply call for end of frame, job self completes if in the request More...
 
static TextureJob LoadTexture2D (TextureRequest request)
 Our job here is not to resize/scale/etc, but to just simply create a Texture2D from the PrimitiveTexture there is no processing being done here More...
 
static void SubmitReadRequest (TextureRequest request)
 Submits a readback request against the gpu, this is an async operation and will avoid blocking main thread as much as possible based on your priority in the request More...
 
static void ProcessRequestSendToGPU (TextureRequest request)
 

Detailed Description

This is a texture class that handles loading and manipulating textures It is higher level then the TextureUtilities and is async

NOTE: using this will typically increase the time spent before you get a texture, but it reduces the stalls and frame drops from immediate lookups

Member Function Documentation

◆ EnqueueGPUSend()

static void Astra.Asset.TextureManager.EnqueueGPUSend ( TextureRequest  request)
inlinestaticprotected

Used internally to queue up a Texture2D.Apply call for end of frame, job self completes if in the request

Parameters
request

◆ GetReadable()

static TextureJob Astra.Asset.TextureManager.GetReadable ( TextureRequest  request)
inlinestatic

Yields a new texture that is readable on the cpu side, as in you can call GetPixels on it NOTE: this is not as efficient as simply getting the data out w/o it being in this format see nativeBuffer

Parameters
texture
Returns

◆ GetTexture2D() [1/2]

static TextureJob Astra.Asset.TextureManager.GetTexture2D ( PrimitiveTexture  pt)
inlinestatic

Efficiently converts a PrimitiveTexture to a Texture2D while minimally blocking main thread

Parameters
pt
Returns

◆ GetTexture2D() [2/2]

static TextureJob Astra.Asset.TextureManager.GetTexture2D ( TextureRequest  request)
inlinestatic

A generic way to convert from any format to any other (within reason) See TextureRequest's options for the many choices/bits/pieces you can set/toggle You must have a srcXYZ variable set and the output will live in dstTexture2D

Parameters
request
Returns

◆ LoadTexture2D()

static TextureJob Astra.Asset.TextureManager.LoadTexture2D ( TextureRequest  request)
inlinestaticprotected

Our job here is not to resize/scale/etc, but to just simply create a Texture2D from the PrimitiveTexture there is no processing being done here

Parameters
request
Returns

◆ OnTick()

static void Astra.Asset.TextureManager.OnTick ( MonoBehaviour  ctx,
float  deltaTime 
)
inlinestatic

Fire this from your update interval via StartCoroutine()

Parameters
ctx
deltaTime

◆ SendToGPU()

static IEnumerator Astra.Asset.TextureManager.SendToGPU ( )
inlinestaticprotected

Fired as a coroutine ensuring a Texture2D.Apply is called at the end of the frame, avoiding pipeline stalls

Returns

◆ SubmitReadRequest()

static void Astra.Asset.TextureManager.SubmitReadRequest ( TextureRequest  request)
inlinestaticprotected

Submits a readback request against the gpu, this is an async operation and will avoid blocking main thread as much as possible based on your priority in the request

Parameters
request

The documentation for this class was generated from the following file: