pub struct Engine {
pub camera: Arc<Mutex<PerspectiveCamera>>,
/* private fields */
}Expand description
High-level engine structure for building and rendering scenes.
Handles Vulkan context, swapchain, render pass, rendering pipeline, inputs, and the physics simulation loop.
Fields§
§camera: Arc<Mutex<PerspectiveCamera>>Implementations§
Source§impl Engine
impl Engine
Sourcepub fn set_light(&mut self, pos: [f32; 3], color: [f32; 3], intensity: f32)
pub fn set_light(&mut self, pos: [f32; 3], color: [f32; 3], intensity: f32)
Set the sun in scene
Sourcepub fn add_cube(&mut self, transform: Transform, mat: &Material, phys: &Physics)
pub fn add_cube(&mut self, transform: Transform, mat: &Material, phys: &Physics)
Adding a cube to the scene.
§Example
engine.add_cube(
Transform {
..Default::default()
},
&Material::standard()
.build(),
&Physics::default()
.collision(0.2), // type, if collision < 0.5 => Box, collision > 0.5 => Sphere
);Sourcepub fn add_sphere(
&mut self,
transform: Transform,
mat: &Material,
phys: &Physics,
)
pub fn add_sphere( &mut self, transform: Transform, mat: &Material, phys: &Physics, )
Adding a sphere to the scene.
§Example
engine.add_sphere(
Transform {
..Default::default()
},
&Material::standard()
.build(),
&Physics::default()
.collision(0.8), // type, if collision < 0.5 => Box, collision > 0.5 => Sphere
);Sourcepub fn set_scene_shader(&mut self, shader: ShaderType)
pub fn set_scene_shader(&mut self, shader: ShaderType)
Set a scene-wide shader override. All objects will use this shader.
Sourcepub fn clear_scene_shader(&mut self)
pub fn clear_scene_shader(&mut self)
Clear the scene-wide shader override. Objects will use their per-object shader.
Sourcepub fn set_scene_physic(&mut self, shader: ComputeShaderType)
pub fn set_scene_physic(&mut self, shader: ComputeShaderType)
Set a scene-wide shader override. All objects will use this shader.
Sourcepub fn clear_scene_physic(&mut self)
pub fn clear_scene_physic(&mut self)
Clear the scene-wide shader override. Objects will use their per-object shader.
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl !Send for Engine
impl !Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl !UnwindSafe for Engine
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.