pub struct PlaneMeshBuilder<'l> {
pub layout: &'l HexLayout,
pub pos: Hex,
pub offset: Option<Vec3>,
pub scale: Option<Vec3>,
pub rotation: Option<Quat>,
pub uv_options: UVOptions,
pub center_aligned: bool,
pub inset_options: Option<InsetOptions>,
}
Expand description
Builder struct to customize hex plane mesh generation.
The mesh will be anchored at the center of the hexagon, use offsets to cutomize anchor/pivot position.
§Note
Transform operations (Scale, Rotate, Translate) through the methods
- Scale:
Self::with_scale
- Rotate:
Self::with_rotation
,Self::facing
- Translate:
Self::with_offset
,Self::at
Are executed in that order, or SRT
Fields§
§layout: &'l HexLayout
The hexagonal layout, used to compute vertex positions
pos: Hex
Custom hex position, will apply an offset if not Hex::ZERO
offset: Option<Vec3>
Optional custom offset for the mesh vertex positions
scale: Option<Vec3>
Optional custom scale factor for the mesh vertex positions
rotation: Option<Quat>
Optional custom rotation, useful to have the mesh already rotated
By default the mesh is facing up (Y axis)
uv_options: UVOptions
UV mapping options
center_aligned: bool
If set to true
, the mesh will ignore HexLayout::origin
inset_options: Option<InsetOptions>
Optional inset options for the plane face
Implementations§
Source§impl<'l> PlaneMeshBuilder<'l>
impl<'l> PlaneMeshBuilder<'l>
Sourcepub const fn new(layout: &'l HexLayout) -> PlaneMeshBuilder<'l>
pub const fn new(layout: &'l HexLayout) -> PlaneMeshBuilder<'l>
Setup a new builder using the given layout
Sourcepub const fn at(self, pos: Hex) -> PlaneMeshBuilder<'l>
pub const fn at(self, pos: Hex) -> PlaneMeshBuilder<'l>
Sourcepub fn facing(self, facing: Vec3) -> PlaneMeshBuilder<'l>
pub fn facing(self, facing: Vec3) -> PlaneMeshBuilder<'l>
Specify a custom facing direction for the mesh, by default the column is vertical (facing up)
§Panics
Will panic if facing
is zero length
Sourcepub const fn with_rotation(self, rotation: Quat) -> PlaneMeshBuilder<'l>
pub const fn with_rotation(self, rotation: Quat) -> PlaneMeshBuilder<'l>
Specify a custom rotation for the whole mesh
Sourcepub const fn with_offset(self, offset: Vec3) -> PlaneMeshBuilder<'l>
pub const fn with_offset(self, offset: Vec3) -> PlaneMeshBuilder<'l>
Specify a custom offset for the whole mesh
Sourcepub const fn with_scale(self, scale: Vec3) -> PlaneMeshBuilder<'l>
pub const fn with_scale(self, scale: Vec3) -> PlaneMeshBuilder<'l>
Specify a custom scale factor for the whole mesh
Sourcepub const fn with_uv_options(
self,
uv_options: UVOptions,
) -> PlaneMeshBuilder<'l>
pub const fn with_uv_options( self, uv_options: UVOptions, ) -> PlaneMeshBuilder<'l>
Specify custom UV mapping options
Sourcepub const fn center_aligned(self) -> PlaneMeshBuilder<'l>
pub const fn center_aligned(self) -> PlaneMeshBuilder<'l>
Ignores the HexLayout::origin
offset, generating a mesh centered
around (0.0, 0.0)
.
Sourcepub const fn with_inset_options(
self,
opts: InsetOptions,
) -> PlaneMeshBuilder<'l>
pub const fn with_inset_options( self, opts: InsetOptions, ) -> PlaneMeshBuilder<'l>
Specify insetting option for the hexagonal face
Trait Implementations§
Source§impl<'l> Clone for PlaneMeshBuilder<'l>
impl<'l> Clone for PlaneMeshBuilder<'l>
Source§fn clone(&self) -> PlaneMeshBuilder<'l>
fn clone(&self) -> PlaneMeshBuilder<'l>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'l> Freeze for PlaneMeshBuilder<'l>
impl<'l> RefUnwindSafe for PlaneMeshBuilder<'l>
impl<'l> Send for PlaneMeshBuilder<'l>
impl<'l> Sync for PlaneMeshBuilder<'l>
impl<'l> Unpin for PlaneMeshBuilder<'l>
impl<'l> UnwindSafe for PlaneMeshBuilder<'l>
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> 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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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