Compare commits
	
		
			No commits in common. "3f91ad256a76ef1e1651a825049c527955e8d484" and "a4727881c5b2300df3640f4d77d68a139df4b190" have entirely different histories.
		
	
	
		
			3f91ad256a
			...
			a4727881c5
		
	
		
					 2 changed files with 10 additions and 13 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								bad_apple.mp4
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bad_apple.mp4
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										21
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								src/main.cpp
									
									
									
									
									
								
							|  | @ -3,6 +3,7 @@ | ||||||
| #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> | ||||||
| 
 | 
 | ||||||
|  | @ -39,7 +40,7 @@ struct kdtree | ||||||
| 
 | 
 | ||||||
|     void draw() |     void draw() | ||||||
|     { |     { | ||||||
|         DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, WHITE); |         DrawRectangleLines(aabb_min.x, aabb_min.y, aabb_size.x, aabb_size.y, BLACK); | ||||||
|         if(left && right) |         if(left && right) | ||||||
|         { |         { | ||||||
|             left->draw(); |             left->draw(); | ||||||
|  | @ -67,14 +68,13 @@ struct kdtree | ||||||
| 
 | 
 | ||||||
| int main (int argc, char *argv[]) | int main (int argc, char *argv[]) | ||||||
| { | { | ||||||
|     auto img = LoadImage(argv[1]); |     auto img = LoadImage("data/img.jpg"); | ||||||
| 
 | 
 | ||||||
|     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,16 +115,13 @@ int main (int argc, char *argv[]) | ||||||
| 
 | 
 | ||||||
|     kdtree tree(pts); |     kdtree tree(pts); | ||||||
| 
 | 
 | ||||||
|     auto target = LoadRenderTexture(img.width, img.height); |     while (!WindowShouldClose()) | ||||||
| 
 |     { | ||||||
|     BeginTextureMode(target); |         BeginDrawing(); | ||||||
|     ClearBackground(BLACK); |         ClearBackground(WHITE); | ||||||
|         tree.draw(); |         tree.draw(); | ||||||
|     EndTextureMode(); |         EndDrawing(); | ||||||
|    |     } | ||||||
|     auto t = LoadImageFromTexture(target.texture); |  | ||||||
|     ImageFlipVertical(&t); |  | ||||||
|     ExportImage(t, argv[2]); |  | ||||||
| 
 | 
 | ||||||
|     CloseWindow(); |     CloseWindow(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue