initial commit
This commit is contained in:
		
						commit
						6bd1181be5
					
				
							
								
								
									
										19
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					# output image
 | 
				
			||||||
 | 
					image.ppm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# binary
 | 
				
			||||||
 | 
					flark
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CMake
 | 
				
			||||||
 | 
					# https://github.com/github/gitignore/blob/master/CMake.gitignore
 | 
				
			||||||
 | 
					CMakeLists.txt.user
 | 
				
			||||||
 | 
					CMakeCache.txt
 | 
				
			||||||
 | 
					CMakeFiles
 | 
				
			||||||
 | 
					CMakeScripts
 | 
				
			||||||
 | 
					Testing
 | 
				
			||||||
 | 
					Makefile
 | 
				
			||||||
 | 
					cmake_install.cmake
 | 
				
			||||||
 | 
					install_manifest.txt
 | 
				
			||||||
 | 
					compile_commands.json
 | 
				
			||||||
 | 
					CTestTestfile.cmake
 | 
				
			||||||
 | 
					_deps
 | 
				
			||||||
							
								
								
									
										6
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					cmake_minimum_required(VERSION 3.10)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					project(flark)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_executable(flark main.cpp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					# Flark
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ray tracing rendering experiments
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					https://raytracing.github.io/
 | 
				
			||||||
							
								
								
									
										31
									
								
								main.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								main.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const int WIDTH = 256;
 | 
				
			||||||
 | 
					const int HEIGHT = 256;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    std::cout << "P3" << std::endl;
 | 
				
			||||||
 | 
					    std::cout << WIDTH << ' ' << HEIGHT << "\n255\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int y = HEIGHT - 1; y >= 0; --y)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        std::cerr << "\rScanlines remaining: " << y << ' ' << std::flush;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (int x = 0; x < WIDTH; ++x)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            double r = double(x) / (WIDTH - 1);
 | 
				
			||||||
 | 
					            double g = double(y) / (HEIGHT - 1);
 | 
				
			||||||
 | 
					            double b = 0.25;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            int ir = static_cast<int>(255.999 * r);
 | 
				
			||||||
 | 
					            int ig = static_cast<int>(255.999 * g);
 | 
				
			||||||
 | 
					            int ib = static_cast<int>(255.999 * b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            std::cout << ir << ' ' << ig << ' ' << ib << std::endl;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::cerr << "\nDone." << std::endl;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user