[Chore]: separate TextureObject child classes into individual files

This commit is contained in:
2025-11-24 09:51:39 +08:00
parent 1c318db4a0
commit ca8d2b7bab
12 changed files with 107 additions and 58 deletions
+3
View File
@@ -140,6 +140,9 @@ set(SOURCE_FILES
MobileGL/MG_State/GLState/VertexArrayState/VertexArrayState.cpp
MobileGL/MG_State/GLState/VertexArrayState/VertexArrayObject.cpp
MobileGL/MG_State/GLState/TextureState/TextureObject.cpp
MobileGL/MG_State/GLState/TextureState/TextureObject1D.cpp
MobileGL/MG_State/GLState/TextureState/TextureObject2D.cpp
MobileGL/MG_State/GLState/TextureState/TextureObject3D.cpp
MobileGL/MG_State/GLState/TextureState/TextureUnit.cpp
MobileGL/MG_State/GLState/TextureState/TextureState.cpp
MobileGL/MG_State/GLState/ProgramState/ProgramObject.cpp
@@ -1,5 +1,5 @@
#include "ProxyTexture.h"
#include "MG_State/GLState/TextureState/TextureObject.h"
#include "MG_State/GLState/TextureState/TextureObject2D.h"
#include "MG_Util/Types.h"
namespace MobileGL::MG_Impl::GLImpl {
+4
View File
@@ -2,6 +2,10 @@
#include "GLImpl/Texture/ProxyTexture.h"
#include "GLImpl/Framebuffer/GL_Framebuffer.h"
#include "MG_State/GLState/TextureState/TextureObject1D.h"
#include "MG_State/GLState/TextureState/TextureObject2D.h"
#include "MG_State/GLState/TextureState/TextureObject3D.h"
namespace MobileGL {
namespace MG_Impl {
void Init() {
@@ -137,36 +137,6 @@ namespace MobileGL {
m_levelRange.y() = maxLevel;
}
// TextureObject1D
TextureObject1D::TextureObject1D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture1D, externalIndex) {}
void TextureObject1D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
// TextureObject2D
TextureObject2D::TextureObject2D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture2D, externalIndex) {}
void TextureObject2D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0 && level.size.y() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
// TextureObject3D
TextureObject3D::TextureObject3D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture3D, externalIndex) {}
void TextureObject3D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0 && level.size.y() > 0 && level.size.z() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
// TODO: add other texture types as needed
} // namespace GLState
@@ -274,33 +274,6 @@ namespace MobileGL {
TextureSwizzleParam::Blue, TextureSwizzleParam::Alpha};
UintVec2 m_levelRange = {0, 1000};
};
class TextureObject1D : public TextureObjectBase {
public:
explicit TextureObject1D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
class TextureObject2D : public TextureObjectBase {
public:
explicit TextureObject2D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
class TextureObject3D : public TextureObjectBase {
public:
explicit TextureObject3D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
// TODO: add other texture types as needed
} // namespace GLState
} // namespace MG_State
} // namespace MobileGL
@@ -0,0 +1,16 @@
#include "TextureObject1D.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject1D::TextureObject1D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture1D, externalIndex) {}
void TextureObject1D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
}
}
}
@@ -0,0 +1,16 @@
#pragma once
#include "TextureObject.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
class TextureObject1D : public TextureObjectBase {
public:
explicit TextureObject1D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
}
}
}
@@ -0,0 +1,16 @@
#include "TextureObject2D.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject2D::TextureObject2D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture2D, externalIndex) {}
void TextureObject2D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0 && level.size.y() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
}
}
}
@@ -0,0 +1,16 @@
#pragma once
#include "TextureObject.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
class TextureObject2D : public TextureObjectBase {
public:
explicit TextureObject2D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
}
}
}
@@ -0,0 +1,16 @@
#include "TextureObject3D.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
TextureObject3D::TextureObject3D(Uint externalIndex)
: TextureObjectBase(TextureTarget::Texture3D, externalIndex) {}
void TextureObject3D::SetMipmapImpl(const MipmapLevelInput& level) {
if (level.size.x() > 0 && level.size.y() > 0 && level.size.z() > 0) {
m_mipmaps.push_back(MipmapLevelInternal(level));
}
}
}
}
}
@@ -0,0 +1,16 @@
#pragma once
#include "TextureObject.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
class TextureObject3D : public TextureObjectBase {
public:
explicit TextureObject3D(Uint externalIndex);
protected:
void SetMipmapImpl(const MipmapLevelInput& level) override;
};
}
}
}
@@ -1,5 +1,8 @@
#include "TextureState.h"
#include "MG_State/GLState/TextureState/TextureObject.h"
#include "MG_State/GLState/TextureState/TextureObject1D.h"
#include "MG_State/GLState/TextureState/TextureObject2D.h"
#include "MG_State/GLState/TextureState/TextureObject3D.h"
#include "MG_Util/Types.h"
namespace MobileGL {