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

[Merged by Bors] - remove mandatory mesh attributes #6127

Closed
wants to merge 1 commit into from

Conversation

IceSentry
Copy link
Contributor

Objective

  • It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

Solution

  • Don't assume these attributes are present and add a shader defs for each attributes
  • I updated 2d and 3d meshes to use the same logic.

Changelog

  • Meshes don't require any attributes

Notes

I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.

@IceSentry IceSentry added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Sep 29, 2022
Copy link
Contributor

@tim-blackbird tim-blackbird left a comment

Choose a reason for hiding this comment

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

LGTM.
It would be nice to have warnings when a material is used with a mesh that is missing the required attributes.
Perhaps the Material trait could be extended to optionally specify these, in a future PR.

@IceSentry
Copy link
Contributor Author

Perhaps the Material trait could be extended to optionally specify these, in a future PR.

Yeah, that could work, I like the idea

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 like these changes a lot: users would regularly stumble on this. Can you add a test to verify that this continues to work?

Code looks good, so once we have automated testing I'm comfortable merging this (yay for slowly learning rendering).

@IceSentry
Copy link
Contributor Author

@alice-i-cecile I tried writing a test, but it requires pretty much an entire App with the entire render pipeline setup to be able to call MeshPipeline::specialize() and it seems a bit overkill here.

I think rendering in general would need a bit more testing infrastructure before we can easily test things like this.

@alice-i-cecile
Copy link
Member

Alright, that makes sense.

bors r+

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 10, 2022
bors bot pushed a commit that referenced this pull request Oct 10, 2022
# Objective

- It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

## Solution

- Don't assume these attributes are present and add a shader defs for each attributes
- I updated 2d and 3d meshes to use the same logic.

---

## Changelog

- Meshes don't require any attributes

# Notes
I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.
@bors bors bot changed the title remove mandatory mesh attributes [Merged by Bors] - remove mandatory mesh attributes Oct 10, 2022
@bors bors bot closed this Oct 10, 2022
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 19, 2022
# Objective

- It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

## Solution

- Don't assume these attributes are present and add a shader defs for each attributes
- I updated 2d and 3d meshes to use the same logic.

---

## Changelog

- Meshes don't require any attributes

# Notes
I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

- It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

## Solution

- Don't assume these attributes are present and add a shader defs for each attributes
- I updated 2d and 3d meshes to use the same logic.

---

## Changelog

- Meshes don't require any attributes

# Notes
I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.
@IceSentry IceSentry deleted the mesh-attributes branch November 21, 2022 20:15
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this pull request Dec 17, 2022
# Objective

- It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

## Solution

- Don't assume these attributes are present and add a shader defs for each attributes
- I updated 2d and 3d meshes to use the same logic.

---

## Changelog

- Meshes don't require any attributes

# Notes
I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- It's possible to create a mesh without positions or normals, but currently bevy forces these attributes to be present on any mesh.

## Solution

- Don't assume these attributes are present and add a shader defs for each attributes
- I updated 2d and 3d meshes to use the same logic.

---

## Changelog

- Meshes don't require any attributes

# Notes
I didn't update the pbr.wgsl shader because I'm not sure how to handle it. It doesn't really make sense to use it without positions or normals.
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-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants