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
use crate::types::*;
use derive_new::new;
use derive_setters::Setters;
use serde::{Deserialize, Serialize};
define_node!(
/// The `Focus` node defines a controllable focus for a Camera device.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/focus?version=R2025a).
Focus {
/// Default: 0.0
focal_distance: SFFloat,
/// Default: 0.0
focal_length: SFFloat,
/// Default: 0.0
max_focal_distance: SFFloat,
/// Default: 0.0
min_focal_distance: SFFloat,
});
define_node!(
/// The `Lens` node simulates camera image distortion.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/lens?version=R2025a).
Lens {
/// Default: 0.5 0.5
center: SFVec2f,
/// Default: 0 0
radial_coefficients: SFVec2f,
/// Default: 0 0
tangential_coefficients: SFVec2f,
});
define_node!(
/// The `LensFlare` node simulates lens flares.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/lensflare?version=R2025a).
LensFlare {
/// Default: 0.4
transparency: SFFloat,
/// Default: 1.5
scale: SFFloat,
/// Default: -0.9
bias: SFFloat,
/// Default: 0.6
dispersal: SFFloat,
/// Default: 4
samples: SFInt32,
/// Default: 0.4
halo_width: SFFloat,
/// Default: 2.0
chroma_distortion: SFFloat,
/// Default: 2
blur_iterations: SFInt32,
});
define_node!(
/// The `Recognition` node provides object recognition capability.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/recognition?version=R2025a).
Recognition {
/// Default: 100.0
max_range: SFFloat,
/// Default: -1
max_objects: SFInt32,
/// Default: 1
occlusion: SFInt32,
/// Default: 1 0 0
frame_color: SFColor,
/// Default: 1
frame_thickness: SFInt32,
/// Default: FALSE
segmentation: SFBool,
});
define_node!(
/// The `Zoom` node defines a controllable zoom for a Camera device.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/zoom?version=R2025a).
Zoom {
/// Default: 1.5
max_field_of_view: SFFloat,
/// Default: 0.5
min_field_of_view: SFFloat,
});
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_optics_new() {
assert!(Focus::new().focal_distance.is_none());
assert!(Lens::new().center.is_none());
assert!(LensFlare::new().scale.is_none());
assert!(Recognition::new().max_range.is_none());
assert!(Zoom::new().max_field_of_view.is_none());
}
}