mirror of
https://github.com/g-truc/glm.git
synced 2024-11-14 14:04:36 +00:00
506a487d24
- specializes for 1, 2, 3 and 4-dimensional vector types which are then aliased as tvec1, tvec2, tvec3 and tvec4 - requires C++11 aliases; breaks compatability with C++03 - tested on: - clang-3.5.2, clang-3.8.0 - gcc 4.8.5, gcc 5.4.1, gcc 6.2.0 TODO: - still uses template template parameters - most can probably be removed - some definitions might now be de-duplicated
24 lines
528 B
C++
24 lines
528 B
C++
#include <glm/gtc/integer.hpp>
|
|
#include <glm/gtx/component_wise.hpp>
|
|
|
|
namespace gli
|
|
{
|
|
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
|
inline T levels(vecType<D, T, P> const& Extent)
|
|
{
|
|
return glm::log2(compMax(Extent)) + static_cast<T>(1);
|
|
}
|
|
|
|
template <typename T>
|
|
inline T levels(T Extent)
|
|
{
|
|
return static_cast<T>(glm::log2(Extent) + static_cast<size_t>(1));
|
|
}
|
|
/*
|
|
inline int levels(int Extent)
|
|
{
|
|
return glm::log2(Extent) + static_cast<int>(1);
|
|
}
|
|
*/
|
|
}//namespace gli
|