Exploring raycasters and possibly make a little "doom like" game based on it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
raycaster/tests/amt_test.cpp

74 lines
2.6 KiB

#include <cstdint>
#include <print>
#include "matrix.hpp"
#include "pixel.hpp"
using namespace amt;
int main() {
auto const format = PixelFormat::abgr;
PixelBuf b(2, 2, RGBA(0x01, 0x02, 0x03, 0x04));
b[1][1] = HSLA(280, 20, 50, 80);
std::println("{:h}", b);
std::uint8_t ps[4 * 4] = {};
b.copy_to(ps, format);
/*for (auto i = 0zu; i < sizeof(ps); ++i) {*/
/* std::println("[{}]: 0x{:0x}", i, ps[i]);*/
/*}*/
PixelBuf test(ps, 2, 2, format);
for (auto i = 0zu; auto color: test) {
std::println("[{}]: {}", i++, color);
}
auto m = Matrix<int>{
{0, 1},
{3, 4}
};
std::println("{}", m);
{
auto ca = RGBA::from_hex(0x333333ff);
auto cb = RGBA::from_hex(0xaabbccff);
std::println("========= RGBA ===========");
std::println("Normal: 0x{:0x}", ca.blend(cb, BlendMode::normal).to_hex());
std::println("Multiply: 0x{:0x}", ca.blend(cb, BlendMode::multiply).to_hex());
std::println("Screen: 0x{:0x}", ca.blend(cb, BlendMode::screen).to_hex());
std::println("Overlay: 0x{:0x}", ca.blend(cb, BlendMode::overlay).to_hex());
std::println("darken: 0x{:0x}", ca.blend(cb, BlendMode::darken).to_hex());
std::println("lighten: 0x{:0x}", ca.blend(cb, BlendMode::lighten).to_hex());
std::println("Dodge: 0x{:0x}", ca.blend(cb, BlendMode::colorDodge).to_hex());
std::println("Burn: 0x{:0x}", ca.blend(cb, BlendMode::colorBurn).to_hex());
std::println("hard light: 0x{:0x}", ca.blend(cb, BlendMode::hardLight).to_hex());
std::println("soft light: 0x{:0x}", ca.blend(cb, BlendMode::softLight).to_hex());
std::println("difference: 0x{:0x}", ca.blend(cb, BlendMode::difference).to_hex());
std::println("exclusion: 0x{:0x}", ca.blend(cb, BlendMode::exclusion).to_hex());
}
{
HSLA ca = RGBA::from_hex(0x333333ff);
HSLA cb = RGBA::from_hex(0xaabbccff);
std::println("========= HSLA ===========");
std::println("Normal: {}", ca.blend(cb, BlendMode::normal));
std::println("Multiply: {}", ca.blend(cb, BlendMode::multiply));
std::println("Screen: {}", ca.blend(cb, BlendMode::screen));
std::println("Overlay: {}", ca.blend(cb, BlendMode::overlay));
std::println("darken: {}", ca.blend(cb, BlendMode::darken));
std::println("lighten: {}", ca.blend(cb, BlendMode::lighten));
std::println("Dodge: {}", ca.blend(cb, BlendMode::colorDodge));
std::println("Burn: {}", ca.blend(cb, BlendMode::colorBurn));
std::println("hard light: {}", ca.blend(cb, BlendMode::hardLight));
std::println("soft light: {}", ca.blend(cb, BlendMode::softLight));
std::println("difference: {}", ca.blend(cb, BlendMode::difference));
std::println("exclusion: {}", ca.blend(cb, BlendMode::exclusion));
}
}