create visitor for all existed CK class
This commit is contained in:
@ -195,4 +195,71 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
return CKObject::IsVisible();
|
||||
}
|
||||
|
||||
#pragma region Misc Oper
|
||||
|
||||
const VxMath::VxMatrix& CK3dEntity::GetWorldMatrix() const {
|
||||
return m_WorldMatrix;
|
||||
}
|
||||
|
||||
void CK3dEntity::SetWorldMatrix(const VxMath::VxMatrix& mat) {
|
||||
m_WorldMatrix = mat;
|
||||
}
|
||||
|
||||
CK_3DENTITY_FLAGS CK3dEntity::GetEntityFlags() const {
|
||||
return m_3dEntityFlags;
|
||||
}
|
||||
|
||||
void CK3dEntity::SetEntityFlags(CK_3DENTITY_FLAGS flags) {
|
||||
m_3dEntityFlags = flags;
|
||||
}
|
||||
|
||||
VxMath::VX_MOVEABLE_FLAGS CK3dEntity::GetMoveableFlags() const {
|
||||
return m_MoveableFlags;
|
||||
}
|
||||
|
||||
void CK3dEntity::SetMoveableFlags(VxMath::VX_MOVEABLE_FLAGS flags) {
|
||||
m_MoveableFlags = flags;
|
||||
}
|
||||
|
||||
CKDWORD CK3dEntity::GetZOrder() const {
|
||||
return m_ZOrder;
|
||||
}
|
||||
|
||||
void CK3dEntity::SetZOrder(CKDWORD ord) {
|
||||
m_ZOrder = ord;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Mesh Oper
|
||||
|
||||
void CK3dEntity::AddPotentialMesh(CKMesh* mesh) {
|
||||
XContainer::NSXObjectPointerArray::AddIfNotHere(m_PotentialMeshes, mesh);
|
||||
}
|
||||
|
||||
void CK3dEntity::RemovePotentialMesh(CKMesh* mesh) {
|
||||
std::erase(m_PotentialMeshes, mesh);
|
||||
}
|
||||
|
||||
CKDWORD CK3dEntity::GetPotentialMeshCount() const {
|
||||
return static_cast<CKDWORD>(m_PotentialMeshes.size());
|
||||
}
|
||||
|
||||
CKMesh* CK3dEntity::GetPotentialMesh(CKDWORD idx) const {
|
||||
if (idx >= m_PotentialMeshes.size()) return nullptr;
|
||||
return static_cast<CKMesh*>(m_PotentialMeshes[idx]);
|
||||
}
|
||||
|
||||
CKMesh* CK3dEntity::GetCurrentMesh() const {
|
||||
return m_CurrentMesh;
|
||||
}
|
||||
|
||||
void CK3dEntity::SetCurrentMesh(CKMesh* mesh) {
|
||||
m_CurrentMesh = mesh;
|
||||
AddPotentialMesh(mesh);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,22 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
virtual void Show(CK_OBJECT_SHOWOPTION show = CK_OBJECT_SHOWOPTION::CKSHOW) override;
|
||||
virtual bool IsVisible() const override;
|
||||
|
||||
const VxMath::VxMatrix& GetWorldMatrix() const;
|
||||
void SetWorldMatrix(const VxMath::VxMatrix& mat);
|
||||
CK_3DENTITY_FLAGS GetEntityFlags() const;
|
||||
void SetEntityFlags(CK_3DENTITY_FLAGS flags);
|
||||
VxMath::VX_MOVEABLE_FLAGS GetMoveableFlags() const;
|
||||
void SetMoveableFlags(VxMath::VX_MOVEABLE_FLAGS flags);
|
||||
CKDWORD GetZOrder() const;
|
||||
void SetZOrder(CKDWORD ord);
|
||||
|
||||
void AddPotentialMesh(CKMesh* mesh);
|
||||
void RemovePotentialMesh(CKMesh* mesh);
|
||||
CKDWORD GetPotentialMeshCount() const;
|
||||
CKMesh* GetPotentialMesh(CKDWORD idx) const;
|
||||
CKMesh* GetCurrentMesh() const;
|
||||
void SetCurrentMesh(CKMesh* mesh);
|
||||
|
||||
protected:
|
||||
XContainer::XObjectPointerArray m_PotentialMeshes;
|
||||
CKMesh* m_CurrentMesh;
|
||||
|
@ -13,7 +13,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
m_Specular(0.5f, 0.5f, 0.5f, 1.0f), m_SpecularPower(0.0f),
|
||||
m_Emissive(0.0f, 0.0f, 0.0f, 1.0f),
|
||||
m_EnableTwoSided(false),
|
||||
m_Textures{nullptr, nullptr, nullptr, nullptr},
|
||||
m_Textures { nullptr, nullptr, nullptr, nullptr },
|
||||
m_TextureMinMode(VxMath::VXTEXTURE_FILTERMODE::VXTEXTUREFILTER_LINEAR), m_TextureMagMode(VxMath::VXTEXTURE_FILTERMODE::VXTEXTUREFILTER_LINEAR),
|
||||
m_SourceBlend(VxMath::VXBLEND_MODE::VXBLEND_ONE), m_DestBlend(VxMath::VXBLEND_MODE::VXBLEND_ZERO), m_EnableAlphaBlend(false),
|
||||
m_ShadeMode(VxMath::VXSHADE_MODE::VXSHADE_GOURAUD),
|
||||
@ -161,7 +161,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
// drop parameter id.
|
||||
CK_ID paramid;
|
||||
chunk->ReadObjectID(paramid);
|
||||
|
||||
|
||||
// read effect self
|
||||
CKDWORD data;
|
||||
chunk->ReadStruct(data);
|
||||
@ -171,4 +171,165 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma region Data Visitor
|
||||
|
||||
const VxMath::VxColor& CKMaterial::GetDiffuse() const {
|
||||
return m_Diffuse;
|
||||
}
|
||||
void CKMaterial::SetDiffuse(const VxMath::VxColor& col) {
|
||||
m_Diffuse = col;
|
||||
}
|
||||
const VxMath::VxColor& CKMaterial::GetAmbient() const {
|
||||
return m_Ambient;
|
||||
}
|
||||
void CKMaterial::SetAmbient(const VxMath::VxColor& col) {
|
||||
m_Ambient = col;
|
||||
}
|
||||
const VxMath::VxColor& CKMaterial::GetSpecular() const {
|
||||
return m_Specular;
|
||||
}
|
||||
void CKMaterial::SetSpecular(const VxMath::VxColor& col) {
|
||||
m_Specular = col;
|
||||
}
|
||||
const VxMath::VxColor& CKMaterial::GetEmissive() const {
|
||||
return m_Emissive;
|
||||
}
|
||||
void CKMaterial::SetEmissive(const VxMath::VxColor& col) {
|
||||
m_Emissive = col;
|
||||
}
|
||||
CKFLOAT CKMaterial::GetSpecularPower() const {
|
||||
return m_SpecularPower;
|
||||
}
|
||||
void CKMaterial::SetSpecularPower(CKFLOAT val) {
|
||||
m_SpecularPower = val;
|
||||
}
|
||||
|
||||
|
||||
CKTexture* CKMaterial::GetTexture(CKDWORD idx) const {
|
||||
if (idx >= m_Textures.size()) return nullptr;
|
||||
return m_Textures[idx];
|
||||
}
|
||||
void CKMaterial::SetTexture(CKTexture* tex, CKDWORD idx) {
|
||||
if (idx >= m_Textures.size()) return;
|
||||
m_Textures[idx] = tex;
|
||||
}
|
||||
CKDWORD CKMaterial::GetTextureBorderColor() const {
|
||||
return m_TextureBorderColor;
|
||||
}
|
||||
void CKMaterial::SetTextureBorderColor(CKDWORD val) {
|
||||
m_TextureBorderColor = val;
|
||||
}
|
||||
|
||||
|
||||
VxMath::VXTEXTURE_BLENDMODE CKMaterial::GetTextureBlendMode() const {
|
||||
return m_TextureBlendMode;
|
||||
}
|
||||
void CKMaterial::SetTextureBlendMode(VxMath::VXTEXTURE_BLENDMODE val) {
|
||||
m_TextureBlendMode = val;
|
||||
}
|
||||
VxMath::VXTEXTURE_FILTERMODE CKMaterial::GetTextureMinMode() const {
|
||||
return m_TextureMinMode;
|
||||
}
|
||||
void CKMaterial::SetTextureMinMode(VxMath::VXTEXTURE_FILTERMODE val) {
|
||||
m_TextureMinMode = val;
|
||||
}
|
||||
VxMath::VXTEXTURE_FILTERMODE CKMaterial::GetTextureMagMode() const {
|
||||
return m_TextureMagMode;
|
||||
}
|
||||
void CKMaterial::SetTextureMagMode(VxMath::VXTEXTURE_FILTERMODE val) {
|
||||
m_TextureMagMode = val;
|
||||
}
|
||||
VxMath::VXTEXTURE_ADDRESSMODE CKMaterial::GetTextureAddressMode() const {
|
||||
return m_TextureAddressMode;
|
||||
}
|
||||
void CKMaterial::SetTextureAddressMode(VxMath::VXTEXTURE_ADDRESSMODE val) {
|
||||
m_TextureAddressMode = val;
|
||||
}
|
||||
|
||||
|
||||
VxMath::VXBLEND_MODE CKMaterial::GetSourceBlend() const {
|
||||
return m_SourceBlend;
|
||||
}
|
||||
void CKMaterial::SetSourceBlend(VxMath::VXBLEND_MODE val) {
|
||||
m_SourceBlend = val;
|
||||
}
|
||||
VxMath::VXBLEND_MODE CKMaterial::GetDestBlend() const {
|
||||
return m_DestBlend;
|
||||
}
|
||||
void CKMaterial::SetDestBlend(VxMath::VXBLEND_MODE val) {
|
||||
m_DestBlend = val;
|
||||
}
|
||||
VxMath::VXFILL_MODE CKMaterial::GetFillMode() const {
|
||||
return m_FillMode;
|
||||
}
|
||||
void CKMaterial::SetFillMode(VxMath::VXFILL_MODE val) {
|
||||
m_FillMode = val;
|
||||
}
|
||||
VxMath::VXSHADE_MODE CKMaterial::GetShadeMode() const {
|
||||
return m_ShadeMode;
|
||||
}
|
||||
void CKMaterial::SetShadeMode(VxMath::VXSHADE_MODE val) {
|
||||
m_ShadeMode = val;
|
||||
}
|
||||
|
||||
|
||||
bool CKMaterial::GetAlphaTestEnabled() const {
|
||||
return m_EnableAlphaTest;
|
||||
}
|
||||
void CKMaterial::SetAlphaTestEnabled(bool enabled) {
|
||||
m_EnableAlphaTest = enabled;
|
||||
}
|
||||
bool CKMaterial::GetAlphaBlendEnabled() const {
|
||||
return m_EnableAlphaBlend;
|
||||
}
|
||||
void CKMaterial::SetAlphaBlendEnabled(bool enabled) {
|
||||
m_EnableAlphaBlend = enabled;
|
||||
}
|
||||
bool CKMaterial::GetPerspectiveCorrectionEnabled() const {
|
||||
return m_EnablePerspectiveCorrection;
|
||||
}
|
||||
void CKMaterial::SetPerspectiveCorrectionEnabled(bool enabled) {
|
||||
m_EnablePerspectiveCorrection = enabled;
|
||||
}
|
||||
bool CKMaterial::GetZWriteEnabled() const {
|
||||
return m_EnableZWrite;
|
||||
}
|
||||
void CKMaterial::SetZWriteEnabled(bool enabled) {
|
||||
m_EnableZWrite = enabled;
|
||||
}
|
||||
bool CKMaterial::GetTwoSidedEnabled() const {
|
||||
return m_EnableTwoSided;
|
||||
}
|
||||
void CKMaterial::SetTwoSidedEnabled(bool enabled) {
|
||||
m_EnableTwoSided = enabled;
|
||||
}
|
||||
|
||||
|
||||
CKBYTE CKMaterial::GetAlphaRef() const {
|
||||
return m_AlphaRef;
|
||||
}
|
||||
void CKMaterial::SetAlphaRef(CKBYTE val) {
|
||||
m_AlphaRef = val;
|
||||
}
|
||||
VxMath::VXCMPFUNC CKMaterial::GetAlphaFunc() const {
|
||||
return m_AlphaFunc;
|
||||
}
|
||||
void CKMaterial::SetAlphaFunc(VxMath::VXCMPFUNC val) {
|
||||
m_AlphaFunc = val;
|
||||
}
|
||||
VxMath::VXCMPFUNC CKMaterial::GetZFunc() const {
|
||||
return m_ZFunc;
|
||||
}
|
||||
void CKMaterial::SetZFunc(VxMath::VXCMPFUNC val) {
|
||||
m_ZFunc = val;
|
||||
}
|
||||
VxMath::VX_EFFECT CKMaterial::GetEffect() const {
|
||||
return m_Effect;
|
||||
}
|
||||
void CKMaterial::SetEffect(VxMath::VX_EFFECT val) {
|
||||
m_Effect = val;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
}
|
@ -11,17 +11,71 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CKMaterial(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKMaterial();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKMaterial);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_MATERIAL;
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
return CK_CLASSID::CKCID_MATERIAL;
|
||||
}
|
||||
|
||||
virtual void CheckPreDeletion() override;
|
||||
|
||||
|
||||
// 2 RW functions
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
|
||||
const VxMath::VxColor& GetDiffuse() const;
|
||||
void SetDiffuse(const VxMath::VxColor& col);
|
||||
const VxMath::VxColor& GetAmbient() const;
|
||||
void SetAmbient(const VxMath::VxColor& col);
|
||||
const VxMath::VxColor& GetSpecular() const;
|
||||
void SetSpecular(const VxMath::VxColor& col);
|
||||
const VxMath::VxColor& GetEmissive() const;
|
||||
void SetEmissive(const VxMath::VxColor& col);
|
||||
CKFLOAT GetSpecularPower() const;
|
||||
void SetSpecularPower(CKFLOAT val);
|
||||
|
||||
CKTexture* GetTexture(CKDWORD idx = 0) const;
|
||||
void SetTexture(CKTexture* tex, CKDWORD idx = 0);
|
||||
CKDWORD GetTextureBorderColor() const;
|
||||
void SetTextureBorderColor(CKDWORD val);
|
||||
|
||||
VxMath::VXTEXTURE_BLENDMODE GetTextureBlendMode() const;
|
||||
void SetTextureBlendMode(VxMath::VXTEXTURE_BLENDMODE val);
|
||||
VxMath::VXTEXTURE_FILTERMODE GetTextureMinMode() const;
|
||||
void SetTextureMinMode(VxMath::VXTEXTURE_FILTERMODE val);
|
||||
VxMath::VXTEXTURE_FILTERMODE GetTextureMagMode() const;
|
||||
void SetTextureMagMode(VxMath::VXTEXTURE_FILTERMODE val);
|
||||
VxMath::VXTEXTURE_ADDRESSMODE GetTextureAddressMode() const;
|
||||
void SetTextureAddressMode(VxMath::VXTEXTURE_ADDRESSMODE val);
|
||||
|
||||
VxMath::VXBLEND_MODE GetSourceBlend() const;
|
||||
void SetSourceBlend(VxMath::VXBLEND_MODE val);
|
||||
VxMath::VXBLEND_MODE GetDestBlend() const;
|
||||
void SetDestBlend(VxMath::VXBLEND_MODE val);
|
||||
VxMath::VXFILL_MODE GetFillMode() const;
|
||||
void SetFillMode(VxMath::VXFILL_MODE val);
|
||||
VxMath::VXSHADE_MODE GetShadeMode() const;
|
||||
void SetShadeMode(VxMath::VXSHADE_MODE val);
|
||||
|
||||
bool GetAlphaTestEnabled() const;
|
||||
void SetAlphaTestEnabled(bool enabled);
|
||||
bool GetAlphaBlendEnabled() const;
|
||||
void SetAlphaBlendEnabled(bool enabled);
|
||||
bool GetPerspectiveCorrectionEnabled() const;
|
||||
void SetPerspectiveCorrectionEnabled(bool enabled);
|
||||
bool GetZWriteEnabled() const;
|
||||
void SetZWriteEnabled(bool enabled);
|
||||
bool GetTwoSidedEnabled() const;
|
||||
void SetTwoSidedEnabled(bool enabled);
|
||||
|
||||
CKBYTE GetAlphaRef() const;
|
||||
void SetAlphaRef(CKBYTE val);
|
||||
VxMath::VXCMPFUNC GetAlphaFunc() const;
|
||||
void SetAlphaFunc(VxMath::VXCMPFUNC val);
|
||||
VxMath::VXCMPFUNC GetZFunc() const;
|
||||
void SetZFunc(VxMath::VXCMPFUNC val);
|
||||
VxMath::VX_EFFECT GetEffect() const;
|
||||
void SetEffect(VxMath::VX_EFFECT val);
|
||||
|
||||
protected:
|
||||
VxMath::VxColor m_Diffuse;
|
||||
VxMath::VxColor m_Ambient;
|
||||
|
@ -424,7 +424,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
#pragma region Vertex Section
|
||||
|
||||
CKDWORD CKMesh::GetVertexCount() {
|
||||
CKDWORD CKMesh::GetVertexCount() const {
|
||||
return m_VertexCount;
|
||||
}
|
||||
|
||||
@ -469,7 +469,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
#pragma region Material Slot Section
|
||||
|
||||
CKDWORD CKMesh::GetMaterialSlotCount() {
|
||||
CKDWORD CKMesh::GetMaterialSlotCount() const {
|
||||
return m_MtlSlotCount;
|
||||
}
|
||||
|
||||
@ -478,16 +478,15 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
m_MaterialSlot.resize(count, nullptr);
|
||||
}
|
||||
|
||||
void CKMesh::SetMaterialSlot(CKMaterial* mtl, CKDWORD idx) {
|
||||
if (idx >= m_MtlSlotCount) return;
|
||||
m_MaterialSlot[idx] = mtl;
|
||||
CKMaterial** CKMesh::GetMaterialSlots() {
|
||||
return m_MaterialSlot.data();
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Face Section
|
||||
|
||||
CKDWORD CKMesh::GetFaceCount() {
|
||||
CKDWORD CKMesh::GetFaceCount() const {
|
||||
return m_FaceCount;
|
||||
}
|
||||
|
||||
@ -520,7 +519,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
#pragma region Line Section
|
||||
|
||||
CKDWORD CKMesh::GetLineCount() {
|
||||
CKDWORD CKMesh::GetLineCount() const {
|
||||
return m_LineCount;
|
||||
}
|
||||
|
||||
@ -537,7 +536,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
#pragma region Mtl Channel Section
|
||||
|
||||
CKDWORD CKMesh::GetMtlChannelCount() {
|
||||
CKDWORD CKMesh::GetMtlChannelCount() const {
|
||||
return m_MtlChannelCount;
|
||||
}
|
||||
|
||||
@ -574,7 +573,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
return m_MaterialChannels[idx].m_CustomUV.data();
|
||||
}
|
||||
|
||||
VxMath::VXCHANNEL_FLAGS CKMesh::GetMtlChannelFlags(CKDWORD idx) {
|
||||
VxMath::VXCHANNEL_FLAGS CKMesh::GetMtlChannelFlags(CKDWORD idx) const {
|
||||
if (idx >= m_MtlChannelCount) return static_cast<VxMath::VXCHANNEL_FLAGS>(0);
|
||||
return m_MaterialChannels[idx].m_Flags;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
// ===== Vertex Section =====
|
||||
public:
|
||||
CKDWORD GetVertexCount();
|
||||
CKDWORD GetVertexCount() const;
|
||||
void SetVertexCount(CKDWORD count);
|
||||
VxMath::VxVector3* GetVertexPositions();
|
||||
VxMath::VxVector3* GetVertexNormals();
|
||||
@ -44,13 +44,13 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
// ===== Material Slot Section =====
|
||||
public:
|
||||
CKDWORD GetMaterialSlotCount();
|
||||
CKDWORD GetMaterialSlotCount() const;
|
||||
void SetMaterialSlotCount(CKDWORD count);
|
||||
void SetMaterialSlot(CKMaterial* mtl, CKDWORD idx);
|
||||
CKMaterial** GetMaterialSlots();
|
||||
|
||||
// ===== Face Section =====
|
||||
public:
|
||||
CKDWORD GetFaceCount();
|
||||
CKDWORD GetFaceCount() const;
|
||||
void SetFaceCount(CKDWORD count);
|
||||
CKWORD* GetFaceIndices();
|
||||
CKWORD* GetFaceMaterialSlotIndexs();
|
||||
@ -59,20 +59,20 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
// ===== Line Section =====
|
||||
public:
|
||||
CKDWORD GetLineCount();
|
||||
CKDWORD GetLineCount() const;
|
||||
void SetLineCount(CKDWORD count);
|
||||
CKWORD* GetLineIndices();
|
||||
|
||||
// ===== Material Channel Section =====
|
||||
public:
|
||||
CKDWORD GetMtlChannelCount();
|
||||
CKDWORD GetMtlChannelCount() const;
|
||||
void SetMtlChannelCount(CKDWORD count);
|
||||
CKMaterial** GetMtlChannelMaterials(CKDWORD& stride);
|
||||
VxMath::VXBLEND_MODE* GetMtlChannelSourceBlends(CKDWORD& stride);
|
||||
VxMath::VXBLEND_MODE* GetMtlChannelDestBlends(CKDWORD& stride);
|
||||
|
||||
VxMath::VxVector2* GetMtlChannelCustomUVs(CKDWORD idx);
|
||||
VxMath::VXCHANNEL_FLAGS GetMtlChannelFlags(CKDWORD idx);
|
||||
VxMath::VXCHANNEL_FLAGS GetMtlChannelFlags(CKDWORD idx) const;
|
||||
void SetMtlChannelFlags(CKDWORD idx, VxMath::VXCHANNEL_FLAGS flags);
|
||||
protected:
|
||||
// 2 sync functions served for material channels.
|
||||
|
@ -94,7 +94,10 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
} else {
|
||||
CKDWORD fmtbytesize;
|
||||
if (chunk->SeekIdentifierAndReturnSize(CK_STATESAVEFLAGS_TEXTURE::CK_STATESAVE_OLDTEXONLY, &fmtbytesize)) {
|
||||
// 0xFF (blank) 0xFF (save options) 0xFF (transparent + movie info + video fmt) 0xFF (mip map)
|
||||
// for mid data:
|
||||
// HIGH >>> 0xFF (blank) 0xFF (save options) 0xFF (transparent + movie info + video fmt) 0xFF (mip map) <<< LOW
|
||||
// for mixed flags:
|
||||
// HIGH >>> 1(blank) 1(cubemap) 1(has video fmt) 1(is transparent)
|
||||
CKDWORD mixdata;
|
||||
chunk->ReadStruct(mixdata);
|
||||
m_UseMipMap = (mixdata & 0xFF);
|
||||
@ -103,6 +106,7 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
mixdata = mixdata & 0xFF00 >> 8;
|
||||
m_ImageHost.SetTransparent(mixdata & 0x1);
|
||||
bool hasVideoFmt = mixdata & 0x2;
|
||||
m_ImageHost.SetCubeMap(mixdata & 0x4);
|
||||
// MARK: I ignore 0x4 in there because it involve video.
|
||||
|
||||
// set current slot, transparent color, and video format.
|
||||
@ -190,4 +194,46 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma region Visitor
|
||||
|
||||
CKBitmapData& CKTexture::GetUnderlyingData() {
|
||||
return m_ImageHost;
|
||||
}
|
||||
|
||||
bool CKTexture::IsUseMipmap() const {
|
||||
return m_UseMipMap;
|
||||
}
|
||||
|
||||
void CKTexture::UseMipmap(bool isUse) {
|
||||
m_UseMipMap = isUse;
|
||||
|
||||
if (!m_UseMipMap) {
|
||||
m_MipmapImages.clear();
|
||||
}
|
||||
}
|
||||
|
||||
CKDWORD CKTexture::GetMipmapLevel() const {
|
||||
return static_cast<CKDWORD>(m_MipmapImages.size());
|
||||
}
|
||||
|
||||
void CKTexture::SetMipmapLevel(CKDWORD level) {
|
||||
m_MipmapImages.resize(level);
|
||||
}
|
||||
|
||||
VxMath::VxImageDescEx* CKTexture::GetMipmapLevelData(CKDWORD level) {
|
||||
if (!m_UseMipMap || level >= m_MipmapImages.size()) return nullptr;
|
||||
return &m_MipmapImages[level];
|
||||
}
|
||||
|
||||
VxMath::VX_PIXELFORMAT CKTexture::GetVideoFormat() const {
|
||||
return m_VideoFormat;
|
||||
}
|
||||
|
||||
void CKTexture::SetVideoFormat(VxMath::VX_PIXELFORMAT fmt) {
|
||||
m_VideoFormat = fmt;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,10 +16,19 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
return CK_CLASSID::CKCID_TEXTURE;
|
||||
}
|
||||
|
||||
//virtual void PreSave(CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
|
||||
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
|
||||
//virtual void PostLoad() override;
|
||||
|
||||
CKBitmapData& GetUnderlyingData();
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user