added gradient shaders to all primatives
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user