Skip to content

Commit 59c23b4

Browse files
committed
Add cwiseAdd to Vec3.h because half type doesn't satisfy std::is_arithmetic so the operator doesn't get instantiated.
Signed-off-by: apradhana <[email protected]>
1 parent 6719224 commit 59c23b4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

openvdb/openvdb/math/Vec3.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,20 @@ 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+
597611
/// Orthonormalize vectors v1, v2 and v3 and store back the resulting
598612
/// basis e.g. Vec3d::orthonormalize(v1,v2,v3);
599613
template <typename T>

0 commit comments

Comments
 (0)