Started scene reader. Added libjson-spirit dependency.

This commit is contained in:
Miguel Angel Astor Romero
2017-01-18 17:26:09 -04:00
parent 965b04ca39
commit 5edccd4d30
10 changed files with 351 additions and 32 deletions

View File

@@ -1,7 +1,6 @@
#include <glm/gtx/rotate_vector.hpp>
#include "camera.hpp"
#include "sampling.hpp"
using glm::vec4;
using glm::rotate;
@@ -48,17 +47,3 @@ void Camera::view_to_world(Ray & r) const {
r.m_direction = vec3(dir.x, dir.y, dir.z);
r.m_origin = vec3(orig.x, orig.y, orig.z);
}
vec2 Camera::sample_pixel(int i, int j) const {
float pxNDC;
float pyNDC;
float pxS;
float pyS;
pyNDC = (static_cast<float>(i) + random01()) / m_h;
pyS = (1.0f - (2.0f * pyNDC)) * glm::tan(radians(m_fov / 2.0f));
pxNDC = (static_cast<float>(j) + random01()) / m_w;
pxS = (2.0f * pxNDC) - 1.0f;
pxS *= m_a_ratio * glm::tan(radians(m_fov / 2.0f));
return vec2(pxS, pyS);
}