Skip to content

Add support for an index buffer #2

@OmarShehata

Description

@OmarShehata

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions