pub struct Sprites { /* private fields */ }
Expand description
A set of sprites, ie. a set of quads that orients itself towards the camera.
The sprites will always orient themselves towards the camera, but if a direction is specified, the sprite normals will also always be orthogonal to that direction. For example, if the up direction is specified, the sprites will rotate around the up direction trying to face the camera. Sprites are also known as billboards in the case where no direction is specified.
Implementations§
Source§impl Sprites
impl Sprites
Sourcepub fn new(context: &Context, centers: &[Vec3], direction: Option<Vec3>) -> Self
pub fn new(context: &Context, centers: &[Vec3], direction: Option<Vec3>) -> Self
Create a new set of Sprites with the given centers. The centers also determines the number of sprites. The sprites will always orient themselves towards the camera, but if a direction is specified, the sprite normals will always be orthogonal to that direction.
Sourcepub fn transformation(&self) -> Mat4
pub fn transformation(&self) -> Mat4
Returns the local to world transformation applied to all sprites.
Sourcepub fn set_transformation(&mut self, transformation: Mat4)
pub fn set_transformation(&mut self, transformation: Mat4)
Set the local to world transformation applied to all sprites.
Sourcepub fn set_direction(&mut self, direction: Option<Vec3>)
pub fn set_direction(&mut self, direction: Option<Vec3>)
Set a direction the sprite normals are always orthogonal to.
Sourcepub fn set_centers(&mut self, centers: &[Vec3])
pub fn set_centers(&mut self, centers: &[Vec3])
Set the centers of the sprites. The centers also determines the number of sprites.
Trait Implementations§
Source§impl Geometry for Sprites
impl Geometry for Sprites
Source§fn draw(
&self,
viewer: &dyn Viewer,
program: &Program,
render_states: RenderStates,
)
fn draw( &self, viewer: &dyn Viewer, program: &Program, render_states: RenderStates, )
Source§fn vertex_shader_source(&self) -> String
fn vertex_shader_source(&self) -> String
Source§fn id(&self) -> GeometryId
fn id(&self) -> GeometryId
Geometry::vertex_shader_source
. Read moreSource§fn render_with_material(
&self,
material: &dyn Material,
viewer: &dyn Viewer,
lights: &[&dyn Light],
)
fn render_with_material( &self, material: &dyn Material, viewer: &dyn Viewer, lights: &[&dyn Light], )
lights
argument, if the material does not require lights to be rendered.Source§fn render_with_effect(
&self,
material: &dyn Effect,
viewer: &dyn Viewer,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>,
)
fn render_with_effect( &self, material: &dyn Effect, viewer: &dyn Viewer, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>>, )
lights
argument, if the material does not require lights to be rendered.