MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / material_system_begin_frame

Method material_system_begin_frame

native/shared/src/renderer/mod.rs:13875–13922  ·  view source on GitHub ↗

Sync PerFrame + PerView uniforms from current renderer state. FFI callers drive this from their frame boundary so `PerFrame.time` reflects the real process-uptime clock.

(&mut self, time_seconds: f32, delta_time: f32)

Source from the content-addressed store, hash-verified

13873 /// FFI callers drive this from their frame boundary so `PerFrame.time`
13874 /// reflects the real process-uptime clock.
13875 pub fn material_system_begin_frame(&mut self, time_seconds: f32, delta_time: f32) {
13876 let screen_w = self.surface_config.width as f32;
13877 let screen_h = self.surface_config.height as f32;
13878 let (rw, rh) = self.render_extent();
13879 let per_frame = material_system::PerFrameUniforms {
13880 time: time_seconds,
13881 delta_time,
13882 frame_index: self.taa_frame_index as u32,
13883 _pad0: 0,
13884 screen_resolution: [screen_w, screen_h],
13885 render_resolution: [rw as f32, rh as f32],
13886 taa_jitter: [0.0, 0.0],
13887 _pad1: [0.0, 0.0],
13888 wind: self.wind,
13889 };
13890 let per_view = material_system::PerViewUniforms {
13891 view: self.current_view_matrix,
13892 proj: self.current_proj_matrix,
13893 view_proj: self.current_vp_matrix,
13894 prev_view_proj: self.prev_vp_matrix,
13895 inv_proj: self.current_inv_proj_matrix,
13896 camera_pos: [
13897 self.current_camera_pos[0],
13898 self.current_camera_pos[1],
13899 self.current_camera_pos[2],
13900 self.lighting_uniforms.camera_pos[3],
13901 ],
13902 camera_dir: [0.0, 0.0, -1.0, 70.0_f32.to_radians()],
13903 ambient: self.lighting_uniforms.ambient,
13904 fog: [self.fog_color[0], self.fog_color[1], self.fog_color[2], self.fog_density],
13905 sun_dir: self.lighting_uniforms.light_dir,
13906 sun_color: self.lighting_uniforms.light_color,
13907 dir_light_count: self.lighting_uniforms.dir_light_count,
13908 dir_lights: std::array::from_fn(|i| material_system::PerViewDirLight {
13909 direction: self.lighting_uniforms.dir_lights[i].direction,
13910 color: self.lighting_uniforms.dir_lights[i].color,
13911 }),
13912 point_light_count: self.lighting_uniforms.point_light_count,
13913 point_lights: std::array::from_fn(|i| material_system::PerViewPointLight {
13914 position: self.lighting_uniforms.point_lights[i].position,
13915 color: self.lighting_uniforms.point_lights[i].color,
13916 }),
13917 shadow_splits: self.lighting_uniforms.shadow_cascade_splits,
13918 shadow_view: self.lighting_uniforms.shadow_view_matrix,
13919 shadow_cascades: self.lighting_uniforms.shadow_cascade_vps,
13920 };
13921 self.material_system.update_frame_uniforms(&self.queue, &per_frame, &per_view);
13922 }
13923}

Callers 3

bloom_screenshot_captureFunction · 0.80
end_frameMethod · 0.80
bloom_screenshot_captureFunction · 0.80

Calls 2

render_extentMethod · 0.80
update_frame_uniformsMethod · 0.80

Tested by

no test coverage detected