Mesh rendering support for Gizmos #10621
Closed
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.
Objective
Add support for rendering meshes to
bevy_gizmos.Solution
Adapt the mesh rendering code from
bevy_pbrandbevy_spritefor gizmo rendering.I copied the
mesh.rsfiles from bothbevy_pbrandbevy_spriteand dumbed them down to rendering just a mesh with a color and some fake shading via a single uniform, removing support for any materials, textures or lighting, hopefully gaining some performance.gizmo_mesh_pipeline_3d.rsismesh.rsadapted frombevy_pbr.gizmo_mesh_pipeline_2d.rsismesh.rsadapted frombevy_sprite.gizmo_mesh_shared.rshas the code that can be shared between those files.Additional types and extraction to the render world is in
mesh_pipeline/mod.rs.The new API can be seen used in the
3d_gizmosexample. (It needs some cleaning up though)Changelog
Added
meshmethod to theGizmossystem parameter for drawing meshes as gizmos.Added
GizmoMeshBundlethat act much likePbrBundlebut instead of having a material asset it has a simpleGizmoStylecomponent containing only an option for color at the moment.TODO
Test whether the performance is worth the code duplication between this and
bevy_pbr+bevy_spriteor whether something more janky but with less code duplication is betterSplit some changes from this PR
Yeet tonemapping
Wail in terror
Test that bevy_gizmos still compiles when either bevy_pbr or bevy_sprite is disabled
Some additional cleanup, probably