checkerspattern.h 546 B

12345678910111213141516171819202122232425
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Checkers Pattern header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_CHECKERSPATTERN_H
  10. #define DORAYME_CHECKERSPATTERN_H
  11. class CheckersPattern : public Pattern
  12. {
  13. public:
  14. CheckersPattern(Colour a, Colour b) : Pattern(a, b) { };
  15. Colour patternAt(Tuple point)
  16. {
  17. double value = floor(point.x) + floor(point.y) + floor(point.z);
  18. return (fmod(value, 2) == 0)?this->a:this->b;
  19. }
  20. };
  21. #endif /* DORAYME_CHECKERSPATTERN_H */