Right now the compute rasterizer only supports a simple list of triangles. It would be a good exercise to add support for an index buffer to support more complex models without using too much memory. You'll need to:
- Create another buffer, similar to the vertex buffer, that holds indices into the vertex buffer, and send that to the compute shader
- Change how many times the compute dispatches to number of indices / 3
- In the shader, get the triangle v1, v2, v3 by getting the next 3 indices and fetching them from the vertex buffer
- Change
src/loadModel.js to return a vertex buffer and an index buffer
Right now the compute rasterizer only supports a simple list of triangles. It would be a good exercise to add support for an index buffer to support more complex models without using too much memory. You'll need to:
src/loadModel.jsto return a vertex buffer and an index buffer