texture.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef TEXTURE_H
  2. #define TEXTURE_H
  3. // ===============================
  4. // AUTHOR : Angel Ortiz (angelo12 AT vt DOT edu)
  5. // CREATE DATE : 2018-07-02
  6. // PURPOSE : To store texture data for retrieval during the pixel shader phase.
  7. // it also has to be capable of storing all the major kinds of textures
  8. // that are used in a physically based renderer.
  9. // ===============================
  10. // SPECIAL NOTES: The two separate methods to get pixel values are not good style,
  11. // and should probably be changed. The reason they're there is because of the different
  12. // return statement for each. Should probably become either different classes or just
  13. // a more general solution.
  14. // ===============================
  15. //Headers
  16. #include <string>
  17. #include "vector3D.h"
  18. class Texture{
  19. public:
  20. Texture(std::string path, std::string type);
  21. ~Texture();
  22. Vector3f getPixelVal(float u, float v);
  23. float getIntensityVal(float u, float v);
  24. private:
  25. float *pixelData;
  26. int width, height, channels, tileW = 32, tileH = 32, widthInTiles;
  27. //Currently disabled after tiling has been implemented
  28. int bilinearFiltering(float u, float v);
  29. //Reorganizes pixel data into a more cache friendly form
  30. void tileData();
  31. };
  32. #endif