Skip to main content

Scene

Struct Scene 

Source
pub struct Scene { /* private fields */ }

Implementations§

Source§

impl Scene

Source§

impl Scene

Source

pub fn set_annotation_anchor( &mut self, anchor: AnnotationAnchor, ) -> Result<(), LookupError>

Source

pub fn clear_annotation_anchor(&mut self, id: &str) -> bool

Source

pub fn annotation_anchor(&self, id: &str) -> Option<&AnnotationAnchor>

Source

pub fn annotation_anchors(&self) -> impl Iterator<Item = &AnnotationAnchor>

Source

pub fn annotation_projection_report( &self, camera: CameraKey, viewport_width: u32, viewport_height: u32, ) -> Result<AnnotationProjectionReportV1, LookupError>

Source

pub fn annotation_projection_report_with_node_handles( &self, camera: CameraKey, viewport_width: u32, viewport_height: u32, node_handles: &BTreeMap<NodeKey, u64>, ) -> Result<AnnotationProjectionReportV1, LookupError>

Source§

impl Scene

Source

pub fn add_callout<F: AssetFetcher>( &mut self, assets: &Assets<F>, callout: Callout, ) -> Result<CalloutReport, LookupError>

Source

pub fn clear_callout(&mut self, id: &str) -> bool

Source

pub fn callout(&self, id: &str) -> Option<CalloutReport>

Source§

impl Scene

Source§

impl Scene

Source

pub fn connect_import_connectors( &mut self, source_import: &SceneImport, source_name: &str, target_import: &SceneImport, target_name: &str, options: ConnectOptions, ) -> Result<ConnectionPreview, ConnectionError>

Source

pub fn mate( &mut self, source: &SceneImport, source_name: &str, target: &SceneImport, target_name: &str, ) -> Result<ConnectionPreview, ConnectionError>

Mate two imported parts by named connector using default options.

Short form of Self::connect_import_connectors with ConnectOptions::default. For non-default alignment, roll policy, or mate offset, call the full form directly.

Source§

impl Scene

Source§

impl Scene

Source§

impl Scene

Source§

impl Scene

Source§

impl Scene

Source

pub fn add_grid_floor<F>( &mut self, assets: &Assets<F>, options: GridFloorOptions, ) -> Result<GridFloorHandles, LookupError>

Adds a matte grid floor sized from GridFloorOptions.

§Errors

Returns LookupError::InvalidFramingOption if the floor options are invalid and LookupError::NodeNotFound if the floor mesh nodes cannot be inserted under the scene root.

Source§

impl Scene

Source

pub fn add_perspective_camera_default_for( &mut self, bounds: Aabb, viewport: (u32, u32), ) -> Result<CameraKey, LookupError>

Adds a standard perspective camera under the scene root and frames it to bounds.

The helper is the scene-level equivalent of the viewer default: callers provide world-space bounds and a target viewport, and scena creates an active camera using PerspectiveCamera::standard plus Scene::frame_bounds. It does not prepare renderer resources, upload GPU data, fetch assets, or render a frame.

§Examples
use scena::{Aabb, Scene, Vec3};

let mut scene = Scene::new();
let bounds = Aabb::new(Vec3::new(-1.0, -0.5, -0.5), Vec3::new(1.0, 0.5, 0.5));

let camera = scene
    .add_perspective_camera_default_for(bounds, (1280, 720))
    .unwrap();
assert_eq!(scene.active_camera(), Some(camera));
§Errors

Returns LookupError::InvalidViewport when either viewport dimension is zero, LookupError::InvalidBounds or LookupError::ImportHasNoBounds for invalid bounds, and the same insertion/framing errors as Scene::add_perspective_camera and Scene::frame_bounds.

Source

pub fn frame_bounds( &mut self, camera: CameraKey, bounds: Aabb, options: FramingOptions, ) -> Result<FramingOutcome, LookupError>

Fits a perspective camera to world-space bounds without preparing or rendering.

