NormalTexture.cpp 513 B

12345678910111213141516171819
  1. #include <cmath>
  2. #include <iostream>
  3. #include "client/rendering/NormalTexture.h"
  4. #include "client/utils/PNGReader.h"
  5. NormalTexture::NormalTexture(const char* path) : texture(Texture::LINEAR) {
  6. u32 maxWidth = 512;
  7. u32 maxHeight = 512;
  8. u32* buffer = new u32[maxWidth * maxHeight];
  9. if(PNGReader::load(path, buffer, maxWidth, maxHeight)) {
  10. texture.setRGBAData(maxWidth, maxHeight, buffer);
  11. }
  12. delete[] buffer;
  13. }
  14. void NormalTexture::bind(uint index) const {
  15. texture.bind(index);
  16. }