updatePositions method
- Float32List positions, {
- int? dirtyStart,
- int? dirtyCount,
Replaces every vertex position, keeping the vertex count unchanged.
positions holds three floats per vertex and must match the
current vertexCount. To change the vertex count, use rebuild.
Throws a StateError unless this geometry is
GeometryStorage.updatable.
When only a contiguous span of vertices changed, pass dirtyStart
and dirtyCount (in vertices) to upload just that span. positions
must still hold every vertex (the full array backs raycasting and
bounds); the hint only narrows the GPU upload. Omit both to upload
the whole stream.
Implementation
void updatePositions(
Float32List positions, {
int? dirtyStart,
int? dirtyCount,
}) {
_ensureUpdatable('updatePositions');
_checkAttributeLength('positions', positions.length, 3);
_cpuPositions = Float32List.fromList(positions);
_writeStream(
0,
_positionRing,
_cpuPositions,
dirtyStart: dirtyStart,
dirtyCount: dirtyCount,
);
_recomputeBounds();
}