Files
UwUGL/primatives/point.cpp
T

32 lines
736 B
C++
Raw Normal View History

2026-07-07 07:25:49 -07:00
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "../shaders/shaders.h"
2026-07-24 18:31:49 -07:00
#include "../mappers/mappers.h"
2026-07-07 07:25:49 -07:00
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
2026-07-24 18:31:49 -07:00
template <class MapperT, class ShaderT>
void draw (Buffer buffer, MapperBase<MapperT>& mapper, ShaderBase<ShaderT>& shader) {
2026-07-07 07:25:49 -07:00
if (x > buffer.width || y > buffer.height) {return;};
2026-07-24 19:06:14 -07:00
Coord2 uv = mapper.map(x, y, x, y);
2026-07-24 18:31:49 -07:00
buffer.drawPixel(x, y, shader.shade(uv.x, uv.y));
2026-07-07 07:25:49 -07:00
return;
}
};
}