The camera is moved so the projected AABB fits the requested viewport fill and margin. This mutates scene camera state and marks the camera transform dirty; it does not prepare renderer resources, upload GPU data, fetch assets, or render a frame.

This writes crate::PerspectiveCamera::aspect from FramingOptions::viewport. Any pre-existing aspect on the camera is ignored so the solved camera pose matches the actual target viewport.

§Examples
use scena::{Aabb, FramingOptions, OrbitControls, PerspectiveCamera, Scene, Transform, Vec3};

let mut scene = Scene::new();
let camera = scene
    .add_perspective_camera(scene.root(), PerspectiveCamera::default(), Transform::default())
    .unwrap();
let bounds = Aabb::new(Vec3::new(-1.0, -0.5, -0.5), Vec3::new(1.0, 0.5, 0.5));

let framing = scene
    .frame_bounds(
        camera,
        bounds,
        FramingOptions::new()
            .isometric()
            .fill(0.72)
            .margin_px(48.0)
            .viewport(1280, 720),
    )
    .unwrap();
let controls = OrbitControls::from_framing(framing);
§Errors

Returns LookupError::CameraNotFound when camera is missing, LookupError::UnsupportedCameraType for non-perspective cameras, LookupError::InvalidBounds for empty or non-projectable bounds, and LookupError::InvalidFramingOption for invalid viewport, fill, margin, or direction options.

Source

pub fn project_world_point( &self, camera: CameraKey, world_position: Vec3, viewport_width: u32, viewport_height: u32, ) -> Result<Option<ProjectedPoint>, LookupError>

Projects a world-space point through a scene camera into viewport pixels.

Returns Ok(None) when the point is outside the camera frustum or behind the camera.

§Errors

Returns LookupError::InvalidViewport when either viewport dimension is zero and LookupError::CameraNotFound when camera is missing.

Source

pub fn bounds_for_transforms<F>( &self, node: NodeKey, transforms: &[Transform], assets: &Assets<F>, ) -> Result<Aabb, LookupError>

Computes union bounds for the same node evaluated at multiple transforms.

This is useful for replay/animation setup where a camera or floor must contain every sampled pose, not only the current transform.

§Errors

Returns LookupError::NodeNotFound when node is missing, LookupError::InvalidFramingOption when transforms is empty, and LookupError::ImportHasNoBounds when the node subtree has no renderable bounds.

Source§

impl Scene

Source

pub fn instantiate( &mut self, scene_asset: &SceneAsset, ) -> Result<SceneImport, InstantiateError>

Source

pub fn instantiate_with( &mut self, scene_asset: &SceneAsset, options: ImportOptions, ) -> Result<SceneImport, InstantiateError>

Source

pub fn instantiate_under( &mut self, parent: NodeKey, scene_asset: &SceneAsset, options: ImportOptions, ) -> Result<SceneImport>

Source§

impl Scene

Source

pub async fn import<F: AssetFetcher>( &mut self, assets: &Assets<F>, path: impl Into<AssetPath>, ) -> Result<SceneImport, ImportError>

Source

pub async fn import_with<F: AssetFetcher>( &mut self, assets: &Assets<F>, path: impl Into<AssetPath>, options: ImportOptions, ) -> Result<SceneImport, ImportError>

Source

pub fn replace_import( &mut self, import: &SceneImport, scene_asset: &SceneAsset, ) -> Result<SceneImport, InstantiateError>

Source§

impl Scene

Source

pub fn set_active_variant( &mut self, import: &SceneImport, name: Option<&str>, ) -> Result<(), LookupError>

Phase 2B step 3: activate a KHR_materials_variants variant by name, updating every imported mesh node’s MeshNode::material to the variant’s bound MaterialHandle and reverting to the primitive default for unmapped variants. Pass None to clear the active variant and restore every default material. Returns LookupError::VariantNotFound when name is not declared by the source asset; the active variant slot remains unchanged in that case.

