Trait NodeTrait

Source
pub trait NodeTrait:
    BaseNodeTrait
    + Reflect
    + Visit
    + ComponentProvider {
Show 14 methods // Required methods fn local_bounding_box(&self) -> AxisAlignedBoundingBox; fn world_bounding_box(&self) -> AxisAlignedBoundingBox; fn id(&self) -> Uuid; // Provided methods fn on_removed_from_graph(&mut self, graph: &mut Graph) { ... } fn on_unlink(&mut self, graph: &mut Graph) { ... } fn sync_native( &self, self_handle: Handle<Node>, context: &mut SyncContext<'_, '_>, ) { ... } fn on_global_transform_changed( &self, new_global_transform: &Matrix4<f32>, context: &mut SyncContext<'_, '_>, ) { ... } fn on_local_transform_changed(&self, context: &mut SyncContext<'_, '_>) { ... } fn is_alive(&self) -> bool { ... } fn update(&mut self, context: &mut UpdateContext<'_>) { ... } fn collect_render_data(&self, ctx: &mut RenderContext<'_>) -> RdcControlFlow { ... } fn should_be_rendered(&self, frustum: Option<&Frustum>) -> bool { ... } fn debug_draw(&self, ctx: &mut SceneDrawingContext) { ... } fn validate(&self, scene: &Scene) -> Result<(), String> { ... }
}
Expand description

A main trait for any scene graph node.

Required Methods§

Source

fn local_bounding_box(&self) -> AxisAlignedBoundingBox

Returns axis-aligned bounding box in local space of the node.

Source

fn world_bounding_box(&self) -> AxisAlignedBoundingBox

Returns axis-aligned bounding box in world space of the node.

§Important notes

World bounding box will become valid only after first update call of the parent scene. It is because to calculate world bounding box we must get world transform first, but it can be calculated with a knowledge of parent world transform, so node on its own cannot know its world bounding box without additional information.

Source

fn id(&self) -> Uuid

Returns actual type id. It will be used for serialization, the type will be saved together with node’s data allowing you to create correct node instance on deserialization.

Provided Methods§

Source

fn on_removed_from_graph(&mut self, graph: &mut Graph)

Gives an opportunity to perform clean up after the node was extracted from the scene graph (or deleted).

The method is called when the node was detached from its parent node.

Source

fn sync_native( &self, self_handle: Handle<Node>, context: &mut SyncContext<'_, '_>, )

Synchronizes internal state of the node with components of scene graph. It has limited usage and mostly allows you to sync the state of backing entity with the state of the node. For example the engine use it to sync native rigid body properties after some property was changed in the crate::scene::rigidbody::RigidBody node.

Source

fn on_global_transform_changed( &self, new_global_transform: &Matrix4<f32>, context: &mut SyncContext<'_, '_>, )

Called when node’s global transform changes.

Source

fn on_local_transform_changed(&self, context: &mut SyncContext<'_, '_>)

Called when node’s local transform changed.

Source

fn is_alive(&self) -> bool

The methods is used to manage lifetime of scene nodes, depending on their internal logic.

Source

fn update(&mut self, context: &mut UpdateContext<'_>)

Updates internal state of the node.

Source

fn collect_render_data(&self, ctx: &mut RenderContext<'_>) -> RdcControlFlow

Allows the node to emit a set of render data. This is a high-level rendering method which can only do culling and provide render data. Render data is just a surface (vertex + index buffers) and a material.

Source

fn should_be_rendered(&self, frustum: Option<&Frustum>) -> bool

Checks if the node should be rendered or not. A node should be rendered if it is enabled, visible and (optionally) is inside some viewing frustum.

Source

fn debug_draw(&self, ctx: &mut SceneDrawingContext)

Allows the node to draw simple shapes to visualize internal data structures for debugging purposes.

Source

fn validate(&self, scene: &Scene) -> Result<(), String>

Validates internal state of a scene node. It can check handles validity, if a handle “points” to a node of particular type, if node’s parameters are in range, etc. It’s main usage is to provide centralized diagnostics for scene graph.

Implementors§

Source§

impl NodeTrait for AnimationBlendingStateMachine

Source§

impl NodeTrait for AnimationPlayer

Source§

impl NodeTrait for Camera

Source§

impl NodeTrait for fyrox_impl::scene::collider::Collider

Source§

impl NodeTrait for Decal

Source§

impl NodeTrait for fyrox_impl::scene::dim2::collider::Collider

Source§

impl NodeTrait for fyrox_impl::scene::dim2::joint::Joint

Source§

impl NodeTrait for Rectangle

Source§

impl NodeTrait for fyrox_impl::scene::dim2::rigidbody::RigidBody

Source§

impl NodeTrait for fyrox_impl::scene::joint::Joint

Source§

impl NodeTrait for DirectionalLight

Source§

impl NodeTrait for PointLight

Source§

impl NodeTrait for SpotLight

Source§

impl NodeTrait for Mesh

Source§

impl NodeTrait for NavigationalMesh

Source§

impl NodeTrait for ParticleSystem

Source§

impl NodeTrait for Pivot

Source§

impl NodeTrait for Ragdoll

Source§

impl NodeTrait for fyrox_impl::scene::rigidbody::RigidBody

Source§

impl NodeTrait for Listener

Source§

impl NodeTrait for Sound

Source§

impl NodeTrait for Sprite

Source§

impl NodeTrait for Terrain

Source§

impl NodeTrait for TileMap