implemented shaders, gradients, and uv mapping
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user