Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/anrieff/fray

  • Loading branch information...
anrieff committed May 30, 2018
2 parents 1ea4d0e + 4684694 commit 302e6018191381a6101e0c1a11e69cd5f96b1456
Showing with 22 additions and 7 deletions.
  1. +4 −0 src/cxxptl-sdl.cpp
  2. +5 −0 src/cxxptl-sdl.h
  3. +9 −7 src/main.cpp
  4. +4 −0 src/random_generator.cpp
@@ -24,7 +24,11 @@
#include "cxxptl-sdl.h"
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <SDL.h>
#else
#include <SDL/SDL.h>
#endif // _WIN32

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
@@ -22,8 +22,13 @@
* @Brief SDL port of the CXXPTL library
*/
#pragma once
#ifdef _WIN32
#include <SDL_thread.h>
#include <SDL_mutex.h>
#else
#include <SDL/SDL_thread.h>
#include <SDL/SDL_mutex.h>
#endif

/**
* @File cxxptl_sdl.h
@@ -294,13 +294,15 @@ Color trace(const Ray& ray, Random& rnd)
Color raytraceSinglePixel(double x, double y)
{
Random& rnd = getRandomGen();
auto getRay = scene.camera->dof ?
[](double x, double y, WhichCamera whichCamera) {
return scene.camera->getDOFRay(x, y, whichCamera);
} :
[](double x, double y, WhichCamera whichCamera) {
return scene.camera->getScreenRay(x, y, whichCamera);
};
const auto getDOFRay = [](double x, double y, WhichCamera whichCamera) {
return scene.camera->getDOFRay(x, y, whichCamera);
};
const auto getScreenRay = [](double x, double y, WhichCamera whichCamera) {
return scene.camera->getScreenRay(x, y, whichCamera);
};
const auto getRay = scene.camera->dof
? std::function<Ray(double, double, WhichCamera)>(getDOFRay)
: std::function<Ray(double, double, WhichCamera)>(getScreenRay);

if (scene.camera->stereoSeparation > 0) {
Ray leftRay = getRay(x, y, CAMERA_LEFT);
@@ -42,7 +42,11 @@
***************************************************************************/

#include <math.h>
#ifdef _WIN32
#include <SDL.h>
#else
#include <SDL/SDL.h>
#endif // _WIN32
#include "random_generator.h"
#include "constants.h"

0 comments on commit 302e601

Please sign in to comment.
You can’t perform that action at this time.