-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break apart Node into Components and Systems #45
Labels
rendering
An issue with the rendering system
Comments
6 tasks
kanerogers
changed the title
Break apart
Break apart Node into Components and Systems
Aug 9, 2021
Node
into Component
s
Still having issues trying to reference another entity from inside an entity:
|
Got this to work with #[system]
#[write_component(Transform)]
pub fn animation(world: &mut SubWorld) -> () {
println!("Running system..");
let mut query = <(&mut Transform,)>::query();
unsafe {
query.for_each_unchecked(world, |t| {
let (mut transform,) = t;
let local_matrix = get_local_matrix(transform);
if let Some(parent) = transform.parent.as_ref() {
let parent = world.entry_ref(*parent).unwrap();
let parent_transform = parent.get_component::<Transform>().unwrap();
transform.global = parent_transform.global * local_matrix;
} else {
transform.global = local_matrix;
}
})
}
} |
|
Difficult problems to solve:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
Well this is going to be really fun.
When attempting to integrate legion I discovered that
Node
, the core structure inHotham
is completely incompatible. This is because, in essenceNode
is doing whatlegion
wants to do - hold all the data and behaviour of the system in one place. Specifically, it's becauseNode
looks like this:The solution is to break
Node
apart into its variousComponent
s (structs) andSystem
s (functions).In essence, this is far closer to the actual representation of a
gltf
file: a discrete set of components with loose references to each-other, rather than an OOP-style graph structure like I've currently got.Onwards!
TODO
Transform
componenttransform
systemSkin
componentJoint
componentskinning
systemMesh
componentrender
systemprepare_frame
functionXrContext
resourceRenderer
a resourceVulkanContext
a resourceVulkanContext
fromRenderer
The text was updated successfully, but these errors were encountered: