1use nalgebra::{vector, Matrix4, Vector3, Vector4};
3use serde::{Deserialize, Serialize};
4
5#[derive(Deserialize, Serialize, Clone, Debug, Copy)]
7#[repr(C)]
8pub struct SceneData {
9 pub projection: [Matrix4<f32>; 2],
11 pub view: [Matrix4<f32>; 2],
13 pub camera_position: [Vector4<f32>; 2],
15}
16
17impl Default for SceneData {
18 fn default() -> Self {
19 Self {
20 view: [Matrix4::identity(), Matrix4::identity()],
21 projection: [Matrix4::identity(), Matrix4::identity()],
22 camera_position: [Vector4::zeros(), Vector4::zeros()],
23 }
24 }
25}
26
27#[derive(Deserialize, Serialize, Clone, Debug, Copy)]
30#[repr(C)]
31pub struct SceneParams {
32 pub light_direction: Vector4<f32>,
34 pub exposure: f32,
36 pub gamma: f32,
38 pub prefiltered_cube_mip_levels: f32,
40 pub scale_ibl_ambient: f32,
42 pub debug_view_inputs: f32,
44 pub debug_view_equation: f32,
46}
47
48impl Default for SceneParams {
49 fn default() -> Self {
50 let light_source: Vector3<f32> =
51 vector![75_f32.to_radians(), 40_f32.to_radians(), 0_f32.to_radians()];
52 let x = light_source.x.sin() * light_source.y.cos();
53 let y = light_source.y.sin();
54 let z = light_source.x.cos() * light_source.y.cos();
55
56 let light_direction = vector![x, y, z, 0.];
57 SceneParams {
58 light_direction,
59 exposure: 4.5,
60 gamma: 2.2,
61 prefiltered_cube_mip_levels: 10.,
62 scale_ibl_ambient: 0.1,
63 debug_view_inputs: 0.,
64 debug_view_equation: 0.,
65 }
66 }
67}