stubbed out CRTP shaders

This commit is contained in:
2026-07-08 22:17:50 -07:00
parent bb30e2df0b
commit b95022de29
3 changed files with 44 additions and 1 deletions
+5 -1
View File
@@ -8,4 +8,8 @@
[ ] implement more primatives
[ ] fix off by one with buffer shader (and probably certain primatives)
[ ] fix memory leak and arrays in stack issue
[ ] fix shader offset limitations and headache
[ ] fix shader offset limitations and headache
[ ] maybe add blitter primative?
[ ] support for lower color depths
[ ] support for transparency
[ ] 15bpp + dither "shader"
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "shaderbase.cpp"
namespace UwU {
class ColorShader : public ShaderBase<ColorShader> {
public:
ColorShader(Color c) {
this->c = c;
}
Color c;
Color shade(uint16_t x, uint16_t y) {
return c;
}
};
}
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
namespace UwU {
template <typename Derived>
class ShaderBase {
public:
Color shade(uint16_t x, uint16_t y) {
return static_cast<Derived*>(this)->shade(x, y);
}
};
}