-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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] - Materials and MaterialPlugin #3428
Conversation
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
bors r+ |
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.
Pull request successfully merged into main. Build succeeded: |
This adds "high level"
Material
andSpecializedMaterial
traits, which can be used with aMaterialPlugin<T: SpecializedMaterial>
.MaterialPlugin
automatically registers the appropriate resources, draw functions, and queue systems. TheMaterial
trait is simpler, and should cover most use cases.SpecializedMaterial
is likeMaterial
, but it also requires defining a "specialization key" (see #3031).Material
has 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_material
example diff) and ensures consistent behavior across all 3d materials (both built in and custom). I ported the built inStandardMaterial
toMaterialPlugin
. There is also a newMaterialMeshBundle<T: SpecializedMaterial>
, whichPbrBundle
aliases to.