shape.cpp 684 B

12345678910111213141516171819202122232425262728293031323334353637
  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 <shape.h>
  11. #include <matrix.h>
  12. #include <tuple.h>
  13. #include <intersect.h>
  14. Shape::Shape(ShapeType type)
  15. {
  16. this->type = type;
  17. this->transformMatrix = Matrix4().identity();
  18. this->inverseTransform = this->transformMatrix.inverse();
  19. }
  20. Intersect Shape::intersect(Ray r)
  21. {
  22. return Intersect();
  23. };
  24. Tuple Shape::normalAt(Tuple point)
  25. {
  26. return Vector(0, 0, 0);
  27. }
  28. void Shape::setTransform(Matrix transform)
  29. {
  30. this->transformMatrix = transform;
  31. this->inverseTransform = transform.inverse();
  32. }