openconfiguration/
geometry_mapping.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
4#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
5#[cfg_attr(feature = "schema", schemars(deny_unknown_fields))]
6#[serde(rename_all = "camelCase")]
7
8/// A Transformation of the UV Set of a Geometry  
9/// Ordering S///T///R///V
10/// This order minimizes shearing and improves
11/// the posibility to fix tiling.
12///
13/// Combination with a MaterialMapping looks like this:
14/// GS///GT///GR///MR///MS///MT///V
15///
16/// GS .. Matrix of GeometryMapping.Scale///
17/// GT .. Matrix of GeometryMapping.Translation///
18/// GR .. Matrix of GeometryMapping.Rotation
19///
20/// MR .. Matrix of TextureMapping.Rotation
21/// MS .. Matrix of TextureMapping.Scale///
22/// MT .. Matrix of TextureMapping.Translation///
23///
24/// V .. (UV)-Vector to be transformed
25///
26/// Rotation is clockwise in degrees
27pub struct GeometryMapping {
28    pub translation_s: f64,
29
30    pub translation_t: f64,
31
32    pub rotation: f64,
33
34    #[serde(default = "default_scale")]
35    ///////
36    /// default value = 1
37    ////
38    pub scale_s: f64,
39
40    #[serde(default = "default_scale")]
41    ///////
42    /// default value = 1
43    ////
44    pub scale_t: f64,
45}
46
47fn default_scale() -> f64 {
48    1.0
49}