pub struct Imposters { /* private fields */ }
Expand description
A level-of-detail technique to replace rendering of high-poly meshes. Should only be used where details cannot be seen, for example when the objects are far away. A set of objects are rendered from different angles into a set of textures and the textures are then rendered continuously instead of the expensive objects.
Implementations§
source§impl Imposters
impl Imposters
sourcepub fn new(
context: &Context,
positions: &[Vec3],
objects: impl IntoIterator<Item = impl Object> + Clone,
lights: &[&dyn Light],
max_texture_size: u32
) -> Self
pub fn new( context: &Context, positions: &[Vec3], objects: impl IntoIterator<Item = impl Object> + Clone, lights: &[&dyn Light], max_texture_size: u32 ) -> Self
Constructs a new Imposters and render the imposter texture from the given objects with the given lights. The imposters are placed at the given positions.
sourcepub fn set_positions(&mut self, positions: &[Vec3])
pub fn set_positions(&mut self, positions: &[Vec3])
Set the positions of the imposters.
sourcepub fn update_texture(
&mut self,
objects: impl IntoIterator<Item = impl Object> + Clone,
lights: &[&dyn Light],
max_texture_size: u32
)
pub fn update_texture( &mut self, objects: impl IntoIterator<Item = impl Object> + Clone, lights: &[&dyn Light], max_texture_size: u32 )
Render the imposter texture from the given objects with the given lights. Use this if you want to update the look of the imposters.
Methods from Deref<Target = Sprites>§
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 Imposters
impl Geometry for Imposters
source§fn draw(
&self,
camera: &Camera,
program: &Program,
render_states: RenderStates,
attributes: FragmentAttributes
)
fn draw( &self, camera: &Camera, program: &Program, render_states: RenderStates, attributes: FragmentAttributes )
source§fn vertex_shader_source(
&self,
required_attributes: FragmentAttributes
) -> String
fn vertex_shader_source( &self, required_attributes: FragmentAttributes ) -> String
source§fn id(&self, required_attributes: FragmentAttributes) -> u16
fn id(&self, required_attributes: FragmentAttributes) -> u16
Geometry::vertex_shader_source
. Read moresource§fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
)
fn render_with_material( &self, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] )
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<'_>>
)
fn render_with_effect( &self, material: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> )
lights
argument, if the material does not require lights to be rendered.source§fn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
source§impl<'a> IntoIterator for &'a Imposters
impl<'a> IntoIterator for &'a Imposters
source§impl Object for Imposters
impl Object for Imposters
source§fn render(&self, camera: &Camera, lights: &[&dyn Light])
fn render(&self, camera: &Camera, lights: &[&dyn Light])
lights
argument, if the objects does not require lights to be rendered.
Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.