strippattern.h 557 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Strip Pattern header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_STRIPPATTERN_H
  10. #define DORAYME_STRIPPATTERN_H
  11. #include <pattern.h>
  12. #include <stdio.h>
  13. class StripPattern : public Pattern
  14. {
  15. public:
  16. StripPattern(Colour a, Colour b) : Pattern(a, b) { };
  17. Colour patternAt(Tuple point)
  18. {
  19. if (fmod(floor(point.x), 2) == 0)
  20. {
  21. return this->a;
  22. }
  23. return this->b;
  24. }
  25. };
  26. #endif /* DORAYME_STRIPPATTERN_H */