implemented shaders, gradients, and uv mapping

This commit is contained in:
2026-07-07 12:17:32 -07:00
parent 989cb196ed
commit ad2e84c279
10 changed files with 149 additions and 27 deletions
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "shader.cpp"
namespace UwU {
class ColorShader : public Shader {
public:
ColorShader(Color color) {
this->shaderColor = color;
}
Color shaderColor;
Color color(uint16_t u, uint16_t v) override {
(void)u;
(void)v;
return shaderColor;
}
};
}
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "shader.cpp"
namespace UwU {
class GradientShader : public Shader {
public:
GradientShader(Color color0, Color color1) {
// this->x0 = x0;
this->shaderColor0 = color0;
// this->x1 = x1;
this->shaderColor1 = color1;
}
// uint16_t x0;
Color shaderColor0;
// uint16_t x1;
Color shaderColor1;
Color color(uint16_t u, uint16_t v) override {
(void)v;
return Helpers::lerpColor(shaderColor0, shaderColor1, u);
}
};
}
+4 -2
View File
@@ -12,8 +12,10 @@ namespace UwU {
public:
Shader() {}
Color color() {
return Color(0xb00b69ff);
virtual Color color(uint16_t u, uint16_t v) {
(void)u;
(void)v;
return Color();
}
};
}