feat: nonfunctional improvements

This commit is contained in:
Nova
2025-09-01 18:49:04 -07:00
committed by Schmarni
parent e69d85cc56
commit 2357cba5f9
2 changed files with 12 additions and 6 deletions

View File

@@ -15,12 +15,12 @@
} }
#endif #endif
struct MyExtendedMaterial { struct LineMaterial {
quantize_steps: u32, unused: u32,
} }
@group(2) @binding(100) @group(2) @binding(100)
var<uniform> my_extended_material: MyExtendedMaterial; var<uniform> line_mat: LineMaterial;
@fragment @fragment
fn fragment( fn fragment(
@@ -43,7 +43,7 @@ fn fragment(
#endif #endif
// alpha discard // alpha discard
pbr_input.material.base_color = alpha_discard(pbr_input.material, pbr_input.material.base_color); // pbr_input.material.base_color = alpha_discard(pbr_input.material, pbr_input.material.base_color);
#ifdef PREPASS_PIPELINE #ifdef PREPASS_PIPELINE
// in deferred mode we can't modify anything after that, as lighting is run in a separate fullscreen shader. // in deferred mode we can't modify anything after that, as lighting is run in a separate fullscreen shader.

View File

@@ -44,6 +44,10 @@ impl MaterialExtension for LineExtension {
LINE_SHADER_HANDLE.into() LINE_SHADER_HANDLE.into()
} }
fn deferred_fragment_shader() -> ShaderRef {
LINE_SHADER_HANDLE.into()
}
fn alpha_mode() -> Option<AlphaMode> { fn alpha_mode() -> Option<AlphaMode> {
Some(AlphaMode::Opaque) Some(AlphaMode::Opaque)
} }
@@ -112,6 +116,8 @@ fn build_line_mesh(
match lines.entity.get() { match lines.entity.get() {
Some(e) => cmds.entity(**e), Some(e) => cmds.entity(**e),
None => { None => {
// if we couldn't get the lines entity then we need to gen the mesh later
lines.gen_mesh.store(true, Ordering::Relaxed);
let e = cmds.spawn(( let e = cmds.spawn((
Name::new("LinesNode"), Name::new("LinesNode"),
SpatialNode(Arc::downgrade(&lines.spatial)), SpatialNode(Arc::downgrade(&lines.spatial)),
@@ -237,9 +243,9 @@ fn build_line_mesh(
panic!("vertex positions contains non finite pos: {vertex_positions:#?}",); panic!("vertex positions contains non finite pos: {vertex_positions:#?}",);
} }
mesh.insert_indices(Indices::U32(vertex_indices)); mesh.insert_indices(Indices::U32(vertex_indices));
mesh.insert_attribute(Mesh::ATTRIBUTE_COLOR, vertex_colors);
mesh.insert_attribute(Mesh::ATTRIBUTE_NORMAL, vertex_normals);
mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, vertex_positions.clone()); mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, vertex_positions.clone());
mesh.insert_attribute(Mesh::ATTRIBUTE_NORMAL, vertex_normals);
mesh.insert_attribute(Mesh::ATTRIBUTE_COLOR, vertex_colors);
let mut entity = match lines.entity.get() { let mut entity = match lines.entity.get() {
Some(e) => cmds.entity(**e), Some(e) => cmds.entity(**e),