Skip to content

Commit

Permalink
Merge pull request #49 from balp/main
Browse files Browse the repository at this point in the history
  • Loading branch information
splashdust authored Jan 10, 2025
2 parents 74ae7ab + f595fb8 commit b1fe817
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/multiple_worlds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy::{
render::{
mesh::MeshVertexBufferLayoutRef,
render_resource::{
AsBindGroup, RenderPipelineDescriptor, ShaderRef, SpecializedMeshPipelineError,
AsBindGroup, RenderPipelineDescriptor, ShaderDefVal, ShaderRef, SpecializedMeshPipelineError,
},
},
utils::HashMap,
Expand Down Expand Up @@ -189,6 +189,14 @@ impl Material for CustomVoxelMaterial {
layout: &MeshVertexBufferLayoutRef,
_key: MaterialPipelineKey<Self>,
) -> Result<(), SpecializedMeshPipelineError> {
if descriptor
.vertex
.shader_defs
.contains(&ShaderDefVal::Bool("PREPASS_PIPELINE".into(), true))
{
return Ok(());
}

// Use `vertex_layout()` from `bevy_voxel_world` to get the correct vertex layout
let vertex_layout = layout.0.get_layout(&vertex_layout())?;
descriptor.vertex.buffers = vec![vertex_layout];
Expand Down

0 comments on commit b1fe817

Please sign in to comment.