pub struct SceneVM {
pub vm: VM,
/* private fields */
}Fields§
§vm: VMImplementations§
Source§impl SceneVM
impl SceneVM
pub fn set_rgba_overlay( &mut self, width: u32, height: u32, rgba: Vec<u8>, rect: [f32; 4], )
pub fn set_rgba_overlay_bytes( &mut self, width: u32, height: u32, rgba: &[u8], rect: [f32; 4], )
pub fn clear_rgba_overlay(&mut self)
Sourcepub fn vm_layer_count(&self) -> usize
pub fn vm_layer_count(&self) -> usize
Total number of VM layers (base + overlays).
Sourcepub fn add_vm_layer(&mut self) -> usize
pub fn add_vm_layer(&mut self) -> usize
Append a new VM layer that will render on top of the existing ones. Returns its layer index.
Sourcepub fn remove_vm_layer(&mut self, index: usize) -> Option<VM>
pub fn remove_vm_layer(&mut self, index: usize) -> Option<VM>
Remove a VM layer by index (cannot remove the base layer at index 0).
Sourcepub fn set_active_vm(&mut self, index: usize) -> bool
pub fn set_active_vm(&mut self, index: usize) -> bool
Switch the VM layer targeted by execute. Returns true if the index existed.
Sourcepub fn active_vm_index(&self) -> usize
pub fn active_vm_index(&self) -> usize
Index of the currently active VM used by execute.
Sourcepub fn atlas_sdf_uv4(&self, id: &Uuid, anim_frame: u32) -> Option<[f32; 4]>
pub fn atlas_sdf_uv4(&self, id: &Uuid, anim_frame: u32) -> Option<[f32; 4]>
Normalized atlas rect (ofs.x, ofs.y, scale.x, scale.y) for a tile/frame, useful for SDF packing.
pub fn atlas_dims(&self) -> (u32, u32)
Sourcepub fn set_layer_enabled(&mut self, index: usize, enabled: bool) -> bool
pub fn set_layer_enabled(&mut self, index: usize, enabled: bool) -> bool
Enable or disable drawing for a VM layer. Disabled layers still receive commands.
Sourcepub fn is_layer_enabled(&self, index: usize) -> Option<bool>
pub fn is_layer_enabled(&self, index: usize) -> Option<bool>
Returns whether a VM layer is enabled.
Sourcepub fn set_layer_activity_logging(&mut self, enabled: bool)
pub fn set_layer_activity_logging(&mut self, enabled: bool)
Toggle verbose per-layer logging for uploads/atlas/grid events.
Sourcepub fn active_vm_mut(&mut self) -> &mut VM
pub fn active_vm_mut(&mut self) -> &mut VM
Borrow the currently active VM mutably.
Sourcepub fn pick_geo_id_at_uv(
&self,
fb_w: u32,
fb_h: u32,
screen_uv: [f32; 2],
include_hidden: bool,
include_billboards: bool,
) -> Option<(GeoId, Vec3<f32>, f32)>
pub fn pick_geo_id_at_uv( &self, fb_w: u32, fb_h: u32, screen_uv: [f32; 2], include_hidden: bool, include_billboards: bool, ) -> Option<(GeoId, Vec3<f32>, f32)>
Ray-pick against the active VM layer using normalized screen UVs.
Sourcepub fn ray_from_uv_with_size(
&self,
fb_w: u32,
fb_h: u32,
screen_uv: [f32; 2],
) -> Option<(Vec3<f32>, Vec3<f32>)>
pub fn ray_from_uv_with_size( &self, fb_w: u32, fb_h: u32, screen_uv: [f32; 2], ) -> Option<(Vec3<f32>, Vec3<f32>)>
Build a world-space ray from screen uv (0..1) using the active VM’s camera and a provided framebuffer size.
Sourcepub fn ray_from_uv(&self, screen_uv: [f32; 2]) -> Option<(Vec3<f32>, Vec3<f32>)>
pub fn ray_from_uv(&self, screen_uv: [f32; 2]) -> Option<(Vec3<f32>, Vec3<f32>)>
Build a world-space ray from screen uv (0..1) using the active VM’s camera and the current SceneVM size.
Sourcepub fn print_geometry_stats(&self)
pub fn print_geometry_stats(&self)
Prints statistics about 2D and 3D polygons currently loaded in all chunks.
Sourcepub fn is_gpu_ready(&self) -> bool
pub fn is_gpu_ready(&self) -> bool
Is the GPU initialized and ready?
Sourcepub fn frame_in_flight(&self) -> bool
pub fn frame_in_flight(&self) -> bool
Is a GPU readback currently in flight (WASM only)? Always false on native.
Sourcepub fn new(initial_width: u32, initial_height: u32) -> Self
pub fn new(initial_width: u32, initial_height: u32) -> Self
Create a new SceneVM. Always uses GPU backend.
Sourcepub fn new_with_window(window: &Window) -> Self
pub fn new_with_window(window: &Window) -> Self
Create a SceneVM that is configured to present directly into a winit window surface.
Sourcepub async fn init_async(&mut self)
pub async fn init_async(&mut self)
Initialize GPU backend asynchronously on WASM. On native, this will initialize synchronously if not already.
Sourcepub fn blit_texture(
&mut self,
tex: &mut Texture,
_cpu_pixels: &mut [u8],
_buf_w: u32,
_buf_h: u32,
)
pub fn blit_texture( &mut self, tex: &mut Texture, _cpu_pixels: &mut [u8], _buf_w: u32, _buf_h: u32, )
Blit a Texture via GPU to the main surface texture, if GPU is ready.
Sourcepub fn resize_window_surface(&mut self, width: u32, height: u32)
pub fn resize_window_surface(&mut self, width: u32, height: u32)
Update the window surface size and internal storage texture (native only).
Sourcepub fn render_to_window(&mut self) -> SceneVMResult<RenderResult>
pub fn render_to_window(&mut self) -> SceneVMResult<RenderResult>
Render directly into the configured window surface (native only, no CPU readback).
Sourcepub async fn render_frame_async(
&mut self,
out_pixels: &mut [u8],
out_w: u32,
out_h: u32,
)
pub async fn render_frame_async( &mut self, out_pixels: &mut [u8], out_w: u32, out_h: u32, )
Single cross-platform async entrypoint for rendering a frame.
Sourcepub fn render_frame(
&mut self,
out_pixels: &mut [u8],
out_w: u32,
out_h: u32,
) -> RenderResult
pub fn render_frame( &mut self, out_pixels: &mut [u8], out_w: u32, out_h: u32, ) -> RenderResult
Cross-platform synchronous render entrypoint (one function for Native & WASM). Returns a RenderResult.
Native: blocks until pixels are ready. WASM: presents the last completed frame
and kicks off a new GPU frame if none is in flight. Call this every frame.
On WASM, you must call init_async().await once before rendering.
Sourcepub fn load_image_rgba<I: IntoDataInput>(
&self,
input: I,
) -> Option<(Vec<u8>, u32, u32)>
pub fn load_image_rgba<I: IntoDataInput>( &self, input: I, ) -> Option<(Vec<u8>, u32, u32)>
Load an image from various inputs (file path on native, raw bytes, &str) and decode to RGBA8.
Sourcepub fn compile_shader_2d(
&mut self,
body_source: &str,
) -> ShaderCompilationResult
pub fn compile_shader_2d( &mut self, body_source: &str, ) -> ShaderCompilationResult
Compile a 2D body shader with the header and return detailed diagnostics. If compilation succeeds (only warnings), the shader is automatically set as active.
Sourcepub fn compile_shader_3d(
&mut self,
body_source: &str,
) -> ShaderCompilationResult
pub fn compile_shader_3d( &mut self, body_source: &str, ) -> ShaderCompilationResult
Compile a 3D body shader with the header and return detailed diagnostics. If compilation succeeds (only warnings), the shader is automatically set as active.
Sourcepub fn compile_shader_sdf(
&mut self,
body_source: &str,
) -> ShaderCompilationResult
pub fn compile_shader_sdf( &mut self, body_source: &str, ) -> ShaderCompilationResult
Compile an SDF body shader with the header and return detailed diagnostics. If compilation succeeds (only warnings), the shader is automatically set as active.
Sourcepub fn default_shader_source(kind: &str) -> Option<String>
pub fn default_shader_source(kind: &str) -> Option<String>
Fetch the source of a built-in shader body by name (e.g. “ui”, “2d”, “3d”, “sdf”, “noise”).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SceneVM
impl !RefUnwindSafe for SceneVM
impl Send for SceneVM
impl Sync for SceneVM
impl Unpin for SceneVM
impl UnsafeUnpin for SceneVM
impl !UnwindSafe for SceneVM
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