-
Notifications
You must be signed in to change notification settings - Fork 658
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
Draft PR: Half Grid Support for OpenVDB #1730
base: master
Are you sure you want to change the base?
Changes from 1 commit
d4a90b1
d4f209c
3c2d73d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ using Int64 = int64_t; | |
using Int = Int32; | ||
using Byte = unsigned char; | ||
using Real = double; | ||
using Half = math::half; | ||
|
||
// Two-dimensional vector types | ||
using Vec2R = math::Vec2<Real>; | ||
|
@@ -446,6 +447,29 @@ template<typename FromType, typename ToType> struct CopyConstness<const FromType | |
/// @endcond | ||
|
||
|
||
//////////////////////////////////////// | ||
template<class T> | ||
struct is_floating_point : std::is_floating_point<T> { }; | ||
|
||
template<> | ||
struct is_floating_point<math::half> : std::is_floating_point<float> { }; | ||
|
||
/// @brief Maps one type (e.g. the value types) to other types | ||
template<typename T> | ||
struct ValueToComputeMap | ||
{ | ||
using Type = T; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably pick one style and go with that? Either |
||
using type = T; | ||
}; | ||
|
||
template<> | ||
struct ValueToComputeMap<math::half> | ||
{ | ||
using Type = float; | ||
using type = float; | ||
}; | ||
|
||
|
||
//////////////////////////////////////// | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
#include <algorithm> | ||
#include <cmath> | ||
#include <type_traits> | ||
#include "Half.h" | ||
|
||
|
||
namespace openvdb { | ||
|
@@ -668,6 +669,21 @@ OPENVDB_IS_POD(Vec3ui) | |
OPENVDB_IS_POD(Vec3s) | ||
OPENVDB_IS_POD(Vec3d) | ||
|
||
// Half WIP | ||
template<> | ||
inline auto cwiseAdd(const Vec3<math::internal::half>& v, const float s) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. Thanks for catching this, Dan. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just pushed an updated version of this PR that moves this function to |
||
{ | ||
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; | ||
} | ||
|
||
} // namespace math | ||
} // namespace OPENVDB_VERSION_NAME | ||
} // namespace openvdb | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume some of these changes are just part of the draft PR and won't end up in the final PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! I changed a few things in this Draft PR to highlight some of the processes I'm going through for the people from Autodesk.