underwater doesn't have base texture

This commit is contained in:
Robin Appelman 2023-12-19 18:29:06 +01:00
commit 47e37c5b81
3 changed files with 8 additions and 4 deletions

View file

@ -88,7 +88,7 @@ impl Material {
Material::VertexLitGeneric(mat) => &mat.base_texture,
Material::UnlitGeneric(mat) => &mat.base_texture,
Material::WorldVertexTransition(mat) => &mat.base_texture,
Material::Water(mat) => &mat.base_texture,
Material::Water(mat) => mat.base_texture.as_deref().unwrap_or_default(),
Material::EyeRefract(mat) => &mat.iris,
_ => "",
}

View file

@ -5,8 +5,12 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WaterMaterial {
/// Usually referred to as a "sludge-layer", acts as a layer on top of the surface of the $AboveWater Material.
#[serde(rename = "$basetexture", deserialize_with = "deserialize_path")]
pub base_texture: String,
#[serde(
rename = "$basetexture",
default,
deserialize_with = "deserialize_path"
)]
pub base_texture: Option<String>,
/// Tells this material is used for models and not brushes.
#[serde(rename = "$abovewater", default)]
pub above_water: bool,

View file

@ -3,7 +3,7 @@ source: tests/parse.rs
expression: result
---
water(WaterMaterial(
r#$basetexture: "swamp/water/water_murky",
r#$basetexture: Some("swamp/water/water_murky"),
r#$abovewater: true,
r#$bottommaterial: Some("swamp/water/water_murky_beneath.vmt"),
r#$underwaterover: None,