Struct rin_scene::scene::Scene[][src]

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.

Implementations

impl Scene[src]

pub fn window(&self) -> ReadGuardRef<'_, Window>[src]

pub fn window_mut(&self) -> WriteGuardRef<'_, Window>[src]

pub fn gl_renderer(&self) -> ReadGuardRef<'_, Renderer<'static>>[src]

pub fn gl_renderer_mut(&self) -> WriteGuardRef<'_, Renderer<'static>>[src]

pub fn render_surface(&self) -> Option<ReadGuardRef<'_, ScreenRenderBuffer>>[src]

pub fn viewport(&self) -> Rect<i32>[src]

pub fn event_stream(&mut self) -> StreamRc<'static, Event>[src]

pub fn priority_stream(&mut self, priority: usize) -> StreamRc<'static, Event>[src]

pub fn set_non_attended(
    &mut self,
    priority: usize,
    stream: StreamRc<'static, Event>
)
[src]

pub fn send_stream<T: Clone + Debug + 'static>(
    &self
) -> (Sender<T>, Stream<'static, T>)
[src]

pub fn events(&self) -> WriteGuardRef<'_, EventsDispatcher>[src]

pub fn set_camera<C: CameraExt + Send + 'static>(&mut self, camera: C)[src]

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

pub fn register_vertex_type<T>(&mut self) where
    T: 'static + VertexFormat + Send + Clone + Copy + Debug
[src]

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 register_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

pub fn register_builder<'a, B: Builder<'a>>(&mut self)[src]

Register a mutiny Builder

It’s only necesary to call this method if a builder type is to be used from a creation system

pub fn add<'a, B: Builder<'a>>(
    &'a mut self,
    settings: <B as Builder<'a>>::Settings
) -> B
[src]

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();

pub fn add_model(&mut self, name: &str) -> ModelBuilder<'_>[src]

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

pub fn add_child_model(
    &mut self,
    name: &str,
    parent: Entity
) -> ModelBuilder<'_>
[src]

Add a new model to the scene, as child of an exisiting entity

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

The transformation of this model will be a child of the entity passed as parameter

pub fn add_empty(&mut self, name: &str) -> EmptyBuilder<'_>[src]

Add an empty node to the scene

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

pub fn add_child_empty(
    &mut self,
    name: &str,
    parent: Entity
) -> EmptyBuilder<'_>
[src]

Add an empty node to the scene parented to another entity with a Transorfmation

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

pub fn register_mesh<T>(&mut self, geom: Mesh<T>) -> GeometryRef where
    T: 'static + VertexFormat + Send + Clone + Copy + Debug
[src]

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

The returned GeometryRef can be used as geometry for models.

pub fn register_named_mesh<T>(
    &mut self,
    geom: Mesh<T>,
    name: &str
) -> GeometryRef where
    T: 'static + VertexFormat + Send + Clone + Copy + Debug
[src]

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

pub fn add_ambient_light(
    &mut self,
    diffuse: Rgb<f32, LinearRgb>,
    specular: Rgb<f32, LinearRgb>
) -> Entity
[src]

Create an ambient light

pub fn add_directional_light<'a>(
    &'a mut self,
    name: &'a str
) -> DirectionalLightBuilder<'a, World>
[src]

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

pub fn add_spot_light<'a>(
    &'a mut self,
    name: &'a str
) -> SpotLightBuilder<'a, World>
[src]

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

pub fn add_point_light<'a>(
    &'a mut self,
    name: &'a str
) -> PointLightBuilder<'a, World>
[src]

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

pub fn add_area_light<'a>(
    &'a mut self,
    name: &'a str
) -> AreaLightBuilder<'a, World>
[src]

Create a area 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

pub fn add_image_based_light<'a>(
    &'a mut self,
    name: &'a str
) -> ImageBasedLightBuilder<'a, World>
[src]

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

pub fn update_all_transformations(&mut self)[src]

Manually update the full hierarchy of objects in the scene

pub fn register_material<M: FullMaterial + 'static>(
    &mut self,
    name: &str,
    material: M
) -> MaterialRef
[src]

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

pub fn register_shadow_material<M: FullMaterial + 'static>(
    &mut self,
    name: &str,
    material: M
) -> ShadowMaterialRef
[src]

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

pub fn find_material(&self, name: &str) -> Option<MaterialRef>[src]

Find a material by name if it exists

pub fn register_texture(&mut self, texture: Texture) -> TextureRef[src]

Register a texture to be used when setting up materials

pub fn register_texture_from_data_format<T: 'static>(
    &mut self,
    format: LoadDataFormat,
    creation_flags: TextureCreationFlags,
    data: &[T]
) -> Result<TextureRef, Error>
[src]

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

pub fn register_cubemap(&mut self, cubemap: CubeMap) -> CubemapRef[src]

pub fn register_named_cubemap(
    &mut self,
    name: &str,
    cubemap: CubeMap
) -> CubemapRef
[src]

