Skip to content

Commit

Permalink
Move inputs fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterchef365 committed Feb 28, 2024
1 parent 1537bfa commit c358482
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 0 additions & 12 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,15 +715,3 @@ fn draw_grid(mesh: &mut Mesh, grid: &Array2D<GridCell>) {
}
}
*/

fn nodegraph_fn_inputs() -> ParameterList {
use vorpal_widgets::vorpal_core::{DataType, ExternInputId};
let params = [
(ExternInputId::new("time".to_string()), DataType::Scalar),
(ExternInputId::new("position".to_string()), DataType::Vec2),
]
.into_iter()
.collect();

ParameterList(params)
}
15 changes: 13 additions & 2 deletions src/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::query_accel::QueryAccelerator;

use glam::Vec2;
use rand::prelude::*;
use vorpal_widgets::vorpal_core::{ExternParameters, ExternInputId, Value};
use vorpal_widgets::vorpal_core::{ExternParameters, ExternInputId, Value, ParameterList, DataType};
use vorpal_widgets::vorpal_core::{Node, native_backend::evaluate_node};

#[derive(Clone)]
Expand Down Expand Up @@ -695,7 +695,7 @@ fn node_interactions(particles: &mut [Particle], node: &Rc<Node>, cfg: &NodeInte
for i in 0..particles.len() {
for neighbor in accel.query_neighbors_fast(i, points[i]) {
// The vector pointing from a to b
let diff = points[i] - points[neighbor];
let diff = points[neighbor] - points[i];

let inputs = [
(ExternInputId::new("neigh-radius".into()), Value::Scalar(cfg.neighbor_radius)),
Expand All @@ -709,3 +709,14 @@ fn node_interactions(particles: &mut [Particle], node: &Rc<Node>, cfg: &NodeInte
}

}

pub fn nodegraph_fn_inputs() -> ParameterList {
let params = [
(ExternInputId::new("neigh-radius".to_string()), DataType::Scalar),
(ExternInputId::new("pos-diff".to_string()), DataType::Vec2),
]
.into_iter()
.collect();

ParameterList(params)
}

0 comments on commit c358482

Please sign in to comment.