draw method

void draw(
  1. Matrix4 mMatrix, {
  2. int index = 0,
  3. Vector4? color,
})

Implementation

void draw(Matrix4 mMatrix, {int index = 0, Vector4? color}) {
  final row = index % rowCount;
  final col = (index ~/ rowCount) % colCount;

  final offsetX = row.toDouble() / rowCount;
  final offsetY = col.toDouble() / colCount;
  mtr.texMatrix[6] = offsetX;
  mtr.texMatrix[7] = offsetY;

  M3Shape2D.prog2D.setMaterial(mtr, color ?? Vector4(1, 1, 1, 1));
  M3Shape2D.prog2D.setModelMatrix(mMatrix);

  // draw shape2D
  _rect.draw();
}