mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
po2 scaling for average luminance
This commit is contained in:
parent
72efd3a650
commit
e778ffee9b
6 changed files with 40 additions and 28 deletions
|
@ -22,6 +22,23 @@ namespace Misc
|
|||
return osg::Vec2f(vec.x() * c + vec.y() * -s, vec.x() * s + vec.y() * c);
|
||||
}
|
||||
|
||||
inline bool isPowerOfTwo(int x)
|
||||
{
|
||||
return ((x > 0) && ((x & (x - 1)) == 0));
|
||||
}
|
||||
|
||||
inline int nextPowerOfTwo(int v)
|
||||
{
|
||||
if (isPowerOfTwo(v))
|
||||
return v;
|
||||
int depth = 0;
|
||||
while (v)
|
||||
{
|
||||
v >>= 1;
|
||||
depth++;
|
||||
}
|
||||
return 1 << depth;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue