Struct bevy::render::mesh::Capsule3dMeshBuilder
pub struct Capsule3dMeshBuilder {
pub capsule: Capsule3d,
pub rings: usize,
pub longitudes: usize,
pub latitudes: usize,
pub uv_profile: CapsuleUvProfile,
}
Fields§
§capsule: Capsule3d
The Capsule3d
shape.
rings: usize
The number of horizontal lines subdividing the cylindrical part of the capsule.
The default is 0
.
longitudes: usize
The number of vertical lines subdividing the hemispheres of the capsule.
The default is 32
.
latitudes: usize
The number of horizontal lines subdividing the hemispheres of the capsule.
The default is 16
.
uv_profile: CapsuleUvProfile
The manner in which UV coordinates are distributed vertically.
The default is CapsuleUvProfile::Aspect
.
Implementations§
§impl Capsule3dMeshBuilder
impl Capsule3dMeshBuilder
pub fn new(
radius: f32,
height: f32,
longitudes: usize,
latitudes: usize
) -> Capsule3dMeshBuilder
pub fn new( radius: f32, height: f32, longitudes: usize, latitudes: usize ) -> Capsule3dMeshBuilder
Creates a new Capsule3dMeshBuilder
from a given radius, height, longitudes, and latitudes.
Note that height
is the distance between the centers of the hemispheres.
radius
will be added to both ends to get the real height of the mesh.
pub const fn rings(self, rings: usize) -> Capsule3dMeshBuilder
pub const fn rings(self, rings: usize) -> Capsule3dMeshBuilder
Sets the number of horizontal lines subdividing the cylindrical part of the capsule.
pub const fn longitudes(self, longitudes: usize) -> Capsule3dMeshBuilder
pub const fn longitudes(self, longitudes: usize) -> Capsule3dMeshBuilder
Sets the number of vertical lines subdividing the hemispheres of the capsule.
pub const fn latitudes(self, latitudes: usize) -> Capsule3dMeshBuilder
pub const fn latitudes(self, latitudes: usize) -> Capsule3dMeshBuilder
Sets the number of horizontal lines subdividing the hemispheres of the capsule.
pub const fn uv_profile(
self,
uv_profile: CapsuleUvProfile
) -> Capsule3dMeshBuilder
pub const fn uv_profile( self, uv_profile: CapsuleUvProfile ) -> Capsule3dMeshBuilder
Sets the manner in which UV coordinates are distributed vertically.
pub fn build(&self) -> Mesh
pub fn build(&self) -> Mesh
Builds a Mesh
based on the configuration in self
.
Examples found in repository?
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
fn spawn_primitive_3d(
mut commands: Commands,
mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
) {
const POSITION: Vec3 = Vec3::new(-LEFT_RIGHT_OFFSET_3D, 0.0, 0.0);
let material: Handle<StandardMaterial> = materials.add(Color::WHITE);
let camera_mode = CameraActive::Dim3;
[
Some(CUBOID.mesh()),
Some(SPHERE.mesh().build()),
None, // ellipse
None, // triangle
Some(PLANE_3D.mesh().build()),
None, // line
None, // segment
None, // polyline
None, // polygon
None, // regular polygon
Some(CAPSULE_3D.mesh().build()),
Some(CYLINDER.mesh().build()),
None, // cone
None, // conical frustum
Some(TORUS.mesh().build()),
]
.into_iter()
.zip(PrimitiveSelected::ALL)
.for_each(|(maybe_mesh, state)| {
if let Some(mesh) = maybe_mesh {
commands.spawn((
MeshDim3,
PrimitiveData {
camera_mode,
primitive_state: state,
},
PbrBundle {
mesh: meshes.add(mesh),
material: material.clone(),
transform: Transform::from_translation(POSITION),
..Default::default()
},
));
}
});
}
Trait Implementations§
§impl Clone for Capsule3dMeshBuilder
impl Clone for Capsule3dMeshBuilder
§fn clone(&self) -> Capsule3dMeshBuilder
fn clone(&self) -> Capsule3dMeshBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for Capsule3dMeshBuilder
impl Debug for Capsule3dMeshBuilder
§impl Default for Capsule3dMeshBuilder
impl Default for Capsule3dMeshBuilder
§fn default() -> Capsule3dMeshBuilder
fn default() -> Capsule3dMeshBuilder
§impl From<Capsule3dMeshBuilder> for Mesh
impl From<Capsule3dMeshBuilder> for Mesh
§fn from(capsule: Capsule3dMeshBuilder) -> Mesh
fn from(capsule: Capsule3dMeshBuilder) -> Mesh
impl Copy for Capsule3dMeshBuilder
Auto Trait Implementations§
impl Freeze for Capsule3dMeshBuilder
impl RefUnwindSafe for Capsule3dMeshBuilder
impl Send for Capsule3dMeshBuilder
impl Sync for Capsule3dMeshBuilder
impl Unpin for Capsule3dMeshBuilder
impl UnwindSafe for Capsule3dMeshBuilder
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.§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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.