24 lines
579 B
C++
24 lines
579 B
C++
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
#include "../datatypes.cpp"
|
||
|
|
#include "../helpers.cpp"
|
||
|
|
#include "../buffer.cpp"
|
||
|
|
#include "shaderbase.cpp"
|
||
|
|
|
||
|
|
namespace UwU {
|
||
|
|
class BufferShader : public ShaderBase<BufferShader> {
|
||
|
|
public:
|
||
|
|
BufferShader(Buffer buffer) {
|
||
|
|
this->buffer = buffer;
|
||
|
|
}
|
||
|
|
Buffer buffer;
|
||
|
|
|
||
|
|
Color shade(uint16_t x, uint16_t y) {
|
||
|
|
uint32_t index = (y * buffer.stride) + (x * 4);
|
||
|
|
Color c = Color(buffer.pixels[index + 2], buffer.pixels[index + 1], buffer.pixels[index], buffer.pixels[index + 3]);
|
||
|
|
return c;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|