vmt_parser/material/
worldvertextransition.rs

1use super::deserialize_path;
2use crate::{
3    default_detail_scale, default_scale, default_scale3, BlendMode, TextureTransform, Vec2, Vec3,
4};
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct WorldVertexTransitionMaterial {
9    /// The first texture in the blend.
10    #[serde(rename = "$basetexture", deserialize_with = "deserialize_path")]
11    pub base_texture: String,
12    /// The second texture to blend to.
13    #[serde(rename = "$basetexture2", deserialize_with = "deserialize_path")]
14    pub base_texture2: String,
15    /// Modulate the blending between materials using a special texture.
16    #[serde(
17        rename = "$blendmodulatetexture",
18        default,
19        deserialize_with = "deserialize_path"
20    )]
21    pub blend_modulate_texture: Option<String>,
22    /// Use this material as a decal.
23    #[serde(rename = "$decal", default)]
24    pub decal: bool,
25    /// Detail texturing.
26    #[serde(rename = "$detail", default)]
27    pub detail: Option<String>,
28    /// Links the surface to a set of physical properties.
29    #[serde(rename = "$surfaceprop", default)]
30    pub surface_prop: Option<String>,
31
32    /// Transforms the texture before use in the material. This does not affect lightmaps on the surface.
33    #[serde(rename = "$basetexturetransform", default)]
34    pub base_texture_transform: TextureTransform,
35    /// Independently scales the red, green and blue channels of an albedo.
36    #[serde(rename = "$color", default = "default_scale3")]
37    pub color: Vec3,
38    /// the number of units that each texel covers
39    #[serde(rename = "$decalscale", default = "default_scale")]
40    pub decal_scale: f32,
41    #[serde(rename = "$decalscale", default = "default_detail_scale")]
42    /// Fits the detail texture onto the material the given number of times
43    pub detail_scale: Vec2,
44    /// Controls the amount that the detail texture affects the base texture. The precise use of this depends on the blend factor; in most cases it acts similarly to $alpha. A value of 0 usually makes the detail texture have no effect, whilst a value of 1 applies the full effect.
45    #[serde(rename = "$detailblendfactor", default = "default_scale")]
46    pub detail_blend_factor: f32,
47    /// How to combine the detail material with the albedo.
48    #[serde(rename = "$detailblendmode", default)]
49    pub detail_blend_mode: BlendMode,
50    /// A separate VertexLitGeneric material to that will replace this one if the decal hits a model.
51    #[serde(
52        rename = "$modelmaterial",
53        default,
54        deserialize_with = "deserialize_path"
55    )]
56    pub model_material: Option<String>,
57    /// Disables texture filtering.
58    #[serde(rename = "$pointsamplemagfilter", default)]
59    pub point_sample_mag_filter: bool,
60    /// Mitigation for displacement texture stretching.
61    #[serde(rename = "$seamless_scale", default = "default_scale")]
62    pub seamless_scale: f32,
63
64    /// Scales the opacity of an entire material.
65    #[serde(rename = "$alpha", default = "default_scale")]
66    pub alpha: f32,
67    /// Specifies a mask to use to determine binary opacity.
68    #[serde(rename = "$alphatest", default)]
69    pub alpha_test: bool,
70    /// Specifies a mask to use to determine binary opacity.
71    #[serde(rename = "$alphatestreference", default = "default_scale")]
72    pub alpha_test_reference: f32,
73    /// Vector-like edge filtering.
74    #[serde(rename = "$distancealpha", default)]
75    pub distance_alpha: bool,
76    /// Disables backface culling.
77    #[serde(rename = "$nocull", default)]
78    pub no_cull: bool,
79    /// Specifies that the material should be partially see-through.
80    #[serde(rename = "$translucent", default)]
81    pub translucent: bool,
82
83    /// bumpmap for the first texture.
84    #[serde(rename = "$bumpmap", default, deserialize_with = "deserialize_path")]
85    pub bump_map: Option<String>,
86    /// bumpmap for the second texture.
87    #[serde(rename = "$bumpmap2", default, deserialize_with = "deserialize_path")]
88    pub bump_map2: Option<String>,
89    /// Per-texel color modification via a warp texture.
90    #[serde(
91        rename = "$lightwarptexture",
92        default,
93        deserialize_with = "deserialize_path"
94    )]
95    pub light_wrap_texture: Option<String>,
96    /// Determines whether the surface is self-illuminated independent of environment lighting.
97    #[serde(rename = "$selfillum", default)]
98    pub self_illum: bool,
99    /// Flags the $bumpmap as being a self-shadowing bumpmap.
100    #[serde(rename = "$ssbump", default)]
101    pub ss_bump: bool,
102
103    /// Specular reflections.
104    #[serde(rename = "$envmap", default, deserialize_with = "deserialize_path")]
105    pub env_map: Option<String>,
106    /// Diffuse reflections.
107    #[serde(rename = "$phong", default)]
108    pub phong: f32,
109
110    /// Prevents fog from overdrawing a material.
111    #[serde(rename = "$nofog", default)]
112    pub no_fog: bool,
113
114    /// Ignore z filtering
115    #[serde(rename = "$ignorez", default)]
116    pub ignore_z: bool,
117}