Module texture

Module texture 

Source
Expand description

Texture processing module

This module provides comprehensive texture processing capabilities for Unity assets, organized following UnityPy and unity-rs best practices.

§Architecture

The module is organized into several sub-modules:

  • formats - Texture format definitions and metadata
  • types - Core data structures (Texture2D, etc.)
  • converter - Main conversion logic from Unity objects
  • decoders - Specialized decoders for different format categories
  • helpers - Utility functions for export and data manipulation

§Examples

use unity_asset_decode::texture::{TextureFormat, Texture2DConverter, TextureDecoder};
use unity_asset_decode::unity_version::UnityVersion;

// Create a converter
let converter = Texture2DConverter::new(UnityVersion::default());

// Convert Unity object to Texture2D (assuming you have a UnityObject)
// let texture = converter.from_unity_object(&unity_object)?;

// Create a decoder and decode to image
let decoder = TextureDecoder::new();
// let image = decoder.decode(&texture)?;

// Export the image
// TextureExporter::export_png(&image, "output.png")?;

Re-exports§

pub use converter::Texture2DConverter;
pub use converter::Texture2DProcessor;
pub use decoders::Decoder;
pub use decoders::TextureDecoder;
pub use formats::TextureFormat;
pub use formats::TextureFormatInfo;
pub use helpers::TextureExporter;
pub use helpers::TextureSwizzler;
pub use types::GLTextureSettings;
pub use types::StreamingInfo;
pub use types::Texture2D;
pub use decoders::BasicDecoder;
pub use decoders::CompressedDecoder;
pub use decoders::CrunchDecoder;
pub use decoders::MobileDecoder;
pub use helpers::export::ExportOptions;

Modules§

converter
Texture2D converter and processor
decoders
Texture decoders module
formats
Texture format definitions
helpers
Texture helper utilities
types
Texture data structures

Structs§

TextureProcessor
Main texture processing facade

Functions§

create_processor
Convenience functions for common operations Create a texture processor with default settings
decode_texture_data
Quick function to decode texture data
export_image
Quick function to export image with automatic format detection
get_supported_formats
Get all supported texture formats
is_format_supported
Quick function to check if a format is supported