object.cpp 648 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Object implementation
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #include <ray.h>
  10. #include <object.h>
  11. #include <matrix.h>
  12. #include <tuple.h>
  13. #include <intersect.h>
  14. Shape::Shape()
  15. {
  16. this->transformMatrix = Matrix4().identity();
  17. this->inverseTransform = this->transformMatrix.inverse();
  18. }
  19. Intersect Shape::intersect(Ray r)
  20. {
  21. return Intersect();
  22. };
  23. Tuple Shape::normalAt(Tuple point)
  24. {
  25. return Vector(0, 0, 0);
  26. }
  27. void Shape::setTransform(Matrix transform)
  28. {
  29. this->transformMatrix = transform;
  30. this->inverseTransform = transform.inverse();
  31. }