diff --git a/inc/hgl/TypeFunc.h b/inc/hgl/TypeFunc.h index fd28ad4..b5c1be9 100644 --- a/inc/hgl/TypeFunc.h +++ b/inc/hgl/TypeFunc.h @@ -472,6 +472,21 @@ namespace hgl return(value); } + inline const uint GetMipLevel(const uint size) + { + return static_cast(floor(log2(size)))+1; + } + + inline const uint GetMipLevel(const uint width,const uint height) + { + return GetMipLevel(hgl_max(width,height)); + } + + inline const uint GetMipLevel(const uint width,const uint height,const uint depth) + { + return GetMipLevel(hgl_max(hgl_max(width,height),depth)); + } + /** * 角度转弧度 */