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,
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.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, viewer: &dyn Viewer, lights: &[&dyn Light])
fn render(&self, viewer: &dyn Viewer, 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.