Skip to content
Snippets Groups Projects
Commit 9d38691a authored by Sebastian Gaida's avatar Sebastian Gaida
Browse files

[#105] convert index to uint32_t

parent 908e0d72
No related branches found
No related tags found
1 merge request!88Resolve "Indirect Draw"
Pipeline #27180 passed
...@@ -80,9 +80,31 @@ void addMeshToIndirectDraw(const vkcv::asset::Scene &scene, ...@@ -80,9 +80,31 @@ void addMeshToIndirectDraw(const vkcv::asset::Scene &scene,
vertexGroup.vertexBuffer.data.begin(), vertexGroup.vertexBuffer.data.begin(),
vertexGroup.vertexBuffer.data.end()); vertexGroup.vertexBuffer.data.end());
compiledIndexBuffer.insert(compiledIndexBuffer.end(), if(vertexGroup.indexBuffer.type == vkcv::asset::IndexType::UINT8){
vertexGroup.indexBuffer.data.begin(), std::vector<uint32_t> indexBuffer;
vertexGroup.indexBuffer.data.end()); for(auto index : vertexGroup.indexBuffer.data)
{
indexBuffer.push_back(*reinterpret_cast<uint32_t*>(&index));
}
compiledIndexBuffer.insert(compiledIndexBuffer.end(),
indexBuffer.begin(),
indexBuffer.end());
}else if(vertexGroup.indexBuffer.type == vkcv::asset::IndexType::UINT16){
std::vector<uint32_t> indexBuffer;
for(int i = 0; i < vertexGroup.indexBuffer.data.size(); i+=2)
{
indexBuffer.push_back(*reinterpret_cast<const uint32_t*>(&vertexGroup.indexBuffer.data[i]));
}
compiledIndexBuffer.insert(compiledIndexBuffer.end(),
indexBuffer.begin(),
indexBuffer.end());
}
else
{
compiledIndexBuffer.insert(compiledIndexBuffer.end(),
vertexGroup.indexBuffer.data.begin(),
vertexGroup.indexBuffer.data.end());
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment