rendajs / Renda

A modern rendering engine for the web.
https://rendajs.org
MIT License
10 stars 4 forks source link

Don't expose `MeshAttributeBuffer` #907

Closed jespertheend closed 5 months ago

jespertheend commented 5 months ago

MeshAttributeBuffer currently exposes a lot of functionality that would break in cases where it is created by a Mesh instance. For instance Mesh.getBufferForAttributeType(type).setVertexCount(42) would result in issues because you should really be doing Mesh.setVertexCount(42).

At the moment, it seems like only Mesh.getBufferForAttributeType() and Mesh.getBuffers() expose attribute buffers. We could make these private. This would mostly break tests, but there's some other places where this is currently in use as well:

I think the best approach here is to create another class type which does expose some of the functionality, while keeping others as getters only.