From c0b1c2e13559f89a20212ebea90d8ae0af52f54c Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Thu, 24 Sep 2020 23:51:05 -0700 Subject: [PATCH] petgraph --- Cargo.toml | 3 ++- src/main.rs | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0c64d4a8..2199fb61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,4 +31,5 @@ winit = "0.22.0" #criterion = "0.3.0" hprof = "0.1.3" rusttype = { version = "0.7.0", features = ["gpu_cache"] } -vulkano_text = "0.12.0" \ No newline at end of file +vulkano_text = "0.12.0" +petgraph = "0.5.1" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 59905ae0..3bc97b87 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,8 @@ use crate::util::vertex::{TextureVertex3D, VertexTypeContainer}; use crate::vkprocessor::VkProcessor; use crate::compu_system::{CompuSystem, Compu}; use crate::event_system::{EventSystem, Evented}; +use petgraph::Graph; +use petgraph::graph::NodeIndex; pub mod util; pub mod vkprocessor; @@ -146,6 +148,39 @@ pub fn main() { compu_frame: CompuFrame::new((0, 0)), }); + + let mut g = Graph::new(); + let mut matrix : Vec>> = vec![vec![NodeIndex::new(1); 20]; 20]; + + for x in 0..20 { + for y in 0..20 { + matrix[x][y] = g.add_node(((x, y), 0.)); + } + } + + + for x in 0..20 { + for y in 0..20 { + + + matrix[x][y] = g.add_node(((x, y), 0.)); + } + } + + + g.extend_with_edges(&[ + (a, b, 1), + (a, d, 1), + (b, c, 1), + (b, f, 1), + (c, e, 1), + (e, f, 1), + (d, e, 1), + ]); + + + + // and the thing that renders it world.create_entity() .with(Compu { kernels: vec![compute_kernel], buffers: vec![compute_buffer] })// just a drawable @@ -244,7 +279,6 @@ pub fn main() { } accumulator_time += delta_time; - world. // This dispatches all the systems in parallel (but blocking). world.write_resource::()