[Merged by Bors] - Materials and MaterialPlugin#3428
Closed
cart wants to merge 4 commits intobevyengine:mainfrom
Closed
[Merged by Bors] - Materials and MaterialPlugin#3428cart wants to merge 4 commits intobevyengine:mainfrom
cart wants to merge 4 commits intobevyengine:mainfrom
Conversation
Member
|
This looks very nice; the code is surprisingly easy to follow and this seems straightforward to customize (as far as these things go). Docs are pretty decent (other than the nit I left): most of this is going to be better served by googling "what's a bind group" for now. Unfortunately we don't have any great tools for testing rendering code yet. At least the example is there :) |
1fba323 to
78c8a5d
Compare
Member
Author
|
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Dec 25, 2021
This adds "high level" `Material` and `SpecializedMaterial` traits, which can be used with a `MaterialPlugin<T: SpecializedMaterial>`. `MaterialPlugin` automatically registers the appropriate resources, draw functions, and queue systems. The `Material` trait is simpler, and should cover most use cases. `SpecializedMaterial` is like `Material`, but it also requires defining a "specialization key" (see #3031). `Material` has a trivial blanket impl of `SpecializedMaterial`, which allows us to use the same types + functions for both. This makes defining custom 3d materials much simpler (see the `shader_material` example diff) and ensures consistent behavior across all 3d materials (both built in and custom). I ported the built in `StandardMaterial` to `MaterialPlugin`. There is also a new `MaterialMeshBundle<T: SpecializedMaterial>`, which `PbrBundle` aliases to.
Contributor
|
Pull request successfully merged into main. Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds "high level"
MaterialandSpecializedMaterialtraits, which can be used with aMaterialPlugin<T: SpecializedMaterial>.MaterialPluginautomatically registers the appropriate resources, draw functions, and queue systems. TheMaterialtrait is simpler, and should cover most use cases.SpecializedMaterialis likeMaterial, but it also requires defining a "specialization key" (see #3031).Materialhas a trivial blanket impl ofSpecializedMaterial, which allows us to use the same types + functions for both.This makes defining custom 3d materials much simpler (see the
shader_materialexample diff) and ensures consistent behavior across all 3d materials (both built in and custom). I ported the built inStandardMaterialtoMaterialPlugin. There is also a newMaterialMeshBundle<T: SpecializedMaterial>, whichPbrBundlealiases to.