added gradient shaders to triangle primative

This commit is contained in:
2026-07-08 15:08:48 -07:00
parent f61e3a8237
commit 27b7640c85
4 changed files with 112 additions and 82 deletions
+3 -11
View File
@@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include <algorithm>
#include "../datatypes.cpp"
#include "../helpers.cpp"
@@ -47,17 +48,8 @@ namespace UwU {
} else if (shader.shaderType == HGRADIENT) {
// find left-right boundaries
uint16_t leftmost, rightmost;
if (xl0 < xl1) {
leftmost = xl0;
} else {
leftmost = xl1;
}
if (xr0 > xr1) {
rightmost = xr0;
} else {
rightmost = xr1;
}
uint16_t leftmost = std::min(xl0, xl1);
uint16_t rightmost = std::max(xr0, xr1);
// precompute gradient LUT
Color cols[rightmost - leftmost];