Skip to content
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

Bump rand to 0.8 #2

Closed
wants to merge 10 commits into from
Closed

Conversation

danwilhelm
Copy link

@danwilhelm danwilhelm commented Jun 20, 2021

Noticed glam uses rand 0.8, so bumped rand 0.7->0.8 in nannou_core and nannou_new to avoid one extra dependency.

Changes (based on rand upgrade guide):

  • gen_range(a, b) -> gen_range(a..b)
  • nannou std feature now also includes rand/std_rng (required to use random())
  • Added rand:: to random(), in order to clarify where it comes from (similarly to rand::thread_rng() later in the file).
  • Updated SmallRng::from_seed([0; 16]) to the recommended SmallRng::seed_from_u64(0). (This ensures the random seed bits are more evenly balanced between 0s and 1s, which some PRNGs may require.)

mitchmindtree and others added 10 commits June 18, 2021 23:53
See nannou-org#752 for motivation behind adding a `nannou_core` crate.

Note that this commit does not yet replace the color, geom, math and
rand modules within the `nannou` crate. This will be performed in a
following commit.
This removes the color, math, rand and geom modules in favour of
depending on the `nannou_core` crate. The `nannou_core` modules are
re-exported within `nannou` in order to provide a near identical API to
the existing one.

The majority of changes here revolve around the change from `cgmath` to
`glam`. The most notable changes include:

- `geom::Vector2` -> `glam::Vec2`
- `cgmath::Matrix4<f32>` -> `glam::Mat4`
- `magnitude` -> `length`

This change also removes the generic `Scalar` type parameter from the
`Draw` API and related items in the hope of improving downstream compile
times.

Also removes the seemingly unused `geom::graph` module. Use-cases for
this module and its abstractions were mostly made reduntatnt upon
allowing for transformations to be applied to the `Draw` instance
itself.
This refactors the `Rect` and `Cuboid` methods to try to use `Point*`
and `Vec*` types where possible for `Rect<f32>` and `Rect<f64>` in order
to maintain an API closer to the original and avoid large sweeps amounts
of breaking changes.

Also exposes common `glam` types via the `nannou_core` `prelude` module.
@mitchmindtree
Copy link
Owner

Nice one!

I rebased nannou_core onto master before noticing this PR, however I just pulled your bump_rand branch locally, rebased the last commit and then merged it into the nannou_core branch manually. Seeing as it's now included in nannou-org#754 I'll close this PR.

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

Successfully merging this pull request may close these issues.

2 participants