(x1, y1, x2, y2, x3, y3 int, buf []Scanline)
| 135 | } |
| 136 | |
| 137 | func rasterizeTriangleBottom(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline { |
| 138 | s1 := float64(x2-x1) / float64(y2-y1) |
| 139 | s2 := float64(x3-x1) / float64(y3-y1) |
| 140 | ax := float64(x1) |
| 141 | bx := float64(x1) |
| 142 | for y := y1; y <= y2; y++ { |
| 143 | a := int(ax) |
| 144 | b := int(bx) |
| 145 | ax += s1 |
| 146 | bx += s2 |
| 147 | if a > b { |
| 148 | a, b = b, a |
| 149 | } |
| 150 | buf = append(buf, Scanline{y, a, b, 0xffff}) |
| 151 | } |
| 152 | return buf |
| 153 | } |
| 154 | |
| 155 | func rasterizeTriangleTop(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline { |
| 156 | s1 := float64(x3-x1) / float64(y3-y1) |
no outgoing calls
no test coverage detected
searching dependent graphs…