pub struct Scene {
pub graph: Graph,
pub animations: AnimationContainer,
pub render_target: Option<Texture>,
pub drawing_context: SceneDrawingContext,
pub navmeshes: NavMeshContainer,
pub performance_statistics: PerformanceStatistics,
pub ambient_lighting_color: Color,
pub enabled: bool,
pub animation_machines: AnimationMachineContainer,
/* private fields */
}
Expand description
See module docs.
Fields
graph: Graph
Graph is main container for all scene nodes. It calculates global transforms for nodes,
updates them and performs all other important work. See graph
module docs for more
info.
animations: AnimationContainer
Animations container controls all animation on scene. Each animation can have tracks which
has handles to graph nodes. See animation
module docs for more info.
render_target: Option<Texture>
Texture to draw scene to. If empty, scene will be drawn on screen directly. It is useful to “embed” some scene into other by drawing a quad with this texture. This can be used to make in-game video conference - you can make separate scene with your characters and draw scene into texture, then in main scene you can attach this texture to some quad which will be used as monitor. Other usage could be previewer of models, like pictogram of character in real-time strategies, in other words there are plenty of possible uses.
drawing_context: SceneDrawingContext
Drawing context for simple graphics.
A container for navigational meshes.
performance_statistics: PerformanceStatistics
Performance statistics from last update
call.
ambient_lighting_color: Color
Color of ambient lighting.
enabled: bool
Whether the scene will be updated and rendered or not. Default is true.
This flag allowing you to build a scene manager for your game. For example,
you may have a scene for menu and one per level. Menu’s scene is persistent,
however you don’t want it to be updated and renderer while you have a level
loaded and playing a game. When you’re start playing, just set enabled
flag
to false for menu’s scene and when you need to open a menu - set it to true and
set enabled
flag to false for level’s scene.
animation_machines: AnimationMachineContainer
A container for animation blending state machines.
Implementations
sourceimpl Scene
impl Scene
sourcepub fn new() -> Self
pub fn new() -> Self
Creates new scene with single root node.
Notes
This method differs from Default trait implementation! Scene::default() creates empty graph with no nodes.
sourcepub fn remove_node(&mut self, handle: Handle<Node>)
pub fn remove_node(&mut self, handle: Handle<Node>)
Removes node from scene with all associated entities, like animations etc. This method should be used all times instead of Graph::remove_node.
Panics
Panics if handle is invalid.
sourcepub async fn resolve(&mut self, resource_manager: ResourceManager)
pub async fn resolve(&mut self, resource_manager: ResourceManager)
Synchronizes the state of the scene with external resources.
sourcepub fn set_lightmap(
&mut self,
lightmap: Lightmap
) -> Result<Option<Lightmap>, &'static str>
pub fn set_lightmap(
&mut self,
lightmap: Lightmap
) -> Result<Option<Lightmap>, &'static str>
Tries to set new lightmap to scene.
sourcepub fn update(&mut self, frame_size: Vector2<f32>, dt: f32)
pub fn update(&mut self, frame_size: Vector2<f32>, dt: f32)
Performs single update tick with given delta time from last frame. Internally it updates physics, animations, and each graph node. In most cases there is no need to call it directly, engine automatically updates all available scenes.
sourcepub fn clone<F>(
&self,
filter: &mut F
) -> (Self, FxHashMap<Handle<Node>, Handle<Node>>) where
F: FnMut(Handle<Node>, &Node) -> bool,
pub fn clone<F>(
&self,
filter: &mut F
) -> (Self, FxHashMap<Handle<Node>, Handle<Node>>) where
F: FnMut(Handle<Node>, &Node) -> bool,
Creates deep copy of a scene, filter predicate allows you to filter out nodes by your criteria.
sourcepub fn save(&mut self, region_name: &str, visitor: &mut Visitor) -> VisitResult
pub fn save(&mut self, region_name: &str, visitor: &mut Visitor) -> VisitResult
Saves scene in a specified file.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Scene
impl Send for Scene
impl !Sync for Scene
impl Unpin for Scene
impl !UnwindSafe for Scene
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<F, A>impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<F, A>impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Convert 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
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> PropertyValue for T where
T: 'static + Debug,
impl<T> PropertyValue for T where
T: 'static + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.