32 lines
736 B
C++
32 lines
736 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../datatypes.cpp"
|
|
#include "../helpers.cpp"
|
|
#include "../buffer.cpp"
|
|
#include "../shaders/shaders.h"
|
|
#include "../mappers/mappers.h"
|
|
|
|
namespace UwU {
|
|
// point
|
|
class Point {
|
|
public:
|
|
Point(uint16_t x, uint16_t y) {
|
|
this->x = x;
|
|
this->y = y;
|
|
}
|
|
Point() {}
|
|
uint16_t x;
|
|
uint16_t y;
|
|
|
|
// Draw a point
|
|
template <class MapperT, class ShaderT>
|
|
void draw (Buffer buffer, MapperBase<MapperT>& mapper, ShaderBase<ShaderT>& shader) {
|
|
if (x > buffer.width || y > buffer.height) {return;};
|
|
Coord2 uv = mapper.map(x, y, x, y);
|
|
buffer.drawPixel(x, y, shader.shade(uv.x, uv.y));
|
|
return;
|
|
}
|
|
};
|
|
} |