Download vendor/libigl/include/igl/opengl/vertex_array.cpp from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 2.12 kB
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/opengl/vertex_array.cpp
- Command line
-
hf download hf://datasets/AVSim/simulation-package/vendor/libigl/include/igl/opengl/vertex_array.cpp
-
curl -L -o vertex_array.cpp https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/opengl/vertex_array.cpp
2.12 kB
| template < | |
| typename DerivedV, | |
| typename DerivedF> | |
| IGL_INLINE void igl::opengl::vertex_array( | |
| const Eigen::PlainObjectBase<DerivedV> & V, | |
| const Eigen::PlainObjectBase<DerivedF> & F, | |
| GLuint & va_id, | |
| GLuint & ab_id, | |
| GLuint & eab_id) | |
| { | |
| // Inputs should be in RowMajor storage. If not, we have no choice but to | |
| // create a copy. | |
| if(!(V.Options & Eigen::RowMajor)) | |
| { | |
| Eigen::Matrix< | |
| typename DerivedV::Scalar, | |
| DerivedV::RowsAtCompileTime, | |
| DerivedV::ColsAtCompileTime, | |
| Eigen::RowMajor> VR = V; | |
| return vertex_array(VR,F,va_id,ab_id,eab_id); | |
| } | |
| if(!(F.Options & Eigen::RowMajor)) | |
| { | |
| Eigen::Matrix< | |
| typename DerivedF::Scalar, | |
| DerivedF::RowsAtCompileTime, | |
| DerivedF::ColsAtCompileTime, | |
| Eigen::RowMajor> FR = F; | |
| return vertex_array(V,FR,va_id,ab_id,eab_id); | |
| } | |
| // Generate and attach buffers to vertex array | |
| glGenVertexArrays(1, &va_id); | |
| glGenBuffers(1, &ab_id); | |
| glGenBuffers(1, &eab_id); | |
| glBindVertexArray(va_id); | |
| glBindBuffer(GL_ARRAY_BUFFER, ab_id); | |
| const auto size_VScalar = sizeof(typename DerivedV::Scalar); | |
| const auto size_FScalar = sizeof(typename DerivedF::Scalar); | |
| glBufferData(GL_ARRAY_BUFFER,size_VScalar*V.size(),V.data(),GL_STATIC_DRAW); | |
| glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, eab_id); | |
| assert(sizeof(GLuint) == size_FScalar && "F type does not match GLuint"); | |
| glBufferData( | |
| GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)*F.size(), F.data(), GL_STATIC_DRAW); | |
| glVertexAttribPointer( | |
| 0, | |
| V.cols(), | |
| size_VScalar==sizeof(float)?GL_FLOAT:GL_DOUBLE, | |
| GL_FALSE, | |
| V.cols()*size_VScalar, | |
| (GLvoid*)0); | |
| glEnableVertexAttribArray(0); | |
| glBindBuffer(GL_ARRAY_BUFFER, 0); | |
| glBindVertexArray(0); | |
| } | |
| template void igl::opengl::vertex_array<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, unsigned int&, unsigned int&, unsigned int&); | |