renderTriangleMesh method
void
renderTriangleMesh(
- RenderState renderState,
- Int16List ixList,
- Float32List vxList,
- int color,
override
Implementation
@override
void renderTriangleMesh(RenderState renderState, Int16List ixList,
Float32List vxList, int color) {
final context = _renderingContext;
final matrix = renderState.globalMatrix;
final alpha = renderState.globalAlpha;
final blendMode = renderState.globalBlendMode;
if (_activeAlpha != alpha) {
_activeAlpha = alpha;
context.globalAlpha = alpha;
}
if (_activeBlendMode != blendMode) {
_activeBlendMode = blendMode;
context.globalCompositeOperation = blendMode.compositeOperation;
}
context.setTransform(
matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
context.beginPath();
for (var i = 0; i < ixList.length - 2; i += 3) {
final i0 = ixList[i + 0] << 1;
final i1 = ixList[i + 1] << 1;
final i2 = ixList[i + 2] << 1;
final x1 = vxList[i0 + 0];
final y1 = vxList[i0 + 1];
final x2 = vxList[i1 + 0];
final y2 = vxList[i1 + 1];
final x3 = vxList[i2 + 0];
final y3 = vxList[i2 + 1];
context.moveTo(x1, y1);
context.lineTo(x2, y2);
context.lineTo(x3, y3);
}
context.fillStyle = color2rgba(color);
context.fill();
}