shaders headerfile, and added CRTP shader to Point
This commit is contained in:
+5
-16
@@ -5,7 +5,7 @@
|
||||
#include "../datatypes.cpp"
|
||||
#include "../helpers.cpp"
|
||||
#include "../buffer.cpp"
|
||||
#include "../shader.cpp"
|
||||
#include "../shaders/shaders.h"
|
||||
|
||||
namespace UwU {
|
||||
// point
|
||||
@@ -19,22 +19,11 @@ namespace UwU {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
|
||||
// Draw a rectangle
|
||||
void draw (Buffer buffer, Shader shader) {
|
||||
// Draw a point
|
||||
template <class ShaderT>
|
||||
void draw (Buffer buffer, ShaderBase<ShaderT>& shader) {
|
||||
if (x > buffer.width || y > buffer.height) {return;};
|
||||
|
||||
if (shader.shaderType == COLOR) {
|
||||
buffer.drawPixel(x, y, shader.c0);
|
||||
return;
|
||||
} else if (shader.shaderType == HGRADIENT) {
|
||||
buffer.drawPixel(x, y, ShaderMethods::gradient(shader.u0, shader.scale, shader.c0, shader.c1, x));
|
||||
return;
|
||||
} else if (shader.shaderType == VGRADIENT) {
|
||||
buffer.drawPixel(x, y, ShaderMethods::gradient(shader.v0, shader.scale, shader.c0, shader.c1, y));
|
||||
return;
|
||||
} else if (shader.shaderType == BUFFER) {
|
||||
buffer.drawPixel(x, y, ShaderMethods::buffer(shader.u0, shader.v0, shader.buffer, x, y));
|
||||
}
|
||||
buffer.drawPixel(x, y, shader.shade(x, y));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user