[][src]Struct mutiny::Scene

pub struct Scene { /* fields omitted */ }

The scene is the container for everything else in mutiny

Through it you can create other elements like models, lights... or add systems that will update those elements over time

To create a scene you need to first create a renderer and an events dispatcher. The scene will take ownership of them and run them later.

Once you have a scene you can use it to create all the entities in the application and their components.

Methods

impl Scene
[src]

Creates a new scene from a renderer and an events dispatcher

Also register the most basic components that are usually always used on any mutiny application and the main systems.

Explicitly register a vertex type

Vertex types are usually registered the first time we add a Geometry of that vertex type to the scene using add_mesh but in some special cases we might want to add geometries directly to an entity. In those cases it's necesary to call this method in order to register the corresponding components and create the renderer systems that allow to render this type of geometry

Register a component in the system

When using a new component that is not defined by mutiny but by your own application it's necesary to register it in the scene using this method

This version only accepts thread safe components (Send)

Register a component in the system

When using a new component that is not defined by mutiny but by your own application it's necesary to register it in the scene using this method

Use this version when registering components that can't be sent accross threads

Register a mutiny Bundle

A Bundle usually register it's own components and systems

You can create your own bundles implementing the Bundle trait

Add an element to the scene through it's Builder and settings

Some modules implement the Builder trait and specify a settings struct that allows to add them to the scene using this method.

For example to add load a blender file you can use:

scene.add::<mutiny::blender::Blender>()
    .load("file_path.blend")
    .unwrap();

Add a new model to the scene

This method returns a ModelBuilder that allows to set the geometry, transformation and other components of the model.

To add geometry and materials to the model they have to be registered in the scene first and the handle that we get when registering them is really what use to set that geometry or material to a model, instead of the geometry and material themselves

This allows renderers to optimize drawing by instancing models with the same geometry and to batch geometries with the same properties

Add an empty node to the scene

Other objects like models, lights... can be created as children of an empty

Adds a mesh to the system and returns a handle to the geometry

The returned GeometryRef can be used as geometry for models.

Adds a mesh with a name to the system and returns a handle to the geometry

The returned GeometryRef can be used as geometry for models.

Names are mostly useful for debugging and not considered an ID of the model

Create a directional light

This method returns a builder object that allows to set different parameter in the light before creating it.

When done setting all the parameters call build on the builder to finally create the light

Create a spot light

This method returns a builder object that allows to set different parameter in the light before creating it.

When done setting all the parameters call build on the builder to finally create the light

Create a point light

This method returns a builder object that allows to set different parameter in the light before creating it.

When done setting all the parameters call build on the builder to finally create the light

Create an imaged based light

This method returns a builder object that allows to set different parameter in the light before creating it.

When done setting all the parameters call build on the builder to finally create the light

Add a camera to the scene

Right now there can only be one camera in the scene and adding a new one will replace the old one

Add a bundle to the scene

Adding a bundle adds all the systems of that bundle.

Manually update the full hierarchy of objects in the scene

Register a new material

Takes ownership of the passed material and returns a handle to it that can be used to set it as a model material

Find a material by name if it exists

Register a texture to be used when setting up materials

Create a texture and register it from the image pixels and a format specification

Create and register a texture from a loaded image

Create a texture and register it with a name from the image pixels and a format specification

Create and register a texture with a name from a loaded image

Register a texture sampler (a texture + parameters of how it has to be used)

Register a texture sampler with a name (a texture + parameters of how it has to be used)

Find a texture by it's name

Create the renderer systems

Call this method after all the methods that might update geometry, transformations...

Usually after every other system and bundle but some systems like postprocessing might need to be inserted after the renderer

Run all the systems once

Run all the systems once without using multiple threads

Run all the systems once in parallel when possible

Return the world resources

Remove a resource

Add a new resource

Add a new resource that can't be sent across threads

Returs a specific resource if it exists

Returs a specific resource for mutable access if it exists

Returs a specific resource that can't be sent across threads if it exists

Adds a Send System that will be run in the order it was added.

Send systems will run in parallel with other Send systems and with thread local systems added in between barriers.

Adds a non Send System that will be run in the order it was added.

SystemThreadLocal will always run in the main thread but can run in parallel with Send systems.

Adds a CreationSystem that will be run in the order it was added.

CreationSystems run alone with no other system running in parallel.

Adds a SystemDebug that will be run in the order it was added.

SystemDebug run alone with no other system running in parallel.

Adds a Send System with a custom name.

Useful mostly when stats are enabeld. Only systems with name will show up in stats.

Send systems will run in parallel with other Send systems and with thread local systems added in between barriers.

Adds a SystemThreadLocal with a custom name.

Useful mostly when stats are enabeld. Only systems with name will show up in stats.

SystemThreadLocal will always run in the main thread but can run in parallel with Send systems.

Adds a SystemThreadLocal with a custom name.

Useful mostly when stats are enabeld. Only systems with name will show up in stats.

This system will have both cpu and gpu stats

SystemThreadLocal will always run in the main thread but can run in parallel with Send systems.

Adds a CreationSystem with a custom name.

Useful mostly when stats are enabeld. Only systems with name will show up in stats.

CreationSystems run alone with no other system running in parallel.

Adds a SystemDebug with a custom name and data that will be passed to the system as first parameter.

Useful mostly when stats are enabeld. Only systems with name will show up in stats.

SystemDebug run alone with no other system running in parallel.

Delimits all the systems that will run in parallel.

Only systems between barriers (or creation and debug systems) will run in parallel with each other.

Barriers allow to create groups of systems that run in parallel including thread local systems that run one by one in the main thread but in parallel with Send systems.

Adds a Send Component to an already existing Entity.

Adds a non Send Component to an already existing Entity.

Adds a Send OneToNComponent to an already existing Entity.

This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.

Adds a non Send OneToNComponent to an already existing Entity.

This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.

Removes a compoenent of the specified type from an entity.

Removes an Entity and all it's compoenents.

Returns an Entities object that allows to iterate over all the Send components of entities in this world.

Returns an EntitiesThreadLocal object that allows to iterate over all the Send and non Send components of entities in this world.

Returns a component for reading for the passed entity

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
let pos = entities.component_for::<Position>(&e1).unwrap();

Returns a component for writing for the passed entity

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
let mut pos = entities.component_for_mut::<Position>(&e1).unwrap();

Returns an iterator over all the statistics of the running systems.

This properties can be added to for example a gui to monitor the running times for each system.

Returns an iterator over all the gpu statistics of the running systems.

This properties can be added to for example a gui to monitor the running times for each system.

Returns an iterator over all the enable system properties.

This properties allow to enable and disable individual systems at run time from for example a gui.

Trait Implementations

impl CreationContext for Scene
[src]

Auto Trait Implementations

impl !Send for Scene

impl !Sync for Scene

Blanket Implementations

impl<C> CreationContext for C where
    C: CreationContext
[src]

impl<C> PathFollowerBuilder for C where
    C: CreationContext
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> SetParameter for T
[src]

Sets value as a parameter of self.

impl<T> Same for T
[src]

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 
[src]

impl<V> IntoVec for V
[src]

impl<V> IntoPnt for V
[src]

impl<B, P> IntoControlBuilder for P where
    B: BuilderFromProperty<P>, 
[src]

impl<T, U> IntoDuration for T where
    U: FromDuration<T>, 
[src]