sphere.h 749 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Sphere header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_SPHERE_H
  10. #define DORAYME_SPHERE_H
  11. #include <shape.h>
  12. #include <ray.h>
  13. #include <intersect.h>
  14. #include <renderstat.h>
  15. class Sphere : public Shape
  16. {
  17. protected:
  18. Intersect localIntersect(Ray r);
  19. Tuple localNormalAt(Tuple point);
  20. public:
  21. Sphere() : Shape(SHAPE_SPHERE) { stats.addSphere(); };
  22. /* All sphere are at (0, 0, 0) and radius 1 in the object space */
  23. };
  24. /* Mostly for test purposes */
  25. class GlassSphere : public Sphere
  26. {
  27. public:
  28. GlassSphere() : Sphere() { this->material.transparency = 1.0; this->material.refractiveIndex = 1.5; };
  29. };
  30. #endif /* DORAYME_SPHERE_H */