mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Feat] (MG_State/TextureState): Implement TextureObjectBase::IsComplete.
This commit is contained in:
@@ -34,6 +34,22 @@ namespace MobileGL {
|
|||||||
return m_mipmaps;
|
return m_mipmaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool TextureObjectBase::IsComplete() const {
|
||||||
|
if (m_internalFormat == TextureInternalFormat::Unknown) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_mipmaps.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (const auto& level : m_mipmaps) {
|
||||||
|
if (level.size.x() <= 0 || level.size.y() <= 0 || level.size.z() <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: add more completeness checks based on texture type and mipmap levels
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
MipmapLevelInternal& TextureObjectBase::GetMipmap(Int index) {
|
MipmapLevelInternal& TextureObjectBase::GetMipmap(Int index) {
|
||||||
if (index > m_mipmaps.size()) {
|
if (index > m_mipmaps.size()) {
|
||||||
// fallback to the last mipmap
|
// fallback to the last mipmap
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ namespace MobileGL {
|
|||||||
virtual const Vector<MipmapLevelInternal>& GetMipmaps() const = 0;
|
virtual const Vector<MipmapLevelInternal>& GetMipmaps() const = 0;
|
||||||
virtual MipmapLevelInternal& GetMipmap(Int index) = 0;
|
virtual MipmapLevelInternal& GetMipmap(Int index) = 0;
|
||||||
virtual void SetInternalFormat(TextureInternalFormat format) = 0;
|
virtual void SetInternalFormat(TextureInternalFormat format) = 0;
|
||||||
|
virtual Bool IsComplete() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureObjectBase : public ITextureObject {
|
class TextureObjectBase : public ITextureObject {
|
||||||
@@ -225,6 +226,7 @@ namespace MobileGL {
|
|||||||
const Vector<MipmapLevelInternal>& GetMipmaps() const override;
|
const Vector<MipmapLevelInternal>& GetMipmaps() const override;
|
||||||
MipmapLevelInternal& GetMipmap(Int index) override;
|
MipmapLevelInternal& GetMipmap(Int index) override;
|
||||||
void SetInternalFormat(TextureInternalFormat format) override;
|
void SetInternalFormat(TextureInternalFormat format) override;
|
||||||
|
Bool IsComplete() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetMipmapImpl(const MipmapLevelInput& level) = 0;
|
virtual void SetMipmapImpl(const MipmapLevelInput& level) = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user