[][src]Crate nvtt_rs

Nvtt

nvtt is a library for converting textures into common compressed formats for use with graphics APIs. See the wiki for more info.

Example

use nvtt_rs::{Compressor, CompressionOptions, Format, InputOptions, OutputOptions};

let input_options = InputOptions::new()?;

let mut output_options = OutputOptions::new()?;
output_options.set_output_location("output.dds");

let mut compression_opts = CompressionOptions::new()?;
compression_opts.set_format(Format::Dxt1);

let mut compressor = Compressor::new()?;
compressor.compress(&compression_opts, &input_options, &output_options)?;

Features

nvtt_image_integration

This feature provides the convenience method InputOptions::set_image, which can be used to configure the InputOptions directly from types provided by the image crate.

Only a limited number of image formats are supported, although this library can provide automatic conversions from a DynamicImage. See the ValidImage type for more information.

serde-serialize

This feature provides serde impls for simple enum and struct types. It is not possible to serialize a Compressor, CompressionOptions, InputOptions or OutputOptions.

Dependencies

Linux/macOS

This crate requires a valid cmake installation and a C++ compiler to build.

Windows

This crate requires a valid installation of Visual Studio.

Notes

This crate does not currently work on Microsoft Windows due to incomplete work on the build system.

Structs

CompressionOptions

Object which stores the compression options for the texture. This provides a safer interface for the NvttCompressionOptions type.

Compressor

The Compressor is used to perform the texture compression. This provides a safer interface for the NvttCompressor type.

EnumConvertError

An error type which may be generated when converting a raw enum value into a rust native enum using the TryFrom trait.

InputOptions

Object which stores the input options for the texture. This provides a safer interface for the NvttInputOptions type.

KaiserParameters

Parameters used to customise the kaiser filter used for mipmapping.

NormalMapFilter
OutputOptions

Object which stores the output options for the texture. This provides a safer interface for the NvttOutputOptions type.

Enums

AlphaMode

Specifies how the alpha should be interpreted on the image.

CompressionOutput

Communicates the output of a compressed texture.

Container

The container format used to store the texture data.

Error

An error which may occur during compression.

Format

Specify the output format.

InputFormat

Specify the color format of the input image.

MipmapFilter

Specify which type of filter used to calculate mipmaps.

OutputLocation

This enum is used to define the output location of the compressed texture data.

PathConvertError

An error type for when a path could not be converted.

Quality

Specify the quality level of the compression output.

RoundMode

Controls how the image edge length is rounded when the image is compressed.

TextureLayout

Describes the layout of the input texture data.

TextureType

The type of the texture.

ValidImage

An enumeration of the valid image buffer types which can be used with nvtt.

WrapMode

Specify how the image should wrap if image boundaries are modified.

Functions

version

Get the version of the linked nvtt library.