base texture transform

This commit is contained in:
Robin Appelman 2023-12-22 18:19:01 +01:00
commit 3172da6abc
3 changed files with 15 additions and 3 deletions

2
Cargo.lock generated
View file

@ -627,7 +627,7 @@ dependencies = [
[[package]] [[package]]
name = "vmt-parser" name = "vmt-parser"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"insta", "insta",
"miette", "miette",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "vmt-parser" name = "vmt-parser"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
description = "Rust parser for valve vmt files." description = "Rust parser for valve vmt files."
license = "MIT" license = "MIT"
@ -18,4 +18,4 @@ serde_repr = "0.1.17"
test-case = "3.3.1" test-case = "3.3.1"
insta = { version = "1.34.0", features = ["ron"] } insta = { version = "1.34.0", features = ["ron"] }
miette = { version = "5.10.0", features = ["fancy"] } miette = { version = "5.10.0", features = ["fancy"] }
walkdir = "2.4.0" walkdir = "2.4.0"

View file

@ -14,6 +14,7 @@ mod vertexlitgeneric;
mod water; mod water;
mod worldvertextransition; mod worldvertextransition;
use crate::TextureTransform;
pub use cable::CableMaterial; pub use cable::CableMaterial;
pub use eyerefract::EyeRefractMaterial; pub use eyerefract::EyeRefractMaterial;
pub use lightmappedgeneric::LightMappedGenericMaterial; pub use lightmappedgeneric::LightMappedGenericMaterial;
@ -132,6 +133,17 @@ impl Material {
} }
} }
pub fn base_texture_transform(&self) -> Option<&TextureTransform> {
match self {
Material::LightMappedGeneric(mat) => Some(&mat.base_texture_transform),
Material::VertexLitGeneric(mat) => Some(&mat.base_texture_transform),
Material::VertexLitGenericDx6(mat) => Some(&mat.base_texture_transform),
Material::UnlitTwoTexture(mat) => Some(&mat.base_texture_transform),
Material::WorldVertexTransition(mat) => Some(&mat.base_texture_transform),
_ => None,
}
}
pub fn bump_map(&self) -> Option<&str> { pub fn bump_map(&self) -> Option<&str> {
match self { match self {
Material::LightMappedGeneric(mat) => mat.bump_map.as_deref(), Material::LightMappedGeneric(mat) => mat.bump_map.as_deref(),