mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
init
This commit is contained in:
commit
de866d23bf
28 changed files with 46878 additions and 0 deletions
43
external/test_ppm.cpp
vendored
Normal file
43
external/test_ppm.cpp
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include "json.hpp"
|
||||
#include "simpleppm.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace nlohmann;
|
||||
|
||||
|
||||
int test_save_ppm(){
|
||||
int dimx = 800;
|
||||
int dimy = 600;
|
||||
|
||||
int w = 100;
|
||||
|
||||
std::vector<double> buffer(3*dimx*dimy);
|
||||
for(int j=0;j<dimy;++j){
|
||||
for(int i=0;i<dimx;++i){
|
||||
if(((i+j)/w)%2==0){
|
||||
buffer[3*j*dimx+3*i+0]=1;
|
||||
buffer[3*j*dimx+3*i+1]=1;
|
||||
buffer[3*j*dimx+3*i+2]=0;
|
||||
} else {
|
||||
buffer[3*j*dimx+3*i+0]=0;
|
||||
buffer[3*j*dimx+3*i+1]=1;
|
||||
buffer[3*j*dimx+3*i+2]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
save_ppm("test.ppm", buffer, dimx, dimy);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue