The GetPixels3D
method retrieves a block of pixel data from a 3D texture. This method is useful for extracting a specific region of a 3D texture at a given mipmap level and converting it into a specified format.
The GetPixels3D
method retrieves a block of pixel data from a 3D texture. This method is useful for extracting a specific region of a 3D texture at a given mipmap level and converting it into a specified format.
To use the GetPixels3D
method, you need to specify the source box, mipmap level, destination data span, destination format, and destination size. The method will fill the provided span with the pixel data from the specified region of the texture.
Parameters:
srcBox
: A tuple representing the 3D region to extract from the texture, defined by six integers (x, y, z, width, height, depth).mip
: The mipmap level to retrieve the pixel data from.dstData
: A span of type T
where the extracted pixel data will be stored.dstFormat
: The format in which the pixel data should be stored in dstData
.dstSize
: A tuple representing the size of the destination data (width, height, depth).// Example usage of GetPixels3D var texture = new Texture(); var srcBox = (0, 0, 0, 10, 10, 10); // Define the source box int mipLevel = 0; // Mipmap level Span<byte> destinationData = new Span<byte>(new byte[1000]); // Destination data buffer ImageFormat destinationFormat = ImageFormat.RGBA32; // Destination format var destinationSize = (10, 10, 10); // Destination size texture.GetPixels3D(srcBox, mipLevel, destinationData, destinationFormat, destinationSize);