Let’s say we have a fairly simple mesh with 100 vertices in it. That means that its color buffer will have 100 entries in it, where each entry is a collection of 4 floats representing a particular vertex’s RGBA values. Hence, this mesh’s color buffer will contain 100 vertices * 4 floats/vertex = 400 floats in it.
Let’s say I have a
Vector3f representing a particular vertex in this mesh. Is there any way to to look up index/position of this vertex’s entry (that is, the index/position of the 4 RGBA floats) in the color buffer?
So for example:
Vector3f vertex = getSomehow(); // doesn't matter for this example FloatBuffer colorBuffer = (FloatBuffer)(mesh.getBuffer(VertexBuffer.Type.Color).getData()); // Perhaps the 4 floats representing this vertex's RGBA values are the 62nd set of floats, // located at positions 247 - 250 in the color buffer. So I am looking for something that would // be able to give me a value of 247 for indexOfVertexRGBAFloats below: int indexOfVertexRGBAFloats = someMagic.getIndexOfRGBAFloats(vertex, colorBuffer);
I’ve looked in
BufferUtils but all I see are
set* methods…nothing resembling a getter that fetches buffer data based on a
How can I lookup the location of the
Vector3f vertex’s RGBA floats in the color buffer? Thanks in advance!