CanvasModelPainter constructor

CanvasModelPainter(
  1. List<Model3D> _figures,
  2. Aabb3? bounds,
  3. InfinityModelController _controller,
  4. InfinityModelConfig _config,
)

Creates a CanvasModelPainter.

Implementation

CanvasModelPainter(
  this._figures,
  Aabb3? bounds,
  this._controller,
  this._config,
) : super(repaint: _controller) {
  _controller.addListener(() {
    _isDirty = true;
  });

  _setupBounds(_figures, bounds);

  final verticesCount = _figures.fold(0, (int p, e) => p + e.verticesCount());
  _verticesToDraw = Float32List(verticesCount * _dimension);
  _colorsToDraw = Int32List(verticesCount);
  _zIndex = Float32List(verticesCount ~/ 3);

  if (_config.supportZIndex) {
    _verticesBuffer = Float32List(verticesCount * _dimension);
    _colorsBuffer = Int32List(verticesCount);
    _priorityQueue = PriorityQueue((a, b) {
      return _zIndex[a].compareTo(_zIndex[b]);
    });
  }
}