pub fn register_image<I: Image + Clone>(
    &mut self,
    img: &I,
    creation_flags: TextureCreationFlags
) -> Result<TextureRef, Error>
[src]

Create and register a texture from a loaded image

pub fn register_named_texture_from_data_format<T: 'static>(
    &mut self,
    name: &str,
    creation_flags: TextureCreationFlags,
    format: LoadDataFormat,
    data: &[T]
) -> Result<TextureRef, Error>
[src]

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

pub fn register_named_image<I: Image + Clone>(
    &mut self,
    name: &str,
    img: &I,
    creation_flags: TextureCreationFlags
) -> Result<TextureRef, Error>
[src]

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

pub fn register_sampler(&mut self, sampler: Sampler) -> SamplerRef[src]

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

pub fn register_named_sampler(
    &mut self,
    name: &str,
    sampler: Sampler
) -> SamplerRef
[src]

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

pub fn find_texture(&self, name: &str) -> Option<TextureRef>[src]

Find a texture by it’s name

pub fn find_cubemap(&self, name: &str) -> Option<CubemapRef>[src]

Find a texture by it’s name

pub fn find_sampler(&self, name: &str) -> Option<SamplerRef>[src]

Find a texture by it’s name

pub fn load_image<P>(
    &mut self,
    path: P,
    flags: TextureCreationFlags
) -> Result<TextureRef> where
    P: AsRef<Path>, 
[src]

pub fn load_cubemap<P>(
    &mut self,
    path: P,
    flags: TextureCreationFlags
) -> Result<CubemapRef> where
    P: AsRef<Path>, 
[src]

pub fn load_equirectangular_cubemap<P>(
    &mut self,
    path: P,
    flags: TextureCreationFlags,
    color_format: ColorFormat
) -> Result<CubemapRef> where
    P: AsRef<Path>, 
[src]

pub fn load_equirectangular_levels_cubemap<P>(
    &mut self,
    paths: &[P],
    flags: TextureCreationFlags,
    color_format: ColorFormat
) -> Result<CubemapRef> where
    P: AsRef<Path>, 
[src]

pub fn reset_clock(&mut self)[src]

pub fn run_once(&mut self)[src]

Run all the systems once

pub fn run_single_threaded(&mut self)[src]

Run all the systems once without using multiple threads

pub fn run_multi_threaded(&mut self)[src]

Run all the systems once in parallel when possible

pub fn resources(&self) -> Resources<'_>[src]

Return the world resources

pub fn remove_resource<T: 'static>(&mut self) -> Option<T>[src]

Remove a resource

pub fn add_resource<T: Send + 'static>(&mut self, resource: T)[src]

Add a new resource

pub fn add_resource_thread_local<T: 'static>(&mut self, resource: T)[src]

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

pub fn resource<T: 'static>(&self) -> Option<ReadGuardRef<'_, T>>[src]

Returs a specific resource if it exists

pub fn resource_mut<T: 'static>(&self) -> Option<WriteGuardRef<'_, T>>[src]

Returs a specific resource for mutable access if it exists

pub fn resources_thread_local(&self) -> ResourcesThreadLocal<'_>[src]

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

pub fn entities_creation(&mut self) -> EntitiesCreation<'_>[src]

pub fn resources_creation(&mut self) -> ResourcesCreation<'_>[src]

pub fn debug_entities(&mut self) -> EntitiesDebug<'_>[src]

pub fn add_system<S>(&mut self, system: S) -> &mut Scene where
    S: System + 'static, 
[src]

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.

pub fn add_system_once<S>(&mut self, system: S) -> &mut Scene where
    S: SystemOnce + 'static, 
[src]

Adds a SendOnce System that will be run only once in the order it was added.

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

pub fn add_system_thread_local<S>(&mut self, system: S) -> &mut Scene where
    S: SystemThreadLocal + 'static, 
[src]

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.

pub fn add_system_once_thread_local<S>(&mut self, system: S) -> &mut Scene where
    S: SystemOnceThreadLocal + 'static, 
[src]

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.

pub fn add_creation_system<S>(&mut self, system: S) -> &mut Scene where
    S: CreationSystem + 'static, 
[src]

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

CreationSystems run alone with no other system running in parallel.

pub fn add_debug_system<S>(&mut self, system: S) -> &mut Scene where
    S: SystemDebug + 'static, 
[src]

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

SystemDebug run alone with no other system running in parallel.

pub fn add_system_with<S>(&mut self, system: S) -> SystemBuilder<'_, '_, S> where
    S: System + 'static, 
[src]

Adds a Send System with a Builder that allows to set some of the system properties like the name it’ll show up with in stats, or run conditions.

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

pub fn add_system_thread_local_with<S>(
    &mut self,
    system: S
) -> SystemBuilderThreadLocal<'_, '_, S> where
    S: SystemThreadLocal + 'static, 
[src]

