Transform and add a polygon to the gl draw list * @param {Array } points - Array of Vector2 points * @param {number} rgba - Color of the polygon as a 32-bit integer * @param {number} x * @param {number} y * @param {number} sx * @param {number} sy * @param {number} angle * @pa
(points, rgba, x, y, sx, sy, angle, tristrip=true)
| 602 | * @param {boolean} [tristrip] - should tristrip algorithm be used |
| 603 | * @memberof WebGL */ |
| 604 | function glDrawPointsTransform(points, rgba, x, y, sx, sy, angle, tristrip=true) |
| 605 | { |
| 606 | const pointsOut = []; |
| 607 | const sa = sin(-angle); |
| 608 | const ca = cos(-angle); |
| 609 | for (const p of points) |
| 610 | { |
| 611 | // transform the point |
| 612 | const px = p.x*sx; |
| 613 | const py = p.y*sy; |
| 614 | pointsOut.push(vec2(x + ca*px - sa*py, y + sa*px + ca*py)); |
| 615 | } |
| 616 | const drawPoints = tristrip ? glPolyStrip(pointsOut) : pointsOut; |
| 617 | glDrawPoints(drawPoints, rgba); |
| 618 | } |
| 619 | |
| 620 | /** Transform and add a polygon to the gl draw list |
| 621 | * @param {Array<Vector2>} points - Array of Vector2 points |
no test coverage detected