BC converter tool

This commit is contained in:
2021-03-11 01:33:58 +01:00
parent 57b3f89817
commit 31cdfa1885
4 changed files with 25 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ name = "rust-engine"
version = "0.1.0"
authors = ["Till <asuro@posteo.de>"]
edition = "2018"
default-run = "rust-engine"
[dependencies]
vulkano-shaders = "0.20"
@@ -19,5 +20,9 @@ gilrs = "0.7.4"
gltf = "0.15.2"
mgf = "1.4.0"
[[bin]]
name = "converter"
path = "build/converter/src/main.rs"
[profile.dev.package."*"]
opt-level = 3

View File

@@ -0,0 +1,20 @@
use gltf::image::Source;
fn main() {
let doc = gltf::Gltf::open("models/box.gltf").unwrap();
for image in doc.images() {
if let Source::Uri { uri, .. } = image.source() {
println!("{}", uri);
let tex_conv_output = std::process::Command::new("build/nvidia-texture-converter/nvtt_export.exe")
.arg("-q").arg("fastest")
.arg("-f").arg("bc1")
.arg("--no-mips")
.arg("-o").arg(format!("textures/{}.dds", image.name().unwrap()))
.arg(uri)
.current_dir("models")
.output().expect("Failed to run texture converter.");
println!("{:?}", tex_conv_output);
}
}
}

Binary file not shown.

Binary file not shown.