ms vc++ support bugfix

pull/9/head
Dmitry Sokolov 2019-01-22 10:16:05 +01:00
parent cd806e6254
commit 2501425809
2 changed files with 5 additions and 10 deletions

View File

@ -1,5 +1,6 @@
#ifndef __GEOMETRY_H__
#define __GEOMETRY_H__
#include <cmath>
#include <vector>
#include <cassert>
@ -76,10 +77,7 @@ template <typename T> vec<3,T> cross(vec<3,T> v1, vec<3,T> v2) {
}
template <size_t DIM, typename T> std::ostream& operator<<(std::ostream& out, const vec<DIM,T>& v) {
for(unsigned int i=0; i<DIM; i++) {
out << v[i] << " " ;
}
for(unsigned int i=0; i<DIM; i++) out << v[i] << " " ;
return out ;
}
#endif //__GEOMETRY_H__

View File

@ -1,11 +1,10 @@
#include <limits>
#define _USE_MATH_DEFINES
#include <cmath>
#include <limits>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include "geometry.h"
struct Light {
@ -81,8 +80,7 @@ bool scene_intersect(const Vec3f &orig, const Vec3f &dir, const std::vector<Sphe
checkerboard_dist = d;
hit = pt;
N = Vec3f(0,1,0);
material.diffuse_color = (int(.5*hit.x+1000) + int(.5*hit.z)) & 1 ? Vec3f(1,1,1) : Vec3f(1, .7, .3);
material.diffuse_color = material.diffuse_color*.3;
material.diffuse_color = (int(.5*hit.x+1000) + int(.5*hit.z)) & 1 ? Vec3f(.3, .3, .3) : Vec3f(.3, .2, .1);
}
}
return std::min(spheres_dist, checkerboard_dist)<1000;
@ -171,4 +169,3 @@ int main() {
return 0;
}