Class CopyTextureToBuffer
Wrapper for a compute shader that may be used to copy data from a texture into a compute buffer.
Namespace: Holoride.ElasticSDK.Compute
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
[PublicAPI]
public static class CopyTextureToBuffer
Methods
Dispatch(Rect, Texture, ComputeBuffer, int, GrayScaleConversion, float, bool)
Dispatches the compute shader for copying a texture into the specified compute buffer representing a 2D float map. This will use the provided bounds to generate the UV coordinates to sample the texture. Imagine these bounds as a rectangle in 2D world space describing the position and size of the compute buffer with the texture being sampled using world space coordinates.
Declaration
public static void Dispatch(Rect bounds, Texture input, ComputeBuffer output, int outputWidth, CopyTextureToBuffer.GrayScaleConversion channel, float scale = 1, bool sampleInterpolated = true)
Parameters
Type | Name | Description |
---|---|---|
Rect | bounds | The bounds describing the target buffers position and size. |
Texture | input | The texture to sample from. |
ComputeBuffer | output | The compute buffer to write into. |
int | outputWidth | The width of the 2D map represented by the compute buffer. |
CopyTextureToBuffer.GrayScaleConversion | channel | The channel of the texture to sample. |
float | scale | A custom scaling to be used when sampling the texture. |
bool | sampleInterpolated | States whether to sample the texture interpolated. Uses point sampling if false. |
Dispatch(CommandBuffer, Rect, Texture, ComputeBuffer, int, GrayScaleConversion, float, bool)
Dispatches the compute shader for copying a texture into the specified compute buffer representing a 2D float map. This will use the provided bounds to generate the UV coordinates to sample the texture. Imagine these bounds as a rectangle in 2D world space describing the position and size of the compute buffer with the texture being sampled using world space coordinates.
Declaration
public static void Dispatch(CommandBuffer commandBuffer, Rect bounds, Texture input, ComputeBuffer output, int outputWidth, CopyTextureToBuffer.GrayScaleConversion channel, float scale = 1, bool sampleInterpolated = true)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | commandBuffer | The command buffer to run the compute shader in. |
Rect | bounds | The bounds describing the target buffers position and size. |
Texture | input | The texture to sample from. |
ComputeBuffer | output | The compute buffer to write into. |
int | outputWidth | The width of the 2D map represented by the compute buffer. |
CopyTextureToBuffer.GrayScaleConversion | channel | The channel of the texture to sample. |
float | scale | A custom scaling to be used when sampling the texture. |
bool | sampleInterpolated | States whether to sample the texture interpolated. Uses point sampling if false. |
Dispatch(CommandBuffer, Texture, ComputeBuffer, int, GrayScaleConversion, float, bool)
Copies data from a texture into a compute buffer.
Declaration
public static void Dispatch(CommandBuffer commandBuffer, Texture input, ComputeBuffer output, int outputWidth, CopyTextureToBuffer.GrayScaleConversion channel = GrayScaleConversion.R, float scale = 1, bool sampleInterpolated = true)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | commandBuffer | The command buffer to run the compute shader in. |
Texture | input | The texture to sample from. |
ComputeBuffer | output | The compute buffer to write into. |
int | outputWidth | The width of the 2D map represented by the compute buffer. |
CopyTextureToBuffer.GrayScaleConversion | channel | The channel of the texture to sample. |
float | scale | A custom scaling to be used when sampling the texture. |
bool | sampleInterpolated | States whether to sample the texture interpolated. Uses point sampling if false. |
Dispatch(Texture, ComputeBuffer, int, GrayScaleConversion, float, bool)
Copies data from a texture into a compute buffer.
Declaration
public static void Dispatch(Texture input, ComputeBuffer output, int outputWidth, CopyTextureToBuffer.GrayScaleConversion channel = GrayScaleConversion.R, float scale = 1, bool sampleInterpolated = true)
Parameters
Type | Name | Description |
---|---|---|
Texture | input | The texture to sample from. |
ComputeBuffer | output | The compute buffer to write into. |
int | outputWidth | The width of the 2D map represented by the compute buffer. |
CopyTextureToBuffer.GrayScaleConversion | channel | The channel of the texture to sample. |
float | scale | A custom scaling to be used when sampling the texture. |
bool | sampleInterpolated | States whether to sample the texture interpolated. Uses point sampling if false. |
Initialize()
Declaration
public static void Initialize()