vmt_parser/material/water.rs
1use super::deserialize_path;
2use crate::{default_scale, default_scale3, TextureTransform, Vec3};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct WaterMaterial {
7 /// Usually referred to as a "sludge-layer", acts as a layer on top of the surface of the $AboveWater Material.
8 #[serde(
9 rename = "$basetexture",
10 default,
11 deserialize_with = "deserialize_path"
12 )]
13 pub base_texture: Option<String>,
14 /// Tells this material is used for models and not brushes.
15 #[serde(rename = "$abovewater", default)]
16 pub above_water: bool,
17 /// Required parameter. This is the material (not texture) to use when underneath the water’s surface. The bottom material must have $reflecttexture, $abovewater and $envmap disabled, but can otherwise do whatever it wants.
18 #[serde(
19 rename = "$bottommaterial",
20 default,
21 deserialize_with = "deserialize_path"
22 )]
23 pub bottom_material: Option<String>,
24 /// Applies a refracting screen overlay when the camera is underwater. Generally used with effects\water_warp01. Requires $abovewater to be 0.
25 #[serde(
26 rename = "$underwaterover",
27 default,
28 deserialize_with = "deserialize_path"
29 )]
30 pub underwater_overlay: Option<String>,
31 /// Specifies a texture that will provide three-dimensional lighting information for a material for DX8.
32 #[serde(rename = "$bumpmap", default, deserialize_with = "deserialize_path")]
33 pub bump_map: Option<String>,
34 /// A Du/dv map for DirectX 8 rendering ($bumpmap), and a bump map for DirectX 9 and above ($normalmap).
35 #[serde(rename = "$normalmap", default, deserialize_with = "deserialize_path")]
36 pub normal_map: Option<String>,
37 #[serde(rename = "$dudvframe", default)]
38 pub du_dv_frame: u32,
39 /// Frame to start the animated du/dv map and bump map on, respectively
40 #[serde(rename = "$bumpframe", default)]
41 pub dump_frame: u32,
42 /// Transforms the bump map texture.
43 #[serde(rename = "$bumptransform", default)]
44 pub bump_transform: TextureTransform,
45 /// Tints the results of projected textures on the water. The flashlight mainly affects the brigthness of the fog in the water.
46 #[serde(rename = "$flashlighttint", default = "default_scale")]
47 pub flash_light_tint: f32,
48
49 /// Enable volumetric fog for the water.
50 #[serde(rename = "$fogenable", default)]
51 pub fog_enable: bool,
52 /// Color of the water’s volumetric fog. Generally this value should match the color used in the bottom material.
53 #[serde(rename = "$fogenable", default = "default_scale3")]
54 pub fog_color: Vec3,
55 /// Distance in units/inches from the eye at which water fog starts.
56 #[serde(rename = "$fogstart", default)]
57 pub fog_start: f32,
58 /// Distance in units/inches from the eye at which water fog ends.
59 #[serde(rename = "$fogend", default)]
60 pub fog_end: f32,
61 /// Enable volumetric fog for the water.
62 #[serde(rename = "$lightmapwaterfog", default)]
63 pub light_map_water_fog: bool,
64 // todo: https://developer.valvesoftware.com/wiki/Water_(shader) from reflection onward
65}