The GetPixels3D
method retrieves pixel data from a 3D texture within a specified region and mip level. The pixel data is extracted into a destination buffer with a specified format and size.
The GetPixels3D
method retrieves pixel data from a 3D texture within a specified region and mip level. The pixel data is extracted into a destination buffer with a specified format and size.
To use the GetPixels3D
method, you need to specify the region of the 3D texture you want to extract pixels from, the mip level, the destination buffer to store the pixel data, the desired format for the pixel data, and the size of the destination buffer.
The srcBox
parameter defines the region in the 3D texture to extract, specified as a tuple of six integers representing the start and end coordinates in the x, y, and z dimensions.
The mip
parameter specifies the mip level of the texture from which to extract the pixels.
The dstData
parameter is a span that will hold the extracted pixel data.
The dstFormat
parameter specifies the format in which the pixel data should be stored in the destination buffer.
The dstSize
parameter is a tuple of three integers representing the width, height, and depth of the destination buffer.
// Example usage of GetPixels3D var texture = new Texture(); var srcBox = (0, 0, 0, 10, 10, 10); // Define the region in the 3D texture int mipLevel = 0; // Specify the mip level Span<byte> destinationBuffer = new byte[1000]; // Allocate a buffer for the pixel data ImageFormat destinationFormat = ImageFormat.RGBA32; // Specify the desired format var destinationSize = (10, 10, 10); // Define the size of the destination buffer texture.GetPixels3D(srcBox, mipLevel, destinationBuffer, destinationFormat, destinationSize);