Struct tiny_game_framework::Circle
source · pub struct Circle {
pub iterations: i32,
pub radius: f32,
pub color: Vec4,
}
Fields§
§iterations: i32
§radius: f32
§color: Vec4
Implementations§
source§impl Circle
impl Circle
sourcepub fn new(iterations: i32, radius: f32, color: Vec4) -> Self
pub fn new(iterations: i32, radius: f32, color: Vec4) -> Self
Examples found in repository?
examples/verlet_physics.rs (line 127)
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
pub fn new(p: Vec3, name: &str, renderer: &mut Renderer, radius: f32) -> Self {
let n = Vec3::ZERO;
let circle = Circle::new(7, radius / 250.0, vec4(rand_betw(0.0, 1.0), rand_betw(0.0, 1.0), rand_betw(0.0, 1.0), 1.0));
circle.add_to_renderer(name, renderer);
renderer.get_mesh_mut(name).unwrap().rotation = Quat::from_euler(EulerRot::XYZ, 0.0, 0.0, rand_betw(0.0, 2.0*std::f32::consts::PI));
Self {
p,
op: p,
v: n,
r: radius,
name: name.to_string(),
}
}
sourcepub fn add_to_renderer(&self, name: &str, renderer: &mut Renderer)
pub fn add_to_renderer(&self, name: &str, renderer: &mut Renderer)
Examples found in repository?
examples/verlet_physics.rs (line 128)
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
pub fn new(p: Vec3, name: &str, renderer: &mut Renderer, radius: f32) -> Self {
let n = Vec3::ZERO;
let circle = Circle::new(7, radius / 250.0, vec4(rand_betw(0.0, 1.0), rand_betw(0.0, 1.0), rand_betw(0.0, 1.0), 1.0));
circle.add_to_renderer(name, renderer);
renderer.get_mesh_mut(name).unwrap().rotation = Quat::from_euler(EulerRot::XYZ, 0.0, 0.0, rand_betw(0.0, 2.0*std::f32::consts::PI));
Self {
p,
op: p,
v: n,
r: radius,
name: name.to_string(),
}
}
pub fn mesh(&self) -> Mesh
Auto Trait Implementations§
impl Freeze for Circle
impl RefUnwindSafe for Circle
impl Send for Circle
impl Sync for Circle
impl Unpin for Circle
impl UnwindSafe for Circle
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