Fix #110083: Fix incorrect initialization of bounds max #110084

Merged
Hans Goudey merged 1 commits from mod_moder/blender:fix_min_is_not_negative_inf into main 2023-07-14 03:16:13 +02:00
4 changed files with 5 additions and 5 deletions

View File

@ -204,14 +204,14 @@ std::optional<Bounds<float3>> GeometrySet::compute_boundbox_without_instances()
}
if (const Mesh *mesh = this->get_mesh_for_read()) {
Bounds<float3> mesh_bounds{float3(std::numeric_limits<float>::max()),
float3(std::numeric_limits<float>::min())};
float3(std::numeric_limits<float>::lowest())};
if (BKE_mesh_wrapper_minmax(mesh, mesh_bounds.min, mesh_bounds.max)) {
bounds = bounds::merge(bounds, {mesh_bounds});
}
}
if (const Volume *volume = this->get_volume_for_read()) {
Bounds<float3> volume_bounds{float3(std::numeric_limits<float>::max()),
float3(std::numeric_limits<float>::min())};
float3(std::numeric_limits<float>::lowest())};
if (BKE_volume_min_max(volume, volume_bounds.min, volume_bounds.max)) {
bounds = bounds::merge(bounds, {volume_bounds});
}

View File

@ -3855,7 +3855,7 @@ bool BKE_object_boundbox_calc_from_evaluated_geometry(Object *ob)
}
else if (const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob)) {
Bounds<float3> mesh_bounds{float3(std::numeric_limits<float>::max()),
float3(std::numeric_limits<float>::min())};
float3(std::numeric_limits<float>::lowest())};
if (BKE_mesh_wrapper_minmax(mesh_eval, mesh_bounds.min, mesh_bounds.max)) {
bounds = bounds::merge(bounds, {mesh_bounds});
}

View File

@ -896,7 +896,7 @@ template<typename T> static std::optional<T> deserialize_int(const io::serialize
return std::nullopt;
}
const int64_t value = io_int->value();
if (value < std::numeric_limits<T>::min()) {
if (value < std::numeric_limits<T>::lowest()) {
return std::nullopt;
}
if (value > std::numeric_limits<T>::max()) {

View File

@ -81,7 +81,7 @@ void USDVolumeWriter::do_write(HierarchyContext &context)
}
float3 volume_bound_min(std::numeric_limits<float>::max());
float3 volume_bound_max(std::numeric_limits<float>::min());
float3 volume_bound_max(std::numeric_limits<float>::lowest());
if (BKE_volume_min_max(volume, volume_bound_min, volume_bound_max)) {
const pxr::VtArray<pxr::GfVec3f> volume_extent = {pxr::GfVec3f(&volume_bound_min[0]),
pxr::GfVec3f(&volume_bound_max[0])};