petgraph
This commit is contained in:
@@ -31,4 +31,5 @@ winit = "0.22.0"
|
|||||||
#criterion = "0.3.0"
|
#criterion = "0.3.0"
|
||||||
hprof = "0.1.3"
|
hprof = "0.1.3"
|
||||||
rusttype = { version = "0.7.0", features = ["gpu_cache"] }
|
rusttype = { version = "0.7.0", features = ["gpu_cache"] }
|
||||||
vulkano_text = "0.12.0"
|
vulkano_text = "0.12.0"
|
||||||
|
petgraph = "0.5.1"
|
||||||
36
src/main.rs
36
src/main.rs
@@ -47,6 +47,8 @@ use crate::util::vertex::{TextureVertex3D, VertexTypeContainer};
|
|||||||
use crate::vkprocessor::VkProcessor;
|
use crate::vkprocessor::VkProcessor;
|
||||||
use crate::compu_system::{CompuSystem, Compu};
|
use crate::compu_system::{CompuSystem, Compu};
|
||||||
use crate::event_system::{EventSystem, Evented};
|
use crate::event_system::{EventSystem, Evented};
|
||||||
|
use petgraph::Graph;
|
||||||
|
use petgraph::graph::NodeIndex;
|
||||||
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod vkprocessor;
|
pub mod vkprocessor;
|
||||||
@@ -146,6 +148,39 @@ pub fn main() {
|
|||||||
compu_frame: CompuFrame::new((0, 0)),
|
compu_frame: CompuFrame::new((0, 0)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
let mut g = Graph::new();
|
||||||
|
let mut matrix : Vec<Vec<NodeIndex<u32>>> = 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
|
// and the thing that renders it
|
||||||
world.create_entity()
|
world.create_entity()
|
||||||
.with(Compu { kernels: vec![compute_kernel], buffers: vec![compute_buffer] })// just a drawable
|
.with(Compu { kernels: vec![compute_kernel], buffers: vec![compute_buffer] })// just a drawable
|
||||||
@@ -244,7 +279,6 @@ pub fn main() {
|
|||||||
}
|
}
|
||||||
accumulator_time += delta_time;
|
accumulator_time += delta_time;
|
||||||
|
|
||||||
world.
|
|
||||||
|
|
||||||
// This dispatches all the systems in parallel (but blocking).
|
// This dispatches all the systems in parallel (but blocking).
|
||||||
world.write_resource::<PersistentState>()
|
world.write_resource::<PersistentState>()
|
||||||
|
|||||||
Reference in New Issue
Block a user