Compare commits
2 commits
a4727881c5
...
3f91ad256a
Author | SHA1 | Date | |
---|---|---|---|
3f91ad256a | |||
4b56e3fa71 |
2 changed files with 13 additions and 10 deletions
BIN
bad_apple.mp4
Normal file
BIN
bad_apple.mp4
Normal file
Binary file not shown.
21
src/main.cpp
21
src/main.cpp
|
@ -3,7 +3,6 @@
|
|||
#include <glm/ext/vector_uint2.hpp>
|
||||
#include <glm/ext/vector_uint3.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <iostream>
|
||||
#include <raylib.h>
|
||||
#include <vector>
|
||||
|
||||
|
@ -40,7 +39,7 @@ struct kdtree
|
|||
|
||||
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)
|
||||
{
|
||||
left->draw();
|
||||
|
@ -68,13 +67,14 @@ struct kdtree
|
|||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
auto img = LoadImage("data/img.jpg");
|
||||
auto img = LoadImage(argv[1]);
|
||||
|
||||
InitWindow(img.width, img.height, "");
|
||||
SetTargetFPS(60);
|
||||
|
||||
std::vector<glm::uvec2> pts;
|
||||
|
||||
|
||||
for (int i = 0; i < img.width * img.height; ++i)
|
||||
{
|
||||
int x = i % img.width;
|
||||
|
@ -115,13 +115,16 @@ int main (int argc, char *argv[])
|
|||
|
||||
kdtree tree(pts);
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
auto target = LoadRenderTexture(img.width, img.height);
|
||||
|
||||
BeginTextureMode(target);
|
||||
ClearBackground(BLACK);
|
||||
tree.draw();
|
||||
EndDrawing();
|
||||
}
|
||||
EndTextureMode();
|
||||
|
||||
auto t = LoadImageFromTexture(target.texture);
|
||||
ImageFlipVertical(&t);
|
||||
ExportImage(t, argv[2]);
|
||||
|
||||
CloseWindow();
|
||||
|
||||
|
|
Loading…
Reference in a new issue