added gradient shaders to all primatives

This commit is contained in:
2026-07-08 17:13:57 -07:00
parent 89afdfce9b
commit ee0d43dd75
6 changed files with 62 additions and 9 deletions
+18
View File
@@ -157,6 +157,24 @@ namespace UwU {
}
}
return;
} else if (shader.shaderType == BUFFER) {
// Left-handed triangle case (midpoint is left of triangle)
if ((int16_t)midX < longBound[midY - topY]) {
for (uint16_t i = 0; i < height; i++) {
for (uint16_t x = (uint16_t)splitBound[i]; x <= (uint16_t)longBound[i]; x++) {
buffer.drawPixel(x, i + (uint16_t)topY, ShaderMethods::buffer(shader.u0, shader.v0, shader.buffer, x, i + topY));
}
}
// Right-handed triangle case (midpoint is right of triangle)
} else {
for (uint16_t i = 0; i < height; i++) {
for (uint16_t x = (uint16_t)longBound[i]; x <= (uint16_t)splitBound[i]; x++) {
buffer.drawPixel(x, i + (uint16_t)topY, ShaderMethods::buffer(shader.u0, shader.v0, shader.buffer, x, i + topY));
}
}
}
return;
}
return;
}