stubbed out shaders
This commit is contained in:
+17
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "datatypes.cpp"
|
||||
#include "helpers.cpp"
|
||||
#include "shaders/shader.cpp"
|
||||
|
||||
namespace UwU {
|
||||
// Buffer object - can be a wayland surface or a virtual buffer
|
||||
@@ -42,5 +43,21 @@ namespace UwU {
|
||||
pixels[i + 3] = 0xff; // A
|
||||
return;
|
||||
}
|
||||
|
||||
void drawPixelShader(Coord2 coord, Shader shader) {
|
||||
size_t i = (size_t)coord.y * stride + (size_t)coord.x * 4;
|
||||
uint8_t b0 = pixels[i + 0];
|
||||
uint8_t g0 = pixels[i + 1];
|
||||
uint8_t r0 = pixels[i + 2];
|
||||
Color newColor = shader.color();
|
||||
uint8_t b = Helpers::lerp8(b0, newColor.b, newColor.a);
|
||||
uint8_t g = Helpers::lerp8(g0, newColor.g, newColor.a);
|
||||
uint8_t r = Helpers::lerp8(r0, newColor.r, newColor.a);
|
||||
pixels[i + 0] = b; // B
|
||||
pixels[i + 1] = g; // G
|
||||
pixels[i + 2] = r; // R
|
||||
pixels[i + 3] = 0xff; // A
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user