fix(render): honor terrain base-only face flags
Docs Deploy / Build and Deploy MkDocs (push) Successful in 33s
Docs Deploy / Build and Deploy MkDocs (push) Successful in 33s
This commit is contained in:
7 files changed
+96
-23
No files matched your search
@@ -1902,18 +1902,23 @@ impl VulkanSmokeRenderer {
|
||||
60,
|
||||
&material_uv_transforms,
|
||||
);
|
||||
let unlit = self.material_unlit.get(texture_index).ok_or(
|
||||
let material_mode = self.material_unlit.get(texture_index).ok_or(
|
||||
VulkanSmokeRendererError::InvariantViolation {
|
||||
context: "static material unlit flag",
|
||||
},
|
||||
)?;
|
||||
let unlit = [unlit.to_ne_bytes()];
|
||||
let material_mode = if range.terrain_base_only {
|
||||
((*material_mode).round() as i32 | 16) as f32
|
||||
} else {
|
||||
*material_mode
|
||||
};
|
||||
let material_mode = [material_mode.to_ne_bytes()];
|
||||
device.device().cmd_push_constants(
|
||||
command_buffer,
|
||||
resources.pipeline_layout,
|
||||
vk::ShaderStageFlags::VERTEX | vk::ShaderStageFlags::FRAGMENT,
|
||||
124,
|
||||
&unlit.concat(),
|
||||
&material_mode.concat(),
|
||||
);
|
||||
device.device().cmd_draw_indexed(
|
||||
command_buffer,
|
||||
@@ -2577,6 +2582,7 @@ mod tests {
|
||||
lightmap_index: 4,
|
||||
batch_flags: 0x108,
|
||||
pipeline_state: base_state,
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 17,
|
||||
},
|
||||
VulkanStaticDrawRange {
|
||||
@@ -2586,6 +2592,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
];
|
||||
@@ -2769,6 +2776,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: fparkan_render::LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
@@ -2792,6 +2800,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: fparkan_render::LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
super::super::VulkanStaticDrawRange {
|
||||
@@ -2801,6 +2810,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: fparkan_render::LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
super::super::VulkanStaticDrawRange {
|
||||
@@ -2810,6 +2820,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: fparkan_render::LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
];
|
||||
@@ -2833,6 +2844,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: fparkan_render::LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
@@ -2861,6 +2873,7 @@ mod tests {
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
terrain_base_only: false,
|
||||
alpha_test_reference: 0,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -422,6 +422,8 @@ pub struct VulkanStaticDrawRange {
|
||||
/// Bits `0x100` and `0x008` opt a range into that queue independently of
|
||||
/// the material blend category.
|
||||
pub batch_flags: u16,
|
||||
/// Terrain ranges that use the native lit base-only path (face flag 0x400 clear).
|
||||
pub terrain_base_only: bool,
|
||||
/// Backend-neutral fixed-function state for this source range.
|
||||
pub pipeline_state: LegacyPipelineState,
|
||||
/// Alpha-test reference in legacy 0..=255 units; dynamic material data.
|
||||
@@ -754,6 +756,7 @@ impl VulkanStaticMesh {
|
||||
material_index: 0,
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
terrain_base_only: false,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
alpha_test_reference: 0,
|
||||
}],
|
||||
@@ -989,6 +992,7 @@ mod static_mesh_tests {
|
||||
material_index: 0,
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
terrain_base_only: false,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
alpha_test_reference: 0,
|
||||
}],
|
||||
@@ -1019,6 +1023,7 @@ mod static_mesh_tests {
|
||||
material_index: 7,
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
terrain_base_only: false,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
@@ -1028,6 +1033,7 @@ mod static_mesh_tests {
|
||||
material_index: 2,
|
||||
lightmap_index: u8::MAX,
|
||||
batch_flags: 0,
|
||||
terrain_base_only: false,
|
||||
pipeline_state: LegacyPipelineState::default(),
|
||||
alpha_test_reference: 0,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user