Adds a SystemThreadLocal with a Builder that allows to set some of the system properties like the name it’ll show up with in stats, if it has gpu stats or it’s run conditions.

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

pub fn add_creation_system_with<S>(
    &mut self,
    system: S
) -> SystemBuilderCreation<'_, '_, S> where
    S: CreationSystem + 'static, 
[src]

Adds a CreationSystem with a Builder that allows to set some of the system properties like the name it’ll show up with in stats, if it has gpu stats or it’s run conditions.

CreationSystems run alone with no other system running in parallel.

pub fn add_update_system<U>(&mut self, system: U) -> &mut Scene where
    U: UpdateSystem + 'static, 
[src]

pub fn add_update_system_thread_local<U>(&mut self, system: U) -> &mut Scene where
    U: UpdateSystemThreadLocal + 'static, 
[src]

pub fn add_events_system<S>(&mut self, system: S) -> &mut Scene where
    S: EventsSystem + 'static, 
[src]

pub fn add_events_system_thread_local<S>(&mut self, system: S) -> &mut Scene where
    S: EventsSystemThreadLocal + 'static, 
[src]

pub fn add_render_system<R>(&mut self, system: R) -> &mut Scene where
    R: RenderSystem + 'static, 
[src]

pub fn add_barrier<B: Barrier + 'static>(&mut self) -> &mut World[src]

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.

pub fn add_component_to<'a, C: ComponentSend>(
    &mut self,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter
[src]

Adds a Send Component to an already existing Entity.

pub fn add_component_to_thread_local<'a, C: ComponentThreadLocal>(
    &mut self,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter
[src]

Adds a non Send Component to an already existing Entity.

pub fn add_child_component_to<'a, C: ComponentSend>(
    &mut self,
    parent: &Entity,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: HierarchicalStorage<'b, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter
[src]

Adds a Send Component to an already existing Entity.

pub fn add_child_component_to_thread_local<'a, C: ComponentThreadLocal>(
    &mut self,
    parent: &Entity,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: HierarchicalStorage<'b, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter
[src]

Adds a non Send Component to an already existing Entity.

pub fn add_slice_component_to<'a, C, I>(
    &mut self,
    entity: &Entity,
    component: I
) where
    C: OneToNComponentSend,
    <C as Component>::Storage: OneToNStorage<'s, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter,
    I: IntoIterator<Item = C>, 
[src]

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.

pub fn add_slice_component_to_thread_local<'a, C, I>(
    &mut self,
    entity: &Entity,
    component: I
) where
    C: OneToNComponentThreadLocal,
    <C as Component>::Storage: OneToNStorage<'s, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter,
    I: IntoIterator<Item = C>, 
[src]

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.

pub fn remove_component_from<'a, C: Component>(&mut self, entity: &Entity) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'a, C>>::Get: DebugParameter
[src]

Removes a compoenent of the specified type from an entity.

pub fn remove_entity(&mut self, entity: &Entity)[src]

Removes an Entity and all it’s compoenents.

pub fn entities(&mut self) -> Entities<'_>[src]

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

pub fn entities_and_resources(&mut self) -> (Entities<'_>, Resources<'_>)[src]

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

pub fn entities_thread_local(&mut self) -> EntitiesThreadLocal<'_>[src]

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

pub fn entities_and_resources_thread_local(
    &mut self
) -> (EntitiesThreadLocal<'_>, ResourcesThreadLocal<'_>)
[src]

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

pub fn component_for<C: Component>(&self, entity: &Entity) -> Option<Ptr<'_, C>> where
    <C as Component>::Storage: Storage<'s, C>, 
[src]

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();

pub fn component_for_mut<C: Component>(
    &self,
    entity: &Entity
) -> Option<PtrMut<'_, C>> where
    <C as Component>::Storage: Storage<'s, C>, 
[src]

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();

pub fn storage_for<'r, S>(&'r self) -> Sto<'r, S> where
    S: UnorderedData<'r> + ReadOnlyOp<'r>, 
[src]

pub fn storage_for_mut<'r, S>(&'r mut self) -> Sto<'r, S> where
    S: UnorderedData<'r>, 
[src]

pub fn render_systems_dependency_graph<P: AsRef<Path>>(&mut self, file: P)[src]

Trait Implementations

impl<'a> CreationContextExt<'a> for Scene[src]

impl<'a> EntitiesCreationExt<'a> for Scene[src]

impl<'a> EntitiesExt<'a> for Scene[src]

impl ResourcesCreationExt for Scene[src]

impl ResourcesExt for Scene[src]

impl ResourcesThreadLocalExt for Scene[src]

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

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

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

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

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

impl<'a, C> CreationContext<'a> for C where
    C: CreationContextExt<'a> + EntitiesExt<'a> + ResourcesExt + ResourcesThreadLocalExt
[src]

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

impl<T> From<T> for T[src]

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

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<'a, C> PathFollowerBuilderExt<C> for C where
    C: CreationContext<'a>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

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

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]