Add a method to calculate a Puppet's bounds#117
Open
ArcturusEmrys wants to merge 6 commits into
Open
Conversation
…es not actually exist in the ECS world.
Speykious
requested changes
Apr 17, 2026
| use glam::Vec2; | ||
|
|
||
| #[derive(Clone, Copy)] | ||
| pub struct Rect { |
Member
There was a problem hiding this comment.
Hmmm, since it's home-grown, I think I'd rather call it RectBounds, since it stores the top left and bottom right rather than a position and size like I would personally expect.
…rely. This is about a 4-5x speedup of bounds calculation on myself. I haven't found out why yet; I assume it either results in way better vector codegen or the index list has a lot of repeats. Probably both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also includes a home-grown Rect type, as I didn't see any in Inox's math libraries.
Currently, we calculate puppet bounds as the union of all points, which seems to work well enough for what I'm doing right now.
Normally, I'd keep this code in my own project, but the ECS isn't part of the public API so I can't get at this information normally.