-
Notifications
You must be signed in to change notification settings - Fork 4
Working on the Light Struct #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,60 @@ pub struct GraspCheck { | |
| pub struct Actor {} | ||
| /// The light element describes a light sou | ||
| #[derive(Debug, Serialize, Deserialize)] | ||
| pub struct Light {} | ||
| pub struct Light { | ||
| // A unique name for the light | ||
| name: String, | ||
| // The light type: point, directional spot | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| #[serde(default)] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| light_type: String, | ||
| // When true, the light will cast shadows | ||
| #[serde(default)] | ||
| cast_shadows: Option<bool>, | ||
| // Scale factor to set the relative power of a light | ||
| #[serde(default)] | ||
| intensity: Option<f64>, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // Diffuse light color | ||
| #[serde(default)] | ||
| diffuse: Option<Color>, | ||
| // Specular light color | ||
| #[serde(default)] | ||
| specular: Option<Color>, | ||
|
Comment on lines
+199
to
+202
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // Light attenuation | ||
| #[serde(default)] | ||
| attenuation: Vec<Attenuation>, | ||
| // Direction of light, only applicable for spot and directional light | ||
| #[serde(default)] | ||
| direction: Vec<i32>, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://docs.rs/nalgebra/0.29.0/nalgebra/base/type.Vector3.html
|
||
| // Spot light parameters | ||
| #[serde(default)] | ||
| spot: Vec<Spot>, | ||
| // A position and orientation with respect to the frame named in relative_to attribute | ||
| #[serde(default)] | ||
| pose: Vec<Pose>, | ||
| } | ||
|
|
||
| // Light attenuation | ||
| pub struct Attenuation { | ||
| range: f64, | ||
| linear: Option<f64>, | ||
| constant: Option<f64>, | ||
| quadratic: Option<f64>, | ||
| } | ||
|
|
||
| // Spot light parameters | ||
| pub struct Spot { | ||
| inner_angle: f64, | ||
| outer_angle: f64, | ||
| falloff: f64, | ||
| } | ||
|
|
||
| // A position and orientation with respect to the frame named in relative_to attribute | ||
| pub struct Pose { | ||
| relative_to: Option<String>, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| // Unit struct for tpe `color` | ||
| struct Color(u8, u8, u8); | ||
|
Comment on lines
+218
to
+238
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| #[cfg(test)] | ||
| mod test { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
///so that the information shows in the documentation.