pub struct DrawObject {Show 17 fields
pub vertex_offset: usize,
pub vertex_count: usize,
pub index_offset: usize,
pub index_count: usize,
pub base_vertex: i32,
pub geometry_generation: u32,
pub model: [[f32; 4]; 4],
pub texture_slot: usize,
pub normal_map_slot: usize,
pub material: MaterialUniforms,
pub shader_bucket: u32,
pub visible: bool,
pub resident: bool,
pub bb_min: [f32; 3],
pub bb_max: [f32; 3],
pub cull_distance: f32,
pub lod_alternates: Vec<LodSlice>,
}Expand description
One renderable object: vertex/index slice within the shared GPU buffers, a model matrix, albedo and normal-map texture slots, and material parameters.
Fields§
§vertex_offset: usizeByte offset into the shared vertex buffer.
vertex_count: usizeNumber of vertices this object occupies in the shared vertex buffer,
starting at vertex_offset. Used by mesh streaming to memcpy the
object’s geometry region in and out of the GPU buffer.
index_offset: usizeElement offset into the shared index buffer.
index_count: usizeNumber of indices to draw.
base_vertex: i32Value added to every index before the vertex fetch (the
drawIndexedPrimitives baseVertex / D3D12 BaseVertexLocation /
Vulkan vertex_offset). 0 for static and streamed-mesh geometry, whose
indices are already absolute into the shared vertex buffer. Streamed
VoxelWorld chunks instead keep mesh-relative (0-based) indices and set
this to their vertex region’s base, so a chunk placed past the
65 535-vertex u16 index range still renders. Read by all three
backends’ shadow/main/velocity passes.
geometry_generation: u32Bumped every time the slot’s vertex / index bytes are rewritten in place at unchanged offsets (a size-matched asset hot-reload). The offsets and counts above identify only where the geometry lives, so without this counter an in-place rewrite is indistinguishable from no change at all and a ray-tracing BLAS built over the previous contents would be reused.
model: [[f32; 4]; 4]Column-major model-to-world matrix.
texture_slot: usizeIndex into the shared texture pool for this object’s albedo map. Clamped to the last slot if out of range.
normal_map_slot: usizeIndex into the shared texture pool for this object’s normal map, or
NO_NORMAL_MAP_SLOT when the object has no normal map (the backend then
substitutes the flat-normal fallback).
material: MaterialUniformsPer-draw material scalars pushed to the fragment shader at buffer(3).
shader_bucket: u32When false the object is skipped in both the shadow and main passes.
Which world shader renders this object: the dense ShaderHandle value of
the material’s shader reference, or 0 (the world default) when the
material names none. The backend binds the matching pipeline for each
bucket; the value never changes after the draw is built.
visible: boolControlled by scene switches to hide props belonging to inactive scenes.
resident: boolWhen false the object’s geometry is not yet uploaded to the GPU buffers and the object is skipped in every pass. Always true unless the asset- streaming subsystem is active; the mesh streamer flips it to true once the geometry region is resident. Read by the shadow/main/velocity passes.
bb_min: [f32; 3]World-space axis-aligned bounding box used for frustum culling. Baked from the mesh’s local bounds and the prop’s initial model matrix at GraphicsSystem init. Set to a degenerate (NaN) box to disable culling.
bb_max: [f32; 3]Upper corner of the world-space culling AABB.
cull_distance: f32If > 0, the object is skipped when the camera is further than this from the AABB centre. Lets a Prop opt in to distance-based unloading.
lod_alternates: Vec<LodSlice>LOD1..N slices for this draw, in ascending switch_distance order.
Empty when the mesh declared lod_levels <= 1; the renderer then
always uses the LOD0 (index_offset, index_count) carried on this
object. With non-empty alternates the renderer picks the highest
slice whose threshold is ≤ the camera→AABB-centre distance each frame.
Implementations§
Source§impl DrawObject
impl DrawObject
Sourcepub fn active_lod(&self, distance: f32) -> (usize, usize)
pub fn active_lod(&self, distance: f32) -> (usize, usize)
Pick the active (index_offset, index_count) for this object given
the current camera distance to its AABB centre. Returns the LOD0
pair when no alternates are present or when the camera is closer
than the first alternate’s threshold; otherwise returns the
highest-indexed alternate whose switch_distance ≤ distance.
Auto Trait Implementations§
impl Freeze for DrawObject
impl RefUnwindSafe for DrawObject
impl Send for DrawObject
impl Sync for DrawObject
impl Unpin for DrawObject
impl UnsafeUnpin for DrawObject
impl UnwindSafe for DrawObject
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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