I’m using the Eigen library in a computer graphics project with meshes that will change often.
What are the performance implications of using a dynamic Eigen Matrix for all the vertex positions, normals, etc?
Should I use:
Eigen::Matrix<float, Eigen::Dynamic, 3, Eigen::RowMajor> vertices;
or
std::vector<Eigen::Vector3f> vertices;
I will have to copy the mesh data to GPU after every change, but as I understand it, I can do this with memcpy efficiently with both representations.
The memory layout of both representation are exactly the same. The main differences are that a std::vector<> is more flexible if you need to insert vectors or stuff like that. On the other hand a Matrix<.,3,Dynamic> is an Eigen object, so it is easier to perform some operations on it, e.g.: