fromFormats static method
VertexBufferLayout
fromFormats(
- List<
WGPUVertexFormat> formats, { - WGPUVertexStepMode stepMode = WGPUVertexStepMode.WGPUVertexStepMode_Vertex,
- int startShaderLocation = 0,
Implementation
static VertexBufferLayout fromFormats(
List<WGPUVertexFormat> formats, {
WGPUVertexStepMode stepMode = WGPUVertexStepMode.WGPUVertexStepMode_Vertex,
int startShaderLocation = 0,
}) {
final List<VertexAttribute> attrs = [];
int currentOffset = 0;
for (int i = 0; i < formats.length; i++) {
final format = formats[i];
attrs.add(VertexAttribute(
format: format,
offset: currentOffset,
shaderLocation: startShaderLocation + i,
));
currentOffset += _getSizeInBytes(format);
}
return VertexBufferLayout(
arrayStride: currentOffset, // Total size is the stride
stepMode: stepMode,
attributes: attrs,
);
}