pub struct System<Controls: Controls> {
pub screen_size: [f32; 2],
/* private fields */
}Expand description
System handler that keeps track of Data needed for the shaders struct Global.
Fields§
§screen_size: [f32; 2]Screen Size used within the shaders.
Implementations§
Source§impl<Controls> System<Controls>where
Controls: Controls,
impl<Controls> System<Controls>where
Controls: Controls,
Sourcepub fn bind_group(&self) -> &BindGroup
pub fn bind_group(&self) -> &BindGroup
Returns a reference too wgpu::BindGroup.
Sourcepub fn controls_mut(&mut self) -> &mut Controls
pub fn controls_mut(&mut self) -> &mut Controls
Returns a mutable reference too [Controls].
Sourcepub fn new(
renderer: &mut GpuRenderer,
projection: Projection,
controls: Controls,
screen_size: [f32; 2],
manual_view: Mat4,
manual_scale: f32,
) -> Self
pub fn new( renderer: &mut GpuRenderer, projection: Projection, controls: Controls, screen_size: [f32; 2], manual_view: Mat4, manual_scale: f32, ) -> Self
Creates a new System
Sourcepub fn projection(&self) -> Mat4
pub fn projection(&self) -> Mat4
Returns the Projection Matrix 4x4.
Sourcepub fn set_controls(&mut self, controls: Controls) -> Controls
pub fn set_controls(&mut self, controls: Controls) -> Controls
Sets the Camera controls to a new controls.
Sourcepub fn set_projection(&mut self, projection: Projection)
pub fn set_projection(&mut self, projection: Projection)
Sets Camera Project to a new Projection.
Sourcepub fn set_manual_view(&mut self, view: Mat4, scale: f32)
pub fn set_manual_view(&mut self, view: Mat4, scale: f32)
Sets Manual to a new View and Scale.
Sourcepub fn manual_view(&self) -> Mat4
pub fn manual_view(&self) -> Mat4
Returns Manual views Matrix 4x4.
Sourcepub fn mut_manual_view(&mut self) -> &mut Mat4
pub fn mut_manual_view(&mut self) -> &mut Mat4
Returns mutable reference to Manual views Matrix 4x4.
Sourcepub fn manual_scale(&self) -> f32
pub fn manual_scale(&self) -> f32
Returns Manual Scale.
Sourcepub fn mut_manual_scale(&mut self) -> &mut f32
pub fn mut_manual_scale(&mut self) -> &mut f32
Returns mutable reference to Manual Scale.
Sourcepub fn update(&mut self, renderer: &GpuRenderer, frame_time: &FrameTime)
pub fn update(&mut self, renderer: &GpuRenderer, frame_time: &FrameTime)
Updates the GPU’s shader struct Global with new Time and new changes.
Sourcepub fn update_screen(&mut self, renderer: &GpuRenderer, screen_size: [f32; 2])
pub fn update_screen(&mut self, renderer: &GpuRenderer, screen_size: [f32; 2])
Updates the GPU’s shader struct Global with new screen size information.
Sourcepub fn projected_world_to_screen(
&self,
camera_type: CameraType,
bounds: &Bounds,
) -> Vec4
pub fn projected_world_to_screen( &self, camera_type: CameraType, bounds: &Bounds, ) -> Vec4
Used to convert bounds information from World into Screen locations with view.
Sourcepub fn world_to_screen(&self, camera_type: CameraType, bounds: &Bounds) -> Vec4
pub fn world_to_screen(&self, camera_type: CameraType, bounds: &Bounds) -> Vec4
Used to convert bounds information from World into Screen locations without view.
Auto Trait Implementations§
impl<Controls> !Freeze for System<Controls>
impl<Controls> !RefUnwindSafe for System<Controls>
impl<Controls> Send for System<Controls>where
Controls: Send,
impl<Controls> Sync for System<Controls>where
Controls: Sync,
impl<Controls> Unpin for System<Controls>where
Controls: Unpin,
impl<Controls> !UnwindSafe for System<Controls>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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