added mappers to rest of primatives
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../helpers.cpp"
|
||||
#include "../buffer.cpp"
|
||||
#include "../shaders/shaders.h"
|
||||
#include "../mappers/mappers.h"
|
||||
|
||||
namespace UwU {
|
||||
// trapezoid (horizontally constrained)
|
||||
@@ -30,8 +31,8 @@ namespace UwU {
|
||||
|
||||
// Draw a horizontally bounded trapezoid
|
||||
// y1 >= y0
|
||||
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) {
|
||||
uint16_t height = 1 + y1 - y0;
|
||||
int16_t LeftBound[height];
|
||||
int16_t RightBound[height];
|
||||
@@ -41,7 +42,8 @@ namespace UwU {
|
||||
|
||||
for (uint16_t i = 0; i < height; i++) {
|
||||
for (uint16_t x = LeftBound[i]; x <= RightBound[i]; x++) {
|
||||
buffer.drawPixel(x, i + y0, shader.shade(x, i + y0));
|
||||
Coord2 uv = mapper.map(x, i + y0);
|
||||
buffer.drawPixel(x, i + y0, shader.shade(uv.x, uv.y));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user