26 lines
598 B
C++
26 lines
598 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../datatypes.cpp"
|
|
#include "../helpers.cpp"
|
|
#include "../buffer.cpp"
|
|
#include "texturebase.cpp"
|
|
|
|
namespace UwU {
|
|
class BitmapTexture : public TextureBase<BitmapTexture> {
|
|
private:
|
|
Buffer buffer;
|
|
|
|
public:
|
|
BitmapTexture(Buffer buffer) {
|
|
this->buffer = buffer;
|
|
}
|
|
|
|
Color texel(uint16_t u, uint16_t v) {
|
|
uint32_t index = (v * buffer.stride) + (u * 4);
|
|
Color c = Color(buffer.pixels[index + 2], buffer.pixels[index + 1], buffer.pixels[index], buffer.pixels[index + 3]);
|
|
return c;
|
|
}
|
|
};
|
|
} |