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