computeBufferInfo method
Implementation
computeBufferInfo(OpenGLContextES gl) {
var attributes = ['position', 'normal', 'uv']; // also the color...
for (int i = 0; i < attributes.length; i++) {
String attributeName = attributes[i];
BufferAttribute attribute = getAttribute(attributeName);
bufferInfo.attribs[attributeName] = AttributeBufferInfo(
buffer: createBufferFromBufferAttribute(gl, attribute, gl.ARRAY_BUFFER),
numComponents: attribute.itemSize,
type: getGLTypeForTypedArray(attribute),
normalize: attribute.normalized,
stride: 0,
offset: 0,
drawType: attribute.usage,
);
}
if (index != null) {
bufferInfo.indices = createBufferFromBufferAttribute(gl, index!, gl.ELEMENT_ARRAY_BUFFER);
bufferInfo.numElements = index!.getLength();
bufferInfo.elementType = getGLTypeForTypedArray(index!);
} else {
bufferInfo.numElements = getAttribute('position').count; // length / numComponents;
}
}