pub struct Lines3d {
pub vertices: Vec<Vert3dInstanced>,
pub indices: Vec<u32>,
}Expand description
Raw data defining a wireframe mesh
Fields§
§vertices: Vec<Vert3dInstanced>§indices: Vec<u32>Implementations§
Source§impl Lines3d
impl Lines3d
Sourcepub fn capsule(
index_offset: u32,
hemisphere_latitude_divisions: u16,
longitude_divisions: u16,
) -> Self
pub fn capsule( index_offset: u32, hemisphere_latitude_divisions: u16, longitude_divisions: u16, ) -> Self
Two hemispherical “caps” connected at their equators.
Intended to be scaled first and then each cap translated along the Z axis to achieve the correct capsule height.
Can also be used to render a hemisphere or a sphere by slicing the
corresponding number of indices. Note that the sphere is slightly
degenerate since there are duplicate vertices on the equator, and so the
last 2 * longitude_divisions indices will differ but the total index
count will be the same.
§Panics
Panics of hemisphere_latitude_divisions is zero or if
longitude_divisions is less than two.
Source§impl Lines3d
impl Lines3d
Sourcepub fn grid(index_offset: u32, dims: u16) -> Self
pub fn grid(index_offset: u32, dims: u16) -> Self
Produces vertices and indices for a 3D lines list arranged in a square grid in the
X/Y plane of dims by dims dimensions.
The number of vertices will be (dims + 1)^2.
The number of indices will be 4*(dims^2 + dims).
§Panics
Panics if dims is zero.
Source§impl Lines3d
impl Lines3d
Sourcepub fn hemisphere(
index_offset: u32,
latitude_divisions: u16,
longitude_divisions: u16,
) -> Self
pub fn hemisphere( index_offset: u32, latitude_divisions: u16, longitude_divisions: u16, ) -> Self
Generates a hemisphere with unit radius in the positive Z half-space
with a number of parallels equal to latitude_divisions and a number of
half-meridians equal to longitude_divisions
Source§impl Lines3d
Produces vertices and indices for a 3D lines list unit sphere (radius
$1.0$) with the given number of latitudinal divisions rounded down to the
nearest even number (ensuring the sphere always has an ‘equator’), and with
the given number of longitudinal divisions.
impl Lines3d
Produces vertices and indices for a 3D lines list unit sphere (radius $1.0$) with the given number of latitudinal divisions rounded down to the nearest even number (ensuring the sphere always has an ‘equator’), and with the given number of longitudinal divisions.
The number of parallels will be equal to latitude_divisions - (latitude_divisions % 2) - 1 and the number of meridians will be equal to
longitude_divisions.
There will be 2 + (latitude_divisions-1) * longitude_divisions
vertices and 4 * longitude_divisions * latitude_divisions - 2 * longitude_divisions indices.
The first 4 * (latitude_divisions / 2) * longitude_divisions indices
can be used to render only the top hemisphere (the sphere itself is
computed progressively by adding more vertices and indices onto a base
hemisphere to form the southern hemisphere).
§Panics
Panics if latitude_divisions or longitude_divisions are less than two
(i.e. there must be at least an equator latitude dividing the north and
south hemispheres and a prime meridian dividing the east and west
hemispheres.
Trait Implementations§
impl StructuralPartialEq for Lines3d
Auto Trait Implementations§
impl Freeze for Lines3d
impl RefUnwindSafe for Lines3d
impl Send for Lines3d
impl Sync for Lines3d
impl Unpin for Lines3d
impl UnsafeUnpin for Lines3d
impl UnwindSafe for Lines3d
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more