pub struct SceneRenderer {
pub fabric: Box<DreamFabric>,
pub last_frame_contract: FrameContract,
/* private fields */
}Expand description
Scene renderer for the runtime. Owns DreamFabric and depth buffer.
Memory safety:
depth_texture/depth_vieware recreated on resize (old dropped first).fabricowns GPU scene, observer, meshlet, cull, and particle resources.fabric.matteris the single owner of all particle systems.- No Arc/Mutex — single-owner, no thread sharing.
Fields§
§fabric: Box<DreamFabric>§last_frame_contract: FrameContractLast frame contract — public API for app layer.
Implementations§
Source§impl SceneRenderer
impl SceneRenderer
pub fn new(ws: &WindowState) -> Self
Sourcepub fn with_msaa(ws: &WindowState, msaa_samples: u32) -> Self
pub fn with_msaa(ws: &WindowState, msaa_samples: u32) -> Self
Create renderer with explicit MSAA sample count.
pub fn resize(&mut self, width: u32, height: u32, device: &Device)
Sourcepub fn render(
&mut self,
ws: &WindowState,
scene: &Scene,
dt: f32,
player_pos: Vec3,
active_layer: TopologyLayer,
)
pub fn render( &mut self, ws: &WindowState, scene: &Scene, dt: f32, player_pos: Vec3, active_layer: TopologyLayer, )
Render the scene. Frame sequence:
- Acquire surface texture (handle Lost/Outdated gracefully)
- DreamFabric begin_frame (observer update, GPU upload)
- Sync GPU scene transforms from engine scene
- Extract → Prepare → Queue (render staging)
- DreamFabric end_frame (cull → DreamMatter simulate → render → picking)
- GPU timestamp resolve + readback
- Submit + present
Sourcepub fn render_entangled(
&mut self,
ws: &WindowState,
scene: &Scene,
dt: f32,
entanglement: &CausalEntanglement,
active_layer: TopologyLayer,
)
pub fn render_entangled( &mut self, ws: &WindowState, scene: &Scene, dt: f32, entanglement: &CausalEntanglement, active_layer: TopologyLayer, )
Render with CausalEntanglement — production entry point. Same pipeline as render() but uses begin_frame_entangled() for observer-aware quantum culling via CausalEntanglement.
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Current render dimensions.
Sourcepub fn msaa_samples(&self) -> u32
pub fn msaa_samples(&self) -> u32
MSAA sample count.
Sourcepub fn msaa_view(&self) -> Option<&TextureView>
pub fn msaa_view(&self) -> Option<&TextureView>
Get the MSAA view for render pass color attachment. Returns None when MSAA is disabled (sample_count = 1).
Sourcepub fn last_picked_id(&self) -> u32
pub fn last_picked_id(&self) -> u32
Last picked object ID.
Sourcepub fn last_frame_stats(&self) -> FrameStats
pub fn last_frame_stats(&self) -> FrameStats
Per-frame stats. cpu_ms is the wall-clock frame time from FrameTimer.
gpu_ms is populated from GPU timestamp queries when available (1-frame lag).
Sourcepub fn set_post_process_config(&mut self, config: PostProcessConfig)
pub fn set_post_process_config(&mut self, config: PostProcessConfig)
Set post-processing configuration.
Sourcepub fn post_process_config(&self) -> &PostProcessConfig
pub fn post_process_config(&self) -> &PostProcessConfig
Get post-processing configuration.
Sourcepub fn set_scene_dream_mode(&mut self, mode: SceneDreamMode)
pub fn set_scene_dream_mode(&mut self, mode: SceneDreamMode)
Set the scene rendering mode.
Sourcepub fn scene_dream_mode(&self) -> SceneDreamMode
pub fn scene_dream_mode(&self) -> SceneDreamMode
Get the current scene rendering mode.
Sourcepub fn set_causal_observer_sender(&mut self, tx: CausalObserverLaneSender)
pub fn set_causal_observer_sender(&mut self, tx: CausalObserverLaneSender)
Set the causal observer lane sender for cold path dispatch.
Sourcepub fn set_bridge_seal(&mut self, seal: [u8; 32])
pub fn set_bridge_seal(&mut self, seal: [u8; 32])
Set the last bridge seal digest (from decoder).
Sourcepub fn frame_gate(&self) -> &FrameGate
pub fn frame_gate(&self) -> &FrameGate
Get the frame gate for quality tier inspection.
Sourcepub fn frame_seal(&self) -> &FrameSeal
pub fn frame_seal(&self) -> &FrameSeal
Get the frame seal for chain depth inspection.
Sourcepub fn frame_memory(&self) -> &FrameMemory
pub fn frame_memory(&self) -> &FrameMemory
Get the frame memory for replay/debug access.
Sourcepub fn causal_observer_recorder(&self) -> &CausalObserverRecorder
pub fn causal_observer_recorder(&self) -> &CausalObserverRecorder
Get the causal observer recorder for KPI timing.
Auto Trait Implementations§
impl Freeze for SceneRenderer
impl !RefUnwindSafe for SceneRenderer
impl Send for SceneRenderer
impl Sync for SceneRenderer
impl Unpin for SceneRenderer
impl UnsafeUnpin for SceneRenderer
impl !UnwindSafe for SceneRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more