Accept finite negative material RGB coefficients
Docs Deploy / Build and Deploy MkDocs (push) Successful in 36s
Docs Deploy / Build and Deploy MkDocs (push) Successful in 36s
This commit is contained in:
2 files changed
+28
-14
No files matched your search
@@ -1091,10 +1091,10 @@ impl VulkanSmokeRenderer {
|
||||
.chain(additive_rgb)
|
||||
.chain(overlay_directional_rgb.into_iter().flatten())
|
||||
.chain(overlay_additive_rgb.into_iter().flatten())
|
||||
.any(|value| !value.is_finite() || value < 0.0)
|
||||
.any(|value| !value.is_finite())
|
||||
{
|
||||
return Err(VulkanSmokeRendererError::InvalidStaticMesh {
|
||||
context: "dynamic material lighting must be finite and non-negative",
|
||||
context: "dynamic material lighting must be finite",
|
||||
});
|
||||
}
|
||||
let lighting = self.material_lighting.get_mut(material_index).ok_or(
|
||||
@@ -1155,10 +1155,10 @@ impl VulkanSmokeRenderer {
|
||||
if specular_rgb
|
||||
.into_iter()
|
||||
.chain(overlay_specular_rgb.into_iter().flatten())
|
||||
.any(|value| !value.is_finite() || value < 0.0)
|
||||
.any(|value| !value.is_finite())
|
||||
{
|
||||
return Err(VulkanSmokeRendererError::InvalidStaticMesh {
|
||||
context: "dynamic material specular RGB must be finite and non-negative",
|
||||
context: "dynamic material specular RGB must be finite",
|
||||
});
|
||||
}
|
||||
let specular = self.material_specular.get_mut(material_index).ok_or(
|
||||
|
||||
@@ -622,9 +622,9 @@ pub(super) fn resolve_draw_texture_indices(
|
||||
.chain(material.additive_rgb)
|
||||
.chain(material.specular_rgb)
|
||||
.chain(material.overlay_specular_rgb.into_iter().flatten())
|
||||
.any(|value| !value.is_finite() || value < 0.0)
|
||||
.any(|value| !value.is_finite())
|
||||
{
|
||||
return Err("static material lighting and specular RGB parameters must be finite and non-negative");
|
||||
return Err("static material lighting and specular RGB parameters must be finite");
|
||||
}
|
||||
if material
|
||||
.uv_transform
|
||||
@@ -645,9 +645,9 @@ pub(super) fn resolve_draw_texture_indices(
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.chain(material.overlay_additive_rgb.into_iter().flatten())
|
||||
.any(|value| !value.is_finite() || value < 0.0)
|
||||
.any(|value| !value.is_finite())
|
||||
{
|
||||
return Err("static material overlay RGB parameters must be finite and non-negative");
|
||||
return Err("static material overlay RGB parameters must be finite");
|
||||
}
|
||||
if material
|
||||
.overlay_uv_transform
|
||||
@@ -1012,15 +1012,15 @@ mod static_mesh_tests {
|
||||
overlay_detail_texture: None,
|
||||
diffuse_alpha: 1.0,
|
||||
overlay_diffuse_alpha: None,
|
||||
directional_rgb: [1.0; 3],
|
||||
additive_rgb: [0.0; 3],
|
||||
specular_rgb: [0.0; 3],
|
||||
directional_rgb: [-0.25; 3],
|
||||
additive_rgb: [-0.5; 3],
|
||||
specular_rgb: [-0.75; 3],
|
||||
specular_power: 0,
|
||||
overlay_specular_rgb: None,
|
||||
overlay_specular_rgb: Some([-1.0; 3]),
|
||||
overlay_specular_power: None,
|
||||
uv_transform: [0.0, 0.0, 1.0, 1.0],
|
||||
overlay_directional_rgb: None,
|
||||
overlay_additive_rgb: None,
|
||||
overlay_directional_rgb: Some([-0.125; 3]),
|
||||
overlay_additive_rgb: Some([-0.375; 3]),
|
||||
detail_uv_transform: [0.0, 0.0, 1.0, 1.0],
|
||||
overlay_uv_transform: None,
|
||||
overlay_detail_uv_transform: None,
|
||||
@@ -1061,6 +1061,20 @@ mod static_mesh_tests {
|
||||
resolve_draw_texture_indices(&ranges, &materials),
|
||||
Ok(vec![1, 0])
|
||||
);
|
||||
|
||||
let mut non_finite_base = materials.clone();
|
||||
non_finite_base[0].specular_rgb[0] = f32::NAN;
|
||||
assert_eq!(
|
||||
resolve_draw_texture_indices(&ranges, &non_finite_base),
|
||||
Err("static material lighting and specular RGB parameters must be finite")
|
||||
);
|
||||
|
||||
let mut non_finite_overlay = materials.clone();
|
||||
non_finite_overlay[0].overlay_additive_rgb = Some([f32::INFINITY, 0.0, 0.0]);
|
||||
assert_eq!(
|
||||
resolve_draw_texture_indices(&ranges, &non_finite_overlay),
|
||||
Err("static material overlay RGB parameters must be finite")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user