feat(render): add scene environment pipeline

This commit is contained in:
Hakan Seven committed 2026-08-05 23:42:18 +03:00
1 parent b667eeeb05
commit c45daeffb6
17 files changed
+2236 -213

No files matched your search

+67 -2
View File
@@ -53,8 +53,51 @@ pub struct Uniforms {
pub light_color_hotspot: [[f32; 4]; 4],
/// x = attenuation mode, y/z = start/end limits, w = cosine of falloff.
pub light_attenuation: [[f32; 4]; 4],
/// x = active light count, y = fallback ambient strength.
/// x = active light count, yzw = per-viewport ambient-light RGB.
pub lighting: [f32; 4],
/// x = viewport face-colour mode, y = viewport face opacity,
/// z = highlight intensity for faces without an attached material,
/// w = visual-style brightness.
pub visual_style: [f32; 4],
/// Viewport visual-style mono/tint colour.
pub visual_style_color: [f32; 4],
/// RGB background selected by the viewport; alpha is one when a drawing
/// background object, rather than the application canvas, supplies it.
pub viewport_background: [f32; 4],
/// x/y = normalized linear brightness/contrast in the documented
/// -10..10 viewport range; z/w are reserved for exposure controls.
pub view_tone: [f32; 4],
pub background_top: [f32; 4],
pub background_middle: [f32; 4],
pub background_bottom: [f32; 4],
pub background_aux0: [f32; 4],
pub background_aux1: [f32; 4],
/// x = mode, y = horizon, z = height, w = rotation in radians.
pub background_params: [f32; 4],
/// x = fit, y = keep aspect, z = tile, w = decoded image aspect.
pub background_image_params: [f32; 4],
/// xy = image offset, zw = image scale.
pub background_image_transform: [f32; 4],
/// x = environment enabled, y = rotation, z = diffuse strength,
/// w = reflection strength.
pub environment_params: [f32; 4],
/// View-to-world rotation used to derive environment lookup directions.
pub environment_view: glam::Mat4,
/// Eye-relative light projection for the first shadow-casting source.
pub shadow_view_proj: glam::Mat4,
/// x = enabled, y = depth bias, z = softness, w = light index.
pub shadow_params: [f32; 4],
/// RGB = document render-environment fog colour.
pub fog_color: [f32; 4],
/// x = enabled, y = affect background, z/w = near/far density.
pub fog_params: [f32; 4],
/// x/y = near/far eye distance used to interpolate the density.
pub fog_distances: [f32; 4],
/// Eight normalized vertical-candela samples for each photometric light.
pub light_web_profile_a: [[f32; 4]; 4],
pub light_web_profile_b: [[f32; 4]; 4],
/// xyz = web rotation, w = profile enabled.
pub light_web_rotation: [[f32; 4]; 4],
}
impl Uniforms {
@@ -83,7 +126,29 @@ impl Uniforms {
light_direction_intensity: [[0.0; 4]; 4],
light_color_hotspot: [[0.0; 4]; 4],
light_attenuation: [[0.0; 4]; 4],
lighting: [0.0, 0.18, 0.0, 0.0],
lighting: [0.0, 0.18, 0.18, 0.18],
visual_style: [1.0, 1.0, -1.0, 0.0],
visual_style_color: [1.0, 1.0, 1.0, 1.0],
viewport_background: [0.0, 0.0, 0.0, 0.0],
view_tone: [0.0; 4],
background_top: [0.0; 4],
background_middle: [0.0; 4],
background_bottom: [0.0; 4],
background_aux0: [0.0; 4],
background_aux1: [0.0; 4],
background_params: [0.0; 4],
background_image_params: [0.0; 4],
background_image_transform: [0.0, 0.0, 1.0, 1.0],
environment_params: [0.0, 0.0, 0.25, 0.35],
environment_view: glam::Mat4::IDENTITY,
shadow_view_proj: glam::Mat4::IDENTITY,
shadow_params: [0.0, 0.0015, 1.0, 0.0],
fog_color: [0.0, 0.0, 0.0, 1.0],
fog_params: [0.0; 4],
fog_distances: [0.0, 1.0, 0.0, 0.0],
light_web_profile_a: [[1.0; 4]; 4],
light_web_profile_b: [[1.0; 4]; 4],
light_web_rotation: [[0.0; 4]; 4],
}
}
}