mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(gx): add TextureCalcMipCount
This commit is contained in:
parent
9e46e15e0b
commit
77622566d7
@ -856,6 +856,26 @@ void TextureCacheNewTexture(CTexture* texture, const CImVector& color) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
uint32_t TextureCalcMipCount(uint32_t width, uint32_t height) {
|
||||
uint32_t count = 1;
|
||||
|
||||
while (width > 1 || height > 1) {
|
||||
width /= 2;
|
||||
if (width == 0) {
|
||||
width = 1;
|
||||
}
|
||||
|
||||
height /= 2;
|
||||
if (height == 0) {
|
||||
height = 1;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
HTEXTURE TextureCreate(const char* fileName, CGxTexFlags texFlags, CStatus* status, int32_t createFlags) {
|
||||
STORM_ASSERT(fileName);
|
||||
STORM_ASSERT(*fileName);
|
||||
|
||||
@ -55,6 +55,8 @@ void TextureCacheNewTexture(CTexture*, CGxTexFlags);
|
||||
|
||||
void TextureCacheNewTexture(CTexture*, const CImVector&);
|
||||
|
||||
uint32_t TextureCalcMipCount(uint32_t width, uint32_t height);
|
||||
|
||||
HTEXTURE TextureCreate(const char*, CGxTexFlags, CStatus*, int32_t);
|
||||
|
||||
HTEXTURE TextureCreate(uint32_t, uint32_t, EGxTexFormat, EGxTexFormat, CGxTexFlags, void*, void (*)(EGxTexCommand, uint32_t, uint32_t, uint32_t, uint32_t, void*, uint32_t&, const void*&), const char*, int32_t);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user