camera.h 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Camera header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_CAMERA_H
  10. #define DORAYME_CAMERA_H
  11. #include <matrix.h>
  12. #include <stdint.h>
  13. #include <ray.h>
  14. #include <canvas.h>
  15. #include <world.h>
  16. class Camera
  17. {
  18. private:
  19. double halfWidth;
  20. double halfHeight;
  21. public:
  22. double focalDistance;
  23. double apertureSize;
  24. uint32_t rayCount;
  25. uint32_t verticalSize;
  26. uint32_t horizontalSize;
  27. double fieldOfView;
  28. double pixelSize;
  29. Matrix transformMatrix;
  30. Matrix inverseTransform;
  31. public:
  32. Camera(uint32_t hsize, uint32_t vsize, double fov);
  33. setFocal(double focal, double aperture, uint32_t rayCount);
  34. void setTransform(Matrix transform);
  35. Ray rayForPixel(uint32_t pixelX, uint32_t pixelY, double horzOffset = 0, double vertOffset = 0);
  36. Canvas render(World w, uint32_t depth = 5);
  37. };
  38. #endif /* DORAYME_CAMERA_H */