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

source

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(),
        }
    }
source

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(),
        }
    }
source

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> 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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V