mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
fix typo and var names
This commit is contained in:
parent
b38e8bc964
commit
b510e1d4d0
1 changed files with 6 additions and 6 deletions
|
@ -45,14 +45,14 @@ void RayTracer::render() {
|
||||||
Vector3f cameraPos = Scene::current->center();
|
Vector3f cameraPos = Scene::current->center();
|
||||||
Vector3f lookAt = Scene::current->lookAt();
|
Vector3f lookAt = Scene::current->lookAt();
|
||||||
float vpHeight =
|
float vpHeight =
|
||||||
2 * tan(Scene ::current->fov() / 180 * M_PI / 2) * lookAt.norm();
|
2 * tan(Scene::current->fov() / 180 * M_PI / 2) * lookAt.norm();
|
||||||
float vpWidth = vpHeight * width / height;
|
float vpWidth = vpHeight * width / height;
|
||||||
Vector3f vpU = Vector3f(vpWidth, 0, 0);
|
Vector3f u = Vector3f(vpWidth, 0, 0);
|
||||||
Vector3f vpV = Vector3f(0, -vpHeight, 0);
|
Vector3f v = Vector3f(0, -vpHeight, 0);
|
||||||
Vector3f du = vpU / width;
|
Vector3f du = u / width;
|
||||||
Vector3f dv = vpV / height;
|
Vector3f dv = v / height;
|
||||||
|
|
||||||
Vector3f vpUpperLeft = cameraPos + lookAt - vpU / 2.0 - vpV / 2.0;
|
Vector3f vpUpperLeft = cameraPos + lookAt - u / 2.0 - v / 2.0;
|
||||||
Vector3f pxUpperLeft = vpUpperLeft + (du + dv) / 2.0;
|
Vector3f pxUpperLeft = vpUpperLeft + (du + dv) / 2.0;
|
||||||
|
|
||||||
Output::current = new Output(Scene::current->backgroundColor(),
|
Output::current = new Output(Scene::current->backgroundColor(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue