moved textures into their own classes, better tilemapping
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#include "../datatypes.cpp"
|
||||
#include "../helpers.cpp"
|
||||
#include "../buffer.cpp"
|
||||
#include "../shaders/shaders.h"
|
||||
#include "../mappers/mappers.h"
|
||||
#include "../textures/textures.h"
|
||||
|
||||
namespace UwU {
|
||||
// point
|
||||
@@ -21,11 +21,11 @@ namespace UwU {
|
||||
uint16_t y;
|
||||
|
||||
// Draw a point
|
||||
template <class MapperT, class ShaderT>
|
||||
void draw (Buffer buffer, MapperBase<MapperT>& mapper, ShaderBase<ShaderT>& shader) {
|
||||
template <class MapperT, class TextureT>
|
||||
void draw (Buffer buffer, MapperBase<MapperT>& mapper, TextureBase<TextureT>& texture) {
|
||||
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));
|
||||
buffer.drawPixel(x, y, texture.texel(uv.x, uv.y));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user