added mappers to rest of primatives

This commit is contained in:
2026-07-24 18:31:49 -07:00
parent 78ec985f7a
commit eddbb85256
6 changed files with 49 additions and 33 deletions
+5 -3
View File
@@ -6,6 +6,7 @@
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "../shaders/shaders.h"
#include "../mappers/mappers.h"
namespace UwU {
// point
@@ -20,10 +21,11 @@ namespace UwU {
uint16_t y;
// Draw a point
template <class ShaderT>
void draw (Buffer buffer, ShaderBase<ShaderT>& shader) {
template <class MapperT, class ShaderT>
void draw (Buffer buffer, MapperBase<MapperT>& mapper, ShaderBase<ShaderT>& shader) {
if (x > buffer.width || y > buffer.height) {return;};
buffer.drawPixel(x, y, shader.shade(x, y));
Coord2 uv = mapper.map(x, y);
buffer.drawPixel(x, y, shader.shade(uv.x, uv.y));
return;
}
};