Skip to content

Commit 60d2343

Browse files
authored
Merge pull request #1894 from apradhana/fix_fix_vec3h_regression
Fixing build issue caused by adding cwiseAdd in `math/Vec3.h`
2 parents 81869db + 3ed0dc8 commit 60d2343

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

openvdb/openvdb/Types.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,23 @@ class Steal {};
688688
/// @brief Tag dispatch class that distinguishes constructors during file input
689689
class PartialCreate {};
690690

691+
// For half compilation
692+
namespace math {
693+
template<>
694+
inline auto cwiseAdd(const math::Vec3<math::half>& v, const float s)
695+
{
696+
math::Vec3<math::half> out;
697+
const math::half* ip = v.asPointer();
698+
math::half* op = out.asPointer();
699+
for (unsigned i = 0; i < 3; ++i, ++op, ++ip) {
700+
OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
701+
*op = *ip + s;
702+
OPENVDB_NO_TYPE_CONVERSION_WARNING_END
703+
}
704+
return out;
705+
}
706+
} // namespace math
707+
691708
} // namespace OPENVDB_VERSION_NAME
692709
} // namespace openvdb
693710

openvdb/openvdb/math/Vec3.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -594,20 +594,6 @@ Abs(const Vec3<T>& v)
594594
return Vec3<T>(Abs(v[0]), Abs(v[1]), Abs(v[2]));
595595
}
596596

597-
template<>
598-
inline auto cwiseAdd(const Vec3<math::internal::half>& v, const float s)
599-
{
600-
Vec3<math::internal::half> out;
601-
const math::internal::half* ip = v.asPointer();
602-
math::internal::half* op = out.asPointer();
603-
for (unsigned i = 0; i < 3; ++i, ++op, ++ip) {
604-
OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
605-
*op = *ip + s;
606-
OPENVDB_NO_TYPE_CONVERSION_WARNING_END
607-
}
608-
return out;
609-
}
610-
611597
/// Orthonormalize vectors v1, v2 and v3 and store back the resulting
612598
/// basis e.g. Vec3d::orthonormalize(v1,v2,v3);
613599
template <typename T>

0 commit comments

Comments
 (0)