Source§

impl Scene

Source§

impl Scene

Source

pub fn hide(&mut self, node: NodeKey) -> Result<(), LookupError>

Source

pub fn show(&mut self, node: NodeKey) -> Result<(), LookupError>

Source

pub fn toggle_visibility(&mut self, node: NodeKey) -> Result<bool, LookupError>

Source

pub fn show_only( &mut self, nodes: impl IntoIterator<Item = NodeKey>, ) -> Result<SceneVisibilitySnapshot, LookupError>

Source

pub fn isolate( &mut self, nodes: impl IntoIterator<Item = NodeKey>, ) -> Result<SceneVisibilitySnapshot, LookupError>

Source

pub fn restore_visibility( &mut self, snapshot: &SceneVisibilitySnapshot, ) -> Result<(), LookupError>

Source

pub fn ghost( &mut self, node: NodeKey, alpha: f32, ) -> Result<SceneTintSnapshot, LookupError>

Source

pub fn ghost_with_tint( &mut self, node: NodeKey, tint: Color, ) -> Result<SceneTintSnapshot, LookupError>

Source

pub fn restore_tints( &mut self, snapshot: &SceneTintSnapshot, ) -> Result<(), LookupError>

Source

pub fn fit_selection_with_assets<F>( &mut self, camera: CameraKey, nodes: impl IntoIterator<Item = NodeKey>, assets: &Assets<F>, ) -> Result<Aabb, LookupError>

Source

pub fn add_bounding_box_overlay<F>( &mut self, assets: &Assets<F>, node: NodeKey, ) -> Result<InspectionHelperReport, LookupError>

Source

pub fn add_world_axes_triad<F>( &mut self, assets: &Assets<F>, length: f32, ) -> Result<InspectionHelperReport, LookupError>

Source

pub fn add_local_axes_triad<F>( &mut self, assets: &Assets<F>, node: NodeKey, length: f32, ) -> Result<InspectionHelperReport, LookupError>

Source

pub fn inspection_toolkit_report(&self) -> InspectionToolkitReport

Source§

impl Scene

Source

pub fn add_instance_set( &mut self, parent: NodeKey, geometry: GeometryHandle, material: MaterialHandle, transform: Transform, ) -> Result<InstanceSetKey, LookupError>

Source

pub fn add_instance_set_node( &mut self, parent: NodeKey, geometry: GeometryHandle, material: MaterialHandle, transform: Transform, ) -> Result<(NodeKey, InstanceSetKey), LookupError>

Source

pub fn instance_set(&self, instance_set: InstanceSetKey) -> Option<&InstanceSet>

Source

pub fn reserve_instances( &mut self, instance_set: InstanceSetKey, additional: usize, ) -> Result<(), LookupError>

Source

pub fn push_instance( &mut self, instance_set: InstanceSetKey, transform: Transform, ) -> Result<InstanceId, LookupError>

Source

pub fn set_instance_transform( &mut self, instance_set: InstanceSetKey, instance: InstanceId, transform: Transform, ) -> Result<(), LookupError>

Source

pub fn set_instance_visible( &mut self, instance_set: InstanceSetKey, instance: InstanceId, visible: bool, ) -> Result<(), LookupError>

Source

pub fn set_instance_tint( &mut self, instance_set: InstanceSetKey, instance: InstanceId, tint: Option<Color>, ) -> Result<(), LookupError>

Source

pub fn remove_instance( &mut self, instance_set: InstanceSetKey, instance: InstanceId, ) -> Result<Option<Instance>, LookupError>

Source

