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
impl Scene
Sourcepub fn set_main_camera(&mut self, main_camera: Arc<RwLock<impl Camera>>)
pub fn set_main_camera(&mut self, main_camera: Arc<RwLock<impl Camera>>)
Sourcepub fn spawn_script_cores(&self, spawner: Spawner)
pub fn spawn_script_cores(&self, spawner: Spawner)
[backend] Spawns the core scripts. i.e. Spawn start and frame.
Sourcepub fn spawn_script_handlers(
&self,
spawner: Spawner,
event: Event<'static, UserEvent<Arc<dyn Any + Send + Sync>>>,
)
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.
Sourcepub 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>
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.
pub fn build_space(&mut self) -> Matrix4<f32>
Trait Implementations§
Source§impl Drawable for Scene
impl Drawable for Scene
Source§fn add_to_draw_pass_manager(&self, draw_pass_manager: &mut DrawPassManager)
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,
)
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<(), ()>
fn add_triangle_mesh(&mut self, mesh: Arc<TriangleMesh>) -> Result<(), ()>
Adds a triangle mesh to the Drawable struct
Source§fn get_visible(&self) -> bool
fn get_visible(&self) -> bool
Checks if an object is visible
fn get_triangle_mesh(&self) -> Vec<Arc<TriangleMesh>>
fn get_vertex_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Vertex]>>>>
fn get_normals_buffer(&self) -> Vec<Option<Arc<CpuAccessibleBuffer<[Normal]>>>>
fn get_texture_indices_buffer( &self, ) -> Vec<Option<Arc<CpuAccessibleBuffer<[TextureIndex]>>>>
Source§impl Parent for Scene
impl Parent for Scene
fn get_children(&self) -> Vec<Arc<RwLock<dyn GameObject>>>
fn add_child(&mut self, child: Arc<RwLock<dyn GameObject>>)
Source§unsafe fn remove_child(
&mut self,
child: Arc<RwLock<dyn GameObject>>,
) -> Result<(), ()>
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<(), ()>
unsafe fn replace_child( &mut self, old: Arc<RwLock<dyn GameObject>>, new: Arc<RwLock<dyn GameObject>>, ) -> Result<(), ()>
Safety Read more
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Content for T
impl<T> Content for T
Source§fn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>
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
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
fn indiv_size() -> usize
Returns the size of an individual element.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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