stubbed out CRTP shaders
This commit is contained in:
@@ -9,3 +9,7 @@
|
|||||||
[ ] fix off by one with buffer shader (and probably certain primatives)
|
[ ] fix off by one with buffer shader (and probably certain primatives)
|
||||||
[ ] fix memory leak and arrays in stack issue
|
[ ] 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"
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user