(x1, y1, x2, y2, x3, y3 int, buf []Scanline)
| 153 | } |
| 154 | |
| 155 | func rasterizeTriangleTop(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline { |
| 156 | s1 := float64(x3-x1) / float64(y3-y1) |
| 157 | s2 := float64(x3-x2) / float64(y3-y2) |
| 158 | ax := float64(x3) |
| 159 | bx := float64(x3) |
| 160 | for y := y3; y > y1; y-- { |
| 161 | ax -= s1 |
| 162 | bx -= s2 |
| 163 | a := int(ax) |
| 164 | b := int(bx) |
| 165 | if a > b { |
| 166 | a, b = b, a |
| 167 | } |
| 168 | buf = append(buf, Scanline{y, a, b, 0xffff}) |
| 169 | } |
| 170 | return buf |
| 171 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…