Scene

Struct Scene 

Source
pub struct Scene {
    pub worldspace: Space,
    pub children: Vec<Arc<RwLock<dyn GameObject>>>,
    pub main_camera: Option<Arc<RwLock<dyn Camera>>>,
}
Expand description

A scene in which GameObjects can exist.

Fields§

§worldspace: Space§children: Vec<Arc<RwLock<dyn GameObject>>>§main_camera: Option<Arc<RwLock<dyn Camera>>>

Implementations§

Source§

impl Scene

Source

pub fn new(worldspace: Option<Space>) -> Arc<RwLock<Self>>

Create a new Scene.

§Arguments
  • worldspace - The mathematical space off of which you will work.
§Examples
let scene = Scene::new(None); // Creates a new scene with a default worldspace.
Source

pub fn set_main_camera(&mut self, main_camera: Arc<RwLock<impl Camera>>)

Sets the main camera of the Scene.

§Arguments
  • main_camera - The new main camera.
Source

pub fn spawn_script_cores(&self, spawner: Spawner)

[backend] Spawns the core scripts. i.e. Spawn start and frame.

Source

pub fn spawn_script_handlers( &self, spawner: Spawner, event: Event<'static, UserEvent<Arc<dyn Any + Send + Sync>>>, )

[backend] Spawns the event_handler of the scripts.

Source

pub fn render( &self, this: Arc<RwLock<Scene>>, frame_system: &mut FrameSystem, image_num: usize, acquire_future: SwapchainAcquireFuture<Window>, previous_frame_end: &mut Option<Box<dyn GpuFuture>>, ) -> Box<dyn GpuFuture>

[backend] Renders the scene.

Source

pub fn build_space(&mut self) -> Matrix4<f32>

Trait Implementations§

Source§

impl Clone for Scene

Source§

fn clone(&self) -> Scene

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Scene

Source§

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

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

impl Drawable for Scene

Source§

fn add_to_draw_pass_manager(&self, draw_pass_manager: &mut DrawPassManager)

Adds self’s visible characteristics and its children to the draw pass.
Source§

fn load_into_managers( &self, this: ParentWrapper, draw_pass_manager: &mut DrawPassManager, lighting_pass_manager: &mut LightingPassManager, )

Adds self’s relevant characteristics and its children to the pass managers.
Source§

fn add_triangle_mesh(&mut self, mesh: Arc<TriangleMesh>) -> Result<(), ()>

Adds a triangle mesh to the Drawable struct
Source§

fn get_visible(&self) -> bool

Checks if an object is visible
Source§

fn get_triangle_mesh(&self) -> Vec<Arc<TriangleMesh>>

Source§

fn get_vertex_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Vertex]>>>>

Source§

fn get_normals_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Normal]>>>>

Source§

fn get_texture_indices_buffer( &self, ) -> Vec<Option<Arc<CpuAccessibleBuffer<[TextureIndex]>>>>

Source§

impl Named for Scene

Source§

fn get_name(&self) -> &str

Source§

impl Parent for Scene

Source§

fn get_children(&self) -> Vec<Arc<RwLock<dyn GameObject>>>

Source§

fn add_child(&mut self, child: Arc<RwLock<dyn GameObject>>)

Source§

unsafe fn remove_child( &mut self, child: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>

Safety Read more
Source§

unsafe fn replace_child( &mut self, old: Arc<RwLock<dyn GameObject>>, new: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>

Safety Read more
Source§

fn get_child_by_name( &self, name: &str, ) -> Result<Arc<RwLock<dyn GameObject>>, &str>

Auto Trait Implementations§

§

impl Freeze for Scene

§

impl RefUnwindSafe for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnwindSafe for Scene

Blanket Implementations§

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Content for T

Source§

fn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>

Builds a pointer to this type from a raw pointer.
Source§

fn is_size_suitable(size: usize) -> bool

Returns true if the size is suitable to store a type like this.
Source§

fn indiv_size() -> usize

Returns the size of an individual element.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> SafeBorrow<T> for T

Source§

impl<T, A> Typed<T> for A
where T: Construct<A>,