Save to file

This commit is contained in:
NukeBird 2025-02-12 16:26:59 +03:00
parent a4727881c5
commit 4b56e3fa71

View file

@ -40,7 +40,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();
@ -75,6 +75,7 @@ int main (int argc, char *argv[])
std::vector<glm::uvec2> pts;
for (int i = 0; i < img.width * img.height; ++i)
{
int x = i % img.width;
@ -115,13 +116,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, "test.jpg");
CloseWindow();