Crate nutexb

source ·
Expand description

§nutexb

Nutexb is an image texture format used in Super Smash Bros Ultimate and some other games. The extension “.nutexb” may stand for “Namco Universal Texture Binary”.

Image data is stored in a contiguous region of memory with metadata stored in the layer_mipmaps and footer. The supported image formats in NutexbFormat use standard compressed and uncompressed formats used for DDS files. The arrays and mipmaps for the image data are stored in a memory layout optimized for the Tegra X1 in a process known as swizzling. This library provides tools for reading and writing nutexb files as well as working with the swizzled image data.

§Reading

Read a NutexbFile with NutexbFile::read or NutexbFile::read_from_file. The image data needs to be deswizzled first with NutexbFile::deswizzled_data to use with applications that expect a standard row-major memory layout.

use nutexb::NutexbFile;

let nutexb = NutexbFile::read_from_file("col_001.nutexb")?;
let surface_data = nutexb.deswizzled_data();

§Writing

The easiest way to create a NutexbFile is by calling NutexbFile::from_dds and NutexbFile::from_image when using the "ddsfile" and "image" features, respectively. For manually specifying the surface dimensions and data, use NutexbFile::from_surface.

use nutexb::NutexbFile;

let image = image::open("col_001.png")?;

let nutexb = NutexbFile::from_image(&image.to_rgba8(), "col_001")?;
nutexb.write_to_file("col_001.nutexb")?;
use nutexb::NutexbFile;

let mut reader = std::io::BufReader::new(std::fs::File::open("cube.dds")?);
let dds = ddsfile::Dds::read(&mut reader)?;

let nutexb = NutexbFile::from_dds(&dds, "cube")?;
nutexb.write_to_file("col_001.nutexb")?;

Re-exports§

Structs§

  • The mipmap sizes for each array layer.
  • The data stored in a nutexb file like "def_001_col.nutexb".
  • Information about the image data.
  • A surface describing a contiguous chunk of image data for the array layers and mipmaps used to create a NutexbFile.

Enums§