camera.h 766 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. uint32_t verticalSize;
  23. uint32_t horizontalSize;
  24. double fieldOfView;
  25. double pixelSize;
  26. Matrix transformMatrix;
  27. Matrix inverseTransform;
  28. public:
  29. Camera(uint32_t hsize, uint32_t vsize, double fov);
  30. void setTransform(Matrix transform);
  31. Ray rayForPixel(uint32_t pixelX, uint32_t pixelY);
  32. Canvas render(World w, uint32_t depth = 5);
  33. };
  34. #endif /* DORAYME_CAMERA_H */