pub struct Circle { /* private fields */ }
Expand description

A circle 2D geometry which can be rendered using a camera created by Camera::new_2d.

Implementations§

source§

impl Circle

source

pub fn new( context: &Context, center: impl Into<PhysicalPoint>, radius: f32 ) -> Self

Constructs a new circle geometry.

source

pub fn set_radius(&mut self, radius: f32)

Set the radius of the circle.

source

pub fn radius(&self) -> f32

Get the radius of the circle.

source

pub fn set_center(&mut self, center: impl Into<PhysicalPoint>)

Set the center of the circle.

source

pub fn center(&self) -> PhysicalPoint

Get the center of the circle.

Methods from Deref<Target = Mesh>§

source

pub fn transformation(&self) -> Mat4

Returns the local to world transformation applied to this mesh.

source

pub fn set_transformation(&mut self, transformation: Mat4)

Set the local to world transformation applied to this mesh. If any animation method is set using Self::set_animation, the transformation from that method is applied before this transformation.

source

pub fn set_animation( &mut self, animation: impl Fn(f32) -> Mat4 + Send + Sync + 'static )

Specifies a function which takes a time parameter as input and returns a transformation that should be applied to this mesh at the given time. To actually animate this mesh, call Geometry::animate at each frame which in turn evaluates the animation function defined by this method. This transformation is applied first, then the local to world transformation defined by Self::set_transformation.

source

pub fn vertex_count(&self) -> u32

Returns the number of vertices in this mesh.

source

pub fn update_positions(&mut self, positions: &[Vector3<f32>])

Updates the vertex positions of the mesh.

§Panics

Panics if the number of positions does not match the number of vertices in the mesh.

source

pub fn update_normals(&mut self, normals: &[Vector3<f32>])

Updates the vertex normals of the mesh.

§Panics

Panics if the number of normals does not match the number of vertices in the mesh.

Trait Implementations§

source§

impl Deref for Circle

§

type Target = Mesh

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for Circle

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Geometry for Circle

source§

fn draw( &self, camera: &Camera, program: &Program, render_states: RenderStates, attributes: FragmentAttributes )

Draw this geometry.
source§

fn vertex_shader_source( &self, required_attributes: FragmentAttributes ) -> String

Returns the vertex shader source for this geometry given that the fragment shader needs the given vertex attributes.
source§

fn id(&self, required_attributes: FragmentAttributes) -> u16

Returns a unique ID for each variation of the shader source returned from Geometry::vertex_shader_source. Read more
source§

fn render_with_material( &self, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] )

Render the geometry with the given Material. Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method. Use an empty array for the lights argument, if the material does not require lights to be rendered.
source§

fn render_with_effect( &self, material: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> )

Render the geometry with the given Effect. Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method. Use an empty array for the lights argument, if the material does not require lights to be rendered.
source§

fn aabb(&self) -> AxisAlignedBoundingBox

Returns the AxisAlignedBoundingBox for this geometry in the global coordinate system.
source§

fn animate(&mut self, time: f32)

For updating the animation of this geometry if it is animated, if not, this method does nothing. The time parameter should be some continious time, for example the time since start.
source§

impl<'a> IntoIterator for &'a Circle

§

type Item = &'a dyn Geometry

The type of the elements being iterated over.
§

type IntoIter = Once<&'a dyn Geometry>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

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.