I have pushed an update to my Vulkan glTF PBR 2.0 application that adds support for rendering primitives without indices. Up until now, all primitives of a glTFs scene had to come with indices to be rendered by the application, which is usually the case for more complex scenes.
After getting a request for this, and checking with the glTF 2.0 spec, primitives without indices are actually a valid glTF 2.0 use-case.
Getting this to work was actually straight forward.
Model loader (VulkanglTFModel.hpp)
Aside from removing some asserts that would check for
indexCount to be > 0 and then only creating and staging the index buffer if indices are present:
I have also added the new
vertexCount properties to the
primitive class of the loader to be used for drawing the primitives.
If you’re using the model loader, and want to support models without indices, you simply have to change your draw routine to either use
vkCmdDrawIndexed depending on the new
hasIndices property of the mesh you want to render:
While not an actual PBR model, here is a short video of demonstrating an animated, low-poly model that does not have indices.