setMatrixAt method

BatchedMesh setMatrixAt(
  1. dynamic geometryId,
  2. Matrix4 matrix
)

Implementation

BatchedMesh setMatrixAt( geometryId, Matrix4 matrix ) {
	// @TODO: Map geometryId to index of the arrays because
	//        optimize() can make geometryId mismatch the index

	final active = _active;
	final matricesTexture = this.matricesTexture;
	final matricesArray = this.matricesTexture?.image.data;
	final geometryCount = _geometryCount;
	if ( geometryId >= geometryCount || active[ geometryId ] == false ) {
		return this;
	}
	matrix.fromNativeArray( matricesArray, geometryId * 16 );
	matricesTexture?.needsUpdate = true;

	return this;
}