strippattern.h 670 B

12345678910111213141516171819202122232425262728293031323334353637
  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 (modulo(floor(point.x), 2) == 0)
  20. {
  21. return this->a;
  22. }
  23. return this->b;
  24. }
  25. void dumpMe(FILE *fp) {
  26. fprintf(fp, "\"Type\": \"Strip\",\n");
  27. Pattern::dumpMe(fp);
  28. }
  29. };
  30. #endif /* DORAYME_STRIPPATTERN_H */