boo/lib/graphicsdev/Common.cpp

16 lines
330 B
C++
Raw Normal View History

2018-01-20 03:02:29 +00:00
#include "Common.hpp"
2018-01-21 23:07:34 +00:00
#include <cmath>
2018-01-20 03:02:29 +00:00
2018-12-08 05:17:51 +00:00
namespace boo {
2018-01-20 03:02:29 +00:00
2018-12-08 05:17:51 +00:00
void UpdateGammaLUT(ITextureD* tex, float gamma) {
void* data = tex->map(65536 * 2);
for (int i = 0; i < 65536; ++i) {
float level = std::pow(i / 65535.f, gamma);
reinterpret_cast<uint16_t*>(data)[i] = level * 65535.f;
}
tex->unmap();
2018-01-20 03:02:29 +00:00
}
2018-12-08 05:17:51 +00:00
} // namespace boo