Skip to main content

SceneExt

Trait SceneExt 

Source
pub trait SceneExt {
    // Required methods
    fn instantiate(&mut self, prefab: &Prefab) -> NodeHandle;
    fn spawn(
        &mut self,
        geometry: impl ResolveGeometry,
        material: impl ResolveMaterial,
        assets: &AssetServer,
    ) -> NodeHandle;
    fn spawn_box(
        &mut self,
        w: f32,
        h: f32,
        d: f32,
        material: impl ResolveMaterial,
        assets: &AssetServer,
    ) -> NodeHandle;
    fn spawn_sphere(
        &mut self,
        radius: f32,
        material: impl ResolveMaterial,
        assets: &AssetServer,
    ) -> NodeHandle;
    fn spawn_plane(
        &mut self,
        width: f32,
        height: f32,
        material: impl ResolveMaterial,
        assets: &AssetServer,
    ) -> NodeHandle;
}
Expand description

Extension trait that adds asset-aware helper methods to Scene.

Required Methods§

Source

fn instantiate(&mut self, prefab: &Prefab) -> NodeHandle

Instantiates a Prefab into the scene, returning the root node handle.

Source

fn spawn( &mut self, geometry: impl ResolveGeometry, material: impl ResolveMaterial, assets: &AssetServer, ) -> NodeHandle

Spawns a mesh node from any geometry/material combination.

Accepts either pre-registered handles or raw resource structs.

Source

fn spawn_box( &mut self, w: f32, h: f32, d: f32, material: impl ResolveMaterial, assets: &AssetServer, ) -> NodeHandle

Spawns a box mesh node.

Source

fn spawn_sphere( &mut self, radius: f32, material: impl ResolveMaterial, assets: &AssetServer, ) -> NodeHandle

Spawns a sphere mesh node.

Source

fn spawn_plane( &mut self, width: f32, height: f32, material: impl ResolveMaterial, assets: &AssetServer, ) -> NodeHandle

Spawns a plane mesh node.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§