Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: the half type doesn't satisfy std::is_arithmetic so the operator doesn't get instantiated #1893

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading