pub struct InstanceDesc2D {
pub pos_attr: Pos2DATTR,
pub rot_attr: Rot2DATTR,
pub scale_attr: Scale2DATTR,
pub col_attr: ColATTR,
pub cus_attrs: Vec<CustomATTR>,
}Expand description
Descriptor for preparing 2D instance data before uploading it to the GPU.
Like InstanceDesc3D, but uses 2-element vectors for position and scale
and single-precision scalars for rotation (angle in radians). The same
interleaving, validation, and upload semantics apply.
§Attribute layout
pos— 2 ×f32(8 bytes)rot— 1 ×f32angle (4 bytes)scale— 2 ×f32(8 bytes)col— 4 ×f32RGBA (16 bytes)- custom attributes, in insertion order
Fields§
§pos_attr: Pos2DATTR§rot_attr: Rot2DATTR§scale_attr: Scale2DATTR§col_attr: ColATTR§cus_attrs: Vec<CustomATTR>Implementations§
Source§impl InstanceDesc2D
impl InstanceDesc2D
Sourcepub fn attach_custom_attr(&mut self, attr: CustomATTR) -> &mut Self
pub fn attach_custom_attr(&mut self, attr: CustomATTR) -> &mut Self
Appends a custom attribute for chaining.
Sourcepub fn ship(&self) -> OpticResult<InstanceBuffer>
pub fn ship(&self) -> OpticResult<InstanceBuffer>
Interleaves all non-empty 2D attributes and uploads to a new GPU buffer.
§Errors
Same error conditions as InstanceDesc3D::ship.
Auto Trait Implementations§
impl Freeze for InstanceDesc2D
impl RefUnwindSafe for InstanceDesc2D
impl Send for InstanceDesc2D
impl Sync for InstanceDesc2D
impl Unpin for InstanceDesc2D
impl UnsafeUnpin for InstanceDesc2D
impl UnwindSafe for InstanceDesc2D
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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