[Feat] (MG_State/TextureState): Implement GetMipmap for TextureObject.

This commit is contained in:
BZLZHH
2025-08-25 15:13:01 +08:00
parent 86a68df114
commit 427e069085
2 changed files with 10 additions and 0 deletions
@@ -34,6 +34,14 @@ namespace MobileGL {
return m_mipmaps;
}
MipmapLevelInternal& TextureObjectBase::GetMipmap(Int index) {
if (index > m_mipmaps.size()) {
// fallback to the last mipmap
index = static_cast<Int>(m_mipmaps.size() - 1);
}
return m_mipmaps[index];
}
void TextureObjectBase::SetInternalFormat(TextureInternalFormat format) {
m_internalFormat = format;
}
@@ -207,6 +207,7 @@ namespace MobileGL {
virtual IntVec3 GetBaseSize() const = 0;
virtual SharedPtr<SamplerObject> GetSamplerObject() const = 0;
virtual const Vector<MipmapLevelInternal>& GetMipmaps() const = 0;
virtual MipmapLevelInternal& GetMipmap(Int index) = 0;
virtual void SetInternalFormat(TextureInternalFormat format) = 0;
};
@@ -221,6 +222,7 @@ namespace MobileGL {
IntVec3 GetBaseSize() const override;
SharedPtr<SamplerObject> GetSamplerObject() const override;
const Vector<MipmapLevelInternal>& GetMipmaps() const override;
MipmapLevelInternal& GetMipmap(Int index) override;
void SetInternalFormat(TextureInternalFormat format) override;
protected: