Skip to content

Commit

Permalink
Merge pull request #1893 from apradhana/fix_vec3h_regression
Browse files Browse the repository at this point in the history
Bug fix: the half type doesn't satisfy std::is_arithmetic so the operator doesn't get instantiated
  • Loading branch information
apradhana committed Sep 10, 2024
2 parents 6719224 + 59c23b4 commit 5a547f1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions openvdb/openvdb/math/Vec3.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,20 @@ Abs(const Vec3<T>& v)
return Vec3<T>(Abs(v[0]), Abs(v[1]), Abs(v[2]));
}

template<>
inline auto cwiseAdd(const Vec3<math::internal::half>& v, const float s)
{
Vec3<math::internal::half> out;
const math::internal::half* ip = v.asPointer();
math::internal::half* op = out.asPointer();
for (unsigned i = 0; i < 3; ++i, ++op, ++ip) {
OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
*op = *ip + s;
OPENVDB_NO_TYPE_CONVERSION_WARNING_END
}
return out;
}

/// Orthonormalize vectors v1, v2 and v3 and store back the resulting
/// basis e.g. Vec3d::orthonormalize(v1,v2,v3);
template <typename T>
Expand Down

0 comments on commit 5a547f1

Please sign in to comment.