1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
use super::Node;
use crate::types::*;
use derive_new::new;
use derive_setters::Setters;
use serde::{Deserialize, Serialize};
define_node!(
/// The `Appearance` node specifies the visual properties of a geometry.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/appearance?version=R2025a).
Appearance {
/// Default: NULL
material: Box<Node>,
/// Default: NULL
texture: Box<Node>,
/// Default: NULL
texture_transform: Box<Node>,
});
define_node!(
/// The `Material` node specifies surface material properties.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/material?version=R2025a).
Material {
/// Default: 0.2
ambient_intensity: SFFloat,
/// Default: 0.8 0.8 0.8
diffuse_color: SFColor,
/// Default: 0 0 0
emissive_color: SFColor,
/// Default: 0.2
shininess: SFFloat,
/// Default: 0 0 0
specular_color: SFColor,
/// Default: 0.0
transparency: SFFloat,
});
define_node!(
/// The `PBRAppearance` node specifies a physically-based visual appearance.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/pbrappearance?version=R2025a).
PBRAppearance {
/// Default: 1 1 1
base_color: SFColor,
/// Default: NULL
base_color_map: Box<Node>,
/// Default: 0.0
transparency: SFFloat,
/// Default: 0.0
roughness: SFFloat,
/// Default: NULL
roughness_map: Box<Node>,
/// Default: 1.0
metalness: SFFloat,
/// Default: NULL
metalness_map: Box<Node>,
/// Default: 1.0
ibl_strength: SFFloat,
/// Default: NULL
normal_map: Box<Node>,
/// Default: 1.0
normal_map_factor: SFFloat,
/// Default: NULL
occlusion_map: Box<Node>,
/// Default: 1.0
occlusion_map_strength: SFFloat,
/// Default: 0 0 0
emissive_color: SFColor,
/// Default: NULL
emissive_color_map: Box<Node>,
/// Default: 1.0
emissive_intensity: SFFloat,
/// Default: NULL
texture_transform: Box<Node>,
});
define_node!(
/// The `ImageTexture` node defines a texture map.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/imagetexture?version=R2025a).
ImageTexture {
/// Default: []
url: MFString,
/// Default: TRUE
repeat_s: SFBool,
/// Default: TRUE
repeat_t: SFBool,
/// Default: 4
filtering: SFInt32,
});
define_node!(
/// The `TextureTransform` node defines a 2D transformation for texture coordinates.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/texturetransform?version=R2025a).
TextureTransform {
/// Default: 0 0
center: SFVec2f,
/// Default: 0.0
rotation: SFFloat,
/// Default: 1 1
scale: SFVec2f,
/// Default: 0 0
translation: SFVec2f,
});
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_appearance_new() {
let app = Appearance::new();
assert!(app.material.is_none());
}
#[test]
fn test_material_new() {
assert!(Material::new().shininess.is_none());
}
#[test]
fn test_pbr_appearance_new() {
let pbr = PBRAppearance::new();
assert!(pbr.base_color.is_none());
}
#[test]
fn test_image_texture_new() {
assert!(ImageTexture::new().filtering.is_none());
}
#[test]
fn test_texture_transform_new() {
assert!(TextureTransform::new().scale.is_none());
}
}