forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add single-f32 constructors for a few (very few) primitives (bevyengi…
…ne#11934) # Objective - I hated having to do `Cuboid::new(1.0, 1.0, 1.0)` or `Cuboid::from_size(Vec3::splat(1.0))` when there should be a much easier way to do this. ## Solution - Implemented a `from_length()` method that only takes in a single float, and constructs a primitive of equal size in all directions. - Ex: ```rs // These: Cuboid::new(1.0, 1.0, 1.0); Cuboid::from_size(Vec3::splat(1.0)); // Are equivalent to this: Cuboid::from_length(1.0); ``` - For the rest of the changed primitives: ```rs Rectangle::from_length(1.0); Plane3d::default().mesh().from_length(1.0); ```
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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