Compare commits

..

2 commits

Author SHA1 Message Date
3f91ad256a Read paths from cli + upload bad apple video 2025-02-12 17:46:27 +03:00
4b56e3fa71 Save to file 2025-02-12 16:26:59 +03:00
2 changed files with 13 additions and 10 deletions

BIN
bad_apple.mp4 Normal file

Binary file not shown.

View file

@ -3,7 +3,6 @@
#include <glm/ext/vector_uint2.hpp> #include <glm/ext/vector_uint2.hpp>
#include <glm/ext/vector_uint3.hpp> #include <glm/ext/vector_uint3.hpp>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <iostream>
#include <raylib.h> #include <raylib.h>
#include <vector> #include <vector>
@ -40,7 +39,7 @@ struct kdtree
void draw() void draw()
{ {
DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, BLACK); DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, WHITE);
if(left && right) if(left && right)
{ {
left->draw(); left->draw();
@ -68,13 +67,14 @@ struct kdtree
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
auto img = LoadImage("data/img.jpg"); auto img = LoadImage(argv[1]);
InitWindow(img.width, img.height, ""); InitWindow(img.width, img.height, "");
SetTargetFPS(60); SetTargetFPS(60);
std::vector<glm::uvec2> pts; std::vector<glm::uvec2> pts;
for (int i = 0; i < img.width * img.height; ++i) for (int i = 0; i < img.width * img.height; ++i)
{ {
int x = i % img.width; int x = i % img.width;
@ -115,13 +115,16 @@ int main (int argc, char *argv[])
kdtree tree(pts); kdtree tree(pts);
while (!WindowShouldClose()) auto target = LoadRenderTexture(img.width, img.height);
{
BeginDrawing(); BeginTextureMode(target);
ClearBackground(WHITE); ClearBackground(BLACK);
tree.draw(); tree.draw();
EndDrawing(); EndTextureMode();
}
auto t = LoadImageFromTexture(target.texture);
ImageFlipVertical(&t);
ExportImage(t, argv[2]);
CloseWindow(); CloseWindow();