#[non_exhaustive]pub struct VolumeMeshItem {
pub boundary_mesh_id: MeshId,
pub face_to_cell: Vec<u32>,
pub projected_tet_id: Option<ProjectedTetId>,
pub volume_mesh_data: Option<Arc<VolumeMeshData>>,
pub model: [[f32; 4]; 4],
pub settings: ItemSettings,
pub material: Material,
pub active_attribute: Option<AttributeRef>,
pub scalar_range: Option<(f32, f32)>,
pub colourmap_id: Option<ColourmapId>,
pub transparency: Option<VolumeTransparency>,
}Expand description
An unstructured volume mesh submitted for one frame.
A volume mesh has two render modes that share the same source data
(VolumeMeshData):
- Boundary surface (default).
transparency: None. The renderer draws the extracted boundary as a standard surface mesh: fullMaterialsupport (shading, textures, shadows), per-frame colourmap lookup, selection outline, face- and cell-level picking. This is the cheap and most common mode. - Volumetric (transparent).
transparency: Some(VolumeTransparency { .. }). The renderer rasterises every interior cell through the projected-tetrahedra pipeline and integrates Beer-Lambert opacity along view rays. Use this when you need to see through the volume. Requires the item to have been uploaded viaupload_volume_mesh_with_transparencysoprojected_tet_idis populated; otherwise the transparency request is silently ignored.
Typical usage:
// Cheap path: boundary only.
let item = resources.upload_volume_mesh(&device, &data)?;
scene.volume_meshes.push(item);
// Volumetric path: opt in to transparency support at upload time.
let mut item = resources.upload_volume_mesh_with_transparency(
&device, &queue, data, "pressure",
)?;
item.transparency = Some(VolumeTransparency { density: 2.0, ..Default::default() });
scene.volume_meshes.push(item);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.boundary_mesh_id: MeshIdGPU mesh slot for the extracted boundary surface.
Always populated. Used for the opaque draw, the selection-outline mask,
and face- or cell-level picking via face_to_cell.
face_to_cell: Vec<u32>Maps each boundary triangle to its originating cell index.
face_to_cell[face_index] is the cell index in the original
VolumeMeshData::cells array.
Used to convert a SubObjectRef::Face
pick hit into a cell index.
projected_tet_id: Option<ProjectedTetId>Projected-tet GPU handle. None for items uploaded via
upload_volume_mesh
(boundary-only path); Some(_) for items uploaded via
upload_volume_mesh_with_transparency.
Transparency requires this to be Some. The handle is crate-internal,
produced by the upload helper.
volume_mesh_data: Option<Arc<VolumeMeshData>>CPU-side volume mesh data used for interior-inclusive cell picking when transparency is active.
Populated by upload_volume_mesh_with_transparency.
Without it, transparent items still render but cell-level picking via
renderer.pick() falls back to face-on-boundary hits only.
model: [[f32; 4]; 4]World-space model matrix. Default: identity.
settings: ItemSettingsPer-item render settings (visibility, opacity, pick identity, selection state).
material: MaterialPer-object material. Consumed only by the boundary-surface render path.
The projected-tet path uses the colourmap LUT and ignores Material.
active_attribute: Option<AttributeRef>Named scalar or colour attribute to colour the boundary surface by.
scalar_range: Option<(f32, f32)>Explicit scalar range (min, max). None = use the range computed at upload.
Applies to both render paths.
colourmap_id: Option<ColourmapId>Colourmap. Used by the boundary-surface path when active_attribute is
set, and by the projected-tet path for the volumetric LUT lookup.
transparency: Option<VolumeTransparency>Volumetric render mode. None = render the boundary as a surface mesh
(default); Some(_) = render through the interior via projected
tetrahedra (requires projected_tet_id to be set).
Implementations§
Source§impl VolumeMeshItem
impl VolumeMeshItem
Sourcepub fn new(boundary_mesh_id: MeshId, face_to_cell: Vec<u32>) -> Self
pub fn new(boundary_mesh_id: MeshId, face_to_cell: Vec<u32>) -> Self
Construct a boundary-only volume mesh item.
Prefer using
upload_volume_mesh
which returns a fully populated item. This constructor is provided for
host code that already has a MeshId and face_to_cell map (for
example after a clipped re-upload).
Sourcepub fn to_render_item(&self) -> SceneRenderItem
pub fn to_render_item(&self) -> SceneRenderItem
Build the SceneRenderItem that the boundary-surface pipeline consumes.
Used internally by the renderer when transparency
is None, and by selection-outline / wireframe passes regardless of
render mode. Host code does not usually need to call this.
Sourcepub fn cell_for_face(&self, face_index: u32) -> Option<u32>
pub fn cell_for_face(&self, face_index: u32) -> Option<u32>
Look up the cell index for a boundary face hit.
Returns None if face_index is out of range.
Sourcepub fn update_mesh(&mut self, boundary_mesh_id: MeshId, face_to_cell: Vec<u32>)
pub fn update_mesh(&mut self, boundary_mesh_id: MeshId, face_to_cell: Vec<u32>)
Replace the boundary mesh ID and face-to-cell map, for example after a
clipped re-upload via
replace_clipped_volume_mesh.
Trait Implementations§
Source§impl Clone for VolumeMeshItem
impl Clone for VolumeMeshItem
Source§fn clone(&self) -> VolumeMeshItem
fn clone(&self) -> VolumeMeshItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VolumeMeshItem
impl RefUnwindSafe for VolumeMeshItem
impl Send for VolumeMeshItem
impl Sync for VolumeMeshItem
impl Unpin for VolumeMeshItem
impl UnsafeUnpin for VolumeMeshItem
impl UnwindSafe for VolumeMeshItem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.