build method

MeshGeometry build({
  1. GeometryStorage storage = GeometryStorage.fixed,
  2. GeometryBufferArena? bufferArena,
  3. bool retainCpuData = true,
})

Builds and GPU-uploads the accumulated mesh.

Pass GeometryStorage.updatable for storage to build a mesh that can be mutated in place afterwards. bufferArena and retainCpuData match MeshGeometry.fromArrays.

Implementation

MeshGeometry build({
  GeometryStorage storage = GeometryStorage.fixed,
  GeometryBufferArena? bufferArena,
  bool retainCpuData = true,
}) {
  return MeshGeometry.fromArrays(
    positions: Float32List.fromList(_positions),
    normals: _resolveNormals(),
    texCoords: Float32List.fromList(_texCoords),
    texCoords1: Float32List.fromList(_texCoords1),
    colors: Float32List.fromList(_colors),
    tangents: Float32List.fromList(_tangents),
    indices: _indices.isEmpty ? null : List.of(_indices),
    storage: storage,
    bufferArena: bufferArena,
    retainCpuData: retainCpuData,
  );
}