pub fn clear_instances( &mut self, instance_set: InstanceSetKey, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn add_label( &mut self, parent: NodeKey, label: LabelDesc, transform: Transform, ) -> Result<LabelKey, LookupError>

Source

pub fn label(&self, label: LabelKey) -> Option<&LabelDesc>

Source

pub fn set_label_text( &mut self, label: LabelKey, text: impl Into<String>, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn light(&self, light: LightKey) -> Option<&Light>

Source

pub fn directional_light(&mut self, light: DirectionalLight) -> LightBuilder<'_>

Source

pub fn add_studio_lighting( &mut self, ) -> Result<StudioLightingHandles, LookupError>

Inserts a studio-style three-point directional rig.

The rig contains a key light, cool fill, and warm rim light. The returned handles are ordered as key, fill, and rim so callers can adjust or remove individual lights after insertion. Intensities are tuned for neutral glTF product/model-viewer scenes without over-exposing PBR metallic body materials.

This preset uses moderate intensities (key 13,500 lux, fill 4,500 lux, rim 3,500 lux). Only the key casts shadows because the renderer supports one shadowed directional light per scene.

§Errors

Returns a LookupError if the scene cannot insert one of the light nodes under the root.

Source

pub fn point_light(&mut self, light: PointLight) -> LightBuilder<'_>

Source

pub fn spot_light(&mut self, light: SpotLight) -> LightBuilder<'_>

Source

pub fn area_light(&mut self, light: AreaLight) -> LightBuilder<'_>

Source§

impl Scene

Source

pub fn set_mesh_lods( &mut self, node: NodeKey, levels: Vec<MeshLodLevel>, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn set_mesh_material( &mut self, node: NodeKey, material: MaterialHandle, ) -> Result<(), LookupError>

Source

pub fn set_node_tint( &mut self, node: NodeKey, tint: Option<Color>, ) -> Result<(), LookupError>

Source

pub fn node_tint(&self, node: NodeKey) -> Result<Option<Color>, LookupError>

Source§

impl Scene

Source§

impl Scene

Source

pub fn create_animation_mixer( &mut self, import: &SceneImport, clip_name: &str, ) -> Result<AnimationMixerKey, AnimationError>

Creates a paused mixer for a named imported animation clip.

Returns the mixer key without starting playback. For the one-call “play this now” path, use Self::play_animation_by_name.

Source

pub fn play_animation_by_name( &mut self, import: &SceneImport, clip_name: &str, ) -> Result<AnimationMixerKey, AnimationError>

Creates and starts a mixer for a named imported animation clip.

This is the one-call path for “play this clip now”. The returned mixer key can still be passed to Self::update_animation, Self::set_animation_loop_mode, Self::set_animation_speed, pause, seek, and stop helpers.

§Examples
let assets = Assets::new();
let model = assets.load_scene("machine.glb").await?;
let mut scene = Scene::new();
let import = scene.instantiate(&model)?;

let mixer = scene.play_animation_by_name(&import, "idle")?;
scene.update_animation(mixer, 1.0 / 60.0)?;
Source

pub fn create_authored_animation_mixer( &mut self, clip: AnimationClip, ) -> Result<AnimationMixerKey, AnimationError>

Creates a paused mixer for a caller-authored animation clip.

Authored clips are not tied to a glTF import lifecycle, so the mixer is not invalidated by import replacement. The host still owns ticking by calling Self::update_animation or explicit sampling with Self::seek_animation.

Source

pub fn play_authored_animation( &mut self, clip: AnimationClip, ) -> Result<AnimationMixerKey, AnimationError>

Creates and starts a mixer for a caller-authored animation clip.

Source

pub fn animation_mixer( &self, mixer: AnimationMixerKey, ) -> Result<&AnimationMixer, AnimationError>

Borrows the mixer state for a given key.

Source

pub fn play_animation( &mut self, mixer: AnimationMixerKey, ) -> Result<(), AnimationError>

Starts the mixer; resumes from the current time if it was paused.

Source

pub fn pause_animation( &mut self, mixer: AnimationMixerKey, ) -> Result<(), AnimationError>

Pauses the mixer at its current time. The next Self::play_animation resumes from the same time.

Source

pub fn stop_animation( &mut self, mixer: AnimationMixerKey, ) -> Result<(), AnimationError>

Stops the mixer and snaps the animated nodes back to time zero.

Source

pub fn seek_animation( &mut self, mixer: AnimationMixerKey, time_seconds: f32, ) -> Result<(), AnimationError>

Seeks the mixer to a specific time in seconds and applies the resulting pose to the animated nodes.

Source

pub fn set_animation_speed( &mut self, mixer: AnimationMixerKey, speed: f32, ) -> Result<(), AnimationError>

Sets the playback speed multiplier. 1.0 is real-time; negative values play the clip in reverse.

Source

pub fn set_animation_loop_mode( &mut self, mixer: AnimationMixerKey, loop_mode: AnimationLoopMode, ) -> Result<(), AnimationError>

Sets the loop mode (loop, once, ping-pong).

Source

pub fn update_animation( &mut self, mixer: AnimationMixerKey, delta_seconds: f32, ) -> Result<(), AnimationError>

Advances the mixer by delta_seconds and applies the resulting pose to animated nodes. Hosts are expected to call this once per frame for every active mixer.

Source§

impl Scene

Source

pub fn morph_weights(&self, node: NodeKey) -> Option<&[f32]>

Source

pub fn set_morph_weights( &mut self, node: NodeKey, weights: impl Into<Vec<f32>>, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn set_origin_shift(&mut self, origin_shift: Vec3)

Source

pub fn origin_shift(&self) -> Vec3

Source§

impl Scene

Source

pub fn add_particle_set( &mut self, parent: NodeKey, particles: ParticleSet, transform: Transform, ) -> Result<ParticleSetKey, LookupError>

Source

pub fn add_particle_set_node( &mut self, parent: NodeKey, particles: ParticleSet, transform: Transform, ) -> Result<(NodeKey, ParticleSetKey), LookupError>

Source

pub fn particle_set(&self, particle_set: ParticleSetKey) -> Option<&ParticleSet>

Source

pub fn set_particle_set( &mut self, particle_set: ParticleSetKey, replacement: ParticleSet, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn pick( &self, camera: CameraKey, cursor: CursorPosition, viewport: Viewport, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_with_assets<F>( &self, camera: CameraKey, cursor: CursorPosition, viewport: Viewport, assets: &Assets<F>, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_pointer( &self, camera: CameraKey, physical_x: f32, physical_y: f32, physical_width: u32, physical_height: u32, device_pixel_ratio: f32, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_and_select( &mut self, camera: CameraKey, physical_x: f32, physical_y: f32, physical_width: u32, physical_height: u32, device_pixel_ratio: f32, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_and_select_with_assets<F>( &mut self, camera: CameraKey, cursor: CursorPosition, viewport: Viewport, assets: &Assets<F>, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_and_hover( &mut self, camera: CameraKey, physical_x: f32, physical_y: f32, physical_width: u32, physical_height: u32, device_pixel_ratio: f32, ) -> Result<Option<Hit>, LookupError>

Source

pub fn pick_and_hover_with_assets<F>( &mut self, camera: CameraKey, cursor: CursorPosition, viewport: Viewport, assets: &Assets<F>, ) -> Result<Option<Hit>, LookupError>

Source

pub fn set_hover_target(&mut self, target: Option<HitTarget>)

Source

pub fn set_primary_selection_target(&mut self, target: Option<HitTarget>)

Source

pub fn interaction(&self) -> &InteractionContext

Source

pub fn interaction_mut(&mut self) -> &mut InteractionContext

Source§

impl Scene

Source

pub fn remove_node(&mut self, node: NodeKey) -> Result<(), LookupError>

Removes node and its descendants from the scene graph.

The root node is permanent and cannot be removed. Removing a subtree also drops node-owned cameras, lights, labels, instance sets, bounds, morph weights, skin bindings, anchors, measurements, and connectors that point at the removed nodes.

Source

pub fn remove_import(&mut self, import: &SceneImport) -> Result<(), LookupError>

Removes every root owned by an import and marks the import stale.

Source§

impl Scene

Source

pub fn skin_binding(&self, node: NodeKey) -> Option<&SceneSkinBinding>

Source

pub fn skin_matrices(&self, node: NodeKey) -> Option<Vec<SkinningMatrix>>

Source

pub fn set_skin_binding( &mut self, node: NodeKey, binding: SceneSkinBinding, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn set_transform( &mut self, node: NodeKey, transform: Transform, ) -> Result<(), LookupError>

Source

pub fn set_transforms( &mut self, transforms: &[(NodeKey, Transform)], ) -> Result<(), LookupError>

Source

pub fn world_transform(&self, node: NodeKey) -> Option<Transform>

Source§

impl Scene

Source

pub fn camera_node(&self, camera: CameraKey) -> Option<NodeKey>

Returns the scene node that owns a camera descriptor.

Source

pub fn frame( &mut self, camera: CameraKey, bounds: Aabb, ) -> Result<(), LookupError>

Frames bounds with the selected camera and tightens the camera depth range.

Source

pub fn add_default_camera(&mut self) -> Result<CameraKey, LookupError>

Adds a perspective camera under the root and makes it active.

Source

pub fn with_default_camera() -> Result<(Self, CameraKey), LookupError>

Convenience constructor returning a fresh Scene plus a default active camera in one call. The renderer-as-library analog of Three.js’s new THREE.Scene() + camera one-liner: callers who only need a default perspective camera framed at z=2 can drop the two-step Scene::new() + add_default_camera() boilerplate. Closes scena-api-ergonomics-reviewer Phase 6 finding F1.

Source

pub fn frame_import( &mut self, camera: CameraKey, import: &SceneImport, ) -> Result<(), LookupError>

Frames the world-space bounds of an imported scene.

Source

pub fn frame_all(&mut self, camera: CameraKey) -> Result<(), LookupError>

Frames all currently visible mesh bounds known to the scene.

Source

pub fn frame_all_with_assets<F>( &mut self, camera: CameraKey, assets: &Assets<F>, ) -> Result<(), LookupError>

Frames all visible mesh and instance bounds, resolving direct geometry handles through Assets.

Source

pub fn frame_all_with_overlays<F>( &mut self, camera: CameraKey, assets: &Assets<F>, viewport_width: u32, viewport_height: u32, ) -> Result<FramingOutcome, LookupError>

Frames visible scene content plus overlay anchors with enough viewport margin for screen-aligned label glyphs.

This is intended for documentation, callout, and measurement captures where the generated leader lines are part of the scene bounds but the label glyphs are screen-space billboards. The helper keeps the camera solve geometric and only reserves pixel margin derived from visible label metrics.

Source

pub fn frame_node( &mut self, camera: CameraKey, node: NodeKey, ) -> Result<(), LookupError>

Frames the world-space bounds of a node and any bounded descendants.

Source

pub fn frame_node_with_assets<F>( &mut self, camera: CameraKey, node: NodeKey, assets: &Assets<F>, ) -> Result<(), LookupError>

Frames a node or bounded descendants, resolving direct geometry handles through Assets.

Source

pub fn node_world_bounds<F>( &self, node: NodeKey, assets: &Assets<F>, ) -> Result<Option<Aabb>, LookupError>

Returns the world-space bounds for a node subtree, including geometry resolved through Assets.

Source

pub fn world_distance(&self, a: NodeKey, b: NodeKey) -> Result<f32, LookupError>

Returns the distance between two node origins in world space.

Source

pub fn look_at( &mut self, camera: CameraKey, target: NodeKey, ) -> Result<(), LookupError>

Rotates the selected camera node so its local -Z axis points at target.

Source

pub fn look_at_point( &mut self, camera: CameraKey, target_position: Vec3, ) -> Result<(), LookupError>

Rotates the selected camera node so its local -Z axis points at a world-space point.

Source

pub fn center_on( &mut self, node: NodeKey, center: Vec3, ) -> Result<(), LookupError>

Source

pub fn align_to( &mut self, node: NodeKey, transform: Transform, ) -> Result<(), LookupError>

Source

pub fn snap_anchor( &mut self, node: NodeKey, anchor: &ImportAnchor, ) -> Result<(), LookupError>

Source

pub fn fit_inside( &mut self, node: NodeKey, source: Aabb, target: Aabb, ) -> Result<(), LookupError>

Source§

impl Scene

Source

pub fn set_visible( &mut self, node: NodeKey, visible: bool, ) -> Result<(), LookupError>

Source

pub fn visible(&self, node: NodeKey) -> Option<bool>

Source

pub fn add_tag( &mut self, node: NodeKey, tag: impl Into<String>, ) -> Result<(), LookupError>

Source

pub fn remove_tag( &mut self, node: NodeKey, tag: &str, ) -> Result<bool, LookupError>

Source

pub fn has_tag(&self, node: NodeKey, tag: &str) -> bool

Source

pub fn tagged<'scene>( &'scene self, tag: &'scene str, ) -> impl Iterator<Item = NodeKey> + 'scene

Source

pub fn set_layer_mask( &mut self, node: NodeKey, mask: u64, ) -> Result<(), LookupError>

Source

pub fn layer_mask(&self, node: NodeKey) -> Option<u64>

Source

pub fn set_camera_layer_mask( &mut self, camera: CameraKey, mask: u64, ) -> Result<(), LookupError>

Source

pub fn camera_layer_mask(&self, camera: CameraKey) -> Option<u64>

Source

pub fn set_render_group( &mut self, node: NodeKey, group: i16, ) -> Result<(), LookupError>

Source

pub fn render_group(&self, node: NodeKey) -> Option<i16>

Source

pub fn set_helper_on_top( &mut self, node: NodeKey, on_top: bool, ) -> Result<(), LookupError>

Source

pub fn helper_on_top(&self, node: NodeKey) -> Option<bool>

Source§

impl Scene

Source

pub fn new() -> Self

Source

pub fn root(&self) -> NodeKey

Source

pub fn active_camera(&self) -> Option<CameraKey>

Source

pub fn set_active_camera( &mut self, camera: CameraKey, ) -> Result<(), LookupError>

Source

pub fn node(&self, node: NodeKey) -> Option<&Node>

Source

pub fn camera(&self, camera: CameraKey) -> Option<&Camera>

Source

pub fn add_empty( &mut self, parent: NodeKey, transform: Transform, ) -> Result<NodeKey, LookupError>

Source

pub fn add_renderable( &mut self, parent: NodeKey, primitives: Vec<Primitive>, transform: Transform, ) -> Result<NodeKey, LookupError>

Source

pub fn mesh( &mut self, geometry: GeometryHandle, material: MaterialHandle, ) -> MeshBuilder<'_>

Starts a mesh-node builder under the scene root.

Use MeshBuilder::parent and MeshBuilder::transform to override the default root parent and identity transform, then call MeshBuilder::add to insert the node.

let _ = scene.mesh(geometry, texture);
Source

pub fn model(&mut self, model: ModelHandle) -> ModelBuilder<'_>

Starts a model-node builder under the scene root.

Use ModelBuilder::parent and ModelBuilder::transform to override the default root parent and identity transform, then call ModelBuilder::add to insert the node.

Source

pub fn add_perspective_camera( &mut self, parent: NodeKey, camera: PerspectiveCamera, transform: Transform, ) -> Result<CameraKey, LookupError>

Source

pub fn add_orthographic_camera( &mut self, parent: NodeKey, camera: OrthographicCamera, transform: Transform, ) -> Result<CameraKey, LookupError>

Trait Implementations§

Source§

impl Debug for Scene

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Scene

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scene

§

impl !Sync for Scene

§

impl Freeze for Scene

§

impl Send for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

§

impl UnwindSafe for Scene

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,