/** * Erweitert die Geometrie um ein Vertexattribut vom Typ GL_FLOAT. * * @param index Index / Location des Attributs * @param size Anzahl der Komponenten des Attributs * @param offset Offset im Vertex gemessen in Byte */ public void addVertexAttribute(int index, int size, int offset) { VertexAttribute attr = new VertexAttribute(); attr.index = index; attr.size = size; attr.offset = offset; attributes.add(attr); }
private int calculateOffsets() { int count = 0; for (int i = 0; i < attributes.length; i++) { VertexAttribute attribute = attributes[i]; attribute.offset = count; if (attribute.usage == VertexAttributes.Usage.ColorPacked) count += 4; else count += 4 * attribute.numComponents; } return count; }