You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
520 B

4 years ago
  1. #include "Object.h"
  2. #include "Material.h"
  3. #include "Ray.h"
  4. #include <math.h>
  5. Object::Object(Geometry * g, Material * m)
  6. {
  7. mGeometry = g;
  8. mMaterial = m;
  9. }
  10. void Object::Set(Geometry * g, Material * m)
  11. {
  12. mGeometry = g;
  13. mMaterial = m;
  14. }
  15. bool Object::HitTest(const Ray & input_ray, float min_distance, float max_distance, HitPoint & hit_point)
  16. {
  17. if (mGeometry->HitTest(input_ray, min_distance, max_distance, hit_point)) {
  18. hit_point.mMaterial = mMaterial;
  19. return true;
  20. }
  21. return false;
  22. }