IndexBuffer suggestions/improvements (consistency)

@sgold After having taken a closer look at the implementation of Mesh, I have found an better way to achieve the goal. Instead of adding another method to Mesh, we can leverage Mesh#setBuffer(Type type, int components, Format format, Buffer buf). It already accepts a generic java.nio.Buffer. I can add a IndexBuffer#getFormat() method that provides the format and have the Byte-Short- and Int implementations of IndexBuffer return the appropriate format. this would confine all changes to IndexBuffer and its subclasses, would achieve the goal as simplyfying the APi but not introduce chages to Mesh.

@RiccardoBlb its a good idea in the long run, but requires far more changes. For now I’d like to keep the change small, with as much benefit as possible. I might be able to introduce larger changes to jme in the future.

4 Likes