Skip to main content

BatchedMesh

Struct BatchedMesh 

Source
pub struct BatchedMesh {
    pub mesh: Mesh,
    pub per_object_frustum_culled: bool,
    pub sort_objects: bool,
    pub custom_sort: Option<CustomSort>,
    /* private fields */
}
Expand description

BatchedMesh extends Mesh.

Fields§

§mesh: Mesh

The Mesh half: geometry, material and morph state.

§per_object_frustum_culled: bool

_perObjectFrustumCulled — whether each instance is culled by its own bounding sphere.

§sort_objects: bool

_sortObjects — whether instances are depth-sorted before drawing.

§custom_sort: Option<CustomSort>

customSort, set by set_custom_sort.

Implementations§

Source§

impl BatchedMesh

Source

pub fn new( max_instance_count: usize, max_vertex_count: usize, max_index_count: usize, material: MeshBasicNodeMaterial, ) -> ObjectRef

new BatchedMesh( maxInstanceCount, maxVertexCount, maxIndexCount, material ), as a scene-graph ObjectRef.

Source

pub fn max_instance_count(&self) -> usize

maxInstanceCount.

Source

pub fn instance_count(&self) -> usize

instanceCount — the number of active instances.

Source

pub fn geometry(&self) -> &Rc<BufferGeometry>

The packed geometry every instance draws a range of.

Source

pub fn geometry_range_at(&self, geometry_id: usize) -> Option<&GeometryInfo>

getGeometryRangeAt( geometryId ) — the packed range this geometry owns inside the shared BufferGeometry.

Source

pub fn set_custom_sort(&mut self, func: Option<CustomSort>) -> &mut Self

setCustomSort( func ).

Source

pub fn add_geometry(&mut self, geometry: &BufferGeometry) -> usize

addGeometry( geometry ) with the default reserved counts.

Source

pub fn set_geometry_at( &mut self, geometry_id: usize, geometry: &BufferGeometry, ) -> usize

setGeometryAt( geometryId, geometry ).

Source

pub fn add_instance(&mut self, geometry_id: usize) -> usize

addInstance( geometryId ).

Source

pub fn set_matrix_at( &mut self, instance_id: usize, matrix: &Matrix4, ) -> &mut Self

setMatrixAt( instanceId, matrix ).

Source

pub fn matrix_at(&self, instance_id: usize) -> Matrix4

getMatrixAt( instanceId, matrix ).

Source

pub fn set_color_at(&mut self, instance_id: usize, color: &Color) -> &mut Self

setColorAt( instanceId, color ). Color.toArray() writes rgb only, so the alpha stays at the texture’s initial 1.

Source

pub fn bounding_box_at(&mut self, geometry_id: usize) -> Option<Box3>

getBoundingBoxAt( geometryId, target ) — computed from the packed geometry’s own index range, so it costs nothing until the first cull.

Source

pub fn bounding_sphere_at(&mut self, geometry_id: usize) -> Option<Sphere>

getBoundingSphereAt( geometryId, target ).

Source

pub fn raycast( &mut self, matrix_world: &Matrix4, object: &ObjectRef, raycaster: &Raycaster, intersects: &mut Vec<Intersection>, )

BatchedMesh.raycast( raycaster, intersects ) — Mesh.raycast() once per active, visible instance, over that instance’s geometry range with its per-geometry bounds and matrixWorld × instanceMatrix, each hit tagged with its batchId.

three.js points a scratch Mesh (no morph targets) at the batch geometry’s attributes for this; the port passes the same pieces to the shared mesh raycast directly.

Source

pub fn on_before_render(&mut self, matrix_world: &Matrix4, camera: &BatchCamera)

onBeforeRender( renderer, scene, camera, geometry, material ).

Trait Implementations§

Source§

impl Clone for BatchedMesh

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.