bit of code cleanup

This commit is contained in:
2026-07-08 14:05:42 -07:00
parent 04afd9eee0
commit b7032c3b8e
8 changed files with 31 additions and 163 deletions
-35
View File
@@ -1,35 +0,0 @@
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "shader.cpp"
namespace UwU {
class HGradientShader{
public:
HGradientShader(uint16_t x0, Color color0, uint16_t x1, Color color1) {
this->shaderType = HGRADIENTSHADER;
this->x0 = x0;
this->shaderColor0 = color0;
this->scale = 0xffffffff / (1 + (uint32_t)x1 - (uint32_t)x0);
this->shaderColor1 = color1;
}
ShaderType shaderType;
uint16_t x0;
Color shaderColor0;
uint32_t scale;
Color shaderColor1;
Color hGradient(uint16_t u, uint16_t v) {
(void)v;
uint32_t t = (((uint32_t)u - (uint32_t)x0) * scale) / 0x01000000;
// if (v == 42) {
// printf("(%u, %u)\n", u, t);
// }
return Helpers::lerpColor(shaderColor0, shaderColor1, (uint8_t)t);
}
};
}