pub struct CurveNetwork { /* private fields */ }Expand description
A curve network structure (nodes connected by edges).
Implementations§
Source§impl CurveNetwork
impl CurveNetwork
Sourcepub fn new(
name: impl Into<String>,
nodes: Vec<Vec3>,
edges: Vec<[u32; 2]>,
) -> Self
pub fn new( name: impl Into<String>, nodes: Vec<Vec3>, edges: Vec<[u32; 2]>, ) -> Self
Creates a new curve network from nodes and edges.
Sourcepub fn new_line(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
pub fn new_line(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
Creates a curve network as a connected line (0-1-2-3-…).
Sourcepub fn new_loop(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
pub fn new_loop(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
Creates a curve network as a closed loop (0-1-2-…-n-0).
Sourcepub fn new_segments(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
pub fn new_segments(name: impl Into<String>, nodes: Vec<Vec3>) -> Self
Creates a curve network as separate segments (0-1, 2-3, 4-5, …).
Sourcepub fn edge_tail_inds(&self) -> &[u32]
pub fn edge_tail_inds(&self) -> &[u32]
Returns the edge tail indices.
Sourcepub fn edge_tip_inds(&self) -> &[u32]
pub fn edge_tip_inds(&self) -> &[u32]
Returns the edge tip indices.
Sourcepub fn edge_centers(&self) -> &[Vec3]
pub fn edge_centers(&self) -> &[Vec3]
Returns the edge centers.
Sourcepub fn node_degrees(&self) -> &[usize]
pub fn node_degrees(&self) -> &[usize]
Returns the node degrees.
Sourcepub fn radius_is_relative(&self) -> bool
pub fn radius_is_relative(&self) -> bool
Returns whether the radius is relative to scene scale.
Sourcepub fn set_radius(&mut self, radius: f32, is_relative: bool) -> &mut Self
pub fn set_radius(&mut self, radius: f32, is_relative: bool) -> &mut Self
Sets the radius.
Sourcepub fn set_material(&mut self, material: impl Into<String>) -> &mut Self
pub fn set_material(&mut self, material: impl Into<String>) -> &mut Self
Sets the material name.
Sourcepub fn render_mode(&self) -> u32
pub fn render_mode(&self) -> u32
Gets the render mode (0 = line, 1 = tube).
Sourcepub fn set_render_mode(&mut self, mode: u32) -> &mut Self
pub fn set_render_mode(&mut self, mode: u32) -> &mut Self
Sets the render mode (0 = line, 1 = tube).
Sourcepub fn update_node_positions(&mut self, nodes: Vec<Vec3>)
pub fn update_node_positions(&mut self, nodes: Vec<Vec3>)
Updates the node positions.
Sourcepub fn add_node_scalar_quantity(
&mut self,
name: impl Into<String>,
values: Vec<f32>,
) -> &mut Self
pub fn add_node_scalar_quantity( &mut self, name: impl Into<String>, values: Vec<f32>, ) -> &mut Self
Adds a node scalar quantity to this curve network.
Sourcepub fn add_edge_scalar_quantity(
&mut self,
name: impl Into<String>,
values: Vec<f32>,
) -> &mut Self
pub fn add_edge_scalar_quantity( &mut self, name: impl Into<String>, values: Vec<f32>, ) -> &mut Self
Adds an edge scalar quantity to this curve network.
Sourcepub fn add_node_color_quantity(
&mut self,
name: impl Into<String>,
colors: Vec<Vec3>,
) -> &mut Self
pub fn add_node_color_quantity( &mut self, name: impl Into<String>, colors: Vec<Vec3>, ) -> &mut Self
Adds a node color quantity to this curve network.
Sourcepub fn add_edge_color_quantity(
&mut self,
name: impl Into<String>,
colors: Vec<Vec3>,
) -> &mut Self
pub fn add_edge_color_quantity( &mut self, name: impl Into<String>, colors: Vec<Vec3>, ) -> &mut Self
Adds an edge color quantity to this curve network.
Sourcepub fn add_node_vector_quantity(
&mut self,
name: impl Into<String>,
vectors: Vec<Vec3>,
) -> &mut Self
pub fn add_node_vector_quantity( &mut self, name: impl Into<String>, vectors: Vec<Vec3>, ) -> &mut Self
Adds a node vector quantity to this curve network.
Sourcepub fn add_edge_vector_quantity(
&mut self,
name: impl Into<String>,
vectors: Vec<Vec3>,
) -> &mut Self
pub fn add_edge_vector_quantity( &mut self, name: impl Into<String>, vectors: Vec<Vec3>, ) -> &mut Self
Adds an edge vector quantity to this curve network.
Sourcepub fn active_node_scalar_quantity(&self) -> Option<&CurveNodeScalarQuantity>
pub fn active_node_scalar_quantity(&self) -> Option<&CurveNodeScalarQuantity>
Returns the currently active node scalar quantity, if any.
Sourcepub fn active_edge_scalar_quantity(&self) -> Option<&CurveEdgeScalarQuantity>
pub fn active_edge_scalar_quantity(&self) -> Option<&CurveEdgeScalarQuantity>
Returns the currently active edge scalar quantity, if any.
Sourcepub fn active_node_color_quantity(&self) -> Option<&CurveNodeColorQuantity>
pub fn active_node_color_quantity(&self) -> Option<&CurveNodeColorQuantity>
Returns the currently active node color quantity, if any.
Sourcepub fn active_edge_color_quantity(&self) -> Option<&CurveEdgeColorQuantity>
pub fn active_edge_color_quantity(&self) -> Option<&CurveEdgeColorQuantity>
Returns the currently active edge color quantity, if any.
Sourcepub fn build_egui_ui(&mut self, ui: &mut Ui, available_materials: &[&str])
pub fn build_egui_ui(&mut self, ui: &mut Ui, available_materials: &[&str])
Builds the egui UI for this curve network.
Sourcepub fn init_gpu_resources(
&mut self,
device: &Device,
bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
)
pub fn init_gpu_resources( &mut self, device: &Device, bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, )
Initializes GPU resources for this curve network.
Sourcepub fn render_data(&self) -> Option<&CurveNetworkRenderData>
pub fn render_data(&self) -> Option<&CurveNetworkRenderData>
Returns the render data if initialized.
Sourcepub fn init_tube_resources(
&mut self,
device: &Device,
compute_bind_group_layout: &BindGroupLayout,
render_bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
)
pub fn init_tube_resources( &mut self, device: &Device, compute_bind_group_layout: &BindGroupLayout, render_bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, )
Initializes tube rendering resources.
Sourcepub fn init_node_render_resources(
&mut self,
device: &Device,
point_bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
)
pub fn init_node_render_resources( &mut self, device: &Device, point_bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, )
Initializes node sphere rendering resources for tube mode joints.
Sourcepub fn init_pick_resources(
&mut self,
device: &Device,
pick_bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
global_start: u32,
)
pub fn init_pick_resources( &mut self, device: &Device, pick_bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, global_start: u32, )
Initializes GPU resources for pick rendering.
Sourcepub fn pick_bind_group(&self) -> Option<&BindGroup>
pub fn pick_bind_group(&self) -> Option<&BindGroup>
Returns the pick bind group if initialized.
Sourcepub fn update_pick_uniforms(&self, queue: &Queue)
pub fn update_pick_uniforms(&self, queue: &Queue)
Updates pick uniforms (e.g., when radius changes).
Sourcepub fn init_tube_pick_resources(
&mut self,
device: &Device,
tube_pick_bind_group_layout: &BindGroupLayout,
camera_buffer: &Buffer,
)
pub fn init_tube_pick_resources( &mut self, device: &Device, tube_pick_bind_group_layout: &BindGroupLayout, camera_buffer: &Buffer, )
Initializes GPU resources for tube-based pick rendering. This uses ray-cylinder intersection for more accurate picking of tube-rendered curves.
Sourcepub fn tube_pick_bind_group(&self) -> Option<&BindGroup>
pub fn tube_pick_bind_group(&self) -> Option<&BindGroup>
Returns the tube pick bind group if initialized.
Sourcepub fn has_tube_pick_resources(&self) -> bool
pub fn has_tube_pick_resources(&self) -> bool
Returns whether tube pick resources are initialized.
Sourcepub fn update_gpu_buffers(&self, queue: &Queue, color_maps: &ColorMapRegistry)
pub fn update_gpu_buffers(&self, queue: &Queue, color_maps: &ColorMapRegistry)
Updates GPU buffers based on current state.
Trait Implementations§
Source§impl HasQuantities for CurveNetwork
impl HasQuantities for CurveNetwork
Source§fn add_quantity(&mut self, quantity: Box<dyn Quantity>)
fn add_quantity(&mut self, quantity: Box<dyn Quantity>)
Source§fn get_quantity_mut(&mut self, name: &str) -> Option<&mut Box<dyn Quantity>>
fn get_quantity_mut(&mut self, name: &str) -> Option<&mut Box<dyn Quantity>>
Source§fn remove_quantity(&mut self, name: &str) -> Option<Box<dyn Quantity>>
fn remove_quantity(&mut self, name: &str) -> Option<Box<dyn Quantity>>
Source§fn quantities(&self) -> &[Box<dyn Quantity>]
fn quantities(&self) -> &[Box<dyn Quantity>]
Source§fn num_quantities(&self) -> usize
fn num_quantities(&self) -> usize
Source§impl Structure for CurveNetwork
impl Structure for CurveNetwork
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any for downcasting.Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
PointCloud”, “SurfaceMesh”).Source§fn bounding_box(&self) -> Option<(Vec3, Vec3)>
fn bounding_box(&self) -> Option<(Vec3, Vec3)>
Source§fn length_scale(&self) -> f32
fn length_scale(&self) -> f32
Source§fn set_transform(&mut self, transform: Mat4)
fn set_transform(&mut self, transform: Mat4)
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Source§fn set_enabled(&mut self, enabled: bool)
fn set_enabled(&mut self, enabled: bool)
Source§fn material(&self) -> &str
fn material(&self) -> &str
Source§fn set_material(&mut self, material_name: &str)
fn set_material(&mut self, material_name: &str)
Source§fn draw(&self, _ctx: &mut dyn RenderContext)
fn draw(&self, _ctx: &mut dyn RenderContext)
Source§fn draw_pick(&self, _ctx: &mut dyn RenderContext)
fn draw_pick(&self, _ctx: &mut dyn RenderContext)
Source§fn build_pick_ui(&self, _ui: &dyn Any, _pick: &PickResult)
fn build_pick_ui(&self, _ui: &dyn Any, _pick: &PickResult)
ImGui UI for a picked element.Source§fn clear_gpu_resources(&mut self)
fn clear_gpu_resources(&mut self)
Source§fn center_bounding_box(&mut self)
fn center_bounding_box(&mut self)
Source§fn reset_transform(&mut self)
fn reset_transform(&mut self)
Auto Trait Implementations§
impl Freeze for CurveNetwork
impl !RefUnwindSafe for CurveNetwork
impl Send for CurveNetwork
impl Sync for CurveNetwork
impl Unpin for CurveNetwork
impl UnsafeUnpin for CurveNetwork
impl !UnwindSafe for CurveNetwork
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
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>. 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>
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)
&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> 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 more