pex-gl / pex-context

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
http://pex-gl.github.io/pex-context/
MIT License
160 stars 12 forks source link

Command count is ignored when using index buffers #77

Closed vorg closed 4 years ago

vorg commented 4 years ago

Caused by https://github.com/pex-gl/pex-context/blob/master/index.js#L912

var count = cmd.indices.count || indexBuffer.length

should be

var count = cmd.count || indexBuffer.length
vorg commented 4 years ago

It actually wasn't bug but more of a regression introduced in pex-renderer's glTF loader

https://github.com/pex-gl/pex-renderer/blob/master/loaders/glTF.js#L436

geometryProps = {
      ...geometryProps,
      indices: {
        buffer: indicesAccessor._bufferView._indexBuffer,
        offset: indicesAccessor.byteOffset,
        type: indicesAccessor.componentType,
        count: indicesAccessor.count
      }
    }