pub struct GridRenderer {
pub enabled: bool,
pub cell_size: f32,
pub major_every: u32,
pub color_minor: Vec4,
pub color_major: Vec4,
pub color_origin: Vec4,
pub fade_start: f32,
pub fade_end: f32,
pub y_plane: f32,
}Expand description
Configuration and rendering logic for the infinite editor grid.
Fields§
§enabled: bool§cell_size: f32§major_every: u32§color_minor: Vec4§color_major: Vec4§color_origin: Vec4§fade_start: f32§fade_end: f32§y_plane: f32Implementations§
Source§impl GridRenderer
impl GridRenderer
pub fn new() -> Self
Sourcepub fn fade_alpha(&self, distance: f32) -> f32
pub fn fade_alpha(&self, distance: f32) -> f32
Compute alpha fade factor at a given distance from the camera.
Sourcepub fn build_lines(
&self,
camera_pos: Vec3,
half_extent: f32,
) -> Vec<(Vec3, Vec3, Vec4)>
pub fn build_lines( &self, camera_pos: Vec3, half_extent: f32, ) -> Vec<(Vec3, Vec3, Vec4)>
Returns a list of grid lines within the visible region. Each line is (start: Vec3, end: Vec3, color: Vec4).
Sourcepub fn render_ascii(&self, width: usize, height: usize) -> String
pub fn render_ascii(&self, width: usize, height: usize) -> String
Render grid as ASCII art for debug/console output.
Trait Implementations§
Source§impl Clone for GridRenderer
impl Clone for GridRenderer
Source§fn clone(&self) -> GridRenderer
fn clone(&self) -> GridRenderer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridRenderer
impl Debug for GridRenderer
Auto Trait Implementations§
impl Freeze for GridRenderer
impl RefUnwindSafe for GridRenderer
impl Send for GridRenderer
impl Sync for GridRenderer
impl Unpin for GridRenderer
impl UnsafeUnpin for GridRenderer
impl UnwindSafe for GridRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.