-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature/core changes #245
Feature/core changes #245
Changes from all commits
61c5da7
fda9a79
d381df6
5be8bb3
983dd82
d9aaa70
f511e4d
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 | ||||
---|---|---|---|---|---|---|
|
@@ -59,7 +59,7 @@ | |||||
namespace inviwo { | ||||||
|
||||||
struct CustomMeshTraits : public OpenMesh::DefaultTraits { | ||||||
typedef OpenMesh::Vec4f Color; | ||||||
using Color = OpenMesh::Vec4f; | ||||||
|
||||||
VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::TexCoord3D | | ||||||
OpenMesh::Attributes::Color); | ||||||
|
@@ -68,37 +68,35 @@ struct CustomMeshTraits : public OpenMesh::DefaultTraits { | |||||
using TriMesh = OpenMesh::TriMesh_ArrayKernelT<CustomMeshTraits>; | ||||||
|
||||||
namespace openmeshutil { | ||||||
namespace detail { | ||||||
|
||||||
template <typename T> | ||||||
struct BufferConvertHelper { | ||||||
using type = Buffer<T>; | ||||||
using value_type = T; | ||||||
static T convertValue(const T& v) { return v; } | ||||||
}; | ||||||
|
||||||
template <typename T, unsigned D> | ||||||
struct BufferConvertHelper<OpenMesh::VectorT<T, D>> { | ||||||
using type = Buffer<Vector<D, T>>; | ||||||
using value_type = Vector<D, T>; | ||||||
static glm::vec<D, T> convertValue(const OpenMesh::VectorT<T, D>& v) { | ||||||
glm::vec<D, T> res; | ||||||
for (unsigned i = 0; i < D; i++) { | ||||||
res[i] = v[i]; | ||||||
} | ||||||
return res; | ||||||
} | ||||||
}; | ||||||
namespace detail { | ||||||
|
||||||
template <typename T, typename OM_Mesh, typename Func> | ||||||
void convertOMtoInviwoBuffer(inviwo::Mesh& ivwMesh, const OM_Mesh& omMesh, BufferType bufferType, | ||||||
Func callback) { | ||||||
using Helper = typename detail::BufferConvertHelper<T>; | ||||||
auto vertices = std::make_shared<typename Helper::type>(); | ||||||
auto& vec = vertices->getEditableRAMRepresentation()->getDataContainer(); | ||||||
ivwMesh.addBuffer(bufferType, vertices); | ||||||
for (const OpenMesh::VertexHandle& v_it : omMesh.vertices()) { | ||||||
vec.push_back(Helper::convertValue(callback(v_it))); | ||||||
if constexpr (std::is_arithmetic_v<T>) { | ||||||
auto vertices = std::make_shared<Buffer<T>>(); | ||||||
auto& vec = vertices->getEditableRAMRepresentation()->getDataContainer(); | ||||||
ivwMesh.addBuffer(bufferType, vertices); | ||||||
for (const OpenMesh::VertexHandle& v_it : omMesh.vertices()) { | ||||||
vec.push_back(callback(v_it)); | ||||||
} | ||||||
} else { | ||||||
using value_type = glm::vec<T::dim(), typename T::value_type, glm::defaultp>; | ||||||
auto convertValue = [](const T& v) { | ||||||
value_type res{0}; | ||||||
for (int i = 0; i < T::dim(); i++) { | ||||||
res[i] = v[i]; | ||||||
} | ||||||
return res; | ||||||
}; | ||||||
|
||||||
auto vertices = std::make_shared<Buffer<value_type>>(); | ||||||
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. clang-tidy diagnostics
Suggested change
clang-tidy diagnosticmisc/openmesh/include/inviwo/openmesh/utils/openmeshconverters.h:89:20: error: [clang-diagnostic-error]
89 | res[i] = v[i];
| ~~~^~ clang-tidy diagnosticmisc/openmesh/include/inviwo/openmesh/utils/openmeshconverters.h:94:49: error: [clang-diagnostic-error]
94 | auto vertices = std::make_shared<Buffer<value_type>>();
| ^ |
||||||
auto& vec = vertices->getEditableRAMRepresentation()->getDataContainer(); | ||||||
ivwMesh.addBuffer(bufferType, vertices); | ||||||
for (const OpenMesh::VertexHandle& v_it : omMesh.vertices()) { | ||||||
vec.push_back(convertValue(callback(v_it))); | ||||||
} | ||||||
} | ||||||
}; | ||||||
|
||||||
|
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.
clang-tidy diagnostics
clang-tidy diagnostic
misc/openmesh/include/inviwo/openmesh/utils/openmeshconverters.h:85:37: error: [clang-diagnostic-error]
clang-tidy diagnostic
misc/openmesh/include/inviwo/openmesh/utils/openmeshconverters.h:87:13: error: [clang-diagnostic-error]
clang-tidy diagnostic
misc/openmesh/include/inviwo/openmesh/utils/openmeshconverters.h:87:13: error: [clang-diagnostic-error]