mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
Restore C++14 compatibility
Summary: Fix the new CPU implementation of point_mesh functionality to be compatible with older C++. Reviewed By: nikhilaravi Differential Revision: D22066785 fbshipit-source-id: a245849342019a93ff68e186a10985458b007436
This commit is contained in:
parent
74659aef26
commit
2f6387f239
@ -11,38 +11,32 @@
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
vec3<T> ExtractPoint(const at::TensorAccessor<T, 1>& t) {
|
vec3<T> ExtractPoint(const at::TensorAccessor<T, 1>& t) {
|
||||||
return vec3(t[0], t[1], t[2]);
|
return vec3<T>(t[0], t[1], t[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Accessor>
|
template <typename Accessor>
|
||||||
struct ExtractHullHelper {
|
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 1>
|
||||||
template <int H>
|
ExtractHullHelper(const Accessor& t, std::array<char, 1> /*tag*/) {
|
||||||
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, H>
|
|
||||||
get(const Accessor& t);
|
|
||||||
|
|
||||||
template <>
|
|
||||||
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 1>
|
|
||||||
get<1>(const Accessor& t) {
|
|
||||||
return {ExtractPoint(t)};
|
return {ExtractPoint(t)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <typename Accessor>
|
||||||
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 2>
|
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 2>
|
||||||
get<2>(const Accessor& t) {
|
ExtractHullHelper(const Accessor& t, std::array<char, 2> /*tag*/) {
|
||||||
return {ExtractPoint(t[0]), ExtractPoint(t[1])};
|
return {ExtractPoint(t[0]), ExtractPoint(t[1])};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <typename Accessor>
|
||||||
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 3>
|
static std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, 3>
|
||||||
get<3>(const Accessor& t) {
|
ExtractHullHelper(const Accessor& t, std::array<char, 3> /*tag*/) {
|
||||||
return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])};
|
return {ExtractPoint(t[0]), ExtractPoint(t[1]), ExtractPoint(t[2])};
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
template <int H, typename Accessor>
|
template <int H, typename Accessor>
|
||||||
std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, H>
|
std::array<vec3<std::remove_pointer_t<typename Accessor::PtrType>>, H>
|
||||||
ExtractHull(const Accessor& t) {
|
ExtractHull(const Accessor& t) {
|
||||||
return ExtractHullHelper<Accessor>::template get<H>(t);
|
std::array<char, H> tag;
|
||||||
|
return ExtractHullHelper(t, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user