#scene-graph #hierarchy #specs #entity-component

specs-hierarchy

用于与specs一起使用的场景图类型层次抽象

16个不稳定版本 (5个破坏性更新)

使用旧的Rust 2015

0.6.0 2020年2月12日
0.5.1 2019年7月23日
0.4.0 2019年7月9日
0.3.0 2018年11月6日
0.2.0 2018年7月11日

666数据结构

Download history 923/week @ 2024-03-15 1266/week @ 2024-03-22 1251/week @ 2024-03-29 841/week @ 2024-04-05 1124/week @ 2024-04-12 1179/week @ 2024-04-19 1155/week @ 2024-04-26 1118/week @ 2024-05-03 1008/week @ 2024-05-10 1056/week @ 2024-05-17 1069/week @ 2024-05-24 1206/week @ 2024-05-31 671/week @ 2024-06-07 983/week @ 2024-06-14 1039/week @ 2024-06-21 488/week @ 2024-06-28

3,371 每月下载量
67 个crate中使用 (6个直接使用)

MIT/Apache

29KB
509

specs-hierarchy

Build Status Crates.io Gitter MIT/Apache Docs.rs LoC

用于specs的场景图类型层次抽象。

通过查询用户提供的Parent组件来构建一个Hierarchy资源。需要组件被Tracked

将在内部的EventChannel上发送修改事件。请注意,Removed事件并不意味着Parent组件已被从组件存储中移除,只是表示实体不再被视为Hierarchy的一部分。这是因为用户可能只想移除组件、完整的Entity或完全不同的内容。当一个父实体被从层次结构中移除时,它下面的完整子树也将从层次结构中移除。

用法

# Cargo.toml
[dependencies]
specs-hierarchy = "0.5.1"

示例

use specs::prelude::{Component, DenseVecStorage, Entity, FlaggedStorage};
use specs_hierarchy::{Hierarchy, Parent as HParent};

/// Component for defining a parent entity.
///
/// The entity with this component *has* a parent, rather than *is* a parent.
#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
pub struct Parent {
    /// The parent entity
    pub entity: Entity,
}

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

impl HParent for Parent {
    fn parent_entity(&self) -> Entity {
        self.entity
    }
}

许可证

根据您的选择许可

贡献

我们是一个欢迎任何人贡献的社区项目。如果您有兴趣帮忙,您可以通过GitHub或gitter联系我们。

除非您明确表示,否则根据Apache-2.0许可证定义的任何有意提交以包含在作品中的贡献,都应如上所述双重许可,不附加任何额外条款或条件。

依赖关系

~4.5MB
~92K SLoC