mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
remove debug code
This commit is contained in:
parent
0d4d15209f
commit
324b226f98
1 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,8 @@
|
||||||
#include "../external/simpleppm.h"
|
#include "../external/simpleppm.h"
|
||||||
#include "Parser.h"
|
#include "Parser.h"
|
||||||
#include "Ray.h"
|
#include "Ray.h"
|
||||||
#include <Eigen/src/Core/Matrix.h>
|
|
||||||
|
#include <Eigen/Core>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
void RayTracer::parse() {
|
void RayTracer::parse() {
|
||||||
|
@ -18,12 +19,11 @@ void RayTracer::parse() {
|
||||||
|
|
||||||
Ray getRay(int x, int y, const Vector3f &camPos, const Vector3f &lookat,
|
Ray getRay(int x, int y, const Vector3f &camPos, const Vector3f &lookat,
|
||||||
float fov, int width, int height) {
|
float fov, int width, int height) {
|
||||||
// TODO: compute ray
|
|
||||||
float focalLength = lookat.norm();
|
float focalLength = lookat.norm();
|
||||||
float theta = fov / 180 * 3.14159;
|
float theta = fov / 180 * 3.14159;
|
||||||
float h = tan(theta / 2);
|
float h = tan(theta / 2);
|
||||||
float viewportHeight = 2 * h * focalLength;
|
float viewportHeight = 2 * h * focalLength;
|
||||||
float viewportWidth = viewportHeight * width / height;
|
float viewportWidth = viewportHeight * (float)width / height;
|
||||||
Vector3f viewportU = Vector3f(viewportWidth, 0, 0);
|
Vector3f viewportU = Vector3f(viewportWidth, 0, 0);
|
||||||
Vector3f viewportV = Vector3f(0, -viewportHeight, 0);
|
Vector3f viewportV = Vector3f(0, -viewportHeight, 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue