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
use crate::types::*;
use derive_new::new;
use derive_setters::Setters;
use serde::{Deserialize, Serialize};
define_node!(
/// The `DirectionalLight` node defines a directional light source.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/directionallight?version=R2025a).
DirectionalLight {
/// Default: 0.0
ambient_intensity: SFFloat,
/// Default: 1 1 1
color: SFColor,
/// Default: 1.0
intensity: SFFloat,
/// Default: TRUE
on: SFBool,
/// Default: FALSE
cast_shadows: SFBool,
/// Default: 0 0 -1
direction: SFVec3f,
});
define_node!(
/// The `PointLight` node specifies a point light source.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/pointlight?version=R2025a).
PointLight {
/// Default: 0.0
ambient_intensity: SFFloat,
/// Default: 1 1 1
color: SFColor,
/// Default: 1.0
intensity: SFFloat,
/// Default: TRUE
on: SFBool,
/// Default: FALSE
cast_shadows: SFBool,
/// Default: 1 0 0
attenuation: SFVec3f,
/// Default: 0 0 0
location: SFVec3f,
/// Default: 100.0
radius: SFFloat,
});
define_node!(
/// The `SpotLight` node defines a light source that emits light in a cone.
///
/// See [Webots Reference](https://cyberbotics.com/doc/reference/spotlight?version=R2025a).
SpotLight {
/// Default: 0.0
ambient_intensity: SFFloat,
/// Default: 1 1 1
color: SFColor,
/// Default: 1.0
intensity: SFFloat,
/// Default: TRUE
on: SFBool,
/// Default: FALSE
cast_shadows: SFBool,
/// Default: 1 0 0
attenuation: SFVec3f,
/// Default: 1.5708
beam_width: SFFloat,
/// Default: 0.785398
cut_off_angle: SFFloat,
/// Default: 0 0 -1
direction: SFVec3f,
/// Default: 0 0 0
location: SFVec3f,
/// Default: 100.0
radius: SFFloat,
});
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_lighting_new() {
assert!(DirectionalLight::new().direction.is_none());
assert!(PointLight::new().radius.is_none());
assert!(SpotLight::new().cut_off_angle.is_none());
}
}