TextureCubeBuilder WithData( System.Byte[] data, int dataLength )

book_4_sparkGenerated
code_blocksInput

Description

The WithData method of the TextureCubeBuilder class allows you to specify the raw byte data for the texture cube being built. This method is part of a fluent interface, enabling you to chain multiple configuration methods together to customize the texture cube before finalizing it with the Finish method.

Usage

To use the WithData method, you need to provide a byte array containing the texture data. This data should be formatted appropriately for a texture cube, typically including data for each face of the cube.

After setting the data, you can continue to configure other properties of the texture cube using additional methods of the TextureCubeBuilder class, and finally call Finish to create the texture.

Example

// Example of using the WithData method
byte[] textureData = LoadTextureData(); // Assume this function loads your texture data

TextureCubeBuilder builder = new TextureCubeBuilder();
Texture textureCube = builder
    .WithData(textureData)
    .WithSize(256, 256) // Example size
    .WithFormat(ImageFormat.RGBA8) // Example format
    .Finish();

// Use the textureCube in your application