vmt_parser/material/
vertexlitgeneric.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 VertexLitGenericMaterial {
9    /// Defines an albedo texture.
10    #[serde(
11        rename = "$basetexture",
12        default,
13        deserialize_with = "deserialize_path"
14    )]
15    pub base_texture: Option<String>,
16    /// Detail texturing.
17    #[serde(rename = "$detail", default, deserialize_with = "deserialize_path")]
18    pub detail: Option<String>,
19    /// Use a 2nd UV channel for high-resolution decal support.
20    #[serde(
21        rename = "$decaltexture",
22        default,
23        deserialize_with = "deserialize_path"
24    )]
25    pub decal_texture: Option<String>,
26
27    /// Color tinting
28    #[serde(rename = "$color2", default = "default_scale3")]
29    pub color2: Vec3,
30    /// Transforms the texture before use in the material. This does not affect lightmaps on the surface.
31    #[serde(rename = "$basetexturetransform", default)]
32    pub base_texture_transform: TextureTransform,
33    /// Independently scales the red, green and blue channels of an albedo.
34    #[serde(rename = "$color", default = "default_scale3")]
35    pub color: Vec3,
36    #[serde(rename = "$decalscale", default = "default_detail_scale")]
37    /// Fits the detail texture onto the material the given number of times
38    pub detail_scale: Vec2,
39    /// 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.
40    #[serde(rename = "$detailblendfactor", default = "default_scale")]
41    pub detail_blend_factor: f32,
42    /// How to combine the detail material with the albedo.
43    #[serde(rename = "$detailblendmode", default)]
44    pub detail_blend_mode: BlendMode,
45    /// A separate VertexLitGeneric material to that will replace this one if the decal hits a model.
46    #[serde(
47        rename = "$modelmaterial",
48        default,
49        deserialize_with = "deserialize_path"
50    )]
51    pub model_material: Option<String>,
52    /// Disables texture filtering.
53    #[serde(rename = "$pointsamplemagfilter", default)]
54    pub point_sample_mag_filter: bool,
55    /// Mitigation for displacement texture stretching.
56    #[serde(rename = "$seamless_scale", default = "default_scale")]
57    pub seamless_scale: f32,
58
59    /// Scales the opacity of an entire material.
60    #[serde(rename = "$alpha", default = "default_scale")]
61    pub alpha: f32,
62    /// Specifies a mask to use to determine binary opacity.
63    #[serde(rename = "$alphatest", default)]
64    pub alpha_test: bool,
65    /// Specifies a mask to use to determine binary opacity.
66    #[serde(rename = "$alphatestreference", default = "default_scale")]
67    pub alpha_test_reference: f32,
68    /// Vector-like edge filtering.
69    #[serde(rename = "$distancealpha", default)]
70    pub distance_alpha: bool,
71    /// Disables backface culling.
72    #[serde(rename = "$nocull", default)]
73    pub no_cull: bool,
74    /// Specifies that the material should be partially see-through.
75    #[serde(rename = "$translucent", default)]
76    pub translucent: bool,
77
78    /// Specifies a texture that will provide three-dimensional lighting information for a material.
79    #[serde(rename = "$bumpmap", default, deserialize_with = "deserialize_path")]
80    pub bump_map: Option<String>,
81    /// Per-texel color modification via a warp texture.
82    #[serde(
83        rename = "$lightwarptexture",
84        default,
85        deserialize_with = "deserialize_path"
86    )]
87    pub light_wrap_texture: Option<String>,
88    /// Determines whether the surface is self-illuminated independent of environment lighting.
89    #[serde(rename = "$selfillum", default)]
90    pub self_illum: bool,
91    /// Flags the $bumpmap as being a self-shadowing bumpmap.
92    #[serde(rename = "$ssbump", default)]
93    pub ss_bump: bool,
94
95    /// Specular reflections.
96    #[serde(rename = "$envmap", default, deserialize_with = "deserialize_path")]
97    pub env_map: Option<String>,
98    /// Diffuse reflections.
99    #[serde(rename = "$phong", default)]
100    pub phong: f32,
101
102    /// Prevents fog from overdrawing a material.
103    #[serde(rename = "$nofog", default)]
104    pub no_fog: bool,
105
106    /// Ignore z filtering
107    #[serde(rename = "$ignorez", default)]
108    pub ignore_z: bool,
109}