uv_aligncheck.h 1013 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * UV Align Check test pattern header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_UV_ALIGNCHECK_H
  10. #define DORAYME_UV_ALIGNCHECK_H
  11. class UVAlignCheck : public UVPattern
  12. {
  13. public:
  14. Colour ul, ur, bl, br;
  15. UVAlignCheck(Colour main, Colour ul, Colour ur, Colour bl, Colour br) : UVPattern(1, 1, main, main),
  16. ul(ul), ur(ur), bl(bl), br(br) {};
  17. Colour uvPatternAt(double u, double v) {
  18. /* Remember that v=0 is at the bottom, v=1 at the top */
  19. if (v > 0.8)
  20. {
  21. if (u < 0.2) { return this->ul; }
  22. if (u > 0.8) { return this->ur; }
  23. }
  24. else if (v < 0.2)
  25. {
  26. if (u < 0.2) { return this->bl; }
  27. if (u > 0.8) { return this->br; }
  28. }
  29. /* main is stored in A or B */
  30. return this->a;
  31. };
  32. };
  33. #endif /* DORAYME_UV_ALIGNCHECK_H */