Don't set the focal/aperture on the constructor and use a dedicated method for that.
This commit is contained in:
@@ -15,8 +15,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <renderstat.h>
|
#include <renderstat.h>
|
||||||
|
|
||||||
Camera::Camera(uint32_t hsize, uint32_t vsize, double fov, double focal, double aperture, uint32_t rayCount) : verticalSize(vsize),
|
Camera::Camera(uint32_t hsize, uint32_t vsize, double fov) : verticalSize(vsize),
|
||||||
horizontalSize(hsize), fieldOfView(fov), focalDistance(focal), apertureSize(aperture), rayCount(rayCount)
|
horizontalSize(hsize), fieldOfView(fov), focalDistance(1), apertureSize(0), rayCount(1)
|
||||||
{
|
{
|
||||||
double aspectRatio = (double)hsize / (double)vsize;
|
double aspectRatio = (double)hsize / (double)vsize;
|
||||||
double halfView = tan(fov / 2.0) * this->focalDistance;
|
double halfView = tan(fov / 2.0) * this->focalDistance;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ public:
|
|||||||
Matrix inverseTransform;
|
Matrix inverseTransform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Camera(uint32_t hsize, uint32_t vsize, double fov, double focal = 1, double aperture = 0, uint32_t rayCount = 1);
|
Camera(uint32_t hsize, uint32_t vsize, double fov);
|
||||||
|
setFocal(double focal, double aperture, uint32_t rayCount);
|
||||||
void setTransform(Matrix transform);
|
void setTransform(Matrix transform);
|
||||||
Ray rayForPixel(uint32_t pixelX, uint32_t pixelY, double horzOffset = 0, double vertOffset = 0);
|
Ray rayForPixel(uint32_t pixelX, uint32_t pixelY, double horzOffset = 0, double vertOffset = 0);
|
||||||
Canvas render(World w, uint32_t depth = 5);
|
Canvas render(World w, uint32_t depth = 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user