8000 Tracking objects with `RenderID` · Issue #94 · ricosjp/truck · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tracking objects with RenderID #94

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

Open
tymokvo opened this issue Mar 4, 2025 · 0 comments
Open

Tracking objects with RenderID #94

tymokvo opened this issue Mar 4, 2025 · 0 comments

Comments

@tymokvo
Copy link
Contributor
tymokvo commented Mar 4, 2025

Hello,

I am trying to implement modifications to objects already in a Scene. The simplest example is the ability to delete a PolygonInstance after it has been added to a scene.

The Scene::remove_object requires a pointer to the entire T: Rendered rather than a RenderID, even though it simply references the object by id for removal from the Scene::objects member. Is it necessary to keep a pointer to the T: Rendered object in order to implement this behavior?

This is a bit onerous as it requires propagating lifetimes to maintain the collection of pointers, e.g. my_objects: HashMap<String, &'a PolygonInstance>. I understand I may be missing something about how these are used to synchronize data with the GPU, though.

/// Removes a render object from the scene.
///
/// If there does not exist the render object in the scene, does nothing and returns `false`.
#[inline(always)]
pub fn remove_object<R: Rendered>(&mut self, object: &R) -> bool {
self.objects.remove(&object.render_id()).is_some()
}

Would it be reasonable to add a Scene::remove_object_by_id member? I would be happy to open a PR if the change makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0