5 unstable releases

Uses old Rust 2015

0.3.0 Jul 5, 2019
0.2.3 Nov 22, 2018
0.2.1 Jun 29, 2018
0.2.0 Jun 28, 2018
0.1.0 Jun 28, 2018

#7 in #scene-graph


Used in 4 crates (via specs_transform)

MIT license

16KB
387 lines

specs_scene_graph

scene graph for specs

use specs_scene_graph::{SceneGraphBundle, Parent as SceneGraphParent};

#[derive(Debug)]
struct Parent {
    entity: Entity,
}

impl Parent {
    #[inline(always)]
    pub fn new(entity: Entity) -> Self {
        Parent { entity: entity }
    }
}

impl Component for Parent {
    type Storage = FlaggedStorage<Self, DenseVecStorage<Self>>;
}

impl SceneGraphParent for Parent {
    #[inline(always)]
    fn parent_entity(&self) -> Entity {
        self.entity
    }
}

let mut world = World::new();

let mut dispatcher = SpecsBundler::new(&mut world, DispatcherBuilder::new())
    .bundle(SceneGraphBundle::<Parent>::default())
    .unwrap()
    .build();

// track modified/removed events from the scene graph
let mut reader_id = world.write_resource::<SceneGraph<Parent>>().track();

Dependencies

~6MB
~117K SLoC