#[cfg(feature = "material_system")]
use source_vmt::MaterialSystem;
fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "material_system")]
{
let mut mat_sys = source_vmt::MaterialSystem::<source_fs::providers::DummyVpk>::from_path("examples/pseudo_game/game")?
.with_search_path("game")
.prioritize_vpks(false);
println!("Loading 'materials/wall_mossy.vmt'...");
let raw_vmt = mat_sys.get_material("materials/wall_mossy.vmt")?;
println!("Raw Shader: {}", raw_vmt.shader);
let vmt = mat_sys.get_resolved_material("materials/wall_mossy.vmt")?;
println!("--- Final Resolved VMT ---");
println!("Shader: {}", vmt.shader);
println!("Base Texture: {:?}", vmt.get_string("basetexture"));
println!("Detail: {:?}", vmt.get_string("detail"));
println!("Phong Enabled: {}", vmt.get_bool("phong"));
if let Some(path) = mat_sys.get_material_path("materials/wall_mossy.vmt") {
println!("Material path: {:?}", path);
}
println!("\n--- Serialized Result ---");
println!("{}", vmt.to_string()?);
}
#[cfg(not(feature = "material_system"))]
println!("Please run this example with --features material_system");
Ok(())
}