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

bevy_render: add torus and capsule shape #1223

Merged
merged 8 commits into from
Jan 8, 2021

Conversation

jakobhellermann
Copy link
Contributor

The file was getting quite large, so I also refactored it into multiple files.

impl From<Icosphere> for Mesh {
fn from(sphere: Icosphere) -> Self {
if sphere.subdivisions >= 80 {
// https://oeis.org/A005901
Copy link
Member

Choose a reason for hiding this comment

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

It looks like oeis content is available under the Creative Commons Non-Commerical 3.0 license: https://creativecommons.org/licenses/by-nc/3.0/

This is unfortunately not compatible with the MIT license (or the general concept of selling games).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the Icosphere code is not modified in this commit, only extracted into an own file.
It looks like this commit introduces the comment.

Copy link
Member

Choose a reason for hiding this comment

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

oof we should remove that then 😄

@OptimisticPeach any thoughts on this?

Copy link
Contributor

@OptimisticPeach OptimisticPeach Jan 7, 2021

Choose a reason for hiding this comment

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

Hmm, I think it'd be preferable to keep some kind of explanation there, however it's up to your discretion.

I'm not very keen on license rules, however might wikipedia be a better resource? https://en.wikipedia.org/wiki/Geodesic_polyhedron#Elements

I just read your second comment about a CC ShareAlike license. Let me look for a better way

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I drafted up a desmos graph to explain a method of calculating it:
https://www.desmos.com/calculator/8bbvlpkecj
However, it doesn't seem that desmos can be used for commercial applications or anything of the sort, hence, I made a gist with the same contents:
https://gist.github.com/OptimisticPeach/0851820de5694850d10f8b050beed125
I believe that linking to that, and additionally changing the code to reflect it, to the following:

let temp = sphere.subdivisions + 1;
let number_of_resulting_points = temp * temp * 10 + 2;

To better reflect these calculations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the code and included @OptimisticPeach's explanation (in my opinion it is short enough to put it in the code). I think this PR should only contain MIT licensed code now.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me. Thanks for resolving this so quickly!


impl From<Torus> for Mesh {
fn from(torus: Torus) -> Self {
// code adapted from http://wiki.unity3d.com/index.php/ProceduralPrimitives#C.23_-_Torus
Copy link
Member

Choose a reason for hiding this comment

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

Unity Wiki content is Creative Commons ShareAlike 3.0. This probably qualifies as a "remix", which means this code also must be released under that license.

We can probably deal with a ShareAlike license, but its suboptimal because any changes made to this code must also be ShareAlike, and we need to label this file as such. In general I'd prefer it if we used content that is compatible with MIT to keep the licensing situation clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I understand. I'll look for another implementation that's more permissively licensed. MIT and CC-0 should be okay, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yup CC-0 is fine. It doesn't require attribution, but if we find code, lets provide attribution anyway (if we can).

@cart
Copy link
Member

cart commented Jan 7, 2021

These changes are very welcome, but they currently come at the cost of license complexity (and/or incompatibility). I'm hoping we can find equivalent algorithms / number sequences under more permissive licenses. I'm guessing the folks at Unity Wiki didn't invent the Torus generation algorithm, so this might just be a matter of finding a more "primary" source and basing the code on that.

@jakobhellermann jakobhellermann marked this pull request as draft January 7, 2021 20:57
@cart
Copy link
Member

cart commented Jan 8, 2021

Looks good to me. Thanks for putting up with my cautiousness. I just want to be as safe as possible when it comes to these things.

@cart cart merged commit 3f2dd22 into bevyengine:master Jan 8, 2021
rparrett pushed a commit to rparrett/bevy that referenced this pull request Jan 27, 2021
* bevy_render: add torus shape

* bevy_render: add capsule shape

* bevy_render: reorganize shape module

* bevy_render: add more docs
@jakobhellermann jakobhellermann deleted the more-shapes branch April 11, 2021 18:57
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.

3 participants