Fix indexed mesh loading from simplices
This commit is contained in:
parent
8eb134908b
commit
aaf6ce7652
1 changed files with 7 additions and 7 deletions
|
|
@ -563,10 +563,10 @@ namespace psemek::gfx
|
|||
load(vertices.data(), vertices.size(), indices.data(), indices.size(), primitive_type, usage);
|
||||
}
|
||||
|
||||
template <typename Vertex, std::size_t N, typename Index>
|
||||
void load(geom::simplex<Vertex, N> const * simplices, std::size_t simplex_count, Index const * indices, std::size_t index_count, GLenum usage = gl::STREAM_DRAW)
|
||||
template <typename Vertex, typename Index, std::size_t N>
|
||||
void load(Vertex const * vertices, std::size_t vertex_count, geom::simplex<Index, N> const * simplices, std::size_t simplex_count, GLenum usage = gl::STREAM_DRAW)
|
||||
{
|
||||
static_assert(sizeof(geom::simplex<Vertex, N>) == (N + 1) * sizeof(Vertex));
|
||||
static_assert(sizeof(geom::simplex<Index, N>) == (N + 1) * sizeof(Index));
|
||||
|
||||
GLenum primitive_type;
|
||||
|
||||
|
|
@ -587,13 +587,13 @@ namespace psemek::gfx
|
|||
static_assert("unknown primitive type");
|
||||
}
|
||||
|
||||
load(reinterpret_cast<Vertex const *>(simplices), simplex_count * (N + 1), indices, index_count, primitive_type, usage);
|
||||
load(vertices, vertex_count, reinterpret_cast<Index const *>(simplices), simplex_count * (N + 1), primitive_type, usage);
|
||||
}
|
||||
|
||||
template <typename Vertex, std::size_t N, typename Index>
|
||||
void load(std::vector<geom::simplex<Vertex, N>> const & simplices, std::vector<Index> const & indices, GLenum usage = gl::STREAM_DRAW)
|
||||
template <typename Vertex, typename Index, std::size_t N>
|
||||
void load(std::vector<Vertex> const & vertices, std::vector<geom::simplex<Index, N>> const & simplices, GLenum usage = gl::STREAM_DRAW)
|
||||
{
|
||||
load(simplices.data(), simplices.size(), indices.data(), indices.size(), usage);
|
||||
load(vertices.data(), vertices.size(), simplices.data(), simplices.size(), usage);
|
||||
}
|
||||
|
||||
void draw() const override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue