16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 12:49:18 +02:00

opengl 3.3 renderer cascaded shadow maps, minor gfx renderer optimizations

This commit is contained in:
tmj-fstate
2019-12-05 15:42:54 +01:00
parent 194400e1af
commit 63619d13a6
21 changed files with 416 additions and 443 deletions

View File

@@ -113,8 +113,7 @@ std::vector<std::string> Split(const std::string &s, char delim);
std::string to_string(int Value);
std::string to_string(unsigned int Value);
std::string to_string(int Value, int precision);
std::string to_string(int Value, int precision, int width);
std::string to_string(int Value, int width);
std::string to_string(double Value);
std::string to_string(double Value, int precision);
std::string to_string(double Value, int precision, int width);
@@ -249,6 +248,20 @@ clamp_circular( Type_ Value, Type_ const Range = static_cast<Type_>(360) ) {
return Value;
}
// rounds down provided value to nearest power of two
template <typename Type_>
Type_
clamp_power_of_two( Type_ Value, Type_ const Min = static_cast<Type_>(1), Type_ const Max = static_cast<Type_>(16384) ) {
Type_ p2size{ Min };
Type_ size;
while( ( p2size <= Max ) && ( p2size <= Value ) ) {
size = p2size;
p2size = p2size << 1;
}
return size;
}
template <typename Type_>
Type_
quantize( Type_ const Value, Type_ const Step ) {