MeshGeometry.fromMeshData constructor
MeshGeometry.fromMeshData(
- MeshData data, {
- GeometryStorage storage = GeometryStorage.fixed,
- GeometryBufferArena? bufferArena,
- bool retainCpuData = true,
Uploads a mesh from a MeshData snapshot built off the render isolate.
The snapshot's CPU work (vertex assembly, normal generation) can run
on a background isolate; this constructor performs only the GPU
upload. See MeshData for the recipe. storage selects whether the
mesh can later be updated in place. bufferArena and retainCpuData
match MeshGeometry.fromArrays.
Implementation
factory MeshGeometry.fromMeshData(
MeshData data, {
GeometryStorage storage = GeometryStorage.fixed,
GeometryBufferArena? bufferArena,
bool retainCpuData = true,
}) {
final geometry = MeshGeometry.fromArrays(
positions: data.positions,
normals: data.normals,
texCoords: data.texCoords,
texCoords1: data.texCoords1,
colors: data.colors,
tangents: data.tangents,
indices: data.indices,
primitiveType: data.primitiveType,
storage: storage,
bufferArena: bufferArena,
retainCpuData: retainCpuData,
);
for (final entry in data.customAttributes.entries) {
geometry.setCustomAttribute(
entry.key,
entry.value.data,
components: entry.value.components,
);
}
return geometry;
}