pub struct Primitive { /* private fields */ }
Expand description
A unit of rendering.
A Primitive
represents one draw call, or one mesh primitive.
Implementations§
Source§impl Primitive
impl Primitive
Sourcepub fn set_vertices(&self, vertices: impl Into<Vertices<GpuOnlyArray>>) -> &Self
pub fn set_vertices(&self, vertices: impl Into<Vertices<GpuOnlyArray>>) -> &Self
Set the vertex data of this primitive.
Sourcepub fn with_vertices(self, vertices: impl Into<Vertices<GpuOnlyArray>>) -> Self
pub fn with_vertices(self, vertices: impl Into<Vertices<GpuOnlyArray>>) -> Self
Set the vertex data of this primitive and return the primitive.
Source§impl Primitive
impl Primitive
Sourcepub fn set_indices(&self, indices: impl Into<Indices<GpuOnlyArray>>) -> &Self
pub fn set_indices(&self, indices: impl Into<Indices<GpuOnlyArray>>) -> &Self
Set the index data of this primitive.
Sourcepub fn with_indices(self, indices: impl Into<Indices<GpuOnlyArray>>) -> Self
pub fn with_indices(self, indices: impl Into<Indices<GpuOnlyArray>>) -> Self
Set the index data of this primitive and return the primitive.
Sourcepub fn remove_indices(&self) -> &Self
pub fn remove_indices(&self) -> &Self
Remove the indices from this primitive.
Source§impl Primitive
impl Primitive
Sourcepub fn id(&self) -> Id<PrimitiveDescriptor>
pub fn id(&self) -> Id<PrimitiveDescriptor>
Return a pointer to the underlying descriptor on the GPU.
Sourcepub fn descriptor(&self) -> PrimitiveDescriptor
pub fn descriptor(&self) -> PrimitiveDescriptor
Return the underlying descriptor.
Sourcepub fn set_bounds(&self, bounds: BoundingSphere) -> &Self
pub fn set_bounds(&self, bounds: BoundingSphere) -> &Self
Set the bounds of this primitive.
Sourcepub fn with_bounds(self, bounds: BoundingSphere) -> Self
pub fn with_bounds(self, bounds: BoundingSphere) -> Self
Set the bounds and return the primitive.
Sourcepub fn bounds(&self) -> BoundingSphere
pub fn bounds(&self) -> BoundingSphere
Get the bounds.
Returns the current BoundingSphere
.
Sourcepub fn modify_bounds<T: 'static>(
&self,
f: impl FnOnce(&mut BoundingSphere) -> T,
) -> T
pub fn modify_bounds<T: 'static>( &self, f: impl FnOnce(&mut BoundingSphere) -> T, ) -> T
Modify the bounds of the primitive.
§Arguments
f
- A closure that takes a mutable reference to theBoundingSphere
and returns a value of typeT
.
Sourcepub fn set_visible(&self, visible: bool) -> &Self
pub fn set_visible(&self, visible: bool) -> &Self
Set the visibility of this primitive.
Sourcepub fn with_visible(self, visible: bool) -> Self
pub fn with_visible(self, visible: bool) -> Self
Set the visibility and return the primitive.
Sourcepub fn modify_visible<T: 'static>(&self, f: impl FnOnce(&mut bool) -> T) -> T
pub fn modify_visible<T: 'static>(&self, f: impl FnOnce(&mut bool) -> T) -> T
Modify the visible of the primitive.
§Arguments
f
- A closure that takes a mutable reference to the visibility and returns a value of typeT
.
Source§impl Primitive
impl Primitive
Sourcepub fn set_transform(&self, transform: impl Into<Transform>) -> &Self
pub fn set_transform(&self, transform: impl Into<Transform>) -> &Self
Sourcepub fn with_transform(self, transform: impl Into<Transform>) -> Self
pub fn with_transform(self, transform: impl Into<Transform>) -> Self
Set the transform and return the Primitive
.
§Note
This can be set with Transform
or
NestedTransform
.
Sourcepub fn transform(&self) -> impl Deref<Target = Option<Transform>> + '_
pub fn transform(&self) -> impl Deref<Target = Option<Transform>> + '_
Get the transform.
Returns a reference to the current Transform
, if any.
Sourcepub fn remove_transform(&self) -> &Self
pub fn remove_transform(&self) -> &Self
Remove the transform from this primitive.
This effectively makes the transform the identity.
Source§impl Primitive
impl Primitive
Sourcepub fn set_material(&self, material: impl Into<Material>) -> &Self
pub fn set_material(&self, material: impl Into<Material>) -> &Self
Set the material of this primitive.
Sourcepub fn with_material(self, material: impl Into<Material>) -> Self
pub fn with_material(self, material: impl Into<Material>) -> Self
Set the material and return the primitive.
Sourcepub fn material(&self) -> impl Deref<Target = Option<Material>> + '_
pub fn material(&self) -> impl Deref<Target = Option<Material>> + '_
Get the material.
Returns a reference to the current Material
, if any.
Sourcepub fn remove_material(&self) -> &Self
pub fn remove_material(&self) -> &Self
Remove the material from this primitive.
Source§impl Primitive
impl Primitive
Source§impl Primitive
impl Primitive
Sourcepub fn set_morph_targets(
&self,
morph_targets: impl Into<MorphTargets>,
weights: impl Into<MorphTargetWeights>,
) -> &Self
pub fn set_morph_targets( &self, morph_targets: impl Into<MorphTargets>, weights: impl Into<MorphTargetWeights>, ) -> &Self
Set the morph targets and weights of this primitive.
Sourcepub fn with_morph_targets(
self,
morph_targets: impl Into<MorphTargets>,
weights: impl Into<MorphTargetWeights>,
) -> Self
pub fn with_morph_targets( self, morph_targets: impl Into<MorphTargets>, weights: impl Into<MorphTargetWeights>, ) -> Self
Set the morph targets and weights and return the primitive.
Sourcepub fn morph_targets(
&self,
) -> impl Deref<Target = Option<(MorphTargets, MorphTargetWeights)>> + '_
pub fn morph_targets( &self, ) -> impl Deref<Target = Option<(MorphTargets, MorphTargetWeights)>> + '_
Get the morph targets and weights.
Returns a reference to the current MorphTargets
and MorphTargetsWeights
, if any.
Sourcepub fn remove_morph_targets(&self) -> &Self
pub fn remove_morph_targets(&self) -> &Self
Remove the morph targets and weights from this primitive.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);