pub struct GridcubeRenderData {
pub position_buffer: Buffer,
pub normal_buffer: Buffer,
pub scalar_buffer: Buffer,
pub uniform_buffer: Buffer,
pub colormap_texture: Texture,
pub colormap_view: TextureView,
pub colormap_sampler: Sampler,
pub bind_group: BindGroup,
pub num_instances: u32,
pub shadow_bind_group: Option<BindGroup>,
pub shadow_model_buffer: Option<Buffer>,
}Expand description
GPU resources for gridcube visualization.
Fields§
§position_buffer: BufferCombined buffer: first 36 entries are unit cube template vertices (vec4),
followed by per-instance data (vec4: xyz=center, w=half_size).
normal_buffer: BufferCube template normals (36 entries, vec4).
scalar_buffer: BufferPer-instance scalar values.
uniform_buffer: BufferUniform buffer.
colormap_texture: TextureColormap texture (1D, RGBA).
colormap_view: TextureViewColormap texture view.
colormap_sampler: SamplerColormap sampler.
bind_group: BindGroupBind group (Group 0).
num_instances: u32Number of instances (grid nodes/cells).
shadow_bind_group: Option<BindGroup>Shadow pass bind group.
shadow_model_buffer: Option<Buffer>Shadow model uniform buffer.
Implementations§
Source§impl GridcubeRenderData
impl GridcubeRenderData
Sourcepub fn new(
device: &Device,
queue: &Queue,
bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
centers: &[Vec3],
half_size: f32,
scalars: &[f32],
colormap_colors: &[Vec3],
) -> Self
pub fn new( device: &Device, queue: &Queue, bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, centers: &[Vec3], half_size: f32, scalars: &[f32], colormap_colors: &[Vec3], ) -> Self
Creates new gridcube render data.
§Arguments
centers- Per-instance cube center positionshalf_size- Half the cube side length (grid spacing / 2)scalars- Per-instance scalar valuescolormap_colors- Color samples for the colormap
Sourcepub fn update_uniforms(&self, queue: &Queue, uniforms: &GridcubeUniforms)
pub fn update_uniforms(&self, queue: &Queue, uniforms: &GridcubeUniforms)
Updates the uniform buffer.
Sourcepub fn update_colormap(&self, queue: &Queue, colors: &[Vec3])
pub fn update_colormap(&self, queue: &Queue, colors: &[Vec3])
Updates the colormap texture with new colors.
Sourcepub fn total_vertices(&self) -> u32
pub fn total_vertices(&self) -> u32
Returns the total number of vertices to draw (36 per instance).
Sourcepub fn init_shadow_resources(
&mut self,
device: &Device,
shadow_bind_group_layout: &BindGroupLayout,
light_buffer: &Buffer,
)
pub fn init_shadow_resources( &mut self, device: &Device, shadow_bind_group_layout: &BindGroupLayout, light_buffer: &Buffer, )
Initializes shadow rendering resources.
Sourcepub fn has_shadow_resources(&self) -> bool
pub fn has_shadow_resources(&self) -> bool
Returns whether shadow resources have been initialized.
Auto Trait Implementations§
impl Freeze for GridcubeRenderData
impl !RefUnwindSafe for GridcubeRenderData
impl Send for GridcubeRenderData
impl Sync for GridcubeRenderData
impl Unpin for GridcubeRenderData
impl UnsafeUnpin for GridcubeRenderData
impl !UnwindSafe for GridcubeRenderData
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
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>
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>
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)
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)
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
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>
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