uploadVertexStreams method
void
uploadVertexStreams(})
Uploads vertex streams in a caller-defined format, one per vertex
buffer slot in order, plus optional indices.
The bytes reach the GPU as given. Describe them with setVertexLayout
and read them with a vertex shader from setVertexShader (or a
ShaderMaterial vertex shader); see "A packed vertex format" in
MATERIALS.md for what that shader must declare and write. Give the
depth-style passes a position-only path with setDepthOnlyVertex.
The engine cannot read a packed position, so it scans no bounds and
keeps no positions for raycasting. Call setLocalBounds, or the mesh is
never culled. bufferArena shares one GPU block between many meshes.
Integer vertex formats do not draw on Impeller's OpenGL ES backend yet.
Implementation
// TODO(gles-integer-attributes): Impeller's GLES backend rejects 32-bit
// integer vertex formats (ToVertexAttribType in formats_gles.h). Drop the
// caveat above once it binds them with glVertexAttribIPointer.
void uploadVertexStreams(
List<TypedData> streams,
int vertexCount, {
TypedData? indices,
gpu.IndexType indexType = gpu.IndexType.int16,
GeometryBufferArena? bufferArena,
}) {
if (streams.isEmpty) {
throw ArgumentError.value(streams, 'streams', 'must not be empty');
}
_cpuVertices = null;
_cpuPositions = null;
_cpuTexCoords = null;
_cpuTexCoords1 = null;
_cpuNormals = null;
_cpuColors = null;
_cpuTangents = null;
// Indices alone still feed the wireframe overlay's edge list.
_cpuIndices = indices == null ? null : _asByteData(indices);
_uploadsCallerStreams = true;
_uploadStreams(streams, vertexCount, indices, indexType, bufferArena);
}