Skip to main content

Geometry

Struct Geometry 

Source
pub struct Geometry {
    pub topology: PrimitiveTopology,
    pub draw_range: Range<u32>,
    pub bounding_box: BoundingBox,
    pub bounding_sphere: BoundingSphere,
    /* private fields */
}

Fields§

§topology: PrimitiveTopology§draw_range: Range<u32>§bounding_box: BoundingBox§bounding_sphere: BoundingSphere

Implementations§

Source§

impl Geometry

Source

pub fn uuid(&self) -> Uuid

Returns the unique identifier for this geometry.

Source

pub fn morph_target_count(&self) -> u32

Returns the number of morph targets in this geometry.

Source

pub fn morph_vertex_count(&self) -> u32

Returns the vertex count per morph target.

Source

pub fn morph_target_names(&self) -> &[String]

Source

pub fn new() -> Geometry

Source

pub fn layout_version(&self) -> u64

Source

pub fn structure_version(&self) -> u64

Source

pub fn data_version(&self) -> u64

Source

pub fn attributes(&self) -> &HashMap<String, Attribute, FxBuildHasher>

Source

pub fn index_attribute(&self) -> Option<&IndexAttribute>

Source

pub fn index_attribute_mut(&mut self) -> &mut Option<IndexAttribute>

Source

pub fn set_attribute(&mut self, name: &str, attr: Attribute)

Source

pub fn remove_attribute(&mut self, name: &str) -> Option<Attribute>

Source

pub fn get_attribute(&self, name: &str) -> Option<&Attribute>

Source

pub fn get_attribute_mut(&mut self, name: &str) -> Option<&mut Attribute>

Source

pub fn add_morph_attribute(&mut self, morph_name: &str, attr: Attribute)

Source

pub fn build_morph_storage_buffers(&mut self)

Builds compact Storage Buffers from morph_attributes Layout: [ Target 0 all vertices | Target 1 all vertices | … ] Each vertex stores 3 f32 values (compact Vec3)

Source

pub fn morph_position_bytes(&self) -> Option<&[u8]>

Gets the byte slice of morph position data

Source

pub fn morph_normal_bytes(&self) -> Option<&[u8]>

Gets the byte slice of morph normal data

Source

pub fn morph_tangent_bytes(&self) -> Option<&[u8]>

Gets the byte slice of morph tangent data

Source

pub fn has_morph_targets(&self) -> bool

Checks if morph targets exist

Source

pub fn set_indices(&mut self, indices: &[u16])

Source

pub fn set_indices_u32(&mut self, indices: &[u32])

Source

pub fn compute_vertex_normals(&mut self)

Source

pub fn compute_bounding_volume(&mut self)

Source

pub fn set_bounding_volume(&mut self, bbox: BoundingBox)

Sets the bounding volume directly from pre-computed AABB bounds.

Used by the quantised geometry pipeline where the position data is not in Float32x3 format. The glTF specification guarantees that accessor min/max are always real-valued floating-point world-space coordinates, so we can use them directly without decoding the quantised vertex data on the CPU.

Source

pub fn set_interleaved_attributes( &mut self, interleaved_data: Vec<u8>, stride: u64, attributes: Vec<(&str, VertexFormat, u64)>, )

Sets interleaved attributes Creates multiple Attributes sharing the same Buffer from an interleaved array

Source

pub fn update_attribute_region<T>( &mut self, name: &str, offset_bytes: u64, data: &[T], )
where T: Pod,

Partially updates attribute data

Source

pub fn shader_defines(&self) -> &ShaderDefines

Computes the geometry’s shader macro definitions

Uses internal caching mechanism, only recalculates when layout_version changes. This avoids Map traversal overhead on the hot path.

Source

pub fn new_box(width: f32, height: f32, depth: f32) -> Geometry

Source

pub fn new_sphere(radius: f32) -> Geometry

Source

pub fn new_plane(width: f32, height: f32) -> Geometry

Trait Implementations§

Source§

impl Bindings for Geometry

Source§

fn define_bindings<'a>(&'a self, builder: &mut ResourceBuilder<'a>)

Source§

impl Debug for Geometry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Geometry

Source§

fn default() -> Geometry

Returns the “default value” for a type. Read more
Source§

impl ResolveGeometry for Geometry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,