Skip to content

Explanation for the '2d shapes' example #19211

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

Merged
merged 6 commits into from
May 26, 2025

Conversation

fallible-algebra
Copy link
Contributor

Explanation for the 2d shapes example, taken from the original HackMD document and edited a bit.

This example is a strange one, it's eye-catching mostly because it's the first example (at time of writing) in the examples page. That being said, the example does a decent amount of teaching utility to it: we can explain the bevy math-shape to mesh pipeline, which illuminates a way of transforming one form of data (abstract, mathematical shape descriptions) into another (meshes) which may be novel or inspirational to some users.

@greeble-dev greeble-dev added C-Docs An addition or correction to our documentation A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels May 16, 2025
//!
//! Thankfully, we can add shape primitives directly to `Assets<Mesh>` because `Mesh` implements `From` for shape primitives and `Assets<T>::add` can be given any value that can be "turned into" `T`!
//!
//! We apply a material to the shape by first making a `Color` then calling `Assets<ColorMaterial>::add` with that color as its argument, which will create a material from that color through the same process `Assets<Mesh>::add` can take a shape primitive.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these inline code snippets be intra-link doc comments ? That would ensure we don't forget updating them if they change somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

Copy link
Member

@Vrixyz Vrixyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving, but doc links would be neat if possible :)

@fallible-algebra
Copy link
Contributor Author

fallible-algebra commented May 17, 2025

I'm approving, but doc links would be neat if possible :)

I'll get on that! We might need an eye for some further post-processing than what we already do with the docs extraction. As it stands, examples like fixed timestep have to hard-link docs to not appear as "[SomeType]" in the docs, I think?

@fallible-algebra
Copy link
Contributor Author

I'm a bit concerned about the possibility intra-docs will cause too much friction for people doing breaking API changes, as example docs are intended to be discarded if things are too catastrophic wrong and not supposed to get in the way overall. For now, I'll be avoiding them on my examples until there's some more clarity.

@fallible-algebra fallible-algebra marked this pull request as ready for review May 17, 2025 10:44
@Vrixyz Vrixyz added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels May 18, 2025
Co-authored-by: theotherphil <phil.j.ellison@gmail.com>
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the tone and target audience: nice stuff!

@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 26, 2025
Merged via the queue into bevyengine:main with commit cedf8d3 May 26, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants