Open alice-i-cecile opened 4 months ago
Rectangle
and Cuboid
are defined just by their half-extents, and don't have any notion of their position. This is useful for things like colliders (more efficient and ergonomic), but means that they cannot be used as AABBs or replace the rect types.
I think having a single type for every usages is more confusing than having specific types whose documentation can be tailored to what they're used for. And names of those types should convey their usage.
There's also UiRect
which is not a rectangle
I have been wanting to get rid of NodeRect
in the animation_graph
example.
Eliminate bevy_render::Aabb in favor of the bevy_math types. Needs benchmarking.
Render::Aabb is a component and has a trait implementation for a render primitive so you can't remove it. I wouldn't be against newtyping, but delegation in Rust is terrible so i don't think there is anything to win either.
Just as an aside, the equivalent types in three.js are Box2
and Box3
, both of which are defined by min/max vectors. (Theoretically you could have BoxN for any N whose min/max values are VecN. In practice, N is always either 2 or 3.)
I think having a single type for every usages is more confusing than having specific types whose documentation can be tailored to what they're used for. And names of those types should convey their usage.
A valid point, but it doesn't feel like this is being applied. prelude::*
exports Rectangle
, URect
, and Rect
which all reads as "rectangle". Rectangle
contains no position information, but that's not apparent from the name. URect
has essentially the same documentation as Rect
and it's not suggested anywhere why I might want to use it over Rect
.
Rectangle
andCuboid
are defined just by their half-extents, and don't have any notion of their position. This is useful for things like colliders (more efficient and ergonomic), but means that they cannot be used as AABBs or replace the rect types.
I ran into a bit of a snag with AabbCast2d
where I wasn't sure if I should be providing the positional data in the ray or the aabb. Is Rectangle
more suitable here?
Problem
In Bevy, there are currently:
Please let me know if I've missed any.
We don't need this many distinct types for a rectangle! This results in user confusion, inconsistencies, duplicated API surfaces and more.
Proposed changes
Rect
used bybevy_ui
in favor ofRectangle
.Rectangle
orCuboid
isn't good enough.