NoiseTexture.cpp 436 B

12345678910111213141516
  1. #include "client/rendering/NoiseTexture.h"
  2. #include "gaming-core/utils/Array.h"
  3. #include "gaming-core/utils/Random.h"
  4. NoiseTexture::NoiseTexture() : texture(TextureFormat::float32(3)) {
  5. Random r(1);
  6. Array<float, 48> data;
  7. for(int i = 0; i < 48; i++) {
  8. data[i] = r.nextFloat() * 2.0f - 1.0f;
  9. }
  10. texture.setData(4, 4, data.begin());
  11. }
  12. void NoiseTexture::bindTo(int index) const {
  13. texture.bindTo(index);
  14. }