vertexSize = calculateOffsets();\r
}\r
\r
+ /** Returns the offset for the first VertexAttribute with the specified usage.\r
+ * @param usage The usage of the VertexAttribute. */\r
+ public int getOffset (int usage) {\r
+ VertexAttribute vertexAttribute = findByUsage(usage);\r
+ if (vertexAttribute == null) return 0;\r
+ return vertexAttribute.offset / 4;\r
+ }\r
+\r
+ /** Returns the first VertexAttribute for the given usage.\r
+ * @param usage The usage of the VertexAttribute to find. */\r
+ public VertexAttribute findByUsage (int usage) {\r
+ int len = size();\r
+ for (int i = 0; i < len; i++)\r
+ if (get(i).usage == usage) return get(i);\r
+ return null;\r
+ }\r
+\r
private int calculateOffsets () {\r
int count = 0;\r
for (int i = 0; i < attributes.length; i++) {\r