libcmo21/LibCmo/CK2/ObjImpls/CKTexture.hpp
yyc12345 e682a87d25 refactor: refactor project
- rename LIBCMO_DISABLE_COPY_MOVE -> YYCC_DEL_CLS_COPY_MOVE and LIBCMO_DEFAULT_COPY_MOVE -> YYCC_DEF_CLS_COPY_MOVE.
- fix Vector declaration generator. throw exception when operator[] face invalid index, instead of do fallback.
- rename VTAll.hpp -> VTInternal.hpp and VYUserAll -> VTAll.hpp for easy to understand.
- fix project name error in Doxygen template.
- replace all LIBCMO_OS_WIN32 to YYCC_OS == YYCC_OS_WINDOWS.
- fix some compile error (involving utf8 encoding) but not the final result.
- use correct way to include std-image library (use <> instead of "")
- finish documentation for VTUtils.hpp and VTEncoding.hpp.
2024-08-17 20:43:27 +08:00

49 lines
1.3 KiB
C++

#pragma once
#include "../../VTInternal.hpp"
#include "../CKBitmapData.hpp"
#include "CKBeObject.hpp"
namespace LibCmo::CK2::ObjImpls {
class CKTexture : public CKBeObject {
public:
CKTexture(CKContext* ctx, CK_ID ckid, CKSTRING name);
virtual ~CKTexture();
YYCC_DEL_CLS_COPY_MOVE(CKTexture);
virtual CK_CLASSID GetClassID(void) override {
return CK_CLASSID::CKCID_TEXTURE;
}
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
CKBitmapData& GetUnderlyingData();
/**
* @brief A wrapper of underlying CKBitmapData::LoadImage. Not only load image, but also set file name.
* @param filename[in] File name of loading image.
* @param slot[in] The slot that image will be loaded into.
* @return True if success.
*/
bool LoadImage(CKSTRING filename, CKDWORD slot);
bool IsUseMipmap() const;
void UseMipmap(bool isUse);
CKDWORD GetMipmapLevel() const;
void SetMipmapLevel(CKDWORD level);
VxMath::VxImageDescEx* GetMipmapLevelData(CKDWORD level);
VxMath::VX_PIXELFORMAT GetVideoFormat() const;
void SetVideoFormat(VxMath::VX_PIXELFORMAT fmt);
protected:
CKBitmapData m_ImageHost;
VxMath::VX_PIXELFORMAT m_VideoFormat;
bool m_UseMipMap;
XContainer::XArray<VxMath::VxImageDescEx> m_MipmapImages;
};
}