Refactor so PWE compiles with the newly externalized LibCommon
This commit is contained in:
parent
dacd21d7fc
commit
2287b05bc3
|
@ -0,0 +1 @@
|
|||
Subproject commit 42038000181a5fa5b92f2abfb74d91b7bec25040
|
|
@ -1 +1 @@
|
|||
Subproject commit 252e4c7e96099c0f684b96d57eb9d947278d565b
|
||||
Subproject commit 4917932573b3e6539113886c537a473550d3bbff
|
|
@ -28,13 +28,13 @@ void CAudioManager::LoadAssets()
|
|||
});
|
||||
|
||||
// Create SFX Define ID -> AGSC map
|
||||
for (u32 iGrp = 0; iGrp < mAudioGroups.size(); iGrp++)
|
||||
for (uint iGrp = 0; iGrp < mAudioGroups.size(); iGrp++)
|
||||
{
|
||||
CAudioGroup *pGroup = mAudioGroups[iGrp];
|
||||
|
||||
for (u32 iSnd = 0; iSnd < pGroup->NumSoundDefineIDs(); iSnd++)
|
||||
for (uint iSnd = 0; iSnd < pGroup->NumSoundDefineIDs(); iSnd++)
|
||||
{
|
||||
u16 DefineID = pGroup->SoundDefineIDByIndex(iSnd);
|
||||
uint16 DefineID = pGroup->SoundDefineIDByIndex(iSnd);
|
||||
ASSERT(mSfxIdMap.find(DefineID) == mSfxIdMap.end());
|
||||
mSfxIdMap[DefineID] = pGroup;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void CAudioManager::ClearAssets()
|
|||
mSfxIdMap.clear();
|
||||
}
|
||||
|
||||
SSoundInfo CAudioManager::GetSoundInfo(u32 SoundID)
|
||||
SSoundInfo CAudioManager::GetSoundInfo(uint32 SoundID)
|
||||
{
|
||||
SSoundInfo Out;
|
||||
Out.SoundID = SoundID;
|
||||
|
@ -84,18 +84,18 @@ SSoundInfo CAudioManager::GetSoundInfo(u32 SoundID)
|
|||
return Out;
|
||||
}
|
||||
|
||||
void CAudioManager::LogSoundInfo(u32 SoundID)
|
||||
void CAudioManager::LogSoundInfo(uint32 SoundID)
|
||||
{
|
||||
SSoundInfo SoundInfo = GetSoundInfo(SoundID);
|
||||
|
||||
if (SoundInfo.DefineID != 0xFFFF)
|
||||
{
|
||||
if (mpProject->Game() >= EGame::EchoesDemo)
|
||||
Log::Write("Sound Name: " + SoundInfo.Name);
|
||||
debugf("Sound Name: %s", *SoundInfo.Name);
|
||||
|
||||
Log::Write("Sound ID: " + TString::HexString(SoundInfo.SoundID, 4));
|
||||
Log::Write("Define ID: " + TString::HexString(SoundInfo.DefineID, 4));
|
||||
Log::Write("Audio Group: " + SoundInfo.pAudioGroup->Entry()->Name());
|
||||
Log::Write("");
|
||||
debugf("Sound ID: 0x%04x", SoundInfo.SoundID);
|
||||
debugf("Define ID: 0x%04x", SoundInfo.DefineID);
|
||||
debugf("Audio Group: %s", *SoundInfo.pAudioGroup->Entry()->Name());
|
||||
debugf("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ struct SSoundInfo
|
|||
{
|
||||
CAudioGroup *pAudioGroup;
|
||||
TString Name;
|
||||
u32 SoundID;
|
||||
u16 DefineID;
|
||||
uint32 SoundID;
|
||||
uint16 DefineID;
|
||||
};
|
||||
|
||||
class CAudioManager
|
||||
|
@ -23,14 +23,14 @@ class CAudioManager
|
|||
std::vector<TResPtr<CAudioGroup>> mAudioGroups;
|
||||
TResPtr<CAudioLookupTable> mpAudioLookupTable;
|
||||
TResPtr<CStringList> mpSfxNameList;
|
||||
std::unordered_map<u16, CAudioGroup*> mSfxIdMap;
|
||||
std::unordered_map<uint16, CAudioGroup*> mSfxIdMap;
|
||||
|
||||
public:
|
||||
CAudioManager(CGameProject *pProj);
|
||||
void LoadAssets();
|
||||
void ClearAssets();
|
||||
SSoundInfo GetSoundInfo(u32 SoundID);
|
||||
void LogSoundInfo(u32 SoundID);
|
||||
SSoundInfo GetSoundInfo(uint32 SoundID);
|
||||
void LogSoundInfo(uint32 SoundID);
|
||||
};
|
||||
|
||||
#endif // CAUDIOMANAGER
|
||||
|
|
|
@ -10,7 +10,7 @@ CRayCollisionTester::~CRayCollisionTester()
|
|||
{
|
||||
}
|
||||
|
||||
void CRayCollisionTester::AddNode(CSceneNode *pNode, u32 ComponentIndex, float Distance)
|
||||
void CRayCollisionTester::AddNode(CSceneNode *pNode, uint32 ComponentIndex, float Distance)
|
||||
{
|
||||
mBoxIntersectList.emplace_back(SRayIntersection());
|
||||
SRayIntersection& rIntersection = mBoxIntersectList.back();
|
||||
|
@ -22,7 +22,7 @@ void CRayCollisionTester::AddNode(CSceneNode *pNode, u32 ComponentIndex, float D
|
|||
void CRayCollisionTester::AddNodeModel(CSceneNode *pNode, CBasicModel *pModel)
|
||||
{
|
||||
// Check each of the model's surfaces and queue them for further testing if they hit
|
||||
for (u32 iSurf = 0; iSurf < pModel->GetSurfaceCount(); iSurf++)
|
||||
for (uint32 iSurf = 0; iSurf < pModel->GetSurfaceCount(); iSurf++)
|
||||
{
|
||||
std::pair<bool,float> SurfResult = pModel->GetSurfaceAABox(iSurf).Transformed(pNode->Transform()).IntersectsRay(mRay);
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#include "SRayIntersection.h"
|
||||
#include "Core/Render/SViewInfo.h"
|
||||
#include "Core/Resource/Model/CBasicModel.h"
|
||||
#include <Common/types.h>
|
||||
#include <Math/CAABox.h>
|
||||
#include <Math/CRay.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Math/CAABox.h>
|
||||
#include <Common/Math/CRay.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
|||
~CRayCollisionTester();
|
||||
const CRay& Ray() const { return mRay; }
|
||||
|
||||
void AddNode(CSceneNode *pNode, u32 AssetIndex, float Distance);
|
||||
void AddNode(CSceneNode *pNode, uint32 AssetIndex, float Distance);
|
||||
void AddNodeModel(CSceneNode *pNode, CBasicModel *pModel);
|
||||
SRayIntersection TestNodes(const SViewInfo& rkViewInfo);
|
||||
};
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
#include "CompressionUtil.h"
|
||||
#include <Common/Log.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/Common.h>
|
||||
|
||||
#include <lzo/lzo1x.h>
|
||||
#include <zlib.h>
|
||||
|
||||
namespace CompressionUtil
|
||||
{
|
||||
TString ErrorText_zlib(s32 Error)
|
||||
const char* ErrorText_zlib(int32 Error)
|
||||
{
|
||||
switch (Error)
|
||||
{
|
||||
|
@ -25,7 +23,7 @@ namespace CompressionUtil
|
|||
}
|
||||
}
|
||||
|
||||
TString ErrorText_LZO(s32 Error)
|
||||
const char* ErrorText_LZO(int32 Error)
|
||||
{
|
||||
switch (Error)
|
||||
{
|
||||
|
@ -48,7 +46,7 @@ namespace CompressionUtil
|
|||
}
|
||||
|
||||
// ************ DECOMPRESS ************
|
||||
bool DecompressZlib(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen, u32& rTotalOut)
|
||||
bool DecompressZlib(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut)
|
||||
{
|
||||
// Initialize z_stream
|
||||
z_stream z;
|
||||
|
@ -61,7 +59,7 @@ namespace CompressionUtil
|
|||
z.next_out = pDst;
|
||||
|
||||
// Attempt decompress
|
||||
s32 Error = inflateInit(&z);
|
||||
int32 Error = inflateInit(&z);
|
||||
|
||||
if (!Error)
|
||||
{
|
||||
|
@ -76,42 +74,42 @@ namespace CompressionUtil
|
|||
// Check for errors
|
||||
if (Error && Error != Z_STREAM_END)
|
||||
{
|
||||
Log::Error("zlib error: " + ErrorText_zlib(Error));
|
||||
errorf("zlib error: %s", ErrorText_zlib(Error));
|
||||
return false;
|
||||
}
|
||||
|
||||
else return true;
|
||||
}
|
||||
|
||||
bool DecompressLZO(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut)
|
||||
bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut)
|
||||
{
|
||||
lzo_init();
|
||||
lzo_uint TotalOut;
|
||||
s32 Error = lzo1x_decompress(pSrc, SrcLen, pDst, &TotalOut, LZO1X_MEM_DECOMPRESS);
|
||||
rTotalOut = (u32) TotalOut;
|
||||
int32 Error = lzo1x_decompress(pSrc, SrcLen, pDst, &TotalOut, LZO1X_MEM_DECOMPRESS);
|
||||
rTotalOut = (uint32) TotalOut;
|
||||
|
||||
if (Error)
|
||||
{
|
||||
Log::Error("LZO error: " + ErrorText_LZO(Error));
|
||||
errorf("LZO error: %s", ErrorText_LZO(Error));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DecompressSegmentedData(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen)
|
||||
bool DecompressSegmentedData(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen)
|
||||
{
|
||||
u8 *pSrcEnd = pSrc + SrcLen;
|
||||
u8 *pDstEnd = pDst + DstLen;
|
||||
uint8 *pSrcEnd = pSrc + SrcLen;
|
||||
uint8 *pDstEnd = pDst + DstLen;
|
||||
|
||||
while ((pSrc < pSrcEnd) && (pDst < pDstEnd))
|
||||
{
|
||||
// Read size value (this method is Endian-independent)
|
||||
u8 ByteA = *pSrc++;
|
||||
u8 ByteB = *pSrc++;
|
||||
s16 Size = (ByteA << 8) | ByteB;
|
||||
uint8 ByteA = *pSrc++;
|
||||
uint8 ByteB = *pSrc++;
|
||||
int16 Size = (ByteA << 8) | ByteB;
|
||||
|
||||
u32 TotalOut;
|
||||
uint32 TotalOut;
|
||||
|
||||
// Negative size denotes uncompressed data.
|
||||
if (Size < 0)
|
||||
|
@ -126,13 +124,13 @@ namespace CompressionUtil
|
|||
else
|
||||
{
|
||||
// Check for zlib magic
|
||||
u8 ByteC = pSrc[0];
|
||||
u8 ByteD = pSrc[1];
|
||||
u16 PeekMagic = (ByteC << 8) | ByteD;
|
||||
uint8 ByteC = pSrc[0];
|
||||
uint8 ByteD = pSrc[1];
|
||||
uint16 PeekMagic = (ByteC << 8) | ByteD;
|
||||
|
||||
if (PeekMagic == 0x78DA || PeekMagic == 0x789C || PeekMagic == 0x7801)
|
||||
{
|
||||
bool Success = DecompressZlib(pSrc, Size, pDst, (u32) (pDstEnd - pDst), TotalOut);
|
||||
bool Success = DecompressZlib(pSrc, Size, pDst, (uint32) (pDstEnd - pDst), TotalOut);
|
||||
if (!Success) return false;
|
||||
}
|
||||
|
||||
|
@ -152,7 +150,7 @@ namespace CompressionUtil
|
|||
}
|
||||
|
||||
// ************ COMPRESS ************
|
||||
bool CompressZlib(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen, u32& rTotalOut)
|
||||
bool CompressZlib(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut)
|
||||
{
|
||||
z_stream z;
|
||||
z.zalloc = Z_NULL;
|
||||
|
@ -163,7 +161,7 @@ namespace CompressionUtil
|
|||
z.avail_out = DstLen;
|
||||
z.next_out = pDst;
|
||||
|
||||
s32 Error = deflateInit(&z, 9);
|
||||
int32 Error = deflateInit(&z, 9);
|
||||
|
||||
if (!Error)
|
||||
{
|
||||
|
@ -177,46 +175,46 @@ namespace CompressionUtil
|
|||
|
||||
if (Error && Error != Z_STREAM_END)
|
||||
{
|
||||
Log::Error("zlib error: " + ErrorText_zlib(Error));
|
||||
errorf("zlib error: %s", ErrorText_zlib(Error));
|
||||
return false;
|
||||
}
|
||||
|
||||
else return true;
|
||||
}
|
||||
|
||||
bool CompressLZO(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut)
|
||||
bool CompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut)
|
||||
{
|
||||
lzo_init();
|
||||
|
||||
u8 *pWorkMem = new u8[LZO1X_999_MEM_COMPRESS];
|
||||
s32 Error = lzo1x_999_compress(pSrc, SrcLen, pDst, (lzo_uint*) &rTotalOut, pWorkMem);
|
||||
uint8 *pWorkMem = new uint8[LZO1X_999_MEM_COMPRESS];
|
||||
int32 Error = lzo1x_999_compress(pSrc, SrcLen, pDst, (lzo_uint*) &rTotalOut, pWorkMem);
|
||||
delete[] pWorkMem;
|
||||
|
||||
if (Error)
|
||||
{
|
||||
Log::Error("LZO error: " + ErrorText_LZO(Error));
|
||||
errorf("LZO error: %s", ErrorText_LZO(Error));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CompressSegmentedData(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool IsZlib, bool AllowUncompressedSegments)
|
||||
bool CompressSegmentedData(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool IsZlib, bool AllowUncompressedSegments)
|
||||
{
|
||||
u8 *pSrcEnd = pSrc + SrcLen;
|
||||
u8 *pDstStart = pDst;
|
||||
uint8 *pSrcEnd = pSrc + SrcLen;
|
||||
uint8 *pDstStart = pDst;
|
||||
|
||||
while (pSrc < pSrcEnd)
|
||||
{
|
||||
// Each segment is compressed separately. Segment size should always be 0x4000 unless there's less than 0x4000 bytes left.
|
||||
u16 Size;
|
||||
u32 Remaining = (u32) (pSrcEnd - pSrc);
|
||||
uint16 Size;
|
||||
uint32 Remaining = (uint32) (pSrcEnd - pSrc);
|
||||
|
||||
if (Remaining < 0x4000) Size = (u16) Remaining;
|
||||
if (Remaining < 0x4000) Size = (uint16) Remaining;
|
||||
else Size = 0x4000;
|
||||
|
||||
std::vector<u8> Compressed(Size * 2);
|
||||
u32 TotalOut;
|
||||
std::vector<uint8> Compressed(Size * 2);
|
||||
uint32 TotalOut;
|
||||
|
||||
if (IsZlib)
|
||||
CompressZlib(pSrc, Size, Compressed.data(), Compressed.size(), TotalOut);
|
||||
|
@ -248,16 +246,16 @@ namespace CompressionUtil
|
|||
pDst += TotalOut;
|
||||
}
|
||||
|
||||
rTotalOut = (u32) (pDst - pDstStart);
|
||||
rTotalOut = (uint32) (pDst - pDstStart);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CompressZlibSegmented(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool AllowUncompressedSegments)
|
||||
bool CompressZlibSegmented(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool AllowUncompressedSegments)
|
||||
{
|
||||
return CompressSegmentedData(pSrc, SrcLen, pDst, rTotalOut, true, AllowUncompressedSegments);
|
||||
}
|
||||
|
||||
bool CompressLZOSegmented(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool AllowUncompressedSegments)
|
||||
bool CompressLZOSegmented(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool AllowUncompressedSegments)
|
||||
{
|
||||
return CompressSegmentedData(pSrc, SrcLen, pDst, rTotalOut, false, AllowUncompressedSegments);
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
#ifndef COMPRESSIONUTIL_H
|
||||
#define COMPRESSIONUTIL_H
|
||||
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/FileIO.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
|
||||
namespace CompressionUtil
|
||||
{
|
||||
TString ErrorText_zlib(s32 Error);
|
||||
TString ErrorText_LZO(s32 Error);
|
||||
|
||||
// Decompression
|
||||
bool DecompressZlib(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen, u32& rTotalOut);
|
||||
bool DecompressLZO(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut);
|
||||
bool DecompressSegmentedData(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen);
|
||||
bool DecompressZlib(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut);
|
||||
bool DecompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut);
|
||||
bool DecompressSegmentedData(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen);
|
||||
|
||||
// Compression
|
||||
bool CompressZlib(u8 *pSrc, u32 SrcLen, u8 *pDst, u32 DstLen, u32& rTotalOut);
|
||||
bool CompressLZO(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut);
|
||||
bool CompressSegmentedData(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool IsZlib, bool AllowUncompressedSegments);
|
||||
bool CompressZlibSegmented(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool AllowUncompressedSegments);
|
||||
bool CompressLZOSegmented(u8 *pSrc, u32 SrcLen, u8 *pDst, u32& rTotalOut, bool AllowUncompressedSegments);
|
||||
bool CompressZlib(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32 DstLen, uint32& rTotalOut);
|
||||
bool CompressLZO(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut);
|
||||
bool CompressSegmentedData(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool IsZlib, bool AllowUncompressedSegments);
|
||||
bool CompressZlibSegmented(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool AllowUncompressedSegments);
|
||||
bool CompressLZOSegmented(uint8 *pSrc, uint32 SrcLen, uint8 *pDst, uint32& rTotalOut, bool AllowUncompressedSegments);
|
||||
}
|
||||
|
||||
#endif // COMPRESSIONUTIL_H
|
||||
|
|
|
@ -27,17 +27,15 @@ CONFIG (debug, debug|release) {
|
|||
TARGET = Cored
|
||||
|
||||
# Debug Libs
|
||||
LIBS += -L$$BUILD_DIR/Common/ -lCommond \
|
||||
-L$$BUILD_DIR/Math/ -lMathd \
|
||||
-L$$EXTERNALS_DIR/assimp/lib/Debug -lassimp-vc140-mt \
|
||||
LIBS += -L$$EXTERNALS_DIR/assimp/lib/Debug -lassimp-vc140-mt \
|
||||
-L$$EXTERNALS_DIR/LibCommon/Build -lLibCommond \
|
||||
-L$$EXTERNALS_DIR/nod/lib/Debug -lnod \
|
||||
-L$$EXTERNALS_DIR/nod/logvisor/Debug -llogvisor \
|
||||
-L$$EXTERNALS_DIR/zlib/lib/ -lzlibd
|
||||
|
||||
# Debug Target Dependencies
|
||||
win32 {
|
||||
PRE_TARGETDEPS += $$BUILD_DIR/Common/Commond.lib \
|
||||
$$BUILD_DIR/Math/Mathd.lib
|
||||
PRE_TARGETDEPS += $$EXTERNALS_DIR/LibCommon/Build/LibCommond.lib
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,17 +45,15 @@ CONFIG (release, debug|release) {
|
|||
TARGET = Core
|
||||
|
||||
# Release Libs
|
||||
LIBS += -L$$BUILD_DIR/Common/ -lCommon \
|
||||
-L$$BUILD_DIR/Math/ -lMath \
|
||||
-L$$EXTERNALS_DIR/assimp/lib/Release -lassimp-vc140-mt \
|
||||
LIBS += -L$$EXTERNALS_DIR/assimp/lib/Release -lassimp-vc140-mt \
|
||||
-L$$EXTERNALS_DIR/LibCommon/Build -lLibCommon \
|
||||
-L$$EXTERNALS_DIR/nod/lib/Release -lnod \
|
||||
-L$$EXTERNALS_DIR/nod/logvisor/Release -llogvisor \
|
||||
-L$$EXTERNALS_DIR/zlib/lib/ -lzlib
|
||||
|
||||
# Release Target Dependencies
|
||||
win32 {
|
||||
PRE_TARGETDEPS += $$BUILD_DIR/Common/Common.lib \
|
||||
$$BUILD_DIR/Math/Math.lib
|
||||
PRE_TARGETDEPS += $$EXTERNALS_DIR/LibCommon/Build/LibCommon.lib
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +66,7 @@ INCLUDEPATH += $$PWE_MAIN_INCLUDE \
|
|||
$$EXTERNALS_DIR/assimp/include \
|
||||
$$EXTERNALS_DIR/CodeGen/include \
|
||||
$$EXTERNALS_DIR/glew-2.1.0/include \
|
||||
$$EXTERNALS_DIR/LibCommon/Source \
|
||||
$$EXTERNALS_DIR/lzo-2.10/include \
|
||||
$$EXTERNALS_DIR/nod/include \
|
||||
$$EXTERNALS_DIR/nod/logvisor/include \
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Core/Resource/CWorld.h"
|
||||
#include "Core/Resource/Animation/CAnimSet.h"
|
||||
#include "Core/Resource/Script/CScriptLayer.h"
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
#define REVERT_AUTO_NAMES 1
|
||||
#define PROCESS_PACKAGES 1
|
||||
|
@ -85,12 +85,12 @@ void ApplyGeneratedName(CResourceEntry *pEntry, const TString& rkDir, const TStr
|
|||
|
||||
void GenerateAssetNames(CGameProject *pProj)
|
||||
{
|
||||
Log::Write("*** Generating Asset Names ***");
|
||||
debugf("*** Generating Asset Names ***");
|
||||
CResourceStore *pStore = pProj->ResourceStore();
|
||||
|
||||
#if REVERT_AUTO_NAMES
|
||||
// Revert all auto-generated asset names back to default to prevent name conflicts resulting in inconsistent results.
|
||||
Log::Write("Reverting auto-generated names");
|
||||
debugf("Reverting auto-generated names");
|
||||
|
||||
for (CResourceIterator It(pStore); It; ++It)
|
||||
{
|
||||
|
@ -106,13 +106,13 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_PACKAGES
|
||||
// Generate names for package named resources
|
||||
Log::Write("Processing packages");
|
||||
debugf("Processing packages");
|
||||
|
||||
for (u32 iPkg = 0; iPkg < pProj->NumPackages(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < pProj->NumPackages(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = pProj->PackageByIndex(iPkg);
|
||||
|
||||
for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
|
||||
if (rkRes.Name.EndsWith("NODEPEND")) continue;
|
||||
|
@ -128,7 +128,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_WORLDS
|
||||
// Generate world/area names
|
||||
Log::Write("Processing worlds");
|
||||
debugf("Processing worlds");
|
||||
const TString kWorldsRoot = "Worlds/";
|
||||
|
||||
for (TResourceIterator<eWorld> It(pStore); It; ++It)
|
||||
|
@ -165,15 +165,15 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
ApplyGeneratedName(pSkyEntry, WorldDir + "sky/cooked/", WorldName + "_sky");
|
||||
|
||||
// Move sky textures
|
||||
for (u32 iSet = 0; iSet < pSkyModel->GetMatSetCount(); iSet++)
|
||||
for (uint32 iSet = 0; iSet < pSkyModel->GetMatSetCount(); iSet++)
|
||||
{
|
||||
CMaterialSet *pSet = pSkyModel->GetMatSet(iSet);
|
||||
|
||||
for (u32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = pSet->MaterialByIndex(iMat);
|
||||
|
||||
for (u32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = pMat->Pass(iPass);
|
||||
|
||||
|
@ -197,7 +197,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
}
|
||||
|
||||
// Areas
|
||||
for (u32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
for (uint32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
{
|
||||
// Determine area name
|
||||
TString AreaName = pWorld->AreaInternalName(iArea);
|
||||
|
@ -233,15 +233,15 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
CGameArea *pArea = (CGameArea*) pAreaEntry->Load();
|
||||
|
||||
// Area lightmaps
|
||||
u32 LightmapNum = 0;
|
||||
uint32 LightmapNum = 0;
|
||||
CMaterialSet *pMaterials = pArea->Materials();
|
||||
|
||||
for (u32 iMat = 0; iMat < pMaterials->NumMaterials(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < pMaterials->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = pMaterials->MaterialByIndex(iMat);
|
||||
bool FoundLightmap = false;
|
||||
|
||||
for (u32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = pMat->Pass(iPass);
|
||||
|
||||
|
@ -277,11 +277,11 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
}
|
||||
|
||||
// Generate names from script instance names
|
||||
for (u32 iLyr = 0; iLyr < pArea->NumScriptLayers(); iLyr++)
|
||||
for (uint32 iLyr = 0; iLyr < pArea->NumScriptLayers(); iLyr++)
|
||||
{
|
||||
CScriptLayer *pLayer = pArea->ScriptLayer(iLyr);
|
||||
|
||||
for (u32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
for (uint32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
{
|
||||
CScriptObject* pInst = pLayer->InstanceByIndex(iInst);
|
||||
CStructProperty* pProperties = pInst->Template()->Properties();
|
||||
|
@ -327,7 +327,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
if (Name.EndsWith(".STRG", false))
|
||||
{
|
||||
u32 StringPropID = (pProj->Game() <= EGame::Prime ? 0x4 : 0x9182250C);
|
||||
uint32 StringPropID = (pProj->Game() <= EGame::Prime ? 0x4 : 0x9182250C);
|
||||
CAssetProperty *pStringProperty = TPropCast<CAssetProperty>(pProperties->ChildByID(StringPropID));
|
||||
ASSERT(pStringProperty); // Temporary assert to remind myself later to update this code when uncooked properties are added to the template
|
||||
|
||||
|
@ -353,7 +353,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
else if (pInst->ObjectTypeID() == 0x0 || pInst->ObjectTypeID() == FOURCC('ACTR') ||
|
||||
pInst->ObjectTypeID() == 0x8 || pInst->ObjectTypeID() == FOURCC('PLAT'))
|
||||
{
|
||||
u32 ModelPropID = (pProj->Game() <= EGame::Prime ? (pInst->ObjectTypeID() == 0x0 ? 0xA : 0x6) : 0xC27FFA8F);
|
||||
uint32 ModelPropID = (pProj->Game() <= EGame::Prime ? (pInst->ObjectTypeID() == 0x0 ? 0xA : 0x6) : 0xC27FFA8F);
|
||||
CAssetProperty *pModelProperty = TPropCast<CAssetProperty>(pProperties->ChildByID(ModelPropID));
|
||||
ASSERT(pModelProperty); // Temporary assert to remind myself later to update this code when uncooked properties are added to the template
|
||||
|
||||
|
@ -396,22 +396,22 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_MODELS
|
||||
// Generate Model Lightmap names
|
||||
Log::Write("Processing model lightmaps");
|
||||
debugf("Processing model lightmaps");
|
||||
|
||||
for (TResourceIterator<eModel> It(pStore); It; ++It)
|
||||
{
|
||||
CModel *pModel = (CModel*) It->Load();
|
||||
u32 LightmapNum = 0;
|
||||
uint32 LightmapNum = 0;
|
||||
|
||||
for (u32 iSet = 0; iSet < pModel->GetMatSetCount(); iSet++)
|
||||
for (uint32 iSet = 0; iSet < pModel->GetMatSetCount(); iSet++)
|
||||
{
|
||||
CMaterialSet *pSet = pModel->GetMatSet(iSet);
|
||||
|
||||
for (u32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < pSet->NumMaterials(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = pSet->MaterialByIndex(iMat);
|
||||
|
||||
for (u32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = pMat->Pass(iPass);
|
||||
|
||||
|
@ -439,7 +439,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_AUDIO_GROUPS
|
||||
// Generate Audio Group names
|
||||
Log::Write("Processing audio groups");
|
||||
debugf("Processing audio groups");
|
||||
const TString kAudioGrpDir = "Audio/";
|
||||
|
||||
for (TResourceIterator<eAudioGroup> It(pStore); It; ++It)
|
||||
|
@ -452,7 +452,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_AUDIO_MACROS
|
||||
// Process audio macro/sample names
|
||||
Log::Write("Processing audio macros");
|
||||
debugf("Processing audio macros");
|
||||
const TString kSfxDir = "Audio/Uncategorized/";
|
||||
|
||||
for (TResourceIterator<eAudioMacro> It(pStore); It; ++It)
|
||||
|
@ -461,7 +461,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
TString MacroName = pMacro->MacroName();
|
||||
ApplyGeneratedName(*It, kSfxDir, MacroName);
|
||||
|
||||
for (u32 iSamp = 0; iSamp < pMacro->NumSamples(); iSamp++)
|
||||
for (uint32 iSamp = 0; iSamp < pMacro->NumSamples(); iSamp++)
|
||||
{
|
||||
CAssetID SampleID = pMacro->SampleByIndex(iSamp);
|
||||
CResourceEntry *pSample = pStore->FindEntry(SampleID);
|
||||
|
@ -484,7 +484,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
#if PROCESS_ANIM_CHAR_SETS
|
||||
// Generate animation format names
|
||||
// Hacky syntax because animsets are under eAnimSet in MP1/2 and eCharacter in MP3/DKCR
|
||||
Log::Write("Processing animation data");
|
||||
debugf("Processing animation data");
|
||||
CResourceIterator *pIter = (pProj->Game() <= EGame::Echoes ? (CResourceIterator*) new TResourceIterator<eAnimSet> : (CResourceIterator*) new TResourceIterator<eCharacter>);
|
||||
CResourceIterator& It = *pIter;
|
||||
|
||||
|
@ -494,7 +494,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
TString NewSetName;
|
||||
CAnimSet *pSet = (CAnimSet*) It->Load();
|
||||
|
||||
for (u32 iChar = 0; iChar < pSet->NumCharacters(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < pSet->NumCharacters(); iChar++)
|
||||
{
|
||||
const SSetCharacter *pkChar = pSet->Character(iChar);
|
||||
|
||||
|
@ -516,7 +516,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
}
|
||||
}
|
||||
|
||||
for (u32 iOverlay = 0; iOverlay < pkChar->OverlayModels.size(); iOverlay++)
|
||||
for (uint32 iOverlay = 0; iOverlay < pkChar->OverlayModels.size(); iOverlay++)
|
||||
{
|
||||
const SOverlayModel& rkOverlay = pkChar->OverlayModels[iOverlay];
|
||||
|
||||
|
@ -573,7 +573,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_STRINGS
|
||||
// Generate string names
|
||||
Log::Write("Processing strings");
|
||||
debugf("Processing strings");
|
||||
const TString kStringsDir = "Strings/Uncategorized/";
|
||||
|
||||
for (TResourceIterator<eStringTable> It(pStore); It; ++It)
|
||||
|
@ -582,12 +582,12 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
CStringTable *pString = (CStringTable*) It->Load();
|
||||
TString String;
|
||||
|
||||
for (u32 iStr = 0; iStr < pString->NumStrings() && String.IsEmpty(); iStr++)
|
||||
for (uint32 iStr = 0; iStr < pString->NumStrings() && String.IsEmpty(); iStr++)
|
||||
String = CStringTable::StripFormatting( pString->String("ENGL", iStr) ).Trimmed();
|
||||
|
||||
if (!String.IsEmpty())
|
||||
{
|
||||
TString Name = String.SubString(0, Math::Min<u32>(String.Size(), 50)).Trimmed();
|
||||
TString Name = String.SubString(0, Math::Min<uint32>(String.Size(), 50)).Trimmed();
|
||||
Name.Replace("\n", " ");
|
||||
|
||||
while (Name.EndsWith(".") || TString::IsWhitespace(Name.Back()))
|
||||
|
@ -600,7 +600,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_SCANS
|
||||
// Generate scan names
|
||||
Log::Write("Processing scans");
|
||||
debugf("Processing scans");
|
||||
for (TResourceIterator<eScan> It(pStore); It; ++It)
|
||||
{
|
||||
if (It->IsNamed()) continue;
|
||||
|
@ -628,7 +628,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
CResourceEntry *pEntry = pStore->FindEntry(FrameID);
|
||||
if (pEntry) ApplyGeneratedName(pEntry, pEntry->DirectoryPath(), "ScanFrame");
|
||||
|
||||
for (u32 iImg = 0; iImg < 4; iImg++)
|
||||
for (uint32 iImg = 0; iImg < 4; iImg++)
|
||||
{
|
||||
CAssetID ImageID = pScan->ScanImage(iImg);
|
||||
CResourceEntry *pImgEntry = pStore->FindEntry(ImageID);
|
||||
|
@ -640,7 +640,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
#if PROCESS_FONTS
|
||||
// Generate font names
|
||||
Log::Write("Processing fonts");
|
||||
debugf("Processing fonts");
|
||||
for (TResourceIterator<eFont> It(pStore); It; ++It)
|
||||
{
|
||||
CFont *pFont = (CFont*) It->Load();
|
||||
|
@ -659,5 +659,5 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
|
||||
pStore->RootDirectory()->DeleteEmptySubdirectories();
|
||||
pStore->ConditionalSaveStore();
|
||||
Log::Write("*** Asset Name Generation FINISHED ***");
|
||||
debugf("*** Asset Name Generation FINISHED ***");
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ bool CAssetNameMap::LoadAssetNames(TString Path /*= ""*/)
|
|||
}
|
||||
else
|
||||
{
|
||||
TString ExpectedIDLength = (mIDLength == e32Bit ? "32-bit" : "64-bit");
|
||||
TString GotIDLength = (FileIDLength == e32Bit ? "32-bit" : "64-bit");
|
||||
Log::Error("Failed to load asset names; expected " + ExpectedIDLength + " IDs, got " + GotIDLength);
|
||||
debugf("Failed to load asset names; expected %s IDs, got %s",
|
||||
mIDLength == e32Bit ? "32-bit" : "64-bit",
|
||||
FileIDLength == e32Bit ? "32-bit" : "64-bit" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::Error("Failed to load asset names; couldn't open XML.");
|
||||
errorf("Failed to load asset names; couldn't open XML.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -117,9 +117,9 @@ void CAssetNameMap::CopyFromStore(CResourceStore *pStore /*= gpResourceStore*/)
|
|||
|
||||
TString OldPath = NameInfo.FullPath();
|
||||
TString NewPath = NewNameInfo.FullPath();
|
||||
Log::Warning("Detected name conflict when copying asset name from the resource store; renaming.");
|
||||
Log::Warning("\tOld Path: " + OldPath);
|
||||
Log::Warning("\tNew Path: " + NewPath);
|
||||
warnf("Detected name conflict when copying asset name from the resource store; renaming.");
|
||||
warnf("\tOld Path: %s", *OldPath);
|
||||
warnf("\tNew Path: %s", *NewPath);
|
||||
NameInfo.Name = NewNameInfo.Name;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void CAssetNameMap::PostLoadValidate()
|
|||
// Verify the name/path is valid
|
||||
if (!CResourceStore::IsValidResourcePath(rkInfo.Directory, rkInfo.Name))
|
||||
{
|
||||
Log::Error("Invalid resource path in asset name map: " + rkInfo.Directory + rkInfo.Name + "." + rkInfo.Type.ToString());
|
||||
errorf("Invalid resource path in asset name map: %s%s.%s", *rkInfo.Directory, *rkInfo.Name, *rkInfo.Type.ToString());
|
||||
Iter = mMap.erase(Iter);
|
||||
FoundErrors = true;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void CAssetNameMap::PostLoadValidate()
|
|||
// Verify correct ID length
|
||||
if (Iter->first.Length() != mIDLength)
|
||||
{
|
||||
Log::Error("Incorrect asset ID length in asset name map: " + Iter->first.ToString());
|
||||
errorf("Incorrect asset ID length in asset name map: %s", *Iter->first.ToString());
|
||||
Iter = mMap.erase(Iter);
|
||||
FoundErrors = true;
|
||||
}
|
||||
|
@ -178,13 +178,11 @@ void CAssetNameMap::PostLoadValidate()
|
|||
// If we detected any dupes, then this map can't be used
|
||||
if (!Dupes.empty())
|
||||
{
|
||||
Log::Error("Asset name map is invalid and cannot be used! Duplicate asset entries detected:");
|
||||
errorf("Asset name map is invalid and cannot be used! Duplicate asset entries detected:");
|
||||
|
||||
for (auto Iter = Dupes.begin(); Iter != Dupes.end(); Iter++)
|
||||
{
|
||||
const SAssetNameInfo& rkInfo = *Iter;
|
||||
TString FullPath = rkInfo.FullPath();
|
||||
Log::Error("\t" + FullPath);
|
||||
warnf("\t%s", Iter->FullPath());
|
||||
}
|
||||
|
||||
mMap.clear();
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
// ************ IDependencyNode ************
|
||||
IDependencyNode::~IDependencyNode()
|
||||
{
|
||||
for (u32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
delete mChildren[iChild];
|
||||
}
|
||||
|
||||
bool IDependencyNode::HasDependency(const CAssetID& rkID) const
|
||||
{
|
||||
for (u32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
{
|
||||
if (mChildren[iChild]->HasDependency(rkID))
|
||||
return true;
|
||||
|
@ -26,7 +26,7 @@ bool IDependencyNode::HasDependency(const CAssetID& rkID) const
|
|||
|
||||
void IDependencyNode::GetAllResourceReferences(std::set<CAssetID>& rOutSet) const
|
||||
{
|
||||
for (u32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
mChildren[iChild]->GetAllResourceReferences(rOutSet);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
|
|||
// Recursive function for parsing script dependencies and loading them into the script instance dependency
|
||||
void* pPropertyData = pInstance->PropertyData();
|
||||
|
||||
for (u32 PropertyIdx = 0; PropertyIdx < pStruct->NumChildren(); PropertyIdx++)
|
||||
for (uint32 PropertyIdx = 0; PropertyIdx < pStruct->NumChildren(); PropertyIdx++)
|
||||
{
|
||||
IProperty *pProp = pStruct->ChildByIndex(PropertyIdx);
|
||||
EPropertyType Type = pProp->Type();
|
||||
|
@ -170,7 +170,7 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
|
|||
|
||||
else if (Type == EPropertyType::Sound)
|
||||
{
|
||||
u32 SoundID = TPropCast<CSoundProperty>(pProp)->Value(pPropertyData);
|
||||
uint32 SoundID = TPropCast<CSoundProperty>(pProp)->Value(pPropertyData);
|
||||
|
||||
if (SoundID != -1)
|
||||
{
|
||||
|
@ -246,13 +246,13 @@ CSetCharacterDependency* CSetCharacterDependency::BuildTree(const SSetCharacter&
|
|||
&rkChar.EffectParticles
|
||||
};
|
||||
|
||||
for (u32 iVec = 0; iVec < 5; iVec++)
|
||||
for (uint32 iVec = 0; iVec < 5; iVec++)
|
||||
{
|
||||
for (u32 iPart = 0; iPart < pkParticleVectors[iVec]->size(); iPart++)
|
||||
for (uint32 iPart = 0; iPart < pkParticleVectors[iVec]->size(); iPart++)
|
||||
pTree->AddDependency(pkParticleVectors[iVec]->at(iPart));
|
||||
}
|
||||
|
||||
for (u32 iOverlay = 0; iOverlay < rkChar.OverlayModels.size(); iOverlay++)
|
||||
for (uint32 iOverlay = 0; iOverlay < rkChar.OverlayModels.size(); iOverlay++)
|
||||
{
|
||||
const SOverlayModel& rkOverlay = rkChar.OverlayModels[iOverlay];
|
||||
pTree->AddDependency(rkOverlay.ModelID);
|
||||
|
@ -276,13 +276,13 @@ void CSetAnimationDependency::Serialize(IArchive& rArc)
|
|||
<< SerialParameter("Children", mChildren);
|
||||
}
|
||||
|
||||
CSetAnimationDependency* CSetAnimationDependency::BuildTree(const CAnimSet *pkOwnerSet, u32 AnimIndex)
|
||||
CSetAnimationDependency* CSetAnimationDependency::BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex)
|
||||
{
|
||||
CSetAnimationDependency *pTree = new CSetAnimationDependency;
|
||||
const SAnimation *pkAnim = pkOwnerSet->Animation(AnimIndex);
|
||||
|
||||
// Find relevant character indices
|
||||
for (u32 iChar = 0; iChar < pkOwnerSet->NumCharacters(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < pkOwnerSet->NumCharacters(); iChar++)
|
||||
{
|
||||
const SSetCharacter *pkChar = pkOwnerSet->Character(iChar);
|
||||
|
||||
|
@ -340,7 +340,7 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector
|
|||
mLayerOffsets.push_back(mChildren.size());
|
||||
std::set<CAssetID> UsedIDs;
|
||||
|
||||
for (u32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
for (uint32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
{
|
||||
CScriptInstanceDependency *pTree = CScriptInstanceDependency::BuildTree( pLayer->InstanceByIndex(iInst) );
|
||||
ASSERT(pTree != nullptr);
|
||||
|
@ -355,34 +355,34 @@ void CAreaDependencyTree::AddScriptLayer(CScriptLayer *pLayer, const std::vector
|
|||
delete pTree;
|
||||
}
|
||||
|
||||
for (u32 iDep = 0; iDep < rkExtraDeps.size(); iDep++)
|
||||
for (uint32 iDep = 0; iDep < rkExtraDeps.size(); iDep++)
|
||||
AddDependency(rkExtraDeps[iDep]);
|
||||
}
|
||||
|
||||
void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<u32>& rModuleLayerOffsetsOut) const
|
||||
void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<uint32>& rModuleLayerOffsetsOut) const
|
||||
{
|
||||
CGameTemplate *pGame = NGameList::GetGameTemplate(Game);
|
||||
|
||||
// Output module list will be split per-script layer
|
||||
// The output offset list contains two offsets per layer - start index and end index
|
||||
for (u32 iLayer = 0; iLayer < mLayerOffsets.size(); iLayer++)
|
||||
for (uint32 iLayer = 0; iLayer < mLayerOffsets.size(); iLayer++)
|
||||
{
|
||||
u32 StartIdx = mLayerOffsets[iLayer];
|
||||
u32 EndIdx = (iLayer == mLayerOffsets.size() - 1 ? mChildren.size() : mLayerOffsets[iLayer + 1]);
|
||||
uint32 StartIdx = mLayerOffsets[iLayer];
|
||||
uint32 EndIdx = (iLayer == mLayerOffsets.size() - 1 ? mChildren.size() : mLayerOffsets[iLayer + 1]);
|
||||
|
||||
u32 ModuleStartIdx = rModuleDepsOut.size();
|
||||
uint32 ModuleStartIdx = rModuleDepsOut.size();
|
||||
rModuleLayerOffsetsOut.push_back(ModuleStartIdx);
|
||||
|
||||
// Keep track of which types we've already checked on this layer to speed things up a little...
|
||||
std::set<u32> UsedObjectTypes;
|
||||
std::set<uint32> UsedObjectTypes;
|
||||
|
||||
for (u32 iInst = StartIdx; iInst < EndIdx; iInst++)
|
||||
for (uint32 iInst = StartIdx; iInst < EndIdx; iInst++)
|
||||
{
|
||||
IDependencyNode *pNode = mChildren[iInst];
|
||||
if (pNode->Type() != eDNT_ScriptInstance) continue;
|
||||
|
||||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(pNode);
|
||||
u32 ObjType = pInst->ObjectType();
|
||||
uint32 ObjType = pInst->ObjectType();
|
||||
|
||||
if (UsedObjectTypes.find(ObjType) == UsedObjectTypes.end())
|
||||
{
|
||||
|
@ -390,12 +390,12 @@ void CAreaDependencyTree::GetModuleDependencies(EGame Game, std::vector<TString>
|
|||
CScriptTemplate *pTemplate = pGame->TemplateByID(ObjType);
|
||||
const std::vector<TString>& rkModules = pTemplate->RequiredModules();
|
||||
|
||||
for (u32 iMod = 0; iMod < rkModules.size(); iMod++)
|
||||
for (uint32 iMod = 0; iMod < rkModules.size(); iMod++)
|
||||
{
|
||||
TString ModuleName = rkModules[iMod];
|
||||
bool NewModule = true;
|
||||
|
||||
for (u32 iUsed = ModuleStartIdx; iUsed < rModuleDepsOut.size(); iUsed++)
|
||||
for (uint32 iUsed = ModuleStartIdx; iUsed < rModuleDepsOut.size(); iUsed++)
|
||||
{
|
||||
if (rModuleDepsOut[iUsed] == ModuleName)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#define CDEPENDENCYTREE
|
||||
|
||||
#include "CResourceEntry.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/FileIO.h>
|
||||
#include <Common/Macros.h>
|
||||
|
||||
class CScriptLayer;
|
||||
class CScriptObject;
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type);
|
||||
|
||||
// Accessors
|
||||
inline u32 NumChildren() const { return mChildren.size(); }
|
||||
inline IDependencyNode* ChildByIndex(u32 Index) const { return mChildren[Index]; }
|
||||
inline uint NumChildren() const { return mChildren.size(); }
|
||||
inline IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; }
|
||||
};
|
||||
|
||||
// Basic dependency tree; this class is sufficient for most resource types.
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
class CCharPropertyDependency : public CPropertyDependency
|
||||
{
|
||||
protected:
|
||||
u32 mUsedChar;
|
||||
int mUsedChar;
|
||||
|
||||
public:
|
||||
CCharPropertyDependency()
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
, mUsedChar(-1)
|
||||
{}
|
||||
|
||||
CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, u32 UsedChar)
|
||||
CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, int UsedChar)
|
||||
: CPropertyDependency(rkPropID, rkAssetID)
|
||||
, mUsedChar(UsedChar)
|
||||
{}
|
||||
|
@ -126,21 +126,21 @@ public:
|
|||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
// Accessors
|
||||
inline u32 UsedChar() const { return mUsedChar; }
|
||||
inline int UsedChar() const { return mUsedChar; }
|
||||
};
|
||||
|
||||
// Node representing a script object. Indicates the type of object.
|
||||
class CScriptInstanceDependency : public IDependencyNode
|
||||
{
|
||||
protected:
|
||||
u32 mObjectType;
|
||||
uint mObjectType;
|
||||
|
||||
public:
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
// Accessors
|
||||
inline u32 ObjectType() const { return mObjectType; }
|
||||
inline uint ObjectType() const { return mObjectType; }
|
||||
|
||||
// Static
|
||||
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
|
||||
|
@ -152,17 +152,17 @@ protected:
|
|||
class CSetCharacterDependency : public CDependencyTree
|
||||
{
|
||||
protected:
|
||||
u32 mCharSetIndex;
|
||||
uint32 mCharSetIndex;
|
||||
|
||||
public:
|
||||
CSetCharacterDependency() : CDependencyTree() {}
|
||||
CSetCharacterDependency(u32 SetIndex) : CDependencyTree(), mCharSetIndex(SetIndex) {}
|
||||
CSetCharacterDependency(uint32 SetIndex) : CDependencyTree(), mCharSetIndex(SetIndex) {}
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
// Accessors
|
||||
inline u32 CharSetIndex() const { return mCharSetIndex; }
|
||||
inline uint32 CharSetIndex() const { return mCharSetIndex; }
|
||||
|
||||
// Static
|
||||
static CSetCharacterDependency* BuildTree(const SSetCharacter& rkChar);
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
class CSetAnimationDependency : public CDependencyTree
|
||||
{
|
||||
protected:
|
||||
std::set<u32> mCharacterIndices;
|
||||
std::set<uint32> mCharacterIndices;
|
||||
|
||||
public:
|
||||
CSetAnimationDependency() : CDependencyTree() {}
|
||||
|
@ -181,36 +181,36 @@ public:
|
|||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
// Accessors
|
||||
inline bool IsUsedByCharacter(u32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
|
||||
inline bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); }
|
||||
inline bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); }
|
||||
|
||||
// Static
|
||||
static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, u32 AnimIndex);
|
||||
static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex);
|
||||
};
|
||||
|
||||
// Node representing an animation event. Indicates which character index uses this event.
|
||||
class CAnimEventDependency : public CResourceDependency
|
||||
{
|
||||
protected:
|
||||
u32 mCharIndex;
|
||||
uint32 mCharIndex;
|
||||
|
||||
public:
|
||||
CAnimEventDependency() : CResourceDependency() {}
|
||||
CAnimEventDependency(const CAssetID& rkID, u32 CharIndex)
|
||||
CAnimEventDependency(const CAssetID& rkID, uint32 CharIndex)
|
||||
: CResourceDependency(rkID), mCharIndex(CharIndex) {}
|
||||
|
||||
virtual EDependencyNodeType Type() const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
// Accessors
|
||||
inline u32 CharIndex() const { return mCharIndex; }
|
||||
inline uint32 CharIndex() const { return mCharIndex; }
|
||||
};
|
||||
|
||||
// Node representing an area. Tracks dependencies on a per-instance basis and can separate dependencies of different script layers.
|
||||
class CAreaDependencyTree : public CDependencyTree
|
||||
{
|
||||
protected:
|
||||
std::vector<u32> mLayerOffsets;
|
||||
std::vector<uint32> mLayerOffsets;
|
||||
|
||||
public:
|
||||
CAreaDependencyTree() : CDependencyTree() {}
|
||||
|
@ -219,11 +219,11 @@ public:
|
|||
virtual void Serialize(IArchive& rArc);
|
||||
|
||||
void AddScriptLayer(CScriptLayer *pLayer, const std::vector<CAssetID>& rkExtraDeps);
|
||||
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<u32>& rModuleLayerOffsetsOut) const;
|
||||
void GetModuleDependencies(EGame Game, std::vector<TString>& rModuleDepsOut, std::vector<uint32>& rModuleLayerOffsetsOut) const;
|
||||
|
||||
// Accessors
|
||||
inline u32 NumScriptLayers() const { return mLayerOffsets.size(); }
|
||||
inline u32 ScriptLayerOffset(u32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
|
||||
inline uint32 NumScriptLayers() const { return mLayerOffsets.size(); }
|
||||
inline uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; }
|
||||
};
|
||||
|
||||
#endif // CDEPENDENCYTREE
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Core/CompressionUtil.h"
|
||||
#include "Core/Resource/CWorld.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/CScopedTimer.h>
|
||||
#include <Common/FileIO.h>
|
||||
#include <Common/FileUtil.h>
|
||||
|
@ -92,7 +92,7 @@ bool CGameExporter::Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAs
|
|||
return !mpProgress->ShouldCancel();
|
||||
}
|
||||
|
||||
void CGameExporter::LoadResource(const CAssetID& rkID, std::vector<u8>& rBuffer)
|
||||
void CGameExporter::LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer)
|
||||
{
|
||||
SResourceInstance *pInst = FindResourceInstance(rkID);
|
||||
if (pInst) LoadResource(*pInst, rBuffer);
|
||||
|
@ -268,7 +268,7 @@ void CGameExporter::LoadPaks()
|
|||
|
||||
if (!Pak.IsValid())
|
||||
{
|
||||
Log::Error("Couldn't open pak: " + PakPath);
|
||||
errorf("Couldn't open pak: %s", *PakPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -278,38 +278,38 @@ void CGameExporter::LoadPaks()
|
|||
// MP1-MP3Proto
|
||||
if (mGame < EGame::Corruption)
|
||||
{
|
||||
u32 PakVersion = Pak.ReadLong();
|
||||
uint32 PakVersion = Pak.ReadLong();
|
||||
Pak.Seek(0x4, SEEK_CUR);
|
||||
ASSERT(PakVersion == 0x00030005);
|
||||
|
||||
// Echoes demo disc has a pak that ends right here.
|
||||
if (!Pak.EoF())
|
||||
{
|
||||
u32 NumNamedResources = Pak.ReadLong();
|
||||
uint32 NumNamedResources = Pak.ReadLong();
|
||||
ASSERT(NumNamedResources > 0);
|
||||
|
||||
for (u32 iName = 0; iName < NumNamedResources; iName++)
|
||||
for (uint32 iName = 0; iName < NumNamedResources; iName++)
|
||||
{
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
CAssetID ResID(Pak, mGame);
|
||||
u32 NameLen = Pak.ReadLong();
|
||||
uint32 NameLen = Pak.ReadLong();
|
||||
TString Name = Pak.ReadString(NameLen);
|
||||
pPackage->AddResource(Name, ResID, ResType);
|
||||
}
|
||||
|
||||
u32 NumResources = Pak.ReadLong();
|
||||
uint32 NumResources = Pak.ReadLong();
|
||||
|
||||
// Keep track of which areas have duplicate resources
|
||||
std::set<CAssetID> PakResourceSet;
|
||||
bool AreaHasDuplicates = true; // Default to true so that first area is always considered as having duplicates
|
||||
|
||||
for (u32 iRes = 0; iRes < NumResources; iRes++)
|
||||
for (uint32 iRes = 0; iRes < NumResources; iRes++)
|
||||
{
|
||||
bool Compressed = (Pak.ReadLong() == 1);
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
CAssetID ResID(Pak, mGame);
|
||||
u32 ResSize = Pak.ReadLong();
|
||||
u32 ResOffset = Pak.ReadLong();
|
||||
uint32 ResSize = Pak.ReadLong();
|
||||
uint32 ResOffset = Pak.ReadLong();
|
||||
|
||||
if (mResourceMap.find(ResID) == mResourceMap.end())
|
||||
mResourceMap[ResID] = SResourceInstance { PakPath, ResID, ResType, ResOffset, ResSize, Compressed, false };
|
||||
|
@ -333,37 +333,37 @@ void CGameExporter::LoadPaks()
|
|||
// MP3 + DKCR
|
||||
else
|
||||
{
|
||||
u32 PakVersion = Pak.ReadLong();
|
||||
u32 PakHeaderLen = Pak.ReadLong();
|
||||
uint32 PakVersion = Pak.ReadLong();
|
||||
uint32 PakHeaderLen = Pak.ReadLong();
|
||||
Pak.Seek(PakHeaderLen - 0x8, SEEK_CUR);
|
||||
ASSERT(PakVersion == 2);
|
||||
|
||||
struct SPakSection {
|
||||
CFourCC Type; u32 Size;
|
||||
CFourCC Type; uint32 Size;
|
||||
};
|
||||
std::vector<SPakSection> PakSections;
|
||||
|
||||
u32 NumPakSections = Pak.ReadLong();
|
||||
uint32 NumPakSections = Pak.ReadLong();
|
||||
ASSERT(NumPakSections == 3);
|
||||
|
||||
for (u32 iSec = 0; iSec < NumPakSections; iSec++)
|
||||
for (uint32 iSec = 0; iSec < NumPakSections; iSec++)
|
||||
{
|
||||
CFourCC Type = Pak.ReadLong();
|
||||
u32 Size = Pak.ReadLong();
|
||||
uint32 Size = Pak.ReadLong();
|
||||
PakSections.push_back(SPakSection { Type, Size });
|
||||
}
|
||||
Pak.SeekToBoundary(64);
|
||||
|
||||
for (u32 iSec = 0; iSec < NumPakSections; iSec++)
|
||||
for (uint32 iSec = 0; iSec < NumPakSections; iSec++)
|
||||
{
|
||||
u32 Next = Pak.Tell() + PakSections[iSec].Size;
|
||||
uint32 Next = Pak.Tell() + PakSections[iSec].Size;
|
||||
|
||||
// Named Resources
|
||||
if (PakSections[iSec].Type == "STRG")
|
||||
{
|
||||
u32 NumNamedResources = Pak.ReadLong();
|
||||
uint32 NumNamedResources = Pak.ReadLong();
|
||||
|
||||
for (u32 iName = 0; iName < NumNamedResources; iName++)
|
||||
for (uint32 iName = 0; iName < NumNamedResources; iName++)
|
||||
{
|
||||
TString Name = Pak.ReadString();
|
||||
CFourCC ResType = Pak.ReadLong();
|
||||
|
@ -375,20 +375,20 @@ void CGameExporter::LoadPaks()
|
|||
else if (PakSections[iSec].Type == "RSHD")
|
||||
{
|
||||
ASSERT(PakSections[iSec + 1].Type == "DATA");
|
||||
u32 DataStart = Next;
|
||||
u32 NumResources = Pak.ReadLong();
|
||||
uint32 DataStart = Next;
|
||||
uint32 NumResources = Pak.ReadLong();
|
||||
|
||||
// Keep track of which areas have duplicate resources
|
||||
std::set<CAssetID> PakResourceSet;
|
||||
bool AreaHasDuplicates = true; // Default to true so that first area is always considered as having duplicates
|
||||
|
||||
for (u32 iRes = 0; iRes < NumResources; iRes++)
|
||||
for (uint32 iRes = 0; iRes < NumResources; iRes++)
|
||||
{
|
||||
bool Compressed = (Pak.ReadLong() == 1);
|
||||
CFourCC Type = Pak.ReadLong();
|
||||
CAssetID ResID(Pak, mGame);
|
||||
u32 Size = Pak.ReadLong();
|
||||
u32 Offset = DataStart + Pak.ReadLong();
|
||||
uint32 Size = Pak.ReadLong();
|
||||
uint32 Offset = DataStart + Pak.ReadLong();
|
||||
|
||||
if (mResourceMap.find(ResID) == mResourceMap.end())
|
||||
mResourceMap[ResID] = SResourceInstance { PakPath, ResID, Type, Offset, Size, Compressed, false };
|
||||
|
@ -425,7 +425,7 @@ void CGameExporter::LoadPaks()
|
|||
#endif
|
||||
}
|
||||
|
||||
void CGameExporter::LoadResource(const SResourceInstance& rkResource, std::vector<u8>& rBuffer)
|
||||
void CGameExporter::LoadResource(const SResourceInstance& rkResource, std::vector<uint8>& rBuffer)
|
||||
{
|
||||
CFileInStream Pak(rkResource.PakFile, IOUtil::eBigEndian);
|
||||
|
||||
|
@ -440,15 +440,15 @@ void CGameExporter::LoadResource(const SResourceInstance& rkResource, std::vecto
|
|||
|
||||
if (mGame <= EGame::CorruptionProto)
|
||||
{
|
||||
std::vector<u8> CompressedData(rkResource.PakSize);
|
||||
std::vector<uint8> CompressedData(rkResource.PakSize);
|
||||
|
||||
u32 UncompressedSize = Pak.ReadLong();
|
||||
uint32 UncompressedSize = Pak.ReadLong();
|
||||
rBuffer.resize(UncompressedSize);
|
||||
Pak.ReadBytes(CompressedData.data(), CompressedData.size());
|
||||
|
||||
if (ZlibCompressed)
|
||||
{
|
||||
u32 TotalOut;
|
||||
uint32 TotalOut;
|
||||
CompressionUtil::DecompressZlib(CompressedData.data(), CompressedData.size(), rBuffer.data(), rBuffer.size(), TotalOut);
|
||||
}
|
||||
else
|
||||
|
@ -462,40 +462,40 @@ void CGameExporter::LoadResource(const SResourceInstance& rkResource, std::vecto
|
|||
CFourCC Magic = Pak.ReadLong();
|
||||
ASSERT(Magic == "CMPD");
|
||||
|
||||
u32 NumBlocks = Pak.ReadLong();
|
||||
uint32 NumBlocks = Pak.ReadLong();
|
||||
|
||||
struct SCompressedBlock {
|
||||
u32 CompressedSize; u32 UncompressedSize;
|
||||
uint32 CompressedSize; uint32 UncompressedSize;
|
||||
};
|
||||
std::vector<SCompressedBlock> CompressedBlocks;
|
||||
|
||||
u32 TotalUncompressedSize = 0;
|
||||
for (u32 iBlock = 0; iBlock < NumBlocks; iBlock++)
|
||||
uint32 TotalUncompressedSize = 0;
|
||||
for (uint32 iBlock = 0; iBlock < NumBlocks; iBlock++)
|
||||
{
|
||||
u32 CompressedSize = (Pak.ReadLong() & 0x00FFFFFF);
|
||||
u32 UncompressedSize = Pak.ReadLong();
|
||||
uint32 CompressedSize = (Pak.ReadLong() & 0x00FFFFFF);
|
||||
uint32 UncompressedSize = Pak.ReadLong();
|
||||
|
||||
TotalUncompressedSize += UncompressedSize;
|
||||
CompressedBlocks.push_back( SCompressedBlock { CompressedSize, UncompressedSize } );
|
||||
}
|
||||
|
||||
rBuffer.resize(TotalUncompressedSize);
|
||||
u32 Offset = 0;
|
||||
uint32 Offset = 0;
|
||||
|
||||
for (u32 iBlock = 0; iBlock < NumBlocks; iBlock++)
|
||||
for (uint32 iBlock = 0; iBlock < NumBlocks; iBlock++)
|
||||
{
|
||||
u32 CompressedSize = CompressedBlocks[iBlock].CompressedSize;
|
||||
u32 UncompressedSize = CompressedBlocks[iBlock].UncompressedSize;
|
||||
uint32 CompressedSize = CompressedBlocks[iBlock].CompressedSize;
|
||||
uint32 UncompressedSize = CompressedBlocks[iBlock].UncompressedSize;
|
||||
|
||||
// Block is compressed
|
||||
if (CompressedSize != UncompressedSize)
|
||||
{
|
||||
std::vector<u8> CompressedData(CompressedBlocks[iBlock].CompressedSize);
|
||||
std::vector<uint8> CompressedData(CompressedBlocks[iBlock].CompressedSize);
|
||||
Pak.ReadBytes(CompressedData.data(), CompressedData.size());
|
||||
|
||||
if (ZlibCompressed)
|
||||
{
|
||||
u32 TotalOut;
|
||||
uint32 TotalOut;
|
||||
CompressionUtil::DecompressZlib(CompressedData.data(), CompressedData.size(), rBuffer.data() + Offset, UncompressedSize, TotalOut);
|
||||
}
|
||||
else
|
||||
|
@ -570,7 +570,7 @@ void CGameExporter::ExportResourceEditorData()
|
|||
CWorld *pWorld = (CWorld*) It->Load();
|
||||
|
||||
// Set area duplicate flags
|
||||
for (u32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
for (uint32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
{
|
||||
CAssetID AreaID = pWorld->AreaResourceID(iArea);
|
||||
auto Find = mAreaDuplicateMap.find(AreaID);
|
||||
|
@ -612,7 +612,7 @@ void CGameExporter::ExportResource(SResourceInstance& rRes)
|
|||
{
|
||||
if (!rRes.Exported)
|
||||
{
|
||||
std::vector<u8> ResourceData;
|
||||
std::vector<uint8> ResourceData;
|
||||
LoadResource(rRes, ResourceData);
|
||||
|
||||
// Register resource and write to file
|
||||
|
@ -657,11 +657,11 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
|
|||
// Find the original world name in the package resource names
|
||||
TString WorldName;
|
||||
|
||||
for (u32 iPkg = 0; iPkg < mpProject->NumPackages(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mpProject->NumPackages(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = mpProject->PackageByIndex(iPkg);
|
||||
|
||||
for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
|
||||
|
||||
|
@ -712,8 +712,8 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
|
|||
// MP2 demo - Use text between the first and second underscores
|
||||
else if (mGame == EGame::EchoesDemo)
|
||||
{
|
||||
u32 UnderscoreA = WorldName.IndexOf('_');
|
||||
u32 UnderscoreB = WorldName.IndexOf('_', UnderscoreA + 1);
|
||||
uint32 UnderscoreA = WorldName.IndexOf('_');
|
||||
uint32 UnderscoreB = WorldName.IndexOf('_', UnderscoreA + 1);
|
||||
|
||||
if (UnderscoreA != UnderscoreB && UnderscoreA != -1 && UnderscoreB != -1)
|
||||
WorldName = WorldName.SubString(UnderscoreA + 1, UnderscoreB - UnderscoreA - 1);
|
||||
|
@ -722,8 +722,8 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
|
|||
// MP2 - Remove text before first underscore and after last underscore, strip remaining underscores (except multiplayer maps, which have one underscore)
|
||||
else if (mGame == EGame::Echoes)
|
||||
{
|
||||
u32 FirstUnderscore = WorldName.IndexOf('_');
|
||||
u32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
uint32 FirstUnderscore = WorldName.IndexOf('_');
|
||||
uint32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
|
||||
if (FirstUnderscore != LastUnderscore && FirstUnderscore != -1 && LastUnderscore != -1)
|
||||
{
|
||||
|
@ -739,14 +739,14 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
|
|||
if (WorldName.StartsWith('!'))
|
||||
WorldName = WorldName.ChopFront(1);
|
||||
|
||||
u32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
uint32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
WorldName = WorldName.ChopBack(WorldName.Size() - LastUnderscore);
|
||||
}
|
||||
|
||||
// MP3 - Remove text after last underscore
|
||||
else if (mGame == EGame::Corruption)
|
||||
{
|
||||
u32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
uint32 LastUnderscore = WorldName.LastIndexOf('_');
|
||||
|
||||
if (LastUnderscore != -1 && !WorldName.StartsWith("front_end_"))
|
||||
WorldName = WorldName.ChopBack(WorldName.Size() - LastUnderscore);
|
||||
|
@ -755,7 +755,7 @@ TString CGameExporter::MakeWorldName(CAssetID WorldID)
|
|||
// DKCR - Remove text prior to first underscore
|
||||
else if (mGame == EGame::DKCReturns)
|
||||
{
|
||||
u32 Underscore = WorldName.IndexOf('_');
|
||||
uint32 Underscore = WorldName.IndexOf('_');
|
||||
WorldName = WorldName.ChopFront(Underscore + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <Common/CAssetID.h>
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <map>
|
||||
#include <nod/nod.hpp>
|
||||
|
||||
|
@ -54,8 +53,8 @@ class CGameExporter
|
|||
TString PakFile;
|
||||
CAssetID ResourceID;
|
||||
CFourCC ResourceType;
|
||||
u32 PakOffset;
|
||||
u32 PakSize;
|
||||
uint32 PakOffset;
|
||||
uint32 PakSize;
|
||||
bool Compressed;
|
||||
bool Exported;
|
||||
};
|
||||
|
@ -76,7 +75,7 @@ class CGameExporter
|
|||
public:
|
||||
CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, ERegion Region, const TString& rkGameName, const TString& rkGameID, float BuildVersion);
|
||||
bool Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAssetNameMap *pNameMap, CGameInfo *pGameInfo, IProgressNotifier *pProgress);
|
||||
void LoadResource(const CAssetID& rkID, std::vector<u8>& rBuffer);
|
||||
void LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer);
|
||||
bool ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot);
|
||||
|
||||
inline TString ProjectPath() const { return mProjectPath; }
|
||||
|
@ -85,7 +84,7 @@ protected:
|
|||
bool ExtractDiscData();
|
||||
bool ExtractDiscNodeRecursive(const nod::Node *pkNode, const TString& rkDir, bool RootNode, const nod::ExtractionContext& rkContext);
|
||||
void LoadPaks();
|
||||
void LoadResource(const SResourceInstance& rkResource, std::vector<u8>& rBuffer);
|
||||
void LoadResource(const SResourceInstance& rkResource, std::vector<uint8>& rBuffer);
|
||||
void ExportCookedResources();
|
||||
void ExportResourceEditorData();
|
||||
void ExportResource(SResourceInstance& rRes);
|
||||
|
@ -94,7 +93,7 @@ protected:
|
|||
// Convenience Functions
|
||||
inline SResourceInstance* FindResourceInstance(const CAssetID& rkID)
|
||||
{
|
||||
u64 IntegralID = rkID.ToLongLong();
|
||||
uint64 IntegralID = rkID.ToLongLong();
|
||||
auto Found = mResourceMap.find(IntegralID);
|
||||
return (Found == mResourceMap.end() ? nullptr : &Found->second);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void CGameInfo::Serialize(IArchive& rArc)
|
|||
|
||||
TString CGameInfo::GetBuildName(float BuildVer, ERegion Region) const
|
||||
{
|
||||
for (u32 iBuild = 0; iBuild < mBuilds.size(); iBuild++)
|
||||
for (uint32 iBuild = 0; iBuild < mBuilds.size(); iBuild++)
|
||||
{
|
||||
const SBuildInfo& rkBuildInfo = mBuilds[iBuild];
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CGAMEINFO
|
||||
#define CGAMEINFO
|
||||
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/Serialization/IArchive.h>
|
||||
|
|
|
@ -14,7 +14,7 @@ CGameProject::~CGameProject()
|
|||
gpResourceStore = nullptr;
|
||||
}
|
||||
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
delete mPackages[iPkg];
|
||||
|
||||
delete mpAudioManager;
|
||||
|
@ -45,7 +45,7 @@ bool CGameProject::Serialize(IArchive& rArc)
|
|||
|
||||
if (!rArc.IsReader())
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
PackageList.push_back( mPackages[iPkg]->DefinitionPath(true) );
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ bool CGameProject::Serialize(IArchive& rArc)
|
|||
{
|
||||
ASSERT(mPackages.empty());
|
||||
|
||||
for (u32 iPkg = 0; iPkg < PackageList.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < PackageList.size(); iPkg++)
|
||||
{
|
||||
const TString& rkPackagePath = PackageList[iPkg];
|
||||
TString PackageName = rkPackagePath.GetFileName(false);
|
||||
|
@ -122,7 +122,7 @@ bool CGameProject::MergeISO(const TString& rkIsoPath, nod::DiscWii *pOriginalIso
|
|||
|
||||
void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = mPackages[iPkg];
|
||||
|
||||
|
@ -130,7 +130,7 @@ void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
|||
// Construct a sorted list of worlds in this package
|
||||
std::list<const SNamedResource*> PackageWorlds;
|
||||
|
||||
for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
|
||||
|
||||
|
@ -153,11 +153,11 @@ void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
|||
|
||||
CAssetID CGameProject::FindNamedResource(const TString& rkName) const
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = mPackages[iPkg];
|
||||
|
||||
for (u32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < pPkg->NumNamedResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = pPkg->NamedResourceByIndex(iRes);
|
||||
|
||||
|
@ -171,7 +171,7 @@ CAssetID CGameProject::FindNamedResource(const TString& rkName) const
|
|||
|
||||
CPackage* CGameProject::FindPackage(const TString& rkName) const
|
||||
{
|
||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||
{
|
||||
CPackage *pPackage = mPackages[iPkg];
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <Common/EGame.h>
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/FileIO/CFileLock.h>
|
||||
|
||||
namespace nod { class DiscWii; }
|
||||
|
@ -92,8 +91,8 @@ public:
|
|||
inline void SetProjectName(const TString& rkName) { mProjectName = rkName; }
|
||||
|
||||
inline TString Name() const { return mProjectName; }
|
||||
inline u32 NumPackages() const { return mPackages.size(); }
|
||||
inline CPackage* PackageByIndex(u32 Index) const { return mPackages[Index]; }
|
||||
inline uint32 NumPackages() const { return mPackages.size(); }
|
||||
inline CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; }
|
||||
inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); }
|
||||
inline CResourceStore* ResourceStore() const { return mpResourceStore; }
|
||||
inline CGameInfo* GameInfo() const { return mpGameInfo; }
|
||||
|
|
|
@ -22,10 +22,10 @@ TString COpeningBanner::EnglishGameName() const
|
|||
// this and prevent the string-reading function from overrunning the buffer
|
||||
CMemoryInStream Banner(mBannerData.data(), mBannerData.size(), IOUtil::eBigEndian);
|
||||
|
||||
u32 CharSize = mWii ? 2 : 1;
|
||||
u32 MaxLen = MaxGameNameLength();
|
||||
uint32 CharSize = mWii ? 2 : 1;
|
||||
uint32 MaxLen = MaxGameNameLength();
|
||||
|
||||
std::vector<u8> NameBuffer((MaxLen + 1) * CharSize, 0);
|
||||
std::vector<uint8> NameBuffer((MaxLen + 1) * CharSize, 0);
|
||||
Banner.GoTo( mWii ? 0xB0 : 0x1860 );
|
||||
Banner.ReadBytes(NameBuffer.data(), MaxLen * CharSize);
|
||||
|
||||
|
@ -36,9 +36,9 @@ TString COpeningBanner::EnglishGameName() const
|
|||
void COpeningBanner::SetEnglishGameName(const TString& rkName)
|
||||
{
|
||||
CMemoryOutStream Banner(mBannerData.data(), mBannerData.size(), IOUtil::eBigEndian);
|
||||
u32 PadCount = 0;
|
||||
uint32 PadCount = 0;
|
||||
|
||||
u32 MaxLen = MaxGameNameLength();
|
||||
uint32 MaxLen = MaxGameNameLength();
|
||||
ASSERT(rkName.Size() <= MaxLen);
|
||||
|
||||
if (mWii)
|
||||
|
@ -54,7 +54,7 @@ void COpeningBanner::SetEnglishGameName(const TString& rkName)
|
|||
PadCount = MaxLen - rkName.Size();
|
||||
}
|
||||
|
||||
for (u32 Pad = 0; Pad < PadCount; Pad++)
|
||||
for (uint32 Pad = 0; Pad < PadCount; Pad++)
|
||||
Banner.WriteByte(0);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ void COpeningBanner::Save()
|
|||
Banner.WriteBytes(mBannerData.data(), mBannerData.size());
|
||||
}
|
||||
|
||||
u32 COpeningBanner::MaxGameNameLength() const
|
||||
uint32 COpeningBanner::MaxGameNameLength() const
|
||||
{
|
||||
return (mWii ? 21 : 64);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ class CGameProject;
|
|||
class COpeningBanner
|
||||
{
|
||||
CGameProject *mpProj;
|
||||
std::vector<u8> mBannerData;
|
||||
std::vector<uint8> mBannerData;
|
||||
bool mWii;
|
||||
|
||||
public:
|
||||
|
@ -18,7 +18,7 @@ public:
|
|||
void SetEnglishGameName(const TString& rkName);
|
||||
void Save();
|
||||
|
||||
u32 MaxGameNameLength() const;
|
||||
uint32 MaxGameNameLength() const;
|
||||
};
|
||||
|
||||
#endif // COPENINGBANNER_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "CGameProject.h"
|
||||
#include "Core/CompressionUtil.h"
|
||||
#include "Core/Resource/Cooker/CWorldCooker.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/FileIO.h>
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/Serialization/XML.h>
|
||||
|
@ -69,7 +69,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
CPackageDependencyListBuilder Builder(this);
|
||||
std::list<CAssetID> AssetList;
|
||||
Builder.BuildDependencyList(true, AssetList);
|
||||
Log::Write(TString::FromInt32(AssetList.size(), 0, 10) + " assets in " + Name() + ".pak");
|
||||
debugf("%d assets in %s.pak", AssetList.size(), *Name());
|
||||
|
||||
// Write new pak
|
||||
TString PakPath = CookedPackagePath(false);
|
||||
|
@ -77,19 +77,19 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
|
||||
if (!Pak.IsValid())
|
||||
{
|
||||
Log::Error("Couldn't cook package " + CookedPackagePath(true) + "; unable to open package for writing");
|
||||
errorf("Couldn't cook package %s; unable to open package for writing", *CookedPackagePath(true));
|
||||
return;
|
||||
}
|
||||
|
||||
EGame Game = mpProject->Game();
|
||||
u32 Alignment = (Game <= EGame::CorruptionProto ? 0x20 : 0x40);
|
||||
u32 AlignmentMinusOne = Alignment - 1;
|
||||
uint32 Alignment = (Game <= EGame::CorruptionProto ? 0x20 : 0x40);
|
||||
uint32 AlignmentMinusOne = Alignment - 1;
|
||||
|
||||
u32 TocOffset = 0;
|
||||
u32 NamesSize = 0;
|
||||
u32 ResTableOffset = 0;
|
||||
u32 ResTableSize = 0;
|
||||
u32 ResDataSize = 0;
|
||||
uint32 TocOffset = 0;
|
||||
uint32 NamesSize = 0;
|
||||
uint32 ResTableOffset = 0;
|
||||
uint32 ResTableSize = 0;
|
||||
uint32 ResDataSize = 0;
|
||||
|
||||
// Write MP1 pak header
|
||||
if (Game <= EGame::CorruptionProto)
|
||||
|
@ -123,7 +123,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
Pak.WriteToBoundary(0x40, 0);
|
||||
|
||||
// Named Resources
|
||||
u32 NamesStart = Pak.Tell();
|
||||
uint32 NamesStart = Pak.Tell();
|
||||
Pak.WriteLong(mResources.size());
|
||||
|
||||
for (auto Iter = mResources.begin(); Iter != mResources.end(); Iter++)
|
||||
|
@ -143,7 +143,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
Pak.WriteLong(AssetList.size());
|
||||
CAssetID Dummy = CAssetID::InvalidID(Game);
|
||||
|
||||
for (u32 iRes = 0; iRes < AssetList.size(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < AssetList.size(); iRes++)
|
||||
{
|
||||
Pak.WriteLongLong(0);
|
||||
Dummy.Write(Pak);
|
||||
|
@ -157,18 +157,18 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
struct SResourceTableInfo
|
||||
{
|
||||
CResourceEntry *pEntry;
|
||||
u32 Offset;
|
||||
u32 Size;
|
||||
uint32 Offset;
|
||||
uint32 Size;
|
||||
bool Compressed;
|
||||
};
|
||||
std::vector<SResourceTableInfo> ResourceTableData(AssetList.size());
|
||||
u32 ResIdx = 0;
|
||||
u32 ResDataOffset = Pak.Tell();
|
||||
uint32 ResIdx = 0;
|
||||
uint32 ResDataOffset = Pak.Tell();
|
||||
|
||||
for (auto Iter = AssetList.begin(); Iter != AssetList.end() && !pProgress->ShouldCancel(); Iter++, ResIdx++)
|
||||
{
|
||||
// Initialize entry, recook assets if needed
|
||||
u32 AssetOffset = Pak.Tell();
|
||||
uint32 AssetOffset = Pak.Tell();
|
||||
CAssetID ID = *Iter;
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(ID);
|
||||
ASSERT(pEntry != nullptr);
|
||||
|
@ -193,15 +193,15 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
// Load resource data
|
||||
CFileInStream CookedAsset(pEntry->CookedAssetPath(), IOUtil::eBigEndian);
|
||||
ASSERT(CookedAsset.IsValid());
|
||||
u32 ResourceSize = CookedAsset.Size();
|
||||
uint32 ResourceSize = CookedAsset.Size();
|
||||
|
||||
std::vector<u8> ResourceData(ResourceSize);
|
||||
std::vector<uint8> ResourceData(ResourceSize);
|
||||
CookedAsset.ReadBytes(ResourceData.data(), ResourceData.size());
|
||||
|
||||
// Check if this asset should be compressed; there are a few resource types that are
|
||||
// always compressed, and some types that are compressed if they're over a certain size
|
||||
EResType Type = pEntry->ResourceType();
|
||||
u32 CompressThreshold = (Game <= EGame::CorruptionProto ? 0x400 : 0x80);
|
||||
uint32 CompressThreshold = (Game <= EGame::CorruptionProto ? 0x400 : 0x80);
|
||||
|
||||
bool ShouldAlwaysCompress = (Type == eTexture || Type == eModel || Type == eSkin ||
|
||||
Type == eAnimSet || Type == eAnimation || Type == eFont);
|
||||
|
@ -230,8 +230,8 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
|
||||
else
|
||||
{
|
||||
u32 CompressedSize;
|
||||
std::vector<u8> CompressedData(ResourceData.size() * 2);
|
||||
uint32 CompressedSize;
|
||||
std::vector<uint8> CompressedData(ResourceData.size() * 2);
|
||||
bool Success = false;
|
||||
|
||||
if (Game <= EGame::EchoesDemo || Game == EGame::DKCReturns)
|
||||
|
@ -242,9 +242,9 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
// Make sure that the compressed data is actually smaller, accounting for padding + uncompressed size value
|
||||
if (Success)
|
||||
{
|
||||
u32 CompressionHeaderSize = (Game <= EGame::CorruptionProto ? 4 : 0x10);
|
||||
u32 PaddedUncompressedSize = (ResourceSize + AlignmentMinusOne) & ~AlignmentMinusOne;
|
||||
u32 PaddedCompressedSize = (CompressedSize + CompressionHeaderSize + AlignmentMinusOne) & ~AlignmentMinusOne;
|
||||
uint32 CompressionHeaderSize = (Game <= EGame::CorruptionProto ? 4 : 0x10);
|
||||
uint32 PaddedUncompressedSize = (ResourceSize + AlignmentMinusOne) & ~AlignmentMinusOne;
|
||||
uint32 PaddedCompressedSize = (CompressedSize + CompressionHeaderSize + AlignmentMinusOne) & ~AlignmentMinusOne;
|
||||
Success = (PaddedCompressedSize < PaddedUncompressedSize);
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
// Write resource table for real
|
||||
Pak.Seek(ResTableOffset+4, SEEK_SET);
|
||||
|
||||
for (u32 iRes = 0; iRes < AssetList.size(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < AssetList.size(); iRes++)
|
||||
{
|
||||
const SResourceTableInfo& rkInfo = ResourceTableData[iRes];
|
||||
CResourceEntry *pEntry = rkInfo.pEntry;
|
||||
|
@ -321,7 +321,7 @@ void CPackage::Cook(IProgressNotifier *pProgress)
|
|||
|
||||
// Clear recook flag
|
||||
mNeedsRecook = false;
|
||||
Log::Write("Finished writing " + PakPath);
|
||||
debugf("Finished writing %s", *PakPath);
|
||||
}
|
||||
|
||||
Save();
|
||||
|
@ -346,31 +346,31 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
|
|||
|
||||
if (!Pak.IsValid() || Pak.Size() == 0)
|
||||
{
|
||||
Log::Error("Failed to compare to original asset list; couldn't open the original pak");
|
||||
errorf("Failed to compare to original asset list; couldn't open the original pak");
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine pak version
|
||||
u32 PakVersion = Pak.ReadLong();
|
||||
uint32 PakVersion = Pak.ReadLong();
|
||||
std::set<CAssetID> OldListSet;
|
||||
|
||||
// Read MP1/2 pak
|
||||
if (PakVersion == 0x00030005)
|
||||
{
|
||||
Pak.Seek(0x4, SEEK_CUR);
|
||||
u32 NumNamedResources = Pak.ReadLong();
|
||||
uint32 NumNamedResources = Pak.ReadLong();
|
||||
|
||||
for (u32 iName = 0; iName < NumNamedResources; iName++)
|
||||
for (uint32 iName = 0; iName < NumNamedResources; iName++)
|
||||
{
|
||||
Pak.Seek(0x8, SEEK_CUR);
|
||||
u32 NameLen = Pak.ReadLong();
|
||||
uint32 NameLen = Pak.ReadLong();
|
||||
Pak.Seek(NameLen, SEEK_CUR);
|
||||
}
|
||||
|
||||
// Build a set out of the original pak resource list
|
||||
u32 NumResources = Pak.ReadLong();
|
||||
uint32 NumResources = Pak.ReadLong();
|
||||
|
||||
for (u32 iRes = 0; iRes < NumResources; iRes++)
|
||||
for (uint32 iRes = 0; iRes < NumResources; iRes++)
|
||||
{
|
||||
Pak.Seek(0x8, SEEK_CUR);
|
||||
OldListSet.insert( CAssetID(Pak, e32Bit) );
|
||||
|
@ -386,15 +386,15 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
|
|||
// Skip named resources
|
||||
Pak.Seek(0x44, SEEK_SET);
|
||||
CFourCC StringSecType = Pak.ReadLong();
|
||||
u32 StringSecSize = Pak.ReadLong();
|
||||
uint32 StringSecSize = Pak.ReadLong();
|
||||
ASSERT(StringSecType == "STRG");
|
||||
|
||||
Pak.Seek(0x80 + StringSecSize, SEEK_SET);
|
||||
|
||||
// Read resource table
|
||||
u32 NumResources = Pak.ReadLong();
|
||||
uint32 NumResources = Pak.ReadLong();
|
||||
|
||||
for (u32 iRes = 0; iRes < NumResources; iRes++)
|
||||
for (uint32 iRes = 0; iRes < NumResources; iRes++)
|
||||
{
|
||||
Pak.Seek(0x8, SEEK_CUR);
|
||||
OldListSet.insert( CAssetID(Pak, e64Bit) );
|
||||
|
@ -411,7 +411,7 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
|
|||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(ID);
|
||||
TString Extension = (pEntry ? "." + pEntry->CookedExtension() : "");
|
||||
Log::Error("Missing resource: " + ID.ToString() + Extension);
|
||||
warnf("Missing resource: %s%s", *ID.ToString(), *Extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ void CPackage::CompareOriginalAssetList(const std::list<CAssetID>& rkNewList)
|
|||
{
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry(ID);
|
||||
TString Extension = (pEntry ? "." + pEntry->CookedExtension() : "");
|
||||
Log::Error("Extra resource: " + ID.ToString() + Extension);
|
||||
warnf("Extra resource: %s%s", *ID.ToString(), *Extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public:
|
|||
inline TString Name() const { return mPakName; }
|
||||
inline TString Path() const { return mPakPath; }
|
||||
inline CGameProject* Project() const { return mpProject; }
|
||||
inline u32 NumNamedResources() const { return mResources.size(); }
|
||||
inline const SNamedResource& NamedResourceByIndex(u32 Idx) const { return mResources[Idx]; }
|
||||
inline uint32 NumNamedResources() const { return mResources.size(); }
|
||||
inline const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; }
|
||||
inline bool NeedsRecook() const { return mNeedsRecook; }
|
||||
|
||||
inline void SetPakName(TString NewName) { mPakName = NewName; }
|
||||
|
|
|
@ -96,7 +96,7 @@ bool CResourceEntry::LoadMetadata()
|
|||
}
|
||||
else
|
||||
{
|
||||
Log::Error(Path + ": Failed to load metadata file!");
|
||||
errorf("%s: Failed to load metadata file!", *Path);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -174,7 +174,7 @@ void CResourceEntry::UpdateDependencies()
|
|||
|
||||
if (!mpResource)
|
||||
{
|
||||
Log::Error("Unable to update cached dependencies; failed to load resource");
|
||||
errorf("Unable to update cached dependencies; failed to load resource");
|
||||
mpDependencies = new CDependencyTree();
|
||||
return;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ bool CResourceEntry::IsInDirectory(CVirtualDirectory *pDir) const
|
|||
return false;
|
||||
}
|
||||
|
||||
u64 CResourceEntry::Size() const
|
||||
uint64 CResourceEntry::Size() const
|
||||
{
|
||||
if (mCachedSize == -1)
|
||||
{
|
||||
|
@ -294,8 +294,7 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
|
|||
|
||||
if (!Writer.Save())
|
||||
{
|
||||
Log::Error("Failed to save raw resource: " + Path);
|
||||
DEBUG_BREAK;
|
||||
errorf("Failed to save raw resource: %s", *Path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -309,7 +308,7 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
|
|||
|
||||
if (!CookSuccess)
|
||||
{
|
||||
Log::Error("Failed to save resource: " + Name() + "." + CookedExtension().ToString());
|
||||
errorf("Failed to save resource: %s.%s", *Name(), *CookedExtension().ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +323,7 @@ bool CResourceEntry::Save(bool SkipCacheSave /*= false*/)
|
|||
mpStore->ConditionalSaveStore();
|
||||
|
||||
// Flag dirty any packages that contain this resource.
|
||||
for (u32 iPkg = 0; iPkg < mpStore->Project()->NumPackages(); iPkg++)
|
||||
for (uint32 iPkg = 0; iPkg < mpStore->Project()->NumPackages(); iPkg++)
|
||||
{
|
||||
CPackage *pPkg = mpStore->Project()->PackageByIndex(iPkg);
|
||||
|
||||
|
@ -352,7 +351,7 @@ bool CResourceEntry::Cook()
|
|||
CFileOutStream File(Path, IOUtil::eBigEndian);
|
||||
if (!File.IsValid())
|
||||
{
|
||||
Log::Error("Failed to open cooked file for writing: " + Path);
|
||||
errorf("Failed to open cooked file for writing: %s", *Path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -390,7 +389,7 @@ CResource* CResourceEntry::Load()
|
|||
|
||||
if (!Reader.IsValid())
|
||||
{
|
||||
Log::Error("Failed to load raw resource; falling back on cooked. Raw path: " + RawAssetPath());
|
||||
errorf("Failed to load raw resource; falling back on cooked. Raw path: %s", *RawAssetPath());
|
||||
delete mpResource;
|
||||
mpResource = nullptr;
|
||||
}
|
||||
|
@ -414,7 +413,7 @@ CResource* CResourceEntry::Load()
|
|||
|
||||
if (!File.IsValid())
|
||||
{
|
||||
Log::Error("Failed to open cooked resource: " + CookedAssetPath(true));
|
||||
errorf("Failed to open cooked resource: %s", *CookedAssetPath(true));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -423,7 +422,7 @@ CResource* CResourceEntry::Load()
|
|||
|
||||
else
|
||||
{
|
||||
Log::Error("Couldn't locate resource: " + CookedAssetPath(true));
|
||||
errorf("Couldn't locate resource: %s", *CookedAssetPath(true));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +499,10 @@ bool CResourceEntry::MoveAndRename(const TString& rkDir, const TString& rkName,
|
|||
TString NewRawPath = RawAssetPath();
|
||||
TString NewMetaPath = MetadataFilePath();
|
||||
|
||||
Log::Write("MOVING RESOURCE: " + FileUtil::MakeRelative(OldCookedPath, mpStore->ResourcesDir()) + " --> " + FileUtil::MakeRelative(NewCookedPath, mpStore->ResourcesDir()));
|
||||
debugf("MOVING RESOURCE: %s --> %s",
|
||||
*FileUtil::MakeRelative(OldCookedPath, mpStore->ResourcesDir()),
|
||||
*FileUtil::MakeRelative(NewCookedPath, mpStore->ResourcesDir())
|
||||
);
|
||||
|
||||
// If the old/new paths are the same then we should have already exited as CanMoveTo() should have returned false
|
||||
ASSERT(OldCookedPath != NewCookedPath && OldRawPath != NewRawPath && OldMetaPath != NewMetaPath);
|
||||
|
@ -586,7 +588,7 @@ bool CResourceEntry::MoveAndRename(const TString& rkDir, const TString& rkName,
|
|||
// Otherwise, revert changes and let the caller know the move failed
|
||||
else
|
||||
{
|
||||
Log::Error("MOVE FAILED: " + MoveFailReason);
|
||||
errorf("MOVE FAILED: %s", *MoveFailReason);
|
||||
mpDirectory = pOldDir;
|
||||
mName = OldName;
|
||||
mpStore->ConditionalDeleteDirectory(pNewDir, false);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/types.h>
|
||||
|
||||
class CResource;
|
||||
class CGameProject;
|
||||
|
@ -37,7 +36,7 @@ class CResourceEntry
|
|||
FResEntryFlags mFlags;
|
||||
|
||||
mutable bool mMetadataDirty;
|
||||
mutable u64 mCachedSize;
|
||||
mutable uint64 mCachedSize;
|
||||
mutable TString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering.
|
||||
|
||||
// Private constructor
|
||||
|
@ -66,7 +65,7 @@ public:
|
|||
CFourCC CookedExtension() const;
|
||||
TString MetadataFilePath(bool Relative = false) const;
|
||||
bool IsInDirectory(CVirtualDirectory *pDir) const;
|
||||
u64 Size() const;
|
||||
uint64 Size() const;
|
||||
bool NeedsRecook() const;
|
||||
bool Save(bool SkipCacheSave = false);
|
||||
bool Cook();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CResourceIterator.h"
|
||||
#include "Core/IUIRelay.h"
|
||||
#include "Core/Resource/CResource.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/Log.h>
|
||||
#include <Common/Serialization/Binary.h>
|
||||
|
@ -54,7 +54,7 @@ void RecursiveGetListOfEmptyDirectories(CVirtualDirectory *pDir, TStringList& rO
|
|||
}
|
||||
else
|
||||
{
|
||||
for (u32 SubIdx = 0; SubIdx < pDir->NumSubdirectories(); SubIdx++)
|
||||
for (uint32 SubIdx = 0; SubIdx < pDir->NumSubdirectories(); SubIdx++)
|
||||
RecursiveGetListOfEmptyDirectories(pDir->SubdirectoryByIndex(SubIdx), rOutList);
|
||||
}
|
||||
}
|
||||
|
@ -65,12 +65,12 @@ bool CResourceStore::SerializeDatabaseCache(IArchive& rArc)
|
|||
if (rArc.ParamBegin("Resources", 0))
|
||||
{
|
||||
// Serialize resources
|
||||
u32 ResourceCount = mResourceEntries.size();
|
||||
uint32 ResourceCount = mResourceEntries.size();
|
||||
rArc << SerialParameter("ResourceCount", ResourceCount);
|
||||
|
||||
if (rArc.IsReader())
|
||||
{
|
||||
for (u32 ResIdx = 0; ResIdx < ResourceCount; ResIdx++)
|
||||
for (uint32 ResIdx = 0; ResIdx < ResourceCount; ResIdx++)
|
||||
{
|
||||
if (rArc.ParamBegin("Resource", 0))
|
||||
{
|
||||
|
@ -195,12 +195,12 @@ void CResourceStore::CloseProject()
|
|||
// If there are, that means something didn't clean up resource references properly on project close!!!
|
||||
if (!mLoadedResources.empty())
|
||||
{
|
||||
Log::Error(TString::FromInt32(mLoadedResources.size(), 0, 10) + " resources still loaded on project close:");
|
||||
warnf("%d resources still loaded on project close:", mLoadedResources.size());
|
||||
|
||||
for (auto Iter = mLoadedResources.begin(); Iter != mLoadedResources.end(); Iter++)
|
||||
{
|
||||
CResourceEntry *pEntry = Iter->second;
|
||||
Log::Write("\t" + pEntry->Name() + "." + pEntry->CookedExtension().ToString());
|
||||
warnf("\t%s.%s", *pEntry->Name(), *pEntry->CookedExtension().ToString());
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
|
@ -325,7 +325,7 @@ bool CResourceStore::BuildFromDirectory(bool ShouldGenerateCacheFile)
|
|||
|
||||
if (!pTypeInfo)
|
||||
{
|
||||
Log::Error("Found resource but couldn't register because failed to identify resource type: " + RelPath);
|
||||
errorf("Found resource but couldn't register because failed to identify resource type: %s", *RelPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ CResourceEntry* CResourceStore::RegisterResource(const CAssetID& rkID, EResType
|
|||
CResourceEntry *pEntry = FindEntry(rkID);
|
||||
|
||||
if (pEntry)
|
||||
Log::Error("Attempted to register resource that's already tracked in the database: " + rkID.ToString() + " / " + rkDir + " / " + rkName);
|
||||
errorf("Attempted to register resource that's already tracked in the database: %s / %s / %s", *rkID.ToString(), *rkDir, *rkName);
|
||||
|
||||
else
|
||||
{
|
||||
|
@ -401,7 +401,7 @@ CResourceEntry* CResourceStore::RegisterResource(const CAssetID& rkID, EResType
|
|||
}
|
||||
|
||||
else
|
||||
Log::Error("Invalid resource path, failed to register: " + rkDir + rkName);
|
||||
errorf("Invalid resource path, failed to register: %s%s", *rkDir, *rkName);
|
||||
}
|
||||
|
||||
return pEntry;
|
||||
|
@ -419,7 +419,7 @@ CResource* CResourceStore::LoadResource(const CAssetID& rkID)
|
|||
else
|
||||
{
|
||||
// Resource doesn't seem to exist
|
||||
Log::Error("Can't find requested resource with ID \"" + rkID.ToString() + "\".");;
|
||||
warnf("Can't find requested resource with ID \"%s\"", *rkID.ToString());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ CResource* CResourceStore::LoadResource(const CAssetID& rkID, EResType Type)
|
|||
CResTypeInfo *pGotType = pRes->TypeInfo();
|
||||
ASSERT(pExpectedType && pGotType);
|
||||
|
||||
Log::Error("Resource with ID \"" + rkID.ToString() + "\" requested with the wrong type; expected " + pExpectedType->TypeName() + " asset, got " + pGotType->TypeName() + " asset");
|
||||
errorf("Resource with ID \"%s\" requested with the wrong type; expected %s asset, get %s asset", *rkID.ToString(), *pExpectedType->TypeName(), *pGotType->TypeName());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ void CResourceStore::TrackLoadedResource(CResourceEntry *pEntry)
|
|||
void CResourceStore::DestroyUnreferencedResources()
|
||||
{
|
||||
// This can be updated to avoid the do-while loop when reference lookup is implemented.
|
||||
u32 NumDeleted;
|
||||
uint32 NumDeleted;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, boo
|
|||
|
||||
if (!pContentsFile)
|
||||
{
|
||||
Log::Error("Failed to open .contents.txt file: " + rkTxtPath);
|
||||
errorf("Failed to open .contents.txt file: %s", *rkTxtPath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -559,12 +559,12 @@ void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, boo
|
|||
TString Line(LineBuffer);
|
||||
if (Line.IsEmpty()) break;
|
||||
|
||||
u32 IDStart = Line.IndexOfPhrase("0x") + 2;
|
||||
uint32 IDStart = Line.IndexOfPhrase("0x") + 2;
|
||||
if (IDStart == 1) continue;
|
||||
|
||||
u32 IDEnd = Line.IndexOf(" \t", IDStart);
|
||||
u32 PathStart = IDEnd + 1;
|
||||
u32 PathEnd = Line.Size() - 5;
|
||||
uint32 IDEnd = Line.IndexOf(" \t", IDStart);
|
||||
uint32 PathStart = IDEnd + 1;
|
||||
uint32 PathEnd = Line.Size() - 5;
|
||||
|
||||
TString IDStr = Line.SubString(IDStart, IDEnd - IDStart);
|
||||
TString Path = Line.SubString(PathStart, PathEnd - PathStart);
|
||||
|
@ -576,7 +576,7 @@ void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, boo
|
|||
if (pEntry)
|
||||
{
|
||||
// Chop name to just after "x_rep"
|
||||
u32 RepStart = Path.IndexOfPhrase("_rep");
|
||||
uint32 RepStart = Path.IndexOfPhrase("_rep");
|
||||
|
||||
if (RepStart != -1)
|
||||
Path = Path.ChopFront(RepStart + 5);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <Common/CFourCC.h>
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
|
@ -82,8 +81,8 @@ public:
|
|||
inline TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; }
|
||||
inline TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; }
|
||||
inline CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; }
|
||||
inline u32 NumTotalResources() const { return mResourceEntries.size(); }
|
||||
inline u32 NumLoadedResources() const { return mLoadedResources.size(); }
|
||||
inline uint32 NumTotalResources() const { return mResourceEntries.size(); }
|
||||
inline uint32 NumLoadedResources() const { return mLoadedResources.size(); }
|
||||
inline bool IsCacheDirty() const { return mDatabaseCacheDirty; }
|
||||
|
||||
inline void SetCacheDirty() { mDatabaseCacheDirty = true; }
|
||||
|
|
|
@ -22,7 +22,7 @@ CVirtualDirectory::CVirtualDirectory(CVirtualDirectory *pParent, const TString&
|
|||
|
||||
CVirtualDirectory::~CVirtualDirectory()
|
||||
{
|
||||
for (u32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
for (uint32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
delete mSubdirectories[iSub];
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ bool CVirtualDirectory::IsEmpty(bool CheckFilesystem) const
|
|||
if (!mResources.empty())
|
||||
return false;
|
||||
|
||||
for (u32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
for (uint32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
if (!mSubdirectories[iSub]->IsEmpty(CheckFilesystem))
|
||||
return false;
|
||||
|
||||
|
@ -66,10 +66,10 @@ CVirtualDirectory* CVirtualDirectory::GetRoot()
|
|||
|
||||
CVirtualDirectory* CVirtualDirectory::FindChildDirectory(const TString& rkName, bool AllowCreate)
|
||||
{
|
||||
u32 SlashIdx = rkName.IndexOf("\\/");
|
||||
uint32 SlashIdx = rkName.IndexOf("\\/");
|
||||
TString DirName = (SlashIdx == -1 ? rkName : rkName.SubString(0, SlashIdx));
|
||||
|
||||
for (u32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
for (uint32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
{
|
||||
CVirtualDirectory *pChild = mSubdirectories[iSub];
|
||||
|
||||
|
@ -126,7 +126,7 @@ CResourceEntry* CVirtualDirectory::FindChildResource(const TString& rkPath)
|
|||
|
||||
CResourceEntry* CVirtualDirectory::FindChildResource(const TString& rkName, EResType Type)
|
||||
{
|
||||
for (u32 iRes = 0; iRes < mResources.size(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < mResources.size(); iRes++)
|
||||
{
|
||||
if (rkName.CaseInsensitiveCompare(mResources[iRes]->Name()) && mResources[iRes]->ResourceType() == Type)
|
||||
return mResources[iRes];
|
||||
|
@ -150,14 +150,14 @@ bool CVirtualDirectory::AddChild(const TString &rkPath, CResourceEntry *pEntry)
|
|||
|
||||
else if (IsValidDirectoryPath(rkPath))
|
||||
{
|
||||
u32 SlashIdx = rkPath.IndexOf("\\/");
|
||||
uint32 SlashIdx = rkPath.IndexOf("\\/");
|
||||
TString DirName = (SlashIdx == -1 ? rkPath : rkPath.SubString(0, SlashIdx));
|
||||
TString Remaining = (SlashIdx == -1 ? "" : rkPath.SubString(SlashIdx + 1, rkPath.Size() - SlashIdx));
|
||||
|
||||
// Check if this subdirectory already exists
|
||||
CVirtualDirectory *pSubdir = nullptr;
|
||||
|
||||
for (u32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
for (uint32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
{
|
||||
if (mSubdirectories[iSub]->Name() == DirName)
|
||||
{
|
||||
|
@ -264,7 +264,7 @@ void CVirtualDirectory::SortSubdirectories()
|
|||
|
||||
bool CVirtualDirectory::Rename(const TString& rkNewName)
|
||||
{
|
||||
Log::Write("MOVING DIRECTORY: " + FullPath() + " -> " + mpParent->FullPath() + rkNewName + '/');
|
||||
debugf("MOVING DIRECTORY: %s --> %s", *FullPath(), *mpParent->FullPath() + rkNewName + '/');
|
||||
|
||||
if (!IsRoot())
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ bool CVirtualDirectory::Rename(const TString& rkNewName)
|
|||
}
|
||||
}
|
||||
|
||||
Log::Error("DIRECTORY MOVE FAILED");
|
||||
errorf("DIRECTORY MOVE FAILED");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ bool CVirtualDirectory::Delete()
|
|||
|
||||
void CVirtualDirectory::DeleteEmptySubdirectories()
|
||||
{
|
||||
for (u32 SubdirIdx = 0; SubdirIdx < mSubdirectories.size(); SubdirIdx++)
|
||||
for (uint32 SubdirIdx = 0; SubdirIdx < mSubdirectories.size(); SubdirIdx++)
|
||||
{
|
||||
CVirtualDirectory *pDir = mSubdirectories[SubdirIdx];
|
||||
|
||||
|
@ -332,7 +332,7 @@ bool CVirtualDirectory::CreateFilesystemDirectory()
|
|||
bool CreateSuccess = FileUtil::MakeDirectory(AbsPath);
|
||||
|
||||
if (!CreateSuccess)
|
||||
Log::Error("FAILED to create filesystem directory: " + AbsPath);
|
||||
errorf("FAILED to create filesystem directory: %s", *AbsPath);
|
||||
|
||||
return CreateSuccess;
|
||||
}
|
||||
|
@ -345,14 +345,14 @@ bool CVirtualDirectory::SetParent(CVirtualDirectory *pParent)
|
|||
ASSERT(!pParent->IsDescendantOf(this));
|
||||
if (mpParent == pParent) return true;
|
||||
|
||||
Log::Write("MOVING DIRECTORY: " + FullPath() + " -> " + pParent->FullPath() + mName + '/');
|
||||
debugf("MOVING DIRECTORY: %s -> %s", *FullPath(), *(pParent->FullPath() + mName + '/'));
|
||||
|
||||
// Check for a conflict
|
||||
CVirtualDirectory *pConflictDir = pParent->FindChildDirectory(mName, false);
|
||||
|
||||
if (pConflictDir)
|
||||
{
|
||||
Log::Error("DIRECTORY MOVE FAILED: Conflicting directory exists at the destination path!");
|
||||
errorf("DIRECTORY MOVE FAILED: Conflicting directory exists at the destination path!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ bool CVirtualDirectory::SetParent(CVirtualDirectory *pParent)
|
|||
}
|
||||
else
|
||||
{
|
||||
Log::Error("DIRECTORY MOVE FAILED: Filesystem move operation failed!");
|
||||
errorf("DIRECTORY MOVE FAILED: Filesystem move operation failed!");
|
||||
mpParent->AddChild(this);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/* Virtual directory system used to look up resources by their location in the filesystem. */
|
||||
#include "Core/Resource/EResType.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/TString.h>
|
||||
#include <vector>
|
||||
|
||||
|
@ -51,10 +51,10 @@ public:
|
|||
inline bool IsRoot() const { return !mpParent; }
|
||||
inline TString Name() const { return mName; }
|
||||
|
||||
inline u32 NumSubdirectories() const { return mSubdirectories.size(); }
|
||||
inline CVirtualDirectory* SubdirectoryByIndex(u32 Index) { return mSubdirectories[Index]; }
|
||||
inline u32 NumResources() const { return mResources.size(); }
|
||||
inline CResourceEntry* ResourceByIndex(u32 Index) { return mResources[Index]; }
|
||||
inline uint32 NumSubdirectories() const { return mSubdirectories.size(); }
|
||||
inline CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; }
|
||||
inline uint32 NumResources() const { return mResources.size(); }
|
||||
inline CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; }
|
||||
};
|
||||
|
||||
#endif // CVIRTUALDIRECTORY
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "DependencyListBuilders.h"
|
||||
|
||||
// ************ CCharacterUsageMap ************
|
||||
bool CCharacterUsageMap::IsCharacterUsed(const CAssetID& rkID, u32 CharacterIndex) const
|
||||
bool CCharacterUsageMap::IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const
|
||||
{
|
||||
if (mpStore->Game() >= EGame::CorruptionProto) return true;
|
||||
auto Find = mUsageMap.find(rkID);
|
||||
|
@ -18,7 +18,7 @@ bool CCharacterUsageMap::IsAnimationUsed(const CAssetID& rkID, CSetAnimationDepe
|
|||
if (Find == mUsageMap.end()) return false;
|
||||
const std::vector<bool>& rkUsageList = Find->second;
|
||||
|
||||
for (u32 iChar = 0; iChar < rkUsageList.size(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < rkUsageList.size(); iChar++)
|
||||
{
|
||||
if (rkUsageList[iChar] && pAnim->IsUsedByCharacter(iChar))
|
||||
return true;
|
||||
|
@ -37,7 +37,7 @@ void CCharacterUsageMap::FindUsagesForArea(CWorld *pWorld, CResourceEntry *pEntr
|
|||
{
|
||||
ASSERT(pEntry->ResourceType() == eArea);
|
||||
|
||||
for (u32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
for (uint32 iArea = 0; iArea < pWorld->NumAreas(); iArea++)
|
||||
{
|
||||
if (pWorld->AreaResourceID(iArea) == pEntry->ID())
|
||||
{
|
||||
|
@ -47,12 +47,12 @@ void CCharacterUsageMap::FindUsagesForArea(CWorld *pWorld, CResourceEntry *pEntr
|
|||
}
|
||||
}
|
||||
|
||||
void CCharacterUsageMap::FindUsagesForArea(CWorld *pWorld, u32 AreaIndex)
|
||||
void CCharacterUsageMap::FindUsagesForArea(CWorld *pWorld, uint32 AreaIndex)
|
||||
{
|
||||
// We only need to search forward from this area to other areas that both use the same character(s) + have duplicates enabled
|
||||
Clear();
|
||||
|
||||
for (u32 iArea = AreaIndex; iArea < pWorld->NumAreas(); iArea++)
|
||||
for (uint32 iArea = AreaIndex; iArea < pWorld->NumAreas(); iArea++)
|
||||
{
|
||||
if (!mIsInitialArea && mStillLookingIDs.empty()) break;
|
||||
mCurrentAreaAllowsDupes = pWorld->DoesAreaAllowPakDuplicates(iArea);
|
||||
|
@ -66,7 +66,7 @@ void CCharacterUsageMap::FindUsagesForArea(CWorld *pWorld, u32 AreaIndex)
|
|||
}
|
||||
}
|
||||
|
||||
void CCharacterUsageMap::FindUsagesForLayer(CResourceEntry *pAreaEntry, u32 LayerIndex)
|
||||
void CCharacterUsageMap::FindUsagesForLayer(CResourceEntry *pAreaEntry, uint32 LayerIndex)
|
||||
{
|
||||
Clear();
|
||||
mLayerIndex = LayerIndex;
|
||||
|
@ -76,10 +76,10 @@ void CCharacterUsageMap::FindUsagesForLayer(CResourceEntry *pAreaEntry, u32 Laye
|
|||
|
||||
// Only examine dependencies of the particular layer specified by the caller
|
||||
bool IsLastLayer = (mLayerIndex == pTree->NumScriptLayers() - 1);
|
||||
u32 StartIdx = pTree->ScriptLayerOffset(mLayerIndex);
|
||||
u32 EndIdx = (IsLastLayer ? pTree->NumChildren() : pTree->ScriptLayerOffset(mLayerIndex + 1));
|
||||
uint32 StartIdx = pTree->ScriptLayerOffset(mLayerIndex);
|
||||
uint32 EndIdx = (IsLastLayer ? pTree->NumChildren() : pTree->ScriptLayerOffset(mLayerIndex + 1));
|
||||
|
||||
for (u32 iInst = StartIdx; iInst < EndIdx; iInst++)
|
||||
for (uint32 iInst = StartIdx; iInst < EndIdx; iInst++)
|
||||
ParseDependencyNode(pTree->ChildByIndex(iInst));
|
||||
}
|
||||
|
||||
|
@ -101,11 +101,11 @@ void CCharacterUsageMap::DebugPrintContents()
|
|||
std::vector<bool>& rUsedList = Iter->second;
|
||||
CAnimSet *pSet = mpStore->LoadResource<CAnimSet>(ID);
|
||||
|
||||
for (u32 iChar = 0; iChar < pSet->NumCharacters(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < pSet->NumCharacters(); iChar++)
|
||||
{
|
||||
bool Used = (rUsedList.size() > iChar && rUsedList[iChar]);
|
||||
TString CharName = pSet->Character(iChar)->Name;
|
||||
Log::Write(ID.ToString() + " : Char " + TString::FromInt32(iChar, 0, 10) + " : " + CharName + " : " + (Used ? "USED" : "UNUSED"));
|
||||
debugf("%s : Char %d : %s : %s", *ID.ToString(), iChar, *CharName, (Used ? "USED" : "UNUSED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void CCharacterUsageMap::ParseDependencyNode(IDependencyNode *pNode)
|
|||
}
|
||||
|
||||
std::vector<bool>& rUsageList = mUsageMap[ResID];
|
||||
u32 UsedChar = pDep->UsedChar();
|
||||
uint32 UsedChar = pDep->UsedChar();
|
||||
|
||||
if (rUsageList.size() <= UsedChar)
|
||||
rUsageList.resize(UsedChar + 1, false);
|
||||
|
@ -164,7 +164,7 @@ void CCharacterUsageMap::ParseDependencyNode(IDependencyNode *pNode)
|
|||
// Look for sub-dependencies of the current node
|
||||
else
|
||||
{
|
||||
for (u32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
ParseDependencyNode(pNode->ChildByIndex(iChild));
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void CPackageDependencyListBuilder::BuildDependencyList(bool AllowDuplicates, st
|
|||
FindUniversalAreaAssets();
|
||||
|
||||
// Iterate over all resources and parse their dependencies
|
||||
for (u32 iRes = 0; iRes < mpkPackage->NumNamedResources(); iRes++)
|
||||
for (uint32 iRes = 0; iRes < mpkPackage->NumNamedResources(); iRes++)
|
||||
{
|
||||
const SNamedResource& rkRes = mpkPackage->NamedResourceByIndex(iRes);
|
||||
CResourceEntry *pEntry = mpStore->FindEntry(rkRes.ID);
|
||||
|
@ -240,7 +240,7 @@ void CPackageDependencyListBuilder::AddDependency(CResourceEntry *pCurEntry, con
|
|||
|
||||
if (mEnableDuplicates)
|
||||
{
|
||||
for (u32 iArea = 0; iArea < mpWorld->NumAreas(); iArea++)
|
||||
for (uint32 iArea = 0; iArea < mpWorld->NumAreas(); iArea++)
|
||||
{
|
||||
if (mpWorld->AreaResourceID(iArea) == rkID)
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ void CPackageDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurE
|
|||
else if (Type == eDNT_AnimEvent)
|
||||
{
|
||||
CAnimEventDependency *pDep = static_cast<CAnimEventDependency*>(pNode);
|
||||
u32 CharIndex = pDep->CharIndex();
|
||||
uint32 CharIndex = pDep->CharIndex();
|
||||
|
||||
if (CharIndex == -1 || mCharacterUsageMap.IsCharacterUsed(mCurrentAnimSetID, CharIndex))
|
||||
AddDependency(pCurEntry, pDep->ID(), rOut);
|
||||
|
@ -313,11 +313,11 @@ void CPackageDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurE
|
|||
{
|
||||
if (Type == eDNT_ScriptInstance)
|
||||
{
|
||||
u32 ObjType = static_cast<CScriptInstanceDependency*>(pNode)->ObjectType();
|
||||
uint32 ObjType = static_cast<CScriptInstanceDependency*>(pNode)->ObjectType();
|
||||
mIsPlayerActor = (ObjType == 0x4C || ObjType == FOURCC('PLAC'));
|
||||
}
|
||||
|
||||
for (u32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
EvaluateDependencyNode(pCurEntry, pNode->ChildByIndex(iChild), rOut);
|
||||
|
||||
if (Type == eDNT_ScriptInstance)
|
||||
|
@ -333,7 +333,7 @@ void CPackageDependencyListBuilder::FindUniversalAreaAssets()
|
|||
if (pPackage)
|
||||
{
|
||||
// Iterate over all the package contents, keep track of all universal area assets
|
||||
for (u32 ResIdx = 0; ResIdx < pPackage->NumNamedResources(); ResIdx++)
|
||||
for (uint32 ResIdx = 0; ResIdx < pPackage->NumNamedResources(); ResIdx++)
|
||||
{
|
||||
const SNamedResource& rkRes = pPackage->NamedResourceByIndex(ResIdx);
|
||||
|
||||
|
@ -349,7 +349,7 @@ void CPackageDependencyListBuilder::FindUniversalAreaAssets()
|
|||
if (pUniverseWorld)
|
||||
{
|
||||
// Area IDs
|
||||
for (u32 AreaIdx = 0; AreaIdx < pUniverseWorld->NumAreas(); AreaIdx++)
|
||||
for (uint32 AreaIdx = 0; AreaIdx < pUniverseWorld->NumAreas(); AreaIdx++)
|
||||
{
|
||||
CAssetID AreaID = pUniverseWorld->AreaResourceID(AreaIdx);
|
||||
|
||||
|
@ -362,7 +362,7 @@ void CPackageDependencyListBuilder::FindUniversalAreaAssets()
|
|||
|
||||
if (pMapWorld)
|
||||
{
|
||||
for (u32 DepIdx = 0; DepIdx < pMapWorld->NumDependencies(); DepIdx++)
|
||||
for (uint32 DepIdx = 0; DepIdx < pMapWorld->NumDependencies(); DepIdx++)
|
||||
{
|
||||
CAssetID DepID = pMapWorld->DependencyByIndex(DepIdx);
|
||||
|
||||
|
@ -378,14 +378,14 @@ void CPackageDependencyListBuilder::FindUniversalAreaAssets()
|
|||
}
|
||||
|
||||
// ************ CAreaDependencyListBuilder ************
|
||||
void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAssetsOut, std::list<u32>& rLayerOffsetsOut, std::set<CAssetID> *pAudioGroupsOut)
|
||||
void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAssetsOut, std::list<uint32>& rLayerOffsetsOut, std::set<CAssetID> *pAudioGroupsOut)
|
||||
{
|
||||
CAreaDependencyTree *pTree = static_cast<CAreaDependencyTree*>(mpAreaEntry->Dependencies());
|
||||
|
||||
// Fill area base used assets set (don't actually add to list yet)
|
||||
u32 BaseEndIndex = (pTree->NumScriptLayers() > 0 ? pTree->ScriptLayerOffset(0) : pTree->NumChildren());
|
||||
uint32 BaseEndIndex = (pTree->NumScriptLayers() > 0 ? pTree->ScriptLayerOffset(0) : pTree->NumChildren());
|
||||
|
||||
for (u32 iDep = 0; iDep < BaseEndIndex; iDep++)
|
||||
for (uint32 iDep = 0; iDep < BaseEndIndex; iDep++)
|
||||
{
|
||||
CResourceDependency *pRes = static_cast<CResourceDependency*>(pTree->ChildByIndex(iDep));
|
||||
ASSERT(pRes->Type() == eDNT_ResourceDependency);
|
||||
|
@ -393,17 +393,17 @@ void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAsset
|
|||
}
|
||||
|
||||
// Get dependencies of each layer
|
||||
for (u32 iLyr = 0; iLyr < pTree->NumScriptLayers(); iLyr++)
|
||||
for (uint32 iLyr = 0; iLyr < pTree->NumScriptLayers(); iLyr++)
|
||||
{
|
||||
mLayerUsedAssets.clear();
|
||||
mCharacterUsageMap.FindUsagesForLayer(mpAreaEntry, iLyr);
|
||||
rLayerOffsetsOut.push_back(rAssetsOut.size());
|
||||
|
||||
bool IsLastLayer = (iLyr == pTree->NumScriptLayers() - 1);
|
||||
u32 StartIdx = pTree->ScriptLayerOffset(iLyr);
|
||||
u32 EndIdx = (IsLastLayer ? pTree->NumChildren() : pTree->ScriptLayerOffset(iLyr + 1));
|
||||
uint32 StartIdx = pTree->ScriptLayerOffset(iLyr);
|
||||
uint32 EndIdx = (IsLastLayer ? pTree->NumChildren() : pTree->ScriptLayerOffset(iLyr + 1));
|
||||
|
||||
for (u32 iChild = StartIdx; iChild < EndIdx; iChild++)
|
||||
for (uint32 iChild = StartIdx; iChild < EndIdx; iChild++)
|
||||
{
|
||||
IDependencyNode *pNode = pTree->ChildByIndex(iChild);
|
||||
|
||||
|
@ -412,7 +412,7 @@ void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAsset
|
|||
CScriptInstanceDependency *pInst = static_cast<CScriptInstanceDependency*>(pNode);
|
||||
mIsPlayerActor = (pInst->ObjectType() == 0x4C || pInst->ObjectType() == FOURCC('PLAC'));
|
||||
|
||||
for (u32 iDep = 0; iDep < pInst->NumChildren(); iDep++)
|
||||
for (uint32 iDep = 0; iDep < pInst->NumChildren(); iDep++)
|
||||
{
|
||||
CPropertyDependency *pDep = static_cast<CPropertyDependency*>(pInst->ChildByIndex(iDep));
|
||||
|
||||
|
@ -452,7 +452,7 @@ void CAreaDependencyListBuilder::BuildDependencyList(std::list<CAssetID>& rAsset
|
|||
mLayerUsedAssets.clear();
|
||||
rLayerOffsetsOut.push_back(rAssetsOut.size());
|
||||
|
||||
for (u32 iDep = 0; iDep < BaseEndIndex; iDep++)
|
||||
for (uint32 iDep = 0; iDep < BaseEndIndex; iDep++)
|
||||
{
|
||||
CResourceDependency *pDep = static_cast<CResourceDependency*>(pTree->ChildByIndex(iDep));
|
||||
AddDependency(pDep->ID(), rAssetsOut, pAudioGroupsOut);
|
||||
|
@ -525,7 +525,7 @@ void CAreaDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurEntr
|
|||
else if (Type == eDNT_AnimEvent)
|
||||
{
|
||||
CAnimEventDependency *pDep = static_cast<CAnimEventDependency*>(pNode);
|
||||
u32 CharIndex = pDep->CharIndex();
|
||||
uint32 CharIndex = pDep->CharIndex();
|
||||
|
||||
if (CharIndex == -1 || mCharacterUsageMap.IsCharacterUsed(mCurrentAnimSetID, CharIndex))
|
||||
AddDependency(pDep->ID(), rOut, pAudioGroupsOut);
|
||||
|
@ -534,10 +534,10 @@ void CAreaDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurEntr
|
|||
else if (Type == eDNT_SetCharacter)
|
||||
{
|
||||
// Note: For MP1/2 PlayerActor, always treat as if Empty Suit is the only used one
|
||||
const u32 kEmptySuitIndex = (mGame >= EGame::EchoesDemo ? 3 : 5);
|
||||
const uint32 kEmptySuitIndex = (mGame >= EGame::EchoesDemo ? 3 : 5);
|
||||
|
||||
CSetCharacterDependency *pChar = static_cast<CSetCharacterDependency*>(pNode);
|
||||
u32 SetIndex = pChar->CharSetIndex();
|
||||
uint32 SetIndex = pChar->CharSetIndex();
|
||||
ParseChildren = mCharacterUsageMap.IsCharacterUsed(mCurrentAnimSetID, pChar->CharSetIndex()) || (mIsPlayerActor && SetIndex == kEmptySuitIndex);
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ void CAreaDependencyListBuilder::EvaluateDependencyNode(CResourceEntry *pCurEntr
|
|||
|
||||
if (ParseChildren)
|
||||
{
|
||||
for (u32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < pNode->NumChildren(); iChild++)
|
||||
EvaluateDependencyNode(pCurEntry, pNode->ChildByIndex(iChild), rOut, pAudioGroupsOut);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class CCharacterUsageMap
|
|||
std::map<CAssetID, std::vector<bool>> mUsageMap;
|
||||
std::set<CAssetID> mStillLookingIDs;
|
||||
CResourceStore *mpStore;
|
||||
u32 mLayerIndex;
|
||||
uint32 mLayerIndex;
|
||||
bool mIsInitialArea;
|
||||
bool mCurrentAreaAllowsDupes;
|
||||
|
||||
|
@ -22,12 +22,12 @@ public:
|
|||
: mpStore(pStore), mLayerIndex(-1), mIsInitialArea(true), mCurrentAreaAllowsDupes(false)
|
||||
{}
|
||||
|
||||
bool IsCharacterUsed(const CAssetID& rkID, u32 CharacterIndex) const;
|
||||
bool IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const;
|
||||
bool IsAnimationUsed(const CAssetID& rkID, CSetAnimationDependency *pAnim) const;
|
||||
void FindUsagesForAsset(CResourceEntry *pEntry);
|
||||
void FindUsagesForArea(CWorld *pWorld, CResourceEntry *pEntry);
|
||||
void FindUsagesForArea(CWorld *pWorld, u32 AreaIndex);
|
||||
void FindUsagesForLayer(CResourceEntry *pAreaEntry, u32 LayerIndex);
|
||||
void FindUsagesForArea(CWorld *pWorld, uint32 AreaIndex);
|
||||
void FindUsagesForLayer(CResourceEntry *pAreaEntry, uint32 LayerIndex);
|
||||
void Clear();
|
||||
void DebugPrintContents();
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
ASSERT(mpAreaEntry->ResourceType() == eArea);
|
||||
}
|
||||
|
||||
void BuildDependencyList(std::list<CAssetID>& rAssetsOut, std::list<u32>& rLayerOffsetsOut, std::set<CAssetID> *pAudioGroupsOut = nullptr);
|
||||
void BuildDependencyList(std::list<CAssetID>& rAssetsOut, std::list<uint32>& rLayerOffsetsOut, std::set<CAssetID> *pAudioGroupsOut = nullptr);
|
||||
void AddDependency(const CAssetID& rkID, std::list<CAssetID>& rOut, std::set<CAssetID> *pAudioGroupsOut);
|
||||
void EvaluateDependencyNode(CResourceEntry *pCurEntry, IDependencyNode *pNode, std::list<CAssetID>& rOut, std::set<CAssetID> *pAudioGroupsOut);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define IPROGRESSNOTIFIER_H
|
||||
|
||||
#include <Common/Common.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
class IProgressNotifier
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "CDynamicVertexBuffer.h"
|
||||
#include "CVertexArrayManager.h"
|
||||
|
||||
static const u32 gskAttribSize[] = {
|
||||
static const uint32 gskAttribSize[] = {
|
||||
0xC, 0xC, 0x4, 0x4, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ CDynamicVertexBuffer::~CDynamicVertexBuffer()
|
|||
ClearBuffers();
|
||||
}
|
||||
|
||||
void CDynamicVertexBuffer::SetVertexCount(u32 NumVerts)
|
||||
void CDynamicVertexBuffer::SetVertexCount(uint32 NumVerts)
|
||||
{
|
||||
ClearBuffers();
|
||||
mNumVertices = NumVerts;
|
||||
|
@ -44,7 +44,7 @@ void CDynamicVertexBuffer::SetActiveAttribs(FVertexDescription AttribFlags)
|
|||
|
||||
void CDynamicVertexBuffer::BufferAttrib(EVertexAttribute Attrib, const void *pkData)
|
||||
{
|
||||
u32 Index;
|
||||
uint32 Index;
|
||||
|
||||
switch (Attrib)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ void CDynamicVertexBuffer::BufferAttrib(EVertexAttribute Attrib, const void *pkD
|
|||
|
||||
void CDynamicVertexBuffer::ClearBuffers()
|
||||
{
|
||||
for (u32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
for (uint32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
{
|
||||
int Bit = 1 << iAttrib;
|
||||
|
||||
|
@ -86,7 +86,7 @@ GLuint CDynamicVertexBuffer::CreateVAO()
|
|||
glGenVertexArrays(1, &VertexArray);
|
||||
glBindVertexArray(VertexArray);
|
||||
|
||||
for (u32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
for (uint32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
{
|
||||
bool HasAttrib = ((3 << (iAttrib * 2)) != 0);
|
||||
|
||||
|
@ -121,7 +121,7 @@ void CDynamicVertexBuffer::InitBuffers()
|
|||
{
|
||||
if (mBufferedFlags) ClearBuffers();
|
||||
|
||||
for (u32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
for (uint32 iAttrib = 0; iAttrib < 12; iAttrib++)
|
||||
{
|
||||
bool HasAttrib = ((3 << (iAttrib * 2)) != 0);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CDYNAMICVERTEXBUFFER_H
|
||||
|
||||
#include "Core/Resource/Model/EVertexAttribute.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
|
||||
#include <vector>
|
||||
#include <GL/glew.h>
|
||||
|
@ -11,13 +11,13 @@ class CDynamicVertexBuffer
|
|||
{
|
||||
FVertexDescription mAttribFlags;
|
||||
FVertexDescription mBufferedFlags;
|
||||
u32 mNumVertices;
|
||||
uint32 mNumVertices;
|
||||
GLuint mAttribBuffers[12];
|
||||
|
||||
public:
|
||||
CDynamicVertexBuffer();
|
||||
~CDynamicVertexBuffer();
|
||||
void SetVertexCount(u32 NumVerts);
|
||||
void SetVertexCount(uint32 NumVerts);
|
||||
void Bind();
|
||||
void Unbind();
|
||||
void SetActiveAttribs(FVertexDescription AttribFlags);
|
||||
|
|
|
@ -11,7 +11,7 @@ CFramebuffer::CFramebuffer()
|
|||
{
|
||||
}
|
||||
|
||||
CFramebuffer::CFramebuffer(u32 Width, u32 Height)
|
||||
CFramebuffer::CFramebuffer(uint32 Width, uint32 Height)
|
||||
: mpRenderbuffer(nullptr)
|
||||
, mpTexture(nullptr)
|
||||
, mWidth(0)
|
||||
|
@ -60,7 +60,7 @@ void CFramebuffer::Bind(GLenum Target /*= GL_FRAMEBUFFER*/)
|
|||
glBindFramebuffer(Target, mFramebuffer);
|
||||
}
|
||||
|
||||
void CFramebuffer::Resize(u32 Width, u32 Height)
|
||||
void CFramebuffer::Resize(uint32 Width, uint32 Height)
|
||||
{
|
||||
if ((mWidth != Width) || (mHeight != Height))
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ void CFramebuffer::InitBuffers()
|
|||
mStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
if (mStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
Log::Error("Framebuffer not complete; error " + TString::HexString((u32) mStatus, 0));
|
||||
errorf("Framebuffer not complete; error 0x%X", mStatus);
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
|
|
|
@ -10,7 +10,7 @@ class CFramebuffer
|
|||
GLuint mFramebuffer;
|
||||
CRenderbuffer *mpRenderbuffer;
|
||||
CTexture *mpTexture;
|
||||
u32 mWidth, mHeight;
|
||||
uint32 mWidth, mHeight;
|
||||
bool mEnableMultisampling;
|
||||
bool mInitialized;
|
||||
GLenum mStatus;
|
||||
|
@ -20,11 +20,11 @@ class CFramebuffer
|
|||
|
||||
public:
|
||||
CFramebuffer();
|
||||
CFramebuffer(u32 Width, u32 Height);
|
||||
CFramebuffer(uint32 Width, uint32 Height);
|
||||
~CFramebuffer();
|
||||
void Init();
|
||||
void Bind(GLenum Target = GL_FRAMEBUFFER);
|
||||
void Resize(u32 Width, u32 Height);
|
||||
void Resize(uint32 Width, uint32 Height);
|
||||
void SetMultisamplingEnabled(bool Enable);
|
||||
|
||||
// Accessors
|
||||
|
|
|
@ -17,19 +17,19 @@ CIndexBuffer::~CIndexBuffer()
|
|||
glDeleteBuffers(1, &mIndexBuffer);
|
||||
}
|
||||
|
||||
void CIndexBuffer::AddIndex(u16 Index)
|
||||
void CIndexBuffer::AddIndex(uint16 Index)
|
||||
{
|
||||
mIndices.push_back(Index);
|
||||
}
|
||||
|
||||
void CIndexBuffer::AddIndices(u16 *pIndices, u32 Count)
|
||||
void CIndexBuffer::AddIndices(uint16 *pIndices, uint Count)
|
||||
{
|
||||
Reserve(Count);
|
||||
for (u32 iIdx = 0; iIdx < Count; iIdx++)
|
||||
for (uint iIdx = 0; iIdx < Count; iIdx++)
|
||||
mIndices.push_back(*pIndices++);
|
||||
}
|
||||
|
||||
void CIndexBuffer::Reserve(u32 Size)
|
||||
void CIndexBuffer::Reserve(uint Size)
|
||||
{
|
||||
mIndices.reserve(mIndices.size() + Size);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void CIndexBuffer::Buffer()
|
|||
|
||||
glGenBuffers(1, &mIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndices.size() * sizeof(u16), mIndices.data(), GL_STATIC_DRAW);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndices.size() * sizeof(uint16), mIndices.data(), GL_STATIC_DRAW);
|
||||
|
||||
mBuffered = true;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void CIndexBuffer::DrawElements()
|
|||
Unbind();
|
||||
}
|
||||
|
||||
void CIndexBuffer::DrawElements(u32 Offset, u32 Size)
|
||||
void CIndexBuffer::DrawElements(uint Offset, uint Size)
|
||||
{
|
||||
Bind();
|
||||
glDrawElements(mPrimitiveType, Size, GL_UNSIGNED_SHORT, (char*)0 + (Offset * 2));
|
||||
|
@ -84,7 +84,7 @@ bool CIndexBuffer::IsBuffered()
|
|||
return mBuffered;
|
||||
}
|
||||
|
||||
u32 CIndexBuffer::GetSize()
|
||||
uint CIndexBuffer::GetSize()
|
||||
{
|
||||
return mIndices.size();
|
||||
}
|
||||
|
@ -99,11 +99,11 @@ void CIndexBuffer::SetPrimitiveType(GLenum Type)
|
|||
mPrimitiveType = Type;
|
||||
}
|
||||
|
||||
void CIndexBuffer::TrianglesToStrips(u16 *pIndices, u32 Count)
|
||||
void CIndexBuffer::TrianglesToStrips(uint16 *pIndices, uint Count)
|
||||
{
|
||||
Reserve(Count + (Count / 3));
|
||||
|
||||
for (u32 iIdx = 0; iIdx < Count; iIdx += 3)
|
||||
for (uint iIdx = 0; iIdx < Count; iIdx += 3)
|
||||
{
|
||||
mIndices.push_back(*pIndices++);
|
||||
mIndices.push_back(*pIndices++);
|
||||
|
@ -112,12 +112,12 @@ void CIndexBuffer::TrianglesToStrips(u16 *pIndices, u32 Count)
|
|||
}
|
||||
}
|
||||
|
||||
void CIndexBuffer::FansToStrips(u16 *pIndices, u32 Count)
|
||||
void CIndexBuffer::FansToStrips(uint16 *pIndices, uint Count)
|
||||
{
|
||||
Reserve(Count);
|
||||
u16 FirstIndex = *pIndices;
|
||||
uint16 FirstIndex = *pIndices;
|
||||
|
||||
for (u32 iIdx = 2; iIdx < Count; iIdx += 3)
|
||||
for (uint iIdx = 2; iIdx < Count; iIdx += 3)
|
||||
{
|
||||
mIndices.push_back(pIndices[iIdx - 1]);
|
||||
mIndices.push_back(pIndices[iIdx]);
|
||||
|
@ -130,11 +130,11 @@ void CIndexBuffer::FansToStrips(u16 *pIndices, u32 Count)
|
|||
}
|
||||
}
|
||||
|
||||
void CIndexBuffer::QuadsToStrips(u16 *pIndices, u32 Count)
|
||||
void CIndexBuffer::QuadsToStrips(uint16 *pIndices, uint Count)
|
||||
{
|
||||
Reserve((u32) (Count * 1.25));
|
||||
Reserve((uint) (Count * 1.25));
|
||||
|
||||
u32 iIdx = 3;
|
||||
uint iIdx = 3;
|
||||
for (; iIdx < Count; iIdx += 4)
|
||||
{
|
||||
mIndices.push_back(pIndices[iIdx - 2]);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef CINDEXBUFFER_H
|
||||
#define CINDEXBUFFER_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
class CIndexBuffer
|
||||
{
|
||||
GLuint mIndexBuffer;
|
||||
std::vector<u16> mIndices;
|
||||
std::vector<uint16> mIndices;
|
||||
GLenum mPrimitiveType;
|
||||
bool mBuffered;
|
||||
|
||||
|
@ -16,24 +16,24 @@ public:
|
|||
CIndexBuffer();
|
||||
CIndexBuffer(GLenum Type);
|
||||
~CIndexBuffer();
|
||||
void AddIndex(u16 Index);
|
||||
void AddIndices(u16 *pIndices, u32 Count);
|
||||
void Reserve(u32 Size);
|
||||
void AddIndex(uint16 Index);
|
||||
void AddIndices(uint16 *pIndices, uint Count);
|
||||
void Reserve(uint Size);
|
||||
void Clear();
|
||||
void Buffer();
|
||||
void Bind();
|
||||
void Unbind();
|
||||
void DrawElements();
|
||||
void DrawElements(u32 Offset, u32 Size);
|
||||
void DrawElements(uint Offset, uint Size);
|
||||
bool IsBuffered();
|
||||
|
||||
u32 GetSize();
|
||||
uint GetSize();
|
||||
GLenum GetPrimitiveType();
|
||||
void SetPrimitiveType(GLenum Type);
|
||||
|
||||
void TrianglesToStrips(u16 *pIndices, u32 Count);
|
||||
void FansToStrips(u16 *pIndices, u32 Count);
|
||||
void QuadsToStrips(u16 *pIndices, u32 Count);
|
||||
void TrianglesToStrips(uint16 *pIndices, uint Count);
|
||||
void FansToStrips(uint16 *pIndices, uint Count);
|
||||
void QuadsToStrips(uint16 *pIndices, uint Count);
|
||||
};
|
||||
|
||||
#endif // CINDEXBUFFER_H
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef CRENDERBUFFER_H
|
||||
#define CRENDERBUFFER_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
class CRenderbuffer
|
||||
{
|
||||
GLuint mRenderbuffer;
|
||||
u32 mWidth, mHeight;
|
||||
uint mWidth, mHeight;
|
||||
bool mEnableMultisampling;
|
||||
bool mInitialized;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
CRenderbuffer::CRenderbuffer(u32 Width, u32 Height)
|
||||
CRenderbuffer::CRenderbuffer(uint Width, uint Height)
|
||||
: mWidth(Width)
|
||||
, mHeight(Height)
|
||||
, mEnableMultisampling(false)
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
InitStorage();
|
||||
}
|
||||
|
||||
inline void CRenderbuffer::Resize(u32 Width, u32 Height)
|
||||
inline void CRenderbuffer::Resize(uint Width, uint Height)
|
||||
{
|
||||
mWidth = Width;
|
||||
mHeight = Height;
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#include "CShader.h"
|
||||
#include "Core/Render/CGraphics.h"
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Log.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/FileIO/CTextInStream.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
bool gDebugDumpShaders = false;
|
||||
u64 gFailedCompileCount = 0;
|
||||
u64 gSuccessfulCompileCount = 0;
|
||||
uint64 gFailedCompileCount = 0;
|
||||
uint64 gSuccessfulCompileCount = 0;
|
||||
|
||||
CShader* CShader::spCurrentShader = nullptr;
|
||||
int CShader::smNumShaders = 0;
|
||||
|
@ -58,8 +57,8 @@ bool CShader::CompileVertexSource(const char* pkSource)
|
|||
if (CompileStatus == GL_FALSE)
|
||||
{
|
||||
TString Out = "dump/BadVS_" + std::to_string(gFailedCompileCount) + ".txt";
|
||||
Log::Error("Unable to compile vertex shader; dumped to " + Out);
|
||||
DumpShaderSource(mVertexShader, Out);
|
||||
errorf("Unable to compile vertex shader; dumped to %s", *Out);
|
||||
|
||||
gFailedCompileCount++;
|
||||
glDeleteShader(mVertexShader);
|
||||
|
@ -70,8 +69,8 @@ bool CShader::CompileVertexSource(const char* pkSource)
|
|||
else if (gDebugDumpShaders == true)
|
||||
{
|
||||
TString Out = "dump/VS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
|
||||
Log::Write("Debug shader dumping enabled; dumped to " + Out);
|
||||
DumpShaderSource(mVertexShader, Out);
|
||||
debugf("Debug shader dumping enabled; dumped to %s", *Out);
|
||||
|
||||
gSuccessfulCompileCount++;
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ bool CShader::CompilePixelSource(const char* pkSource)
|
|||
if (CompileStatus == GL_FALSE)
|
||||
{
|
||||
TString Out = "dump/BadPS_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
|
||||
Log::Error("Unable to compile pixel shader; dumped to " + Out);
|
||||
errorf("Unable to compile pixel shader; dumped to %s", *Out);
|
||||
DumpShaderSource(mPixelShader, Out);
|
||||
|
||||
gFailedCompileCount++;
|
||||
|
@ -105,7 +104,7 @@ bool CShader::CompilePixelSource(const char* pkSource)
|
|||
else if (gDebugDumpShaders == true)
|
||||
{
|
||||
TString Out = "dump/PS_" + TString::FromInt64(gSuccessfulCompileCount, 8, 10) + ".txt";
|
||||
Log::Write("Debug shader dumping enabled; dumped to " + Out);
|
||||
debugf("Debug shader dumping enabled; dumped to %s", *Out);
|
||||
DumpShaderSource(mPixelShader, Out);
|
||||
|
||||
gSuccessfulCompileCount++;
|
||||
|
@ -136,7 +135,7 @@ bool CShader::LinkShaders()
|
|||
if (LinkStatus == GL_FALSE)
|
||||
{
|
||||
TString Out = "dump/BadLink_" + TString::FromInt64(gFailedCompileCount, 8, 10) + ".txt";
|
||||
Log::Error("Unable to link shaders. Dumped error log to " + Out);
|
||||
errorf("Unable to link shaders. Dumped error log to %s", *Out);
|
||||
|
||||
GLint LogLen;
|
||||
glGetProgramiv(mProgram, GL_INFO_LOG_LENGTH, &LogLen);
|
||||
|
@ -188,13 +187,13 @@ GLuint CShader::GetUniformBlockIndex(const char* pkUniformBlock)
|
|||
return glGetUniformBlockIndex(mProgram, pkUniformBlock);
|
||||
}
|
||||
|
||||
void CShader::SetTextureUniforms(u32 NumTextures)
|
||||
void CShader::SetTextureUniforms(uint32 NumTextures)
|
||||
{
|
||||
for (u32 iTex = 0; iTex < NumTextures; iTex++)
|
||||
for (uint32 iTex = 0; iTex < NumTextures; iTex++)
|
||||
glUniform1i(mTextureUniforms[iTex], iTex);
|
||||
}
|
||||
|
||||
void CShader::SetNumLights(u32 NumLights)
|
||||
void CShader::SetNumLights(uint32 NumLights)
|
||||
{
|
||||
glUniform1i(mNumLightsUniform, NumLights);
|
||||
}
|
||||
|
@ -219,26 +218,18 @@ CShader* CShader::FromResourceFile(const TString& rkShaderName)
|
|||
{
|
||||
TString VertexShaderFilename = "../resources/shaders/" + rkShaderName + ".vs";
|
||||
TString PixelShaderFilename = "../resources/shaders/" + rkShaderName + ".ps";
|
||||
CTextInStream VertexShaderFile(VertexShaderFilename);
|
||||
CTextInStream PixelShaderFile(PixelShaderFilename);
|
||||
TString VertexShaderText, PixelShaderText;
|
||||
|
||||
if (!VertexShaderFile.IsValid())
|
||||
Log::Error("Couldn't load vertex shader file for " + rkShaderName);
|
||||
if (!PixelShaderFile.IsValid())
|
||||
Log::Error("Error: Couldn't load pixel shader file for " + rkShaderName);
|
||||
if ((!VertexShaderFile.IsValid()) || (!PixelShaderFile.IsValid())) return nullptr;
|
||||
|
||||
std::stringstream VertexShader;
|
||||
while (!VertexShaderFile.EoF())
|
||||
VertexShader << VertexShaderFile.GetString();
|
||||
|
||||
std::stringstream PixelShader;
|
||||
while (!PixelShaderFile.EoF())
|
||||
PixelShader << PixelShaderFile.GetString();
|
||||
if (!FileUtil::LoadFileToString(VertexShaderFilename, VertexShaderText))
|
||||
errorf("Couldn't load vertex shader file for %s", *rkShaderName);
|
||||
if (!FileUtil::LoadFileToString(PixelShaderFilename, PixelShaderText))
|
||||
errorf("Couldn't load pixel shader file for %s", *rkShaderName);
|
||||
if (VertexShaderText.IsEmpty() || PixelShaderText.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
CShader *pShader = new CShader();
|
||||
pShader->CompileVertexSource(VertexShader.str().c_str());
|
||||
pShader->CompilePixelSource(PixelShader.str().c_str());
|
||||
pShader->CompileVertexSource(*VertexShaderText);
|
||||
pShader->CompilePixelSource(*PixelShaderText);
|
||||
pShader->LinkShaders();
|
||||
return pShader;
|
||||
}
|
||||
|
@ -256,7 +247,7 @@ void CShader::KillCachedShader()
|
|||
// ************ PRIVATE ************
|
||||
void CShader::CacheCommonUniforms()
|
||||
{
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
{
|
||||
TString TexUniform = "Texture" + TString::FromInt32(iTex);
|
||||
mTextureUniforms[iTex] = glGetUniformLocation(mProgram, *TexUniform);
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
GLuint GetProgramID();
|
||||
GLuint GetUniformLocation(const char* pkUniform);
|
||||
GLuint GetUniformBlockIndex(const char* pkUniformBlock);
|
||||
void SetTextureUniforms(u32 NumTextures);
|
||||
void SetNumLights(u32 NumLights);
|
||||
void SetTextureUniforms(uint32 NumTextures);
|
||||
void SetNumLights(uint32 NumLights);
|
||||
void SetCurrent();
|
||||
|
||||
// Static
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "CShaderGenerator.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
@ -179,7 +179,7 @@ bool CShaderGenerator::CreateVertexShader(const CMaterial& rkMat)
|
|||
if (VtxDesc & eColor0) ShaderCode << "out vec4 Color0;\n";
|
||||
if (VtxDesc & eColor1) ShaderCode << "out vec4 Color1;\n";
|
||||
|
||||
for (u32 iPass = 0; iPass < rkMat.PassCount(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < rkMat.PassCount(); iPass++)
|
||||
if (rkMat.Pass(iPass)->TexCoordSource() != 0xFF)
|
||||
ShaderCode << "out vec3 Tex" << iPass << ";\n";
|
||||
|
||||
|
@ -332,9 +332,9 @@ bool CShaderGenerator::CreateVertexShader(const CMaterial& rkMat)
|
|||
ShaderCode << " \n"
|
||||
<< " // TexGen\n";
|
||||
|
||||
u32 PassCount = rkMat.PassCount();
|
||||
uint32 PassCount = rkMat.PassCount();
|
||||
|
||||
for (u32 iPass = 0; iPass < PassCount; iPass++)
|
||||
for (uint32 iPass = 0; iPass < PassCount; iPass++)
|
||||
{
|
||||
CMaterialPass *pPass = rkMat.Pass(iPass);
|
||||
if (pPass->TexCoordSource() == 0xFF) continue;
|
||||
|
@ -378,9 +378,9 @@ bool CShaderGenerator::CreatePixelShader(const CMaterial& rkMat)
|
|||
if (VtxDesc & eColor0) ShaderCode << "in vec4 Color0;\n";
|
||||
if (VtxDesc & eColor1) ShaderCode << "in vec4 Color1;\n";
|
||||
|
||||
u32 PassCount = rkMat.PassCount();
|
||||
uint32 PassCount = rkMat.PassCount();
|
||||
|
||||
for (u32 iPass = 0; iPass < PassCount; iPass++)
|
||||
for (uint32 iPass = 0; iPass < PassCount; iPass++)
|
||||
if (rkMat.Pass(iPass)->TexCoordSource() != 0xFF)
|
||||
ShaderCode << "in vec3 Tex" << iPass << ";\n";
|
||||
|
||||
|
@ -396,7 +396,7 @@ bool CShaderGenerator::CreatePixelShader(const CMaterial& rkMat)
|
|||
<< " float LightmapMultiplier;\n"
|
||||
<< "};\n\n";
|
||||
|
||||
for (u32 iPass = 0; iPass < PassCount; iPass++)
|
||||
for (uint32 iPass = 0; iPass < PassCount; iPass++)
|
||||
if (rkMat.Pass(iPass)->Texture() != nullptr)
|
||||
ShaderCode << "uniform sampler2D Texture" << iPass << ";\n";
|
||||
|
||||
|
@ -413,7 +413,7 @@ bool CShaderGenerator::CreatePixelShader(const CMaterial& rkMat)
|
|||
<< " \n";
|
||||
|
||||
bool Lightmap = false;
|
||||
for (u32 iPass = 0; iPass < PassCount; iPass++)
|
||||
for (uint32 iPass = 0; iPass < PassCount; iPass++)
|
||||
{
|
||||
const CMaterialPass *pPass = rkMat.Pass(iPass);
|
||||
CFourCC PassType = pPass->Type();
|
||||
|
@ -451,7 +451,7 @@ bool CShaderGenerator::CreatePixelShader(const CMaterial& rkMat)
|
|||
if (pPass->RasSel() != eRasColorNull)
|
||||
ShaderCode << " Ras = " << gkRasSel[pPass->RasSel()] << ";\n";
|
||||
|
||||
for (u8 iInput = 0; iInput < 4; iInput++)
|
||||
for (uint8 iInput = 0; iInput < 4; iInput++)
|
||||
{
|
||||
char TevChar = iInput + 0x41; // the current stage number represented as an ASCII letter; eg 0 is 'A'
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef CUNIFORMBUFFER_H
|
||||
#define CUNIFORMBUFFER_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
class CUniformBuffer
|
||||
{
|
||||
GLuint mUniformBuffer;
|
||||
u32 mBufferSize;
|
||||
uint mBufferSize;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -17,7 +17,7 @@ public:
|
|||
SetBufferSize(0);
|
||||
}
|
||||
|
||||
CUniformBuffer(u32 Size)
|
||||
CUniformBuffer(uint Size)
|
||||
{
|
||||
glGenBuffers(1, &mUniformBuffer);
|
||||
SetBufferSize(Size);
|
||||
|
@ -52,20 +52,20 @@ public:
|
|||
Unbind();
|
||||
}
|
||||
|
||||
void BufferRange(const void *pkData, u32 Offset, u32 Size)
|
||||
void BufferRange(const void *pkData, uint Offset, uint Size)
|
||||
{
|
||||
Bind();
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, Offset, Size, pkData);
|
||||
Unbind();
|
||||
}
|
||||
|
||||
void SetBufferSize(u32 Size)
|
||||
void SetBufferSize(uint Size)
|
||||
{
|
||||
mBufferSize = Size;
|
||||
InitializeBuffer();
|
||||
}
|
||||
|
||||
u32 GetBufferSize()
|
||||
uint GetBufferSize()
|
||||
{
|
||||
return mBufferSize;
|
||||
}
|
||||
|
|
|
@ -94,12 +94,12 @@ CVertexArrayManager* CVertexArrayManager::Current()
|
|||
|
||||
void CVertexArrayManager::DeleteAllArraysForVBO(CVertexBuffer *pVBO)
|
||||
{
|
||||
for (u32 iVAM = 0; iVAM < sVAManagers.size(); iVAM++)
|
||||
for (uint32 iVAM = 0; iVAM < sVAManagers.size(); iVAM++)
|
||||
sVAManagers[iVAM]->DeleteVAO(pVBO);
|
||||
}
|
||||
|
||||
void CVertexArrayManager::DeleteAllArraysForVBO(CDynamicVertexBuffer *pVBO)
|
||||
{
|
||||
for (u32 iVAM = 0; iVAM < sVAManagers.size(); iVAM++)
|
||||
for (uint32 iVAM = 0; iVAM < sVAManagers.size(); iVAM++)
|
||||
sVAManagers[iVAM]->DeleteVAO(pVBO);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class CVertexArrayManager
|
|||
{
|
||||
std::unordered_map<CVertexBuffer*, GLuint> mVBOMap;
|
||||
std::unordered_map<CDynamicVertexBuffer*, GLuint> mDynamicVBOMap;
|
||||
u32 mVectorIndex;
|
||||
uint32 mVectorIndex;
|
||||
|
||||
static std::vector<CVertexArrayManager*> sVAManagers;
|
||||
static CVertexArrayManager *spCurrentManager;
|
||||
|
|
|
@ -21,7 +21,7 @@ CVertexBuffer::~CVertexBuffer()
|
|||
glDeleteBuffers(14, mAttribBuffers);
|
||||
}
|
||||
|
||||
u16 CVertexBuffer::AddVertex(const CVertex& rkVtx)
|
||||
uint16 CVertexBuffer::AddVertex(const CVertex& rkVtx)
|
||||
{
|
||||
if (mPositions.size() == 0xFFFF) throw std::overflow_error("VBO contains too many vertices");
|
||||
|
||||
|
@ -30,10 +30,10 @@ u16 CVertexBuffer::AddVertex(const CVertex& rkVtx)
|
|||
if (mVtxDesc & eColor0) mColors[0].push_back(rkVtx.Color[0]);
|
||||
if (mVtxDesc & eColor1) mColors[1].push_back(rkVtx.Color[1]);
|
||||
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
if (mVtxDesc & (eTex0 << iTex)) mTexCoords[iTex].push_back(rkVtx.Tex[iTex]);
|
||||
|
||||
for (u32 iMtx = 0; iMtx < 8; iMtx++)
|
||||
for (uint32 iMtx = 0; iMtx < 8; iMtx++)
|
||||
if (mVtxDesc & (ePosMtx << iMtx)) mTexCoords[iMtx].push_back(rkVtx.MatrixIndices[iMtx]);
|
||||
|
||||
if (mVtxDesc.HasAnyFlags(eBoneIndices | eBoneWeights) && mpSkin)
|
||||
|
@ -46,11 +46,11 @@ u16 CVertexBuffer::AddVertex(const CVertex& rkVtx)
|
|||
return (mPositions.size() - 1);
|
||||
}
|
||||
|
||||
u16 CVertexBuffer::AddIfUnique(const CVertex& rkVtx, u16 Start)
|
||||
uint16 CVertexBuffer::AddIfUnique(const CVertex& rkVtx, uint16 Start)
|
||||
{
|
||||
if (Start < mPositions.size())
|
||||
{
|
||||
for (u16 iVert = Start; iVert < mPositions.size(); iVert++)
|
||||
for (uint16 iVert = Start; iVert < mPositions.size(); iVert++)
|
||||
{
|
||||
// I use a bool because "continue" doesn't work properly within the iTex loop
|
||||
bool Unique = false;
|
||||
|
@ -68,7 +68,7 @@ u16 CVertexBuffer::AddIfUnique(const CVertex& rkVtx, u16 Start)
|
|||
if (rkVtx.Color[1] != mColors[1][iVert]) Unique = true;
|
||||
|
||||
if (!Unique)
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
if ((mVtxDesc & (eTex0 << iTex)))
|
||||
if (rkVtx.Tex[iTex] != mTexCoords[iTex][iVert])
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ u16 CVertexBuffer::AddIfUnique(const CVertex& rkVtx, u16 Start)
|
|||
{
|
||||
const SVertexWeights& rkWeights = mpSkin->WeightsForVertex(rkVtx.ArrayPosition);
|
||||
|
||||
for (u32 iWgt = 0; iWgt < 4; iWgt++)
|
||||
for (uint32 iWgt = 0; iWgt < 4; iWgt++)
|
||||
{
|
||||
if ( ((mVtxDesc & eBoneIndices) && (rkWeights.Indices[iWgt] != mBoneIndices[iVert][iWgt])) ||
|
||||
((mVtxDesc & eBoneWeights) && (rkWeights.Weights[iWgt] != mBoneWeights[iVert][iWgt])) )
|
||||
|
@ -98,9 +98,9 @@ u16 CVertexBuffer::AddIfUnique(const CVertex& rkVtx, u16 Start)
|
|||
return AddVertex(rkVtx);
|
||||
}
|
||||
|
||||
void CVertexBuffer::Reserve(u16 Size)
|
||||
void CVertexBuffer::Reserve(uint16 Size)
|
||||
{
|
||||
u32 ReserveSize = mPositions.size() + Size;
|
||||
uint32 ReserveSize = mPositions.size() + Size;
|
||||
|
||||
if (mVtxDesc & ePosition)
|
||||
mPositions.reserve(ReserveSize);
|
||||
|
@ -114,7 +114,7 @@ void CVertexBuffer::Reserve(u16 Size)
|
|||
if (mVtxDesc & eColor1)
|
||||
mColors[1].reserve(ReserveSize);
|
||||
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
if (mVtxDesc & (eTex0 << iTex))
|
||||
mTexCoords[iTex].reserve(ReserveSize);
|
||||
|
||||
|
@ -136,7 +136,7 @@ void CVertexBuffer::Clear()
|
|||
mColors[0].clear();
|
||||
mColors[1].clear();
|
||||
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
mTexCoords[iTex].clear();
|
||||
|
||||
mBoneIndices.clear();
|
||||
|
@ -155,7 +155,7 @@ void CVertexBuffer::Buffer()
|
|||
// Generate buffers
|
||||
glGenBuffers(14, mAttribBuffers);
|
||||
|
||||
for (u32 iAttrib = 0; iAttrib < 14; iAttrib++)
|
||||
for (uint32 iAttrib = 0; iAttrib < 14; iAttrib++)
|
||||
{
|
||||
int Attrib = (ePosition << iAttrib);
|
||||
bool HasAttrib = ((mVtxDesc & Attrib) != 0);
|
||||
|
@ -171,7 +171,7 @@ void CVertexBuffer::Buffer()
|
|||
|
||||
else if (iAttrib < 4)
|
||||
{
|
||||
u8 Index = (u8) (iAttrib - 2);
|
||||
uint8 Index = (uint8) (iAttrib - 2);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mAttribBuffers[iAttrib]);
|
||||
glBufferData(GL_ARRAY_BUFFER, mColors[Index].size() * sizeof(CColor), mColors[Index].data(), GL_STATIC_DRAW);
|
||||
|
@ -179,7 +179,7 @@ void CVertexBuffer::Buffer()
|
|||
|
||||
else if (iAttrib < 12)
|
||||
{
|
||||
u8 Index = (u8) (iAttrib - 4);
|
||||
uint8 Index = (uint8) (iAttrib - 4);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mAttribBuffers[iAttrib]);
|
||||
glBufferData(GL_ARRAY_BUFFER, mTexCoords[Index].size() * sizeof(CVector2f), mTexCoords[Index].data(), GL_STATIC_DRAW);
|
||||
|
@ -234,7 +234,7 @@ void CVertexBuffer::SetSkin(CSkin *pSkin)
|
|||
mpSkin = pSkin;
|
||||
}
|
||||
|
||||
u32 CVertexBuffer::Size()
|
||||
uint32 CVertexBuffer::Size()
|
||||
{
|
||||
return mPositions.size();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ GLuint CVertexBuffer::CreateVAO()
|
|||
glGenVertexArrays(1, &VertexArray);
|
||||
glBindVertexArray(VertexArray);
|
||||
|
||||
for (u32 iAttrib = 0; iAttrib < 14; iAttrib++)
|
||||
for (uint32 iAttrib = 0; iAttrib < 14; iAttrib++)
|
||||
{
|
||||
int Attrib = (ePosition << iAttrib);
|
||||
bool HasAttrib = ((mVtxDesc & Attrib) != 0);
|
||||
|
|
|
@ -25,9 +25,9 @@ public:
|
|||
CVertexBuffer();
|
||||
CVertexBuffer(FVertexDescription Desc);
|
||||
~CVertexBuffer();
|
||||
u16 AddVertex(const CVertex& rkVtx);
|
||||
u16 AddIfUnique(const CVertex& rkVtx, u16 Start);
|
||||
void Reserve(u16 Size);
|
||||
uint16 AddVertex(const CVertex& rkVtx);
|
||||
uint16 AddIfUnique(const CVertex& rkVtx, uint16 Start);
|
||||
void Reserve(uint16 Size);
|
||||
void Clear();
|
||||
void Buffer();
|
||||
void Bind();
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
FVertexDescription VertexDesc();
|
||||
void SetVertexDesc(FVertexDescription Desc);
|
||||
void SetSkin(CSkin *pSkin);
|
||||
u32 Size();
|
||||
uint32 Size();
|
||||
GLuint CreateVAO();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef GLCOMMON_H
|
||||
#define GLCOMMON_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
enum EBlendFactor
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define CBONETRANSFORMDATA
|
||||
|
||||
#include "Core/Resource/Animation/CSkeleton.h"
|
||||
#include <Common/types.h>
|
||||
#include <Math/CTransform4f.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Math/CTransform4f.h>
|
||||
#include <vector>
|
||||
|
||||
class CBoneTransformData
|
||||
|
@ -14,13 +14,13 @@ public:
|
|||
CBoneTransformData() { }
|
||||
CBoneTransformData(CSkeleton *pSkel) { ResizeToSkeleton(pSkel); }
|
||||
inline void ResizeToSkeleton(CSkeleton *pSkel) { mBoneMatrices.resize(pSkel ? pSkel->MaxBoneID() + 1 : 0); }
|
||||
inline CTransform4f& BoneMatrix(u32 BoneID) { return mBoneMatrices[BoneID]; }
|
||||
inline const CTransform4f& BoneMatrix(u32 BoneID) const { return mBoneMatrices[BoneID]; }
|
||||
inline CTransform4f& BoneMatrix(uint32 BoneID) { return mBoneMatrices[BoneID]; }
|
||||
inline const CTransform4f& BoneMatrix(uint32 BoneID) const { return mBoneMatrices[BoneID]; }
|
||||
inline const void* Data() const { return mBoneMatrices.data(); }
|
||||
inline u32 DataSize() const { return mBoneMatrices.size() * sizeof(CTransform4f); }
|
||||
inline u32 NumTrackedBones() const { return mBoneMatrices.size(); }
|
||||
inline CTransform4f& operator[](u32 BoneIndex) { return BoneMatrix(BoneIndex); }
|
||||
inline const CTransform4f& operator[](u32 BoneIndex) const { return BoneMatrix(BoneIndex); }
|
||||
inline uint32 DataSize() const { return mBoneMatrices.size() * sizeof(CTransform4f); }
|
||||
inline uint32 NumTrackedBones() const { return mBoneMatrices.size(); }
|
||||
inline CTransform4f& operator[](uint32 BoneIndex) { return BoneMatrix(BoneIndex); }
|
||||
inline const CTransform4f& operator[](uint32 BoneIndex) const { return BoneMatrix(BoneIndex); }
|
||||
};
|
||||
|
||||
#endif // CBONETRANSFORMDATA
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "CCamera.h"
|
||||
#include "CGraphics.h"
|
||||
#include <Math/CQuaternion.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/Math/CQuaternion.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
CCamera::CCamera()
|
||||
: mMode(eFreeCamera)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#ifndef CCAMERA_H
|
||||
#define CCAMERA_H
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/EKeyInputs.h>
|
||||
#include <Common/EMouseInputs.h>
|
||||
#include <Math/CAABox.h>
|
||||
#include <Math/CFrustumPlanes.h>
|
||||
#include <Math/CMatrix4f.h>
|
||||
#include <Math/CRay.h>
|
||||
#include <Math/CVector2i.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/Math/CAABox.h>
|
||||
#include <Common/Math/CFrustumPlanes.h>
|
||||
#include <Common/Math/CMatrix4f.h>
|
||||
#include <Common/Math/CRay.h>
|
||||
#include <Common/Math/CVector2i.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
|
||||
enum ECameraMoveMode
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "CGraphics.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include <Common/Log.h>
|
||||
#include <Math/CTransform4f.h>
|
||||
#include <Common/Math/CTransform4f.h>
|
||||
#include <iostream>
|
||||
|
||||
// ************ MEMBER INITIALIZATION ************
|
||||
|
@ -85,7 +85,7 @@ void CDrawUtil::DrawSquare(const float *pTexCoords)
|
|||
Init();
|
||||
|
||||
// Set tex coords
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
{
|
||||
EVertexAttribute TexAttrib = (EVertexAttribute) (eTex0 << (iTex *2));
|
||||
mSquareVertices.BufferAttrib(TexAttrib, pTexCoords);
|
||||
|
@ -357,7 +357,7 @@ CShader* CDrawUtil::GetTextShader()
|
|||
return mpTextShader;
|
||||
}
|
||||
|
||||
void CDrawUtil::LoadCheckerboardTexture(u32 GLTextureUnit)
|
||||
void CDrawUtil::LoadCheckerboardTexture(uint32 GLTextureUnit)
|
||||
{
|
||||
Init();
|
||||
mpCheckerTexture->Bind(GLTextureUnit);
|
||||
|
@ -390,7 +390,7 @@ void CDrawUtil::Init()
|
|||
{
|
||||
if (!mDrawUtilInitialized)
|
||||
{
|
||||
Log::Write("Initializing CDrawUtil");
|
||||
debugf("Initializing CDrawUtil");
|
||||
InitGrid();
|
||||
InitSquare();
|
||||
InitLine();
|
||||
|
@ -406,7 +406,7 @@ void CDrawUtil::Init()
|
|||
|
||||
void CDrawUtil::InitGrid()
|
||||
{
|
||||
Log::Write("Creating grid");
|
||||
debugf("Creating grid");
|
||||
|
||||
const int kGridSize = 501; // must be odd
|
||||
const float kGridSpacing = 1.f;
|
||||
|
@ -416,7 +416,7 @@ void CDrawUtil::InitGrid()
|
|||
mGridVertices.SetVertexDesc(ePosition);
|
||||
mGridVertices.Reserve(kGridSize * 4);
|
||||
|
||||
for (s32 i = MinIdx; i <= MaxIdx; i++)
|
||||
for (int32 i = MinIdx; i <= MaxIdx; i++)
|
||||
{
|
||||
if (i == 0) continue;
|
||||
mGridVertices.AddVertex(CVector3f(MinIdx * kGridSpacing, i * kGridSpacing, 0.0f));
|
||||
|
@ -432,13 +432,13 @@ void CDrawUtil::InitGrid()
|
|||
|
||||
int NumIndices = kGridSize * 4;
|
||||
mGridIndices.Reserve(NumIndices);
|
||||
for (u16 i = 0; i < NumIndices; i++) mGridIndices.AddIndex(i);
|
||||
for (uint16 i = 0; i < NumIndices; i++) mGridIndices.AddIndex(i);
|
||||
mGridIndices.SetPrimitiveType(GL_LINES);
|
||||
}
|
||||
|
||||
void CDrawUtil::InitSquare()
|
||||
{
|
||||
Log::Write("Creating square");
|
||||
debugf("Creating square");
|
||||
mSquareVertices.SetActiveAttribs(ePosition | eNormal |
|
||||
eTex0 | eTex1 | eTex2 | eTex3 |
|
||||
eTex4 | eTex5 | eTex6 | eTex7);
|
||||
|
@ -468,7 +468,7 @@ void CDrawUtil::InitSquare()
|
|||
mSquareVertices.BufferAttrib(ePosition, SquareVertices);
|
||||
mSquareVertices.BufferAttrib(eNormal, SquareNormals);
|
||||
|
||||
for (u32 iTex = 0; iTex < 8; iTex++)
|
||||
for (uint32 iTex = 0; iTex < 8; iTex++)
|
||||
{
|
||||
EVertexAttribute Attrib = (EVertexAttribute) (eTex0 << (iTex *2));
|
||||
mSquareVertices.BufferAttrib(Attrib, SquareTexCoords);
|
||||
|
@ -484,7 +484,7 @@ void CDrawUtil::InitSquare()
|
|||
|
||||
void CDrawUtil::InitLine()
|
||||
{
|
||||
Log::Write("Creating line");
|
||||
debugf("Creating line");
|
||||
mLineVertices.SetActiveAttribs(ePosition);
|
||||
mLineVertices.SetVertexCount(2);
|
||||
|
||||
|
@ -496,13 +496,13 @@ void CDrawUtil::InitLine()
|
|||
|
||||
void CDrawUtil::InitCube()
|
||||
{
|
||||
Log::Write("Creating cube");
|
||||
debugf("Creating cube");
|
||||
mpCubeModel = gpEditorStore->LoadResource("Cube.CMDL");
|
||||
}
|
||||
|
||||
void CDrawUtil::InitWireCube()
|
||||
{
|
||||
Log::Write("Creating wire cube");
|
||||
debugf("Creating wire cube");
|
||||
mWireCubeVertices.SetVertexDesc(ePosition);
|
||||
mWireCubeVertices.Reserve(8);
|
||||
mWireCubeVertices.AddVertex(CVector3f(-0.5f, -0.5f, -0.5f));
|
||||
|
@ -514,7 +514,7 @@ void CDrawUtil::InitWireCube()
|
|||
mWireCubeVertices.AddVertex(CVector3f( 0.5f, 0.5f, 0.5f));
|
||||
mWireCubeVertices.AddVertex(CVector3f(-0.5f, 0.5f, 0.5f));
|
||||
|
||||
u16 Indices[] = {
|
||||
uint16 Indices[] = {
|
||||
0, 1,
|
||||
1, 2,
|
||||
2, 3,
|
||||
|
@ -528,26 +528,26 @@ void CDrawUtil::InitWireCube()
|
|||
2, 6,
|
||||
3, 5
|
||||
};
|
||||
mWireCubeIndices.AddIndices(Indices, sizeof(Indices) / sizeof(u16));
|
||||
mWireCubeIndices.AddIndices(Indices, sizeof(Indices) / sizeof(uint16));
|
||||
mWireCubeIndices.SetPrimitiveType(GL_LINES);
|
||||
}
|
||||
|
||||
void CDrawUtil::InitSphere()
|
||||
{
|
||||
Log::Write("Creating sphere");
|
||||
debugf("Creating sphere");
|
||||
mpSphereModel = gpEditorStore->LoadResource("Sphere.CMDL");
|
||||
mpDoubleSidedSphereModel = gpEditorStore->LoadResource("SphereDoubleSided.CMDL");
|
||||
}
|
||||
|
||||
void CDrawUtil::InitWireSphere()
|
||||
{
|
||||
Log::Write("Creating wire sphere");
|
||||
debugf("Creating wire sphere");
|
||||
mpWireSphereModel = gpEditorStore->LoadResource("WireSphere.CMDL");
|
||||
}
|
||||
|
||||
void CDrawUtil::InitShaders()
|
||||
{
|
||||
Log::Write("Creating shaders");
|
||||
debugf("Creating shaders");
|
||||
mpColorShader = CShader::FromResourceFile("ColorShader");
|
||||
mpColorShaderLighting = CShader::FromResourceFile("ColorShaderLighting");
|
||||
mpBillboardShader = CShader::FromResourceFile("BillboardShader");
|
||||
|
@ -559,7 +559,7 @@ void CDrawUtil::InitShaders()
|
|||
|
||||
void CDrawUtil::InitTextures()
|
||||
{
|
||||
Log::Write("Loading textures");
|
||||
debugf("Loading textures");
|
||||
mpCheckerTexture = gpEditorStore->LoadResource("Checkerboard.TXTR");
|
||||
|
||||
mpLightTextures[0] = gpEditorStore->LoadResource("LightAmbient.TXTR");
|
||||
|
@ -577,7 +577,7 @@ void CDrawUtil::Shutdown()
|
|||
{
|
||||
if (mDrawUtilInitialized)
|
||||
{
|
||||
Log::Write("Shutting down");
|
||||
debugf("Shutting down");
|
||||
delete mpColorShader;
|
||||
delete mpColorShaderLighting;
|
||||
delete mpTextureShader;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
static void UseCollisionShader(bool IsFloor, bool IsUnstandable, const CColor& TintColor = CColor::skWhite);
|
||||
|
||||
static CShader* GetTextShader();
|
||||
static void LoadCheckerboardTexture(u32 GLTextureUnit);
|
||||
static void LoadCheckerboardTexture(uint32 GLTextureUnit);
|
||||
static CTexture* GetLightTexture(ELightType Type);
|
||||
static CTexture* GetLightMask(ELightType Type);
|
||||
static CModel* GetCubeModel();
|
||||
|
|
|
@ -9,8 +9,8 @@ CUniformBuffer* CGraphics::mpVertexBlockBuffer;
|
|||
CUniformBuffer* CGraphics::mpPixelBlockBuffer;
|
||||
CUniformBuffer* CGraphics::mpLightBlockBuffer;
|
||||
CUniformBuffer* CGraphics::mpBoneTransformBuffer;
|
||||
u32 CGraphics::mContextIndices = 0;
|
||||
u32 CGraphics::mActiveContext = -1;
|
||||
uint32 CGraphics::mContextIndices = 0;
|
||||
uint32 CGraphics::mActiveContext = -1;
|
||||
bool CGraphics::mInitialized = false;
|
||||
std::vector<CVertexArrayManager*> CGraphics::mVAMs;
|
||||
bool CGraphics::mIdentityBoneTransforms = false;
|
||||
|
@ -21,7 +21,7 @@ CGraphics::SPixelBlock CGraphics::sPixelBlock;
|
|||
CGraphics::SLightBlock CGraphics::sLightBlock;
|
||||
|
||||
CGraphics::ELightingMode CGraphics::sLightMode;
|
||||
u32 CGraphics::sNumLights;
|
||||
uint32 CGraphics::sNumLights;
|
||||
const CColor CGraphics::skDefaultAmbientColor = CColor(0.5f, 0.5f, 0.5f, 1.f);
|
||||
CColor CGraphics::sAreaAmbientColor = CColor::skBlack;
|
||||
float CGraphics::sWorldLightMultiplier;
|
||||
|
@ -36,12 +36,12 @@ void CGraphics::Initialize()
|
|||
{
|
||||
if (!mInitialized)
|
||||
{
|
||||
Log::Write("Initializing GLEW");
|
||||
debugf("Initializing GLEW");
|
||||
glewExperimental = true;
|
||||
glewInit();
|
||||
glGetError(); // This is to work around a glew bug - error is always set after initializing
|
||||
|
||||
Log::Write("Creating uniform buffers");
|
||||
debugf("Creating uniform buffers");
|
||||
mpMVPBlockBuffer = new CUniformBuffer(sizeof(sMVPBlock));
|
||||
mpVertexBlockBuffer = new CUniformBuffer(sizeof(sVertexBlock));
|
||||
mpPixelBlockBuffer = new CUniformBuffer(sizeof(sPixelBlock));
|
||||
|
@ -66,7 +66,7 @@ void CGraphics::Shutdown()
|
|||
{
|
||||
if (mInitialized)
|
||||
{
|
||||
Log::Write("Shutting down CGraphics");
|
||||
debugf("Shutting down CGraphics");
|
||||
delete mpMVPBlockBuffer;
|
||||
delete mpVertexBlockBuffer;
|
||||
delete mpPixelBlockBuffer;
|
||||
|
@ -121,11 +121,11 @@ GLuint CGraphics::BoneTransformBlockBindingPoint()
|
|||
return 4;
|
||||
}
|
||||
|
||||
u32 CGraphics::GetContextIndex()
|
||||
uint32 CGraphics::GetContextIndex()
|
||||
{
|
||||
for (u32 iCon = 0; iCon < 32; iCon++)
|
||||
for (uint32 iCon = 0; iCon < 32; iCon++)
|
||||
{
|
||||
u32 Mask = (1 << iCon);
|
||||
uint32 Mask = (1 << iCon);
|
||||
if ((mContextIndices & Mask) == 0)
|
||||
{
|
||||
mContextIndices |= Mask;
|
||||
|
@ -141,19 +141,19 @@ u32 CGraphics::GetContextIndex()
|
|||
return -1;
|
||||
}
|
||||
|
||||
u32 CGraphics::GetActiveContext()
|
||||
uint32 CGraphics::GetActiveContext()
|
||||
{
|
||||
return mActiveContext;
|
||||
}
|
||||
|
||||
void CGraphics::ReleaseContext(u32 Index)
|
||||
void CGraphics::ReleaseContext(uint32 Index)
|
||||
{
|
||||
if (Index < 32) mContextIndices &= ~(1 << Index);
|
||||
if (mActiveContext == Index) mActiveContext = -1;
|
||||
delete mVAMs[Index];
|
||||
}
|
||||
|
||||
void CGraphics::SetActiveContext(u32 Index)
|
||||
void CGraphics::SetActiveContext(uint32 Index)
|
||||
{
|
||||
mActiveContext = Index;
|
||||
mVAMs[Index]->SetCurrent();
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include "Core/OpenGL/CVertexArrayManager.h"
|
||||
#include "Core/Resource/CLight.h"
|
||||
#include <Common/CColor.h>
|
||||
#include <Math/CMatrix4f.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Math/CVector4f.h>
|
||||
#include <Common/Math/CMatrix4f.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
#include <Common/Math/CVector4f.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
/**
|
||||
|
@ -25,8 +25,8 @@ class CGraphics
|
|||
static CUniformBuffer *mpPixelBlockBuffer;
|
||||
static CUniformBuffer *mpLightBlockBuffer;
|
||||
static CUniformBuffer *mpBoneTransformBuffer;
|
||||
static u32 mContextIndices;
|
||||
static u32 mActiveContext;
|
||||
static uint32 mContextIndices;
|
||||
static uint32 mActiveContext;
|
||||
static bool mInitialized;
|
||||
static std::vector<CVertexArrayManager*> mVAMs;
|
||||
static bool mIdentityBoneTransforms;
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
// Lighting-related
|
||||
enum ELightingMode { eNoLighting, eBasicLighting, eWorldLighting };
|
||||
static ELightingMode sLightMode;
|
||||
static u32 sNumLights;
|
||||
static uint32 sNumLights;
|
||||
static const CColor skDefaultAmbientColor;
|
||||
static CColor sAreaAmbientColor;
|
||||
static float sWorldLightMultiplier;
|
||||
|
@ -99,10 +99,10 @@ public:
|
|||
static GLuint PixelBlockBindingPoint();
|
||||
static GLuint LightBlockBindingPoint();
|
||||
static GLuint BoneTransformBlockBindingPoint();
|
||||
static u32 GetContextIndex();
|
||||
static u32 GetActiveContext();
|
||||
static void ReleaseContext(u32 Index);
|
||||
static void SetActiveContext(u32 Index);
|
||||
static uint32 GetContextIndex();
|
||||
static uint32 GetActiveContext();
|
||||
static void ReleaseContext(uint32 Index);
|
||||
static void SetActiveContext(uint32 Index);
|
||||
static void SetDefaultLighting();
|
||||
static void SetupAmbientColor();
|
||||
static void SetIdentityMVP();
|
||||
|
|
|
@ -32,7 +32,7 @@ void CRenderBucket::CSubBucket::Sort(const CCamera* pkCamera, bool DebugVisualiz
|
|||
|
||||
if (DebugVisualization)
|
||||
{
|
||||
for (u32 iPtr = 0; iPtr < mSize; iPtr++)
|
||||
for (uint32 iPtr = 0; iPtr < mSize; iPtr++)
|
||||
{
|
||||
SRenderablePtr *pPtr = &mRenderables[iPtr];
|
||||
CVector3f Point = pPtr->AABox.ClosestPointAlongVector(pkCamera->Direction());
|
||||
|
@ -63,7 +63,7 @@ void CRenderBucket::CSubBucket::Draw(const SViewInfo& rkViewInfo)
|
|||
{
|
||||
FRenderOptions Options = rkViewInfo.pRenderer->RenderOptions();
|
||||
|
||||
for (u32 iPtr = 0; iPtr < mSize; iPtr++)
|
||||
for (uint32 iPtr = 0; iPtr < mSize; iPtr++)
|
||||
{
|
||||
const SRenderablePtr& rkPtr = mRenderables[iPtr];
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "CGraphics.h"
|
||||
#include "FRenderOptions.h"
|
||||
#include "SRenderablePtr.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
@ -17,8 +17,8 @@ class CRenderBucket
|
|||
class CSubBucket
|
||||
{
|
||||
std::vector<SRenderablePtr> mRenderables;
|
||||
u32 mEstSize;
|
||||
u32 mSize;
|
||||
uint32 mEstSize;
|
||||
uint32 mSize;
|
||||
|
||||
public:
|
||||
CSubBucket()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CGraphics.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include "Core/Resource/Factory/CTextureDecoder.h"
|
||||
#include <Math/CTransform4f.h>
|
||||
#include <Common/Math/CTransform4f.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
@ -13,7 +13,7 @@
|
|||
#include <sstream>
|
||||
|
||||
// ************ STATIC MEMBER INITIALIZATION ************
|
||||
u32 CRenderer::sNumRenderers = 0;
|
||||
uint32 CRenderer::sNumRenderers = 0;
|
||||
|
||||
// ************ INITIALIZATION ************
|
||||
CRenderer::CRenderer()
|
||||
|
@ -99,14 +99,14 @@ void CRenderer::SetClearColor(const CColor& rkClear)
|
|||
glClearColor(mClearColor.R, mClearColor.G, mClearColor.B, mClearColor.A);
|
||||
}
|
||||
|
||||
void CRenderer::SetViewportSize(u32 Width, u32 Height)
|
||||
void CRenderer::SetViewportSize(uint32 Width, uint32 Height)
|
||||
{
|
||||
mViewportWidth = Width;
|
||||
mViewportHeight = Height;
|
||||
mBloomHScale = ((float) Width / 640);
|
||||
mBloomVScale = ((float) Height / 528);
|
||||
mBloomWidth = (u32) (320 * mBloomHScale);
|
||||
mBloomHeight = (u32) (224 * mBloomVScale);
|
||||
mBloomWidth = (uint32) (320 * mBloomHScale);
|
||||
mBloomHeight = (uint32) (224 * mBloomVScale);
|
||||
mBloomHScale = 1.f / mBloomHScale;
|
||||
mBloomVScale = 1.f / mBloomVScale;
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ void CRenderer::RenderBloom()
|
|||
CColor::Integral(53, 53, 53),
|
||||
CColor::Integral(17, 17, 17) };
|
||||
|
||||
u32 BloomWidth = (mBloomMode == eBloom ? mBloomWidth : mViewportWidth);
|
||||
u32 BloomHeight = (mBloomMode == eBloom ? mBloomHeight : mViewportHeight);
|
||||
uint32 BloomWidth = (mBloomMode == eBloom ? mBloomWidth : mViewportWidth);
|
||||
uint32 BloomHeight = (mBloomMode == eBloom ? mBloomHeight : mViewportHeight);
|
||||
float BloomHScale = (mBloomMode == eBloom ? mBloomHScale : 0);
|
||||
float BloomVScale = (mBloomMode == eBloom ? mBloomVScale : 0);
|
||||
|
||||
|
@ -199,7 +199,7 @@ void CRenderer::RenderBloom()
|
|||
mBloomFramebuffers[0].Texture()->Bind(0);
|
||||
CDrawUtil::DrawSquare();
|
||||
|
||||
for (u32 iPass = 0; iPass < 6; iPass++)
|
||||
for (uint32 iPass = 0; iPass < 6; iPass++)
|
||||
{
|
||||
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
||||
CVector3f Translate(skHOffset[iPass] * BloomHScale, 0.f, 0.f);
|
||||
|
@ -219,7 +219,7 @@ void CRenderer::RenderBloom()
|
|||
mBloomFramebuffers[1].Texture()->Bind(0);
|
||||
CDrawUtil::DrawSquare();
|
||||
|
||||
for (u32 iPass = 0; iPass < 6; iPass++)
|
||||
for (uint32 iPass = 0; iPass < 6; iPass++)
|
||||
{
|
||||
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
||||
CVector3f Translate(0.f, skVOffset[iPass] * BloomVScale, 0.f);
|
||||
|
@ -353,4 +353,4 @@ void CRenderer::InitFramebuffer()
|
|||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
u32 gDrawCount;
|
||||
uint32 gDrawCount;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "Core/Scene/CSceneNode.h"
|
||||
|
||||
#include <Common/CColor.h>
|
||||
#include <Math/CAABox.h>
|
||||
#include <Math/CMatrix4f.h>
|
||||
#include <Common/Math/CAABox.h>
|
||||
#include <Common/Math/CMatrix4f.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
|
@ -33,10 +33,10 @@ private:
|
|||
EBloomMode mBloomMode;
|
||||
bool mDrawGrid;
|
||||
CColor mClearColor;
|
||||
u32 mContextIndex;
|
||||
uint32 mContextIndex;
|
||||
bool mInitialized;
|
||||
u32 mViewportWidth, mViewportHeight;
|
||||
u32 mBloomWidth, mBloomHeight;
|
||||
uint32 mViewportWidth, mViewportHeight;
|
||||
uint32 mBloomWidth, mBloomHeight;
|
||||
float mBloomHScale, mBloomVScale;
|
||||
|
||||
CFramebuffer mSceneFramebuffer;
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
CRenderBucket mUIBucket;
|
||||
|
||||
// Static Members
|
||||
static u32 sNumRenderers;
|
||||
static uint32 sNumRenderers;
|
||||
|
||||
public:
|
||||
// Initialization
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
void ToggleAlphaDisabled(bool Enable);
|
||||
void SetBloom(EBloomMode BloomMode);
|
||||
void SetClearColor(const CColor& rkClear);
|
||||
void SetViewportSize(u32 Width, u32 Height);
|
||||
void SetViewportSize(uint32 Width, uint32 Height);
|
||||
|
||||
// Render
|
||||
void RenderBuckets(const SViewInfo& rkViewInfo);
|
||||
|
@ -83,6 +83,6 @@ private:
|
|||
void InitFramebuffer();
|
||||
};
|
||||
|
||||
extern u32 gDrawCount;
|
||||
extern uint32 gDrawCount;
|
||||
|
||||
#endif // RENDERMANAGER_H
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "ERenderCommand.h"
|
||||
#include "FRenderOptions.h"
|
||||
#include "SViewInfo.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
|
||||
class CRenderer;
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#include "ERenderCommand.h"
|
||||
#include "IRenderable.h"
|
||||
#include <Common/types.h>
|
||||
#include <Math/CAABox.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Math/CAABox.h>
|
||||
|
||||
struct SRenderablePtr
|
||||
{
|
||||
IRenderable *pRenderable;
|
||||
u32 ComponentIndex;
|
||||
uint32 ComponentIndex;
|
||||
CAABox AABox;
|
||||
ERenderCommand Command;
|
||||
};
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
#include "Core/Resource/CCollisionMaterial.h"
|
||||
#include "Core/Scene/FShowFlags.h"
|
||||
#include <Math/CFrustumPlanes.h>
|
||||
#include <Math/CMatrix4f.h>
|
||||
#include <Math/CRay.h>
|
||||
#include <Common/Math/CFrustumPlanes.h>
|
||||
#include <Common/Math/CMatrix4f.h>
|
||||
#include <Common/Math/CRay.h>
|
||||
|
||||
struct SCollisionRenderSettings
|
||||
{
|
||||
u64 HighlightMask;
|
||||
u64 HideMask;
|
||||
uint64 HighlightMask;
|
||||
uint64 HideMask;
|
||||
|
||||
CCollisionMaterial HideMaterial;
|
||||
bool DrawWireframe;
|
||||
|
|
|
@ -9,7 +9,7 @@ class CAnimEventData : public CResource
|
|||
|
||||
struct SEvent
|
||||
{
|
||||
u32 mCharacterIndex;
|
||||
uint32 mCharacterIndex;
|
||||
CAssetID mAssetRef;
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void AddDependenciesToTree(CDependencyTree *pTree) const
|
||||
{
|
||||
for (u32 iEvt = 0; iEvt < mEvents.size(); iEvt++)
|
||||
for (uint32 iEvt = 0; iEvt < mEvents.size(); iEvt++)
|
||||
{
|
||||
const SEvent& rkEvent = mEvents[iEvt];
|
||||
CAssetID ID = rkEvent.mAssetRef;
|
||||
|
@ -43,11 +43,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
inline u32 NumEvents() const { return mEvents.size(); }
|
||||
inline u32 EventCharacterIndex(u32 EventIdx) const { return mEvents[EventIdx].mCharacterIndex; }
|
||||
inline CAssetID EventAssetRef(u32 EventIdx) const { return mEvents[EventIdx].mAssetRef; }
|
||||
inline uint32 NumEvents() const { return mEvents.size(); }
|
||||
inline uint32 EventCharacterIndex(uint32 EventIdx) const { return mEvents[EventIdx].mCharacterIndex; }
|
||||
inline CAssetID EventAssetRef(uint32 EventIdx) const { return mEvents[EventIdx].mAssetRef; }
|
||||
|
||||
inline void AddEvent(u32 CharIdx, CAssetID AssetID) { mEvents.push_back( SEvent { CharIdx, AssetID } ); }
|
||||
inline void AddEvent(uint32 CharIdx, CAssetID AssetID) { mEvents.push_back( SEvent { CharIdx, AssetID } ); }
|
||||
};
|
||||
|
||||
#endif // CANIMEVENTDATA
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include "Core/Resource/CResource.h"
|
||||
#include "Core/Resource/TResPtr.h"
|
||||
#include "Core/Resource/Model/CModel.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Animation structures
|
||||
struct SAdditiveAnim
|
||||
{
|
||||
u32 AnimID;
|
||||
uint32 AnimID;
|
||||
float FadeInTime;
|
||||
float FadeOutTime;
|
||||
};
|
||||
|
@ -32,15 +32,15 @@ struct SAnimation
|
|||
|
||||
struct STransition
|
||||
{
|
||||
u32 Unknown;
|
||||
u32 AnimIdA;
|
||||
u32 AnimIdB;
|
||||
uint32 Unknown;
|
||||
uint32 AnimIdA;
|
||||
uint32 AnimIdB;
|
||||
IMetaTransition *pMetaTrans;
|
||||
};
|
||||
|
||||
struct SHalfTransition
|
||||
{
|
||||
u32 AnimID;
|
||||
uint32 AnimID;
|
||||
IMetaTransition *pMetaTrans;
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ struct SOverlayModel
|
|||
|
||||
struct SSetCharacter
|
||||
{
|
||||
u32 ID;
|
||||
uint32 ID;
|
||||
TString Name;
|
||||
TResPtr<CModel> pModel;
|
||||
TResPtr<CSkin> pSkin;
|
||||
|
@ -79,7 +79,7 @@ struct SSetCharacter
|
|||
std::vector<CAssetID> SoundEffects;
|
||||
std::vector<CAssetID> DKDependencies;
|
||||
CAssetID SpatialPrimitives;
|
||||
std::set<u32> UsedAnimationIndices;
|
||||
std::set<uint32> UsedAnimationIndices;
|
||||
};
|
||||
|
||||
class CAnimSet : public CResource
|
||||
|
@ -109,19 +109,19 @@ public:
|
|||
|
||||
~CAnimSet()
|
||||
{
|
||||
for (u32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
delete mAnimations[iAnim].pMetaAnim;
|
||||
|
||||
for (u32 iTrans = 0; iTrans < mTransitions.size(); iTrans++)
|
||||
for (uint32 iTrans = 0; iTrans < mTransitions.size(); iTrans++)
|
||||
delete mTransitions[iTrans].pMetaTrans;
|
||||
|
||||
for (u32 iHalf = 0; iHalf < mHalfTransitions.size(); iHalf++)
|
||||
for (uint32 iHalf = 0; iHalf < mHalfTransitions.size(); iHalf++)
|
||||
delete mHalfTransitions[iHalf].pMetaTrans;
|
||||
|
||||
delete mpDefaultTransition;
|
||||
|
||||
// For MP2, anim events need to be cleaned up manually
|
||||
for (u32 iEvent = 0; iEvent < mAnimEvents.size(); iEvent++)
|
||||
for (uint32 iEvent = 0; iEvent < mAnimEvents.size(); iEvent++)
|
||||
{
|
||||
ASSERT(mAnimEvents[iEvent] && !mAnimEvents[iEvent]->Entry());
|
||||
delete mAnimEvents[iEvent];
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
CDependencyTree *pTree = new CDependencyTree();
|
||||
|
||||
// Character dependencies
|
||||
for (u32 iChar = 0; iChar < mCharacters.size(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < mCharacters.size(); iChar++)
|
||||
{
|
||||
CSetCharacterDependency *pCharTree = CSetCharacterDependency::BuildTree( mCharacters[iChar] );
|
||||
ASSERT(pCharTree);
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
// Animation dependencies
|
||||
if (Game() <= EGame::Echoes)
|
||||
{
|
||||
for (u32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
{
|
||||
CSetAnimationDependency *pAnimTree = CSetAnimationDependency::BuildTree(this, iAnim);
|
||||
ASSERT(pAnimTree);
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
std::set<CAnimPrimitive> PrimitiveSet;
|
||||
|
||||
// Animations
|
||||
for (u32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
{
|
||||
const SAnimation& rkAnim = mAnimations[iAnim];
|
||||
rkAnim.pMetaAnim->GetUniquePrimitives(PrimitiveSet);
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
}
|
||||
|
||||
// Event sounds
|
||||
for (u32 iSound = 0; iSound < rkChar.SoundEffects.size(); iSound++)
|
||||
for (uint32 iSound = 0; iSound < rkChar.SoundEffects.size(); iSound++)
|
||||
{
|
||||
pTree->AddDependency(rkChar.SoundEffects[iSound]);
|
||||
}
|
||||
|
@ -184,14 +184,14 @@ public:
|
|||
{
|
||||
const SSetCharacter& rkChar = mCharacters[0];
|
||||
|
||||
for (u32 iDep = 0; iDep < rkChar.DKDependencies.size(); iDep++)
|
||||
for (uint32 iDep = 0; iDep < rkChar.DKDependencies.size(); iDep++)
|
||||
pTree->AddDependency(rkChar.DKDependencies[iDep]);
|
||||
}
|
||||
|
||||
return pTree;
|
||||
}
|
||||
|
||||
CAnimation* FindAnimationAsset(u32 AnimID) const
|
||||
CAnimation* FindAnimationAsset(uint32 AnimID) const
|
||||
{
|
||||
if (AnimID >= 0 && AnimID < mAnimPrimitives.size())
|
||||
{
|
||||
|
@ -204,27 +204,27 @@ public:
|
|||
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
{
|
||||
for (u32 iAnim = 0; iAnim < mAnimPrimitives.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimPrimitives.size(); iAnim++)
|
||||
rPrimSet.insert(mAnimPrimitives[iAnim]);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
inline u32 NumCharacters() const { return mCharacters.size(); }
|
||||
inline u32 NumAnimations() const { return mAnimations.size(); }
|
||||
inline uint32 NumCharacters() const { return mCharacters.size(); }
|
||||
inline uint32 NumAnimations() const { return mAnimations.size(); }
|
||||
|
||||
inline const SSetCharacter* Character(u32 Index) const
|
||||
inline const SSetCharacter* Character(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < NumCharacters());
|
||||
return &mCharacters[Index];
|
||||
}
|
||||
|
||||
inline const SAnimation* Animation(u32 Index) const
|
||||
inline const SAnimation* Animation(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < NumAnimations());
|
||||
return &mAnimations[Index];
|
||||
}
|
||||
|
||||
CAnimEventData* AnimationEventData(u32 Index) const
|
||||
CAnimEventData* AnimationEventData(uint32 Index) const
|
||||
{
|
||||
ASSERT(Index >= 0 && Index < NumAnimations());
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "CAnimation.h"
|
||||
#include <Math/CTransform4f.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/Math/CTransform4f.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
CAnimation::CAnimation(CResourceEntry *pEntry /*= 0*/)
|
||||
: CResource(pEntry)
|
||||
|
@ -8,7 +8,7 @@ CAnimation::CAnimation(CResourceEntry *pEntry /*= 0*/)
|
|||
, mTickInterval(0.0333333f)
|
||||
, mNumKeys(0)
|
||||
{
|
||||
for (u32 iBone = 0; iBone < 100; iBone++)
|
||||
for (uint32 iBone = 0; iBone < 100; iBone++)
|
||||
{
|
||||
mBoneInfo[iBone].TranslationChannelIdx = 0xFF;
|
||||
mBoneInfo[iBone].RotationChannelIdx = 0xFF;
|
||||
|
@ -23,7 +23,7 @@ CDependencyTree* CAnimation::BuildDependencyTree() const
|
|||
return pTree;
|
||||
}
|
||||
|
||||
void CAnimation::EvaluateTransform(float Time, u32 BoneID, CVector3f *pOutTranslation, CQuaternion *pOutRotation, CVector3f *pOutScale) const
|
||||
void CAnimation::EvaluateTransform(float Time, uint32 BoneID, CVector3f *pOutTranslation, CQuaternion *pOutRotation, CVector3f *pOutScale) const
|
||||
{
|
||||
const bool kInterpolate = true;
|
||||
if (!pOutTranslation && !pOutRotation && !pOutScale) return;
|
||||
|
@ -32,12 +32,12 @@ void CAnimation::EvaluateTransform(float Time, u32 BoneID, CVector3f *pOutTransl
|
|||
if (Time >= mDuration) Time = mDuration;
|
||||
if (Time >= FLT_EPSILON) Time -= FLT_EPSILON;
|
||||
float t = fmodf(Time, mTickInterval) / mTickInterval;
|
||||
u32 LowKey = (u32) (Time / mTickInterval);
|
||||
uint32 LowKey = (uint32) (Time / mTickInterval);
|
||||
if (LowKey == (mNumKeys - 1)) LowKey = mNumKeys - 2;
|
||||
|
||||
u8 ScaleChannel = mBoneInfo[BoneID].ScaleChannelIdx;
|
||||
u8 RotChannel = mBoneInfo[BoneID].RotationChannelIdx;
|
||||
u8 TransChannel = mBoneInfo[BoneID].TranslationChannelIdx;
|
||||
uint8 ScaleChannel = mBoneInfo[BoneID].ScaleChannelIdx;
|
||||
uint8 RotChannel = mBoneInfo[BoneID].RotationChannelIdx;
|
||||
uint8 TransChannel = mBoneInfo[BoneID].TranslationChannelIdx;
|
||||
|
||||
if (ScaleChannel != 0xFF && pOutScale)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ void CAnimation::EvaluateTransform(float Time, u32 BoneID, CVector3f *pOutTransl
|
|||
}
|
||||
}
|
||||
|
||||
bool CAnimation::HasTranslation(u32 BoneID) const
|
||||
bool CAnimation::HasTranslation(uint32 BoneID) const
|
||||
{
|
||||
return (mBoneInfo[BoneID].TranslationChannelIdx != 0xFF);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "Core/Resource/CResource.h"
|
||||
#include "Core/Resource/TResPtr.h"
|
||||
#include "Core/Resource/Animation/CAnimEventData.h"
|
||||
#include <Math/CQuaternion.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/Math/CQuaternion.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
#include <vector>
|
||||
|
||||
class CAnimation : public CResource
|
||||
|
@ -19,7 +19,7 @@ class CAnimation : public CResource
|
|||
|
||||
float mDuration;
|
||||
float mTickInterval;
|
||||
u32 mNumKeys;
|
||||
uint32 mNumKeys;
|
||||
|
||||
std::vector<TScaleChannel> mScaleChannels;
|
||||
std::vector<TRotationChannel> mRotationChannels;
|
||||
|
@ -27,9 +27,9 @@ class CAnimation : public CResource
|
|||
|
||||
struct SBoneChannelInfo
|
||||
{
|
||||
u8 ScaleChannelIdx;
|
||||
u8 RotationChannelIdx;
|
||||
u8 TranslationChannelIdx;
|
||||
uint8 ScaleChannelIdx;
|
||||
uint8 RotationChannelIdx;
|
||||
uint8 TranslationChannelIdx;
|
||||
};
|
||||
SBoneChannelInfo mBoneInfo[100];
|
||||
|
||||
|
@ -38,11 +38,11 @@ class CAnimation : public CResource
|
|||
public:
|
||||
CAnimation(CResourceEntry *pEntry = 0);
|
||||
CDependencyTree* BuildDependencyTree() const;
|
||||
void EvaluateTransform(float Time, u32 BoneID, CVector3f *pOutTranslation, CQuaternion *pOutRotation, CVector3f *pOutScale) const;
|
||||
bool HasTranslation(u32 BoneID) const;
|
||||
void EvaluateTransform(float Time, uint32 BoneID, CVector3f *pOutTranslation, CQuaternion *pOutRotation, CVector3f *pOutScale) const;
|
||||
bool HasTranslation(uint32 BoneID) const;
|
||||
|
||||
inline float Duration() const { return mDuration; }
|
||||
inline u32 NumKeys() const { return mNumKeys; }
|
||||
inline uint32 NumKeys() const { return mNumKeys; }
|
||||
inline float TickInterval() const { return mTickInterval; }
|
||||
inline CAnimEventData* EventData() const { return mpEventData; }
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ CAnimationParameters::CAnimationParameters(IInputStream& rSCLY, EGame Game)
|
|||
|
||||
else if (Game == EGame::DKCReturns)
|
||||
{
|
||||
u8 Flags = rSCLY.ReadByte();
|
||||
uint8 Flags = rSCLY.ReadByte();
|
||||
|
||||
// 0x80 - CharacterAnimationSet is empty.
|
||||
if (Flags & 0x80)
|
||||
|
@ -114,11 +114,11 @@ void CAnimationParameters::Write(IOutputStream& rSCLY)
|
|||
else
|
||||
{
|
||||
if (!mCharacterID.IsValid())
|
||||
rSCLY.WriteByte((u8) 0x80);
|
||||
rSCLY.WriteByte((uint8) 0x80);
|
||||
|
||||
else
|
||||
{
|
||||
u8 Flag = 0;
|
||||
uint8 Flag = 0;
|
||||
if (mAnimIndex != -1) Flag |= 0x20;
|
||||
if (mUnknown2 != 0 || mUnknown3 != 0) Flag |= 0x40;
|
||||
|
||||
|
@ -156,7 +156,7 @@ void CAnimationParameters::Serialize(IArchive& rArc)
|
|||
}
|
||||
}
|
||||
|
||||
const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(s32 NodeIndex /*= -1*/)
|
||||
const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(int32 NodeIndex /*= -1*/)
|
||||
{
|
||||
CAnimSet *pSet = AnimSet();
|
||||
|
||||
|
@ -165,27 +165,27 @@ const SSetCharacter* CAnimationParameters::GetCurrentSetCharacter(s32 NodeIndex
|
|||
if (NodeIndex == -1)
|
||||
NodeIndex = mCharIndex;
|
||||
|
||||
if (mCharIndex != -1 && pSet->NumCharacters() > (u32) NodeIndex)
|
||||
if (mCharIndex != -1 && pSet->NumCharacters() > (uint32) NodeIndex)
|
||||
return pSet->Character(NodeIndex);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CModel* CAnimationParameters::GetCurrentModel(s32 NodeIndex /*= -1*/)
|
||||
CModel* CAnimationParameters::GetCurrentModel(int32 NodeIndex /*= -1*/)
|
||||
{
|
||||
const SSetCharacter *pkChar = GetCurrentSetCharacter(NodeIndex);
|
||||
return pkChar ? pkChar->pModel : nullptr;
|
||||
}
|
||||
|
||||
TString CAnimationParameters::GetCurrentCharacterName(s32 NodeIndex /*= -1*/)
|
||||
TString CAnimationParameters::GetCurrentCharacterName(int32 NodeIndex /*= -1*/)
|
||||
{
|
||||
const SSetCharacter *pkChar = GetCurrentSetCharacter(NodeIndex);
|
||||
return pkChar ? pkChar->Name : "";
|
||||
}
|
||||
|
||||
// ************ ACCESSORS ************
|
||||
u32 CAnimationParameters::Unknown(u32 Index)
|
||||
uint32 CAnimationParameters::Unknown(uint32 Index)
|
||||
{
|
||||
// mAnimIndex isn't unknown, but I'm too lazy to move it because there's a lot
|
||||
// of UI stuff that depends on these functions atm for accessing and editing parameters.
|
||||
|
@ -214,14 +214,14 @@ void CAnimationParameters::SetResource(const CAssetID& rkID)
|
|||
CResourceEntry *pEntry = gpResourceStore->FindEntry(rkID);
|
||||
|
||||
if (!pEntry)
|
||||
Log::Error("Invalid resource ID passed to CAnimationParameters: " + rkID.ToString());
|
||||
errorf("Invalid resource ID passed to CAnimationParameters: %s", *rkID.ToString());
|
||||
else if (pEntry->ResourceType() != eAnimSet && pEntry->ResourceType() != eCharacter)
|
||||
Log::Error("Resource with invalid type passed to CAnimationParameters: " + pEntry->CookedAssetPath().GetFileName());
|
||||
errorf("Resource with invalid type passed to CAnimationParameters: %s", *pEntry->CookedAssetPath().GetFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimationParameters::SetUnknown(u32 Index, u32 Value)
|
||||
void CAnimationParameters::SetUnknown(uint32 Index, uint32 Value)
|
||||
{
|
||||
switch (Index)
|
||||
{
|
||||
|
|
|
@ -10,10 +10,10 @@ class CAnimationParameters
|
|||
EGame mGame;
|
||||
CAssetID mCharacterID;
|
||||
|
||||
u32 mCharIndex;
|
||||
u32 mAnimIndex;
|
||||
u32 mUnknown2;
|
||||
u32 mUnknown3;
|
||||
uint32 mCharIndex;
|
||||
uint32 mAnimIndex;
|
||||
uint32 mUnknown2;
|
||||
uint32 mUnknown3;
|
||||
|
||||
public:
|
||||
CAnimationParameters();
|
||||
|
@ -22,18 +22,18 @@ public:
|
|||
void Write(IOutputStream& rSCLY);
|
||||
void Serialize(IArchive& rArc);
|
||||
|
||||
const SSetCharacter* GetCurrentSetCharacter(s32 NodeIndex = -1);
|
||||
CModel* GetCurrentModel(s32 NodeIndex = -1);
|
||||
TString GetCurrentCharacterName(s32 NodeIndex = -1);
|
||||
const SSetCharacter* GetCurrentSetCharacter(int32 NodeIndex = -1);
|
||||
CModel* GetCurrentModel(int32 NodeIndex = -1);
|
||||
TString GetCurrentCharacterName(int32 NodeIndex = -1);
|
||||
|
||||
// Accessors
|
||||
inline EGame Version() const { return mGame; }
|
||||
inline CAssetID ID() const { return mCharacterID; }
|
||||
inline CAnimSet* AnimSet() const { return (CAnimSet*) gpResourceStore->LoadResource(mCharacterID); }
|
||||
inline u32 CharacterIndex() const { return mCharIndex; }
|
||||
inline u32 AnimIndex() const { return mAnimIndex; }
|
||||
inline void SetCharIndex(u32 Index) { mCharIndex = Index; }
|
||||
inline void SetAnimIndex(u32 Index) { mAnimIndex = Index; }
|
||||
inline uint32 CharacterIndex() const { return mCharIndex; }
|
||||
inline uint32 AnimIndex() const { return mAnimIndex; }
|
||||
inline void SetCharIndex(uint32 Index) { mCharIndex = Index; }
|
||||
inline void SetAnimIndex(uint32 Index) { mAnimIndex = Index; }
|
||||
|
||||
inline void SetGame(EGame Game)
|
||||
{
|
||||
|
@ -49,9 +49,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
u32 Unknown(u32 Index);
|
||||
uint32 Unknown(uint32 Index);
|
||||
void SetResource(const CAssetID& rkID);
|
||||
void SetUnknown(u32 Index, u32 Value);
|
||||
void SetUnknown(uint32 Index, uint32 Value);
|
||||
|
||||
// Operators
|
||||
inline CAnimationParameters& operator=(const CAnimationParameters& rkOther)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "Core/Render/CBoneTransformData.h"
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include "Core/Render/CGraphics.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <Common/Math/MathUtil.h>
|
||||
|
||||
// ************ CBone ************
|
||||
CBone::CBone(CSkeleton *pSkel)
|
||||
|
@ -37,7 +37,7 @@ void CBone::UpdateTransform(CBoneTransformData& rData, const SBoneTransformInfo&
|
|||
rTransform *= mInvBind;
|
||||
|
||||
// Calculate children
|
||||
for (u32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < mChildren.size(); iChild++)
|
||||
mChildren[iChild]->UpdateTransform(rData, TransformInfo, pAnim, Time, AnchorRoot);
|
||||
}
|
||||
|
||||
|
@ -70,13 +70,13 @@ CSkeleton::CSkeleton(CResourceEntry *pEntry /*= 0*/)
|
|||
|
||||
CSkeleton::~CSkeleton()
|
||||
{
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
delete mBones[iBone];
|
||||
}
|
||||
|
||||
CBone* CSkeleton::BoneByID(u32 BoneID) const
|
||||
CBone* CSkeleton::BoneByID(uint32 BoneID) const
|
||||
{
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
if (mBones[iBone]->ID() == BoneID)
|
||||
return mBones[iBone];
|
||||
|
@ -87,7 +87,7 @@ CBone* CSkeleton::BoneByID(u32 BoneID) const
|
|||
|
||||
CBone* CSkeleton::BoneByName(const TString& rkBoneName) const
|
||||
{
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
if (mBones[iBone]->Name() == rkBoneName)
|
||||
return mBones[iBone];
|
||||
|
@ -96,11 +96,11 @@ CBone* CSkeleton::BoneByName(const TString& rkBoneName) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
u32 CSkeleton::MaxBoneID() const
|
||||
uint32 CSkeleton::MaxBoneID() const
|
||||
{
|
||||
u32 ID = 0;
|
||||
uint32 ID = 0;
|
||||
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
if (mBones[iBone]->ID() > ID)
|
||||
ID = mBones[iBone]->ID();
|
||||
|
@ -121,7 +121,7 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
|
|||
glLineWidth(1.f);
|
||||
|
||||
// Draw all child links first to minimize model matrix swaps.
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
CBone *pBone = mBones[iBone];
|
||||
CVector3f BonePos = pkData ? pBone->TransformedPosition(*pkData) : pBone->Position();
|
||||
|
@ -136,7 +136,7 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
|
|||
}
|
||||
|
||||
// Draw child links
|
||||
for (u32 iChild = 0; iChild < pBone->NumChildren(); iChild++)
|
||||
for (uint32 iChild = 0; iChild < pBone->NumChildren(); iChild++)
|
||||
{
|
||||
CBone *pChild = pBone->ChildByIndex(iChild);
|
||||
CVector3f ChildPos = pkData ? pChild->TransformedPosition(*pkData) : pChild->Position();
|
||||
|
@ -147,7 +147,7 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
|
|||
// Draw bone spheres
|
||||
CTransform4f BaseTransform = CGraphics::sMVPBlock.ModelMatrix;
|
||||
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
CBone *pBone = mBones[iBone];
|
||||
CVector3f BonePos = pkData ? pBone->TransformedPosition(*pkData) : pBone->Position();
|
||||
|
@ -161,11 +161,11 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<s32,float> CSkeleton::RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData)
|
||||
std::pair<int32,float> CSkeleton::RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData)
|
||||
{
|
||||
std::pair<s32,float> Out(-1, FLT_MAX);
|
||||
std::pair<int32,float> Out(-1, FLT_MAX);
|
||||
|
||||
for (u32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
for (uint32 iBone = 0; iBone < mBones.size(); iBone++)
|
||||
{
|
||||
CBone *pBone = mBones[iBone];
|
||||
CVector3f BonePos = pBone->TransformedPosition(rkData);
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#include "CAnimation.h"
|
||||
#include "Core/Render/FRenderOptions.h"
|
||||
#include "Core/Resource/CResource.h"
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <Math/CRay.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/Math/CRay.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
|
||||
class CBoneTransformData;
|
||||
class CBone;
|
||||
|
@ -36,14 +36,14 @@ public:
|
|||
CSkeleton(CResourceEntry *pEntry = 0);
|
||||
~CSkeleton();
|
||||
void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot);
|
||||
CBone* BoneByID(u32 BoneID) const;
|
||||
CBone* BoneByID(uint32 BoneID) const;
|
||||
CBone* BoneByName(const TString& rkBoneName) const;
|
||||
u32 MaxBoneID() const;
|
||||
uint32 MaxBoneID() const;
|
||||
|
||||
void Draw(FRenderOptions Options, const CBoneTransformData *pkData);
|
||||
std::pair<s32,float> RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData);
|
||||
std::pair<int32,float> RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData);
|
||||
|
||||
inline u32 NumBones() const { return mBones.size(); }
|
||||
inline uint32 NumBones() const { return mBones.size(); }
|
||||
inline CBone* RootBone() const { return mpRootBone; }
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ class CBone
|
|||
CSkeleton *mpSkeleton;
|
||||
CBone *mpParent;
|
||||
std::vector<CBone*> mChildren;
|
||||
u32 mID;
|
||||
uint32 mID;
|
||||
CVector3f mPosition;
|
||||
CVector3f mLocalPosition;
|
||||
CQuaternion mRotation;
|
||||
|
@ -73,9 +73,9 @@ public:
|
|||
// Accessors
|
||||
inline CSkeleton* Skeleton() const { return mpSkeleton; }
|
||||
inline CBone* Parent() const { return mpParent; }
|
||||
inline u32 NumChildren() const { return mChildren.size(); }
|
||||
inline CBone* ChildByIndex(u32 Index) const { return mChildren[Index]; }
|
||||
inline u32 ID() const { return mID; }
|
||||
inline uint32 NumChildren() const { return mChildren.size(); }
|
||||
inline CBone* ChildByIndex(uint32 Index) const { return mChildren[Index]; }
|
||||
inline uint32 ID() const { return mID; }
|
||||
inline CVector3f Position() const { return mPosition; }
|
||||
inline CVector3f LocalPosition() const { return mLocalPosition; }
|
||||
inline CQuaternion Rotation() const { return mRotation; }
|
||||
|
|
|
@ -18,14 +18,14 @@ class CSkin : public CResource
|
|||
struct SVertGroup
|
||||
{
|
||||
SVertexWeights Weights;
|
||||
u32 NumVertices;
|
||||
uint32 NumVertices;
|
||||
};
|
||||
std::vector<SVertGroup> mVertGroups;
|
||||
|
||||
public:
|
||||
CSkin(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
||||
|
||||
const SVertexWeights& WeightsForVertex(u32 VertIdx)
|
||||
const SVertexWeights& WeightsForVertex(uint32 VertIdx)
|
||||
{
|
||||
// Null weights bind everything to the root bone in case there is no matching vertex group
|
||||
static const SVertexWeights skNullWeights = {
|
||||
|
@ -33,9 +33,9 @@ public:
|
|||
{ 1.f, 0.f, 0.f, 0.f }
|
||||
};
|
||||
|
||||
u32 Index = 0;
|
||||
uint32 Index = 0;
|
||||
|
||||
for (u32 iGrp = 0; iGrp < mVertGroups.size(); iGrp++)
|
||||
for (uint32 iGrp = 0; iGrp < mVertGroups.size(); iGrp++)
|
||||
{
|
||||
if (VertIdx < Index + mVertGroups[iGrp].NumVertices)
|
||||
return mVertGroups[iGrp].Weights;
|
||||
|
|
|
@ -34,10 +34,10 @@ public:
|
|||
|
||||
~CSourceAnimData()
|
||||
{
|
||||
for (u32 TransIdx = 0; TransIdx < mTransitions.size(); TransIdx++)
|
||||
for (uint32 TransIdx = 0; TransIdx < mTransitions.size(); TransIdx++)
|
||||
delete mTransitions[TransIdx].pTransition;
|
||||
|
||||
for (u32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
for (uint32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
delete mHalfTransitions[HalfIdx].pTransition;
|
||||
|
||||
delete mpDefaultTransition;
|
||||
|
@ -54,10 +54,10 @@ public:
|
|||
|
||||
void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
{
|
||||
for (u32 TransIdx = 0; TransIdx < mTransitions.size(); TransIdx++)
|
||||
for (uint32 TransIdx = 0; TransIdx < mTransitions.size(); TransIdx++)
|
||||
mTransitions[TransIdx].pTransition->GetUniquePrimitives(rPrimSet);
|
||||
|
||||
for (u32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
for (uint32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
mHalfTransitions[HalfIdx].pTransition->GetUniquePrimitives(rPrimSet);
|
||||
|
||||
if (mpDefaultTransition)
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
UsedTransitions.insert(mpDefaultTransition);
|
||||
}
|
||||
|
||||
for (u32 TransitionIdx = 0; TransitionIdx < mTransitions.size(); TransitionIdx++)
|
||||
for (uint32 TransitionIdx = 0; TransitionIdx < mTransitions.size(); TransitionIdx++)
|
||||
{
|
||||
const STransition& rkTransition = mTransitions[TransitionIdx];
|
||||
IMetaTransition *pTransition = rkTransition.pTransition;
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
for (u32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
for (uint32 HalfIdx = 0; HalfIdx < mHalfTransitions.size(); HalfIdx++)
|
||||
{
|
||||
const SHalfTransition& rkHalfTrans = mHalfTransitions[HalfIdx];
|
||||
IMetaTransition *pTransition = rkHalfTrans.pTransition;
|
||||
|
|
|
@ -23,13 +23,13 @@ IMetaAnimation* CMetaAnimFactory::LoadFromStream(IInputStream& rInput, EGame Gam
|
|||
return new CMetaAnimSequence(rInput, Game);
|
||||
|
||||
default:
|
||||
Log::Error("Unrecognized meta-animation type: " + TString::FromInt32(Type, 0, 10));
|
||||
errorf("Unrecognized meta-animation type: %d", Type);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// ************ CMetaAnimationPlay ************
|
||||
CMetaAnimPlay::CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, u32 UnkB)
|
||||
CMetaAnimPlay::CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB)
|
||||
: mPrimitive(rkPrimitive)
|
||||
, mUnknownA(UnkA)
|
||||
, mUnknownB(UnkB)
|
||||
|
@ -84,10 +84,10 @@ void CMetaAnimBlend::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) con
|
|||
// ************ CMetaAnimRandom ************
|
||||
CMetaAnimRandom::CMetaAnimRandom(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
u32 NumPairs = rInput.ReadLong();
|
||||
uint32 NumPairs = rInput.ReadLong();
|
||||
mProbabilityPairs.reserve(NumPairs);
|
||||
|
||||
for (u32 iAnim = 0; iAnim < NumPairs; iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < NumPairs; iAnim++)
|
||||
{
|
||||
SAnimProbabilityPair Pair;
|
||||
Pair.pAnim = gMetaAnimFactory.LoadFromStream(rInput, Game);
|
||||
|
@ -98,7 +98,7 @@ CMetaAnimRandom::CMetaAnimRandom(IInputStream& rInput, EGame Game)
|
|||
|
||||
CMetaAnimRandom::~CMetaAnimRandom()
|
||||
{
|
||||
for (u32 iPair = 0; iPair < mProbabilityPairs.size(); iPair++)
|
||||
for (uint32 iPair = 0; iPair < mProbabilityPairs.size(); iPair++)
|
||||
delete mProbabilityPairs[iPair].pAnim;
|
||||
}
|
||||
|
||||
|
@ -109,17 +109,17 @@ EMetaAnimationType CMetaAnimRandom::Type() const
|
|||
|
||||
void CMetaAnimRandom::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
{
|
||||
for (u32 iPair = 0; iPair < mProbabilityPairs.size(); iPair++)
|
||||
for (uint32 iPair = 0; iPair < mProbabilityPairs.size(); iPair++)
|
||||
mProbabilityPairs[iPair].pAnim->GetUniquePrimitives(rPrimSet);
|
||||
}
|
||||
|
||||
// ************ CMetaAnimSequence ************
|
||||
CMetaAnimSequence::CMetaAnimSequence(IInputStream& rInput, EGame Game)
|
||||
{
|
||||
u32 NumAnims = rInput.ReadLong();
|
||||
uint32 NumAnims = rInput.ReadLong();
|
||||
mAnimations.reserve(NumAnims);
|
||||
|
||||
for (u32 iAnim = 0; iAnim < NumAnims; iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < NumAnims; iAnim++)
|
||||
{
|
||||
IMetaAnimation *pAnim = gMetaAnimFactory.LoadFromStream(rInput, Game);
|
||||
mAnimations.push_back(pAnim);
|
||||
|
@ -128,7 +128,7 @@ CMetaAnimSequence::CMetaAnimSequence(IInputStream& rInput, EGame Game)
|
|||
|
||||
CMetaAnimSequence::~CMetaAnimSequence()
|
||||
{
|
||||
for (u32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
delete mAnimations[iAnim];
|
||||
}
|
||||
|
||||
|
@ -139,6 +139,6 @@ EMetaAnimationType CMetaAnimSequence::Type() const
|
|||
|
||||
void CMetaAnimSequence::GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const
|
||||
{
|
||||
for (u32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
||||
mAnimations[iAnim]->GetUniquePrimitives(rPrimSet);
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ extern CMetaAnimFactory gMetaAnimFactory;
|
|||
class CAnimPrimitive
|
||||
{
|
||||
TResPtr<CAnimation> mpAnim;
|
||||
u32 mID;
|
||||
uint32 mID;
|
||||
TString mName;
|
||||
|
||||
public:
|
||||
CAnimPrimitive() : mID(0) {}
|
||||
|
||||
CAnimPrimitive(const CAssetID& rkAnimAssetID, u32 CharAnimID, const TString& rkAnimName)
|
||||
CAnimPrimitive(const CAssetID& rkAnimAssetID, uint32 CharAnimID, const TString& rkAnimName)
|
||||
: mID(CharAnimID), mName(rkAnimName)
|
||||
{
|
||||
mpAnim = gpResourceStore->LoadResource(rkAnimAssetID);
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
// Accessors
|
||||
CAnimation* Animation() const { return mpAnim; }
|
||||
u32 ID() const { return mID; }
|
||||
uint32 ID() const { return mID; }
|
||||
TString Name() const { return mName; }
|
||||
};
|
||||
|
||||
|
@ -73,10 +73,10 @@ class CMetaAnimPlay : public IMetaAnimation
|
|||
protected:
|
||||
CAnimPrimitive mPrimitive;
|
||||
float mUnknownA;
|
||||
u32 mUnknownB;
|
||||
uint32 mUnknownB;
|
||||
|
||||
public:
|
||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, u32 UnkB);
|
||||
CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB);
|
||||
CMetaAnimPlay(IInputStream& rInput, EGame Game);
|
||||
virtual EMetaAnimationType Type() const;
|
||||
virtual void GetUniquePrimitives(std::set<CAnimPrimitive>& rPrimSet) const;
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
// Accessors
|
||||
inline CAnimPrimitive Primitive() const { return mPrimitive; }
|
||||
inline float UnknownA() const { return mUnknownA; }
|
||||
inline u32 UnknownB() const { return mUnknownB; }
|
||||
inline uint32 UnknownB() const { return mUnknownB; }
|
||||
};
|
||||
|
||||
// CMetaAnimBlend - blend between two animations
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
struct SAnimProbabilityPair
|
||||
{
|
||||
IMetaAnimation *pAnim;
|
||||
u32 Probability;
|
||||
uint32 Probability;
|
||||
};
|
||||
|
||||
// CMetaAnimRandom - play random animation
|
||||
|
|
|
@ -24,7 +24,7 @@ IMetaTransition* CMetaTransFactory::LoadFromStream(IInputStream& rInput, EGame G
|
|||
return new CMetaTransType4(rInput, Game);
|
||||
|
||||
default:
|
||||
Log::Error("Unrecognized meta-transition type: " + TString::FromInt32(Type, 0, 10));
|
||||
errorf("Unrecognized meta-transition type: %d", Type);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ class CMetaTransTrans : public IMetaTransition
|
|||
{
|
||||
EMetaTransitionType mType;
|
||||
float mUnknownA;
|
||||
u32 mUnknownB;
|
||||
uint32 mUnknownB;
|
||||
bool mUnknownC;
|
||||
bool mUnknownD;
|
||||
u32 mUnknownE;
|
||||
uint32 mUnknownE;
|
||||
|
||||
public:
|
||||
CMetaTransTrans(EMetaTransitionType Type, IInputStream& rInput, EGame Game);
|
||||
|
|
|
@ -21,11 +21,11 @@ CGameArea::~CGameArea()
|
|||
|
||||
delete mpCollision;
|
||||
|
||||
for (u32 iSCLY = 0; iSCLY < mScriptLayers.size(); iSCLY++)
|
||||
for (uint32 iSCLY = 0; iSCLY < mScriptLayers.size(); iSCLY++)
|
||||
delete mScriptLayers[iSCLY];
|
||||
|
||||
for (u32 iLyr = 0; iLyr < mLightLayers.size(); iLyr++)
|
||||
for (u32 iLight = 0; iLight < mLightLayers[iLyr].size(); iLight++)
|
||||
for (uint32 iLyr = 0; iLyr < mLightLayers.size(); iLyr++)
|
||||
for (uint32 iLight = 0; iLight < mLightLayers[iLyr].size(); iLight++)
|
||||
delete mLightLayers[iLyr][iLight];
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,13 @@ CDependencyTree* CGameArea::BuildDependencyTree() const
|
|||
}
|
||||
|
||||
// Extra deps
|
||||
for (u32 iDep = 0; iDep < mExtraAreaDeps.size(); iDep++)
|
||||
for (uint32 iDep = 0; iDep < mExtraAreaDeps.size(); iDep++)
|
||||
pTree->AddDependency(mExtraAreaDeps[iDep]);
|
||||
|
||||
// Layer dependencies
|
||||
std::vector<CAssetID> DummyDeps;
|
||||
|
||||
for (u32 iLayer = 0; iLayer < mScriptLayers.size(); iLayer++)
|
||||
for (uint32 iLayer = 0; iLayer < mScriptLayers.size(); iLayer++)
|
||||
{
|
||||
const std::vector<CAssetID>& rkExtras = (mExtraLayerDeps.size() > iLayer ? mExtraLayerDeps[iLayer] : DummyDeps);
|
||||
pTree->AddScriptLayer(mScriptLayers[iLayer], rkExtras);
|
||||
|
@ -77,12 +77,12 @@ void CGameArea::MergeTerrain()
|
|||
if (mTerrainMerged) return;
|
||||
|
||||
// Nothing really complicated here - iterate through every terrain submesh, add each to a static model
|
||||
for (u32 iMdl = 0; iMdl < mWorldModels.size(); iMdl++)
|
||||
for (uint32 iMdl = 0; iMdl < mWorldModels.size(); iMdl++)
|
||||
{
|
||||
CModel *pMdl = mWorldModels[iMdl];
|
||||
u32 SubmeshCount = pMdl->GetSurfaceCount();
|
||||
uint32 SubmeshCount = pMdl->GetSurfaceCount();
|
||||
|
||||
for (u32 iSurf = 0; iSurf < SubmeshCount; iSurf++)
|
||||
for (uint32 iSurf = 0; iSurf < SubmeshCount; iSurf++)
|
||||
{
|
||||
SSurface *pSurf = pMdl->GetSurface(iSurf);
|
||||
CMaterial *pMat = mpMaterialSet->MaterialByIndex(pSurf->MaterialID);
|
||||
|
@ -118,11 +118,11 @@ void CGameArea::MergeTerrain()
|
|||
|
||||
void CGameArea::ClearTerrain()
|
||||
{
|
||||
for (u32 iModel = 0; iModel < mWorldModels.size(); iModel++)
|
||||
for (uint32 iModel = 0; iModel < mWorldModels.size(); iModel++)
|
||||
delete mWorldModels[iModel];
|
||||
mWorldModels.clear();
|
||||
|
||||
for (u32 iStatic = 0; iStatic < mStaticWorldModels.size(); iStatic++)
|
||||
for (uint32 iStatic = 0; iStatic < mStaticWorldModels.size(); iStatic++)
|
||||
delete mStaticWorldModels[iStatic];
|
||||
mStaticWorldModels.clear();
|
||||
|
||||
|
@ -141,26 +141,26 @@ void CGameArea::ClearScriptLayers()
|
|||
mScriptLayers.clear();
|
||||
}
|
||||
|
||||
u32 CGameArea::TotalInstanceCount() const
|
||||
uint32 CGameArea::TotalInstanceCount() const
|
||||
{
|
||||
u32 Num = 0;
|
||||
uint32 Num = 0;
|
||||
|
||||
for (u32 iLyr = 0; iLyr < mScriptLayers.size(); iLyr++)
|
||||
for (uint32 iLyr = 0; iLyr < mScriptLayers.size(); iLyr++)
|
||||
Num += mScriptLayers[iLyr]->NumInstances();
|
||||
|
||||
return Num;
|
||||
}
|
||||
|
||||
CScriptObject* CGameArea::InstanceByID(u32 InstanceID)
|
||||
CScriptObject* CGameArea::InstanceByID(uint32 InstanceID)
|
||||
{
|
||||
auto it = mObjectMap.find(InstanceID);
|
||||
if (it != mObjectMap.end()) return it->second;
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
u32 CGameArea::FindUnusedInstanceID() const
|
||||
uint32 CGameArea::FindUnusedInstanceID() const
|
||||
{
|
||||
u32 InstanceID = (mWorldIndex << 16) | 1;
|
||||
uint32 InstanceID = (mWorldIndex << 16) | 1;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -180,20 +180,20 @@ CScriptObject* CGameArea::SpawnInstance(CScriptTemplate *pTemplate,
|
|||
const CVector3f& rkPosition /*= CVector3f::skZero*/,
|
||||
const CQuaternion& rkRotation /*= CQuaternion::skIdentity*/,
|
||||
const CVector3f& rkScale /*= CVector3f::skOne*/,
|
||||
u32 SuggestedID /*= -1*/,
|
||||
u32 SuggestedLayerIndex /*= -1*/ )
|
||||
uint32 SuggestedID /*= -1*/,
|
||||
uint32 SuggestedLayerIndex /*= -1*/ )
|
||||
{
|
||||
// Verify we can fit another instance in this area.
|
||||
u32 NumInstances = TotalInstanceCount();
|
||||
uint32 NumInstances = TotalInstanceCount();
|
||||
|
||||
if (NumInstances >= 0xFFFF)
|
||||
{
|
||||
Log::Error("Unable to spawn a new script instance; too many instances in area (" + TString::FromInt32(NumInstances, 0, 10) + ")");
|
||||
errorf("Unable to spawn a new script instance; too many instances in area (%d)", NumInstances);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Check whether the suggested instance ID is valid
|
||||
u32 InstanceID = SuggestedID;
|
||||
uint32 InstanceID = SuggestedID;
|
||||
|
||||
if (InstanceID != -1)
|
||||
{
|
||||
|
@ -205,11 +205,11 @@ CScriptObject* CGameArea::SpawnInstance(CScriptTemplate *pTemplate,
|
|||
if (InstanceID == -1)
|
||||
{
|
||||
// Determine layer index
|
||||
u32 LayerIndex = pLayer->AreaIndex();
|
||||
uint32 LayerIndex = pLayer->AreaIndex();
|
||||
|
||||
if (LayerIndex == -1)
|
||||
{
|
||||
Log::Error("Unable to spawn a new script instance; invalid script layer passed in");
|
||||
errorf("Unable to spawn a new script instance; invalid script layer passed in");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "Core/Resource/CPoiToWorld.h"
|
||||
#include "Core/Resource/Model/CModel.h"
|
||||
#include "Core/Resource/Model/CStaticModel.h"
|
||||
#include <Common/types.h>
|
||||
#include <Math/CQuaternion.h>
|
||||
#include <Math/CTransform4f.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/Math/CQuaternion.h>
|
||||
#include <Common/Math/CTransform4f.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -24,22 +24,22 @@ class CGameArea : public CResource
|
|||
friend class CAreaLoader;
|
||||
friend class CAreaCooker;
|
||||
|
||||
u32 mWorldIndex;
|
||||
u32 mVertexCount;
|
||||
u32 mTriangleCount;
|
||||
uint32 mWorldIndex;
|
||||
uint32 mVertexCount;
|
||||
uint32 mTriangleCount;
|
||||
bool mTerrainMerged;
|
||||
CTransform4f mTransform;
|
||||
CAABox mAABox;
|
||||
|
||||
// Data saved from the original file to help on recook
|
||||
std::vector<std::vector<u8>> mSectionDataBuffers;
|
||||
u32 mOriginalWorldMeshCount;
|
||||
std::vector<std::vector<uint8>> mSectionDataBuffers;
|
||||
uint32 mOriginalWorldMeshCount;
|
||||
bool mUsesCompression;
|
||||
|
||||
struct SSectionNumber
|
||||
{
|
||||
CFourCC SectionID;
|
||||
u32 Index;
|
||||
uint32 Index;
|
||||
};
|
||||
std::vector<SSectionNumber> mSectionNumbers;
|
||||
|
||||
|
@ -49,7 +49,7 @@ class CGameArea : public CResource
|
|||
std::vector<CStaticModel*> mStaticWorldModels; // StaticTerrainModels is the merged terrain for faster rendering in the world editor
|
||||
// Script
|
||||
std::vector<CScriptLayer*> mScriptLayers;
|
||||
std::unordered_map<u32, CScriptObject*> mObjectMap;
|
||||
std::unordered_map<uint32, CScriptObject*> mObjectMap;
|
||||
// Collision
|
||||
CCollisionMeshGroup *mpCollision;
|
||||
// Lights
|
||||
|
@ -73,38 +73,38 @@ public:
|
|||
void MergeTerrain();
|
||||
void ClearTerrain();
|
||||
void ClearScriptLayers();
|
||||
u32 TotalInstanceCount() const;
|
||||
CScriptObject* InstanceByID(u32 InstanceID);
|
||||
u32 FindUnusedInstanceID() const;
|
||||
uint32 TotalInstanceCount() const;
|
||||
CScriptObject* InstanceByID(uint32 InstanceID);
|
||||
uint32 FindUnusedInstanceID() const;
|
||||
CScriptObject* SpawnInstance(CScriptTemplate *pTemplate, CScriptLayer *pLayer,
|
||||
const CVector3f& rkPosition = CVector3f::skZero,
|
||||
const CQuaternion& rkRotation = CQuaternion::skIdentity,
|
||||
const CVector3f& rkScale = CVector3f::skOne,
|
||||
u32 SuggestedID = -1, u32 SuggestedLayerIndex = -1);
|
||||
uint32 SuggestedID = -1, uint32 SuggestedLayerIndex = -1);
|
||||
void AddInstanceToArea(CScriptObject *pInstance);
|
||||
void DeleteInstance(CScriptObject *pInstance);
|
||||
void ClearExtraDependencies();
|
||||
|
||||
// Inline Accessors
|
||||
inline u32 WorldIndex() const { return mWorldIndex; }
|
||||
inline uint32 WorldIndex() const { return mWorldIndex; }
|
||||
inline CTransform4f Transform() const { return mTransform; }
|
||||
inline CMaterialSet* Materials() const { return mpMaterialSet; }
|
||||
inline u32 NumWorldModels() const { return mWorldModels.size(); }
|
||||
inline u32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
inline CModel* TerrainModel(u32 iMdl) const { return mWorldModels[iMdl]; }
|
||||
inline CStaticModel* StaticModel(u32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
||||
inline uint32 NumWorldModels() const { return mWorldModels.size(); }
|
||||
inline uint32 NumStaticModels() const { return mStaticWorldModels.size(); }
|
||||
inline CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; }
|
||||
inline CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; }
|
||||
inline CCollisionMeshGroup* Collision() const { return mpCollision; }
|
||||
inline u32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
inline CScriptLayer* ScriptLayer(u32 Index) const { return mScriptLayers[Index]; }
|
||||
inline u32 NumLightLayers() const { return mLightLayers.size(); }
|
||||
inline u32 NumLights(u32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
inline CLight* Light(u32 LayerIndex, u32 LightIndex) const { return mLightLayers[LayerIndex][LightIndex]; }
|
||||
inline uint32 NumScriptLayers() const { return mScriptLayers.size(); }
|
||||
inline CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; }
|
||||
inline uint32 NumLightLayers() const { return mLightLayers.size(); }
|
||||
inline uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); }
|
||||
inline CLight* Light(uint32 LayerIndex, uint32 LightIndex) const { return mLightLayers[LayerIndex][LightIndex]; }
|
||||
inline CAssetID PathID() const { return mPathID; }
|
||||
inline CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; }
|
||||
inline CAssetID PortalAreaID() const { return mPortalAreaID; }
|
||||
inline CAABox AABox() const { return mAABox; }
|
||||
|
||||
inline void SetWorldIndex(u32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
||||
inline void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; }
|
||||
};
|
||||
|
||||
#endif // CGAMEAREA_H
|
||||
|
|
|
@ -10,8 +10,8 @@ class CAudioGroup : public CResource
|
|||
friend class CAudioGroupLoader;
|
||||
|
||||
TString mGroupName;
|
||||
u32 mGroupID;
|
||||
std::vector<u16> mDefineIDs;
|
||||
uint32 mGroupID;
|
||||
std::vector<uint16> mDefineIDs;
|
||||
|
||||
public:
|
||||
CAudioGroup(CResourceEntry *pEntry = 0)
|
||||
|
@ -21,9 +21,9 @@ public:
|
|||
|
||||
// Accessors
|
||||
inline TString GroupName() const { return mGroupName; }
|
||||
inline u32 GroupID() const { return mGroupID; }
|
||||
inline u32 NumSoundDefineIDs() const { return mDefineIDs.size(); }
|
||||
inline u16 SoundDefineIDByIndex(u32 Index) const { return mDefineIDs[Index]; }
|
||||
inline uint32 GroupID() const { return mGroupID; }
|
||||
inline uint32 NumSoundDefineIDs() const { return mDefineIDs.size(); }
|
||||
inline uint16 SoundDefineIDByIndex(uint32 Index) const { return mDefineIDs[Index]; }
|
||||
};
|
||||
|
||||
#endif // CAUDIOGROUP
|
||||
|
|
|
@ -7,14 +7,14 @@ class CAudioLookupTable : public CResource
|
|||
{
|
||||
DECLARE_RESOURCE_TYPE(eAudioLookupTable)
|
||||
friend class CAudioGroupLoader;
|
||||
std::vector<u16> mDefineIDs;
|
||||
std::vector<uint16> mDefineIDs;
|
||||
|
||||
public:
|
||||
CAudioLookupTable(CResourceEntry *pEntry = 0)
|
||||
: CResource(pEntry)
|
||||
{}
|
||||
|
||||
inline u16 FindSoundDefineID(u32 SoundID)
|
||||
inline uint16 FindSoundDefineID(uint32 SoundID)
|
||||
{
|
||||
if (SoundID >= mDefineIDs.size()) return -1;
|
||||
return mDefineIDs[SoundID];
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
{
|
||||
CDependencyTree *pTree = new CDependencyTree();
|
||||
|
||||
for (u32 iSamp = 0; iSamp < mSamples.size(); iSamp++)
|
||||
for (uint32 iSamp = 0; iSamp < mSamples.size(); iSamp++)
|
||||
pTree->AddDependency(mSamples[iSamp]);
|
||||
|
||||
return pTree;
|
||||
|
@ -28,8 +28,8 @@ public:
|
|||
|
||||
// Accessors
|
||||
inline TString MacroName() const { return mMacroName; }
|
||||
inline u32 NumSamples() const { return mSamples.size(); }
|
||||
inline CAssetID SampleByIndex(u32 Index) const { return mSamples[Index]; }
|
||||
inline uint32 NumSamples() const { return mSamples.size(); }
|
||||
inline CAssetID SampleByIndex(uint32 Index) const { return mSamples[Index]; }
|
||||
};
|
||||
|
||||
#endif // CAUDIOMACRO_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "CCollisionMaterial.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <unordered_map>
|
||||
|
||||
ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
||||
|
@ -19,7 +19,7 @@ ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
|||
|
||||
// Determine which list we should use.
|
||||
const ECollisionFlag* pkFlagArray;
|
||||
u32 Num;
|
||||
uint32 Num;
|
||||
|
||||
if (Game <= EGame::Prime)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
|||
}
|
||||
|
||||
// Locate type.
|
||||
for (u32 iType = 0; iType < Num; iType++)
|
||||
for (uint32 iType = 0; iType < Num; iType++)
|
||||
{
|
||||
if (*this & pkFlagArray[iType])
|
||||
return pkFlagArray[iType];
|
||||
|
|
|
@ -51,7 +51,7 @@ enum ECollisionFlag
|
|||
class CCollisionMaterial : public TFlags<ECollisionFlag>
|
||||
{
|
||||
friend class CCollisionLoader;
|
||||
u64 mRawFlags;
|
||||
uint64 mRawFlags;
|
||||
|
||||
public:
|
||||
ECollisionFlag SurfaceType(EGame Game) const;
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
bool IsFloor() const;
|
||||
bool IsUnstandable(EGame Game) const;
|
||||
|
||||
inline u64 RawFlags() const { return mRawFlags; }
|
||||
inline uint64 RawFlags() const { return mRawFlags; }
|
||||
};
|
||||
|
||||
#endif // CCOLLISIONMATERIAL
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "CCollisionMesh.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
|
||||
CCollisionMesh::CCollisionMesh()
|
||||
{
|
||||
|
@ -43,11 +43,11 @@ void CCollisionMesh::BufferGL()
|
|||
mIBO.Reserve(SortedTris.size() * 3);
|
||||
|
||||
mMaterialOffsets.reserve(mMaterials.size());
|
||||
u32 CurMat = 0;
|
||||
uint32 CurMat = 0;
|
||||
|
||||
for (u32 iTri = 0; iTri < SortedTris.size(); iTri++)
|
||||
for (uint32 iTri = 0; iTri < SortedTris.size(); iTri++)
|
||||
{
|
||||
u16 Verts[3];
|
||||
uint16 Verts[3];
|
||||
|
||||
CCollisionFace *pFace = &SortedTris[iTri];
|
||||
CCollisionLine *pLineA = GetLine(pFace->Lines[0]);
|
||||
|
@ -75,7 +75,7 @@ void CCollisionMesh::BufferGL()
|
|||
// Some faces have a property that indicates they need to be inverted
|
||||
if (GetMaterial(pFace->MaterialIdx) & eCF_FlippedTri)
|
||||
{
|
||||
u16 V0 = Verts[0];
|
||||
uint16 V0 = Verts[0];
|
||||
Verts[0] = Verts[2];
|
||||
Verts[2] = V0;
|
||||
}
|
||||
|
@ -89,12 +89,12 @@ void CCollisionMesh::BufferGL()
|
|||
CVector3f V0toV2 = (rVert2.Pos - rVert0.Pos).Normalized();
|
||||
CVector3f FaceNormal = V0toV1.Cross(V0toV2).Normalized();
|
||||
|
||||
for (u32 iVtx = 0; iVtx < 3; iVtx++)
|
||||
for (uint32 iVtx = 0; iVtx < 3; iVtx++)
|
||||
{
|
||||
CVertex Vtx;
|
||||
Vtx.Position = mCollisionVertices[ Verts[iVtx] ].Pos;
|
||||
Vtx.Normal = FaceNormal;
|
||||
u16 Index = mVBO.AddVertex(Vtx);
|
||||
uint16 Index = mVBO.AddVertex(Vtx);
|
||||
mIBO.AddIndex(Index);
|
||||
}
|
||||
}
|
||||
|
@ -122,14 +122,14 @@ void CCollisionMesh::Draw()
|
|||
mVBO.Unbind();
|
||||
}
|
||||
|
||||
void CCollisionMesh::DrawMaterial(u32 MatIdx, bool Wireframe)
|
||||
void CCollisionMesh::DrawMaterial(uint32 MatIdx, bool Wireframe)
|
||||
{
|
||||
if (!mBuffered) BufferGL();
|
||||
ASSERT(MatIdx < mMaterials.size());
|
||||
|
||||
mVBO.Bind();
|
||||
u32 StartIdx = (MatIdx == 0 ? 0 : mMaterialOffsets[MatIdx - 1]);
|
||||
u32 NumElements = mMaterialOffsets[MatIdx] - StartIdx;
|
||||
uint32 StartIdx = (MatIdx == 0 ? 0 : mMaterialOffsets[MatIdx - 1]);
|
||||
uint32 NumElements = mMaterialOffsets[MatIdx] - StartIdx;
|
||||
|
||||
if (Wireframe)
|
||||
{
|
||||
|
@ -153,17 +153,17 @@ void CCollisionMesh::DrawWireframe()
|
|||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionVertex* CCollisionMesh::GetVertex(u16 Index)
|
||||
CCollisionMesh::CCollisionVertex* CCollisionMesh::GetVertex(uint16 Index)
|
||||
{
|
||||
return &mCollisionVertices[Index];
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionLine* CCollisionMesh::GetLine(u16 Index)
|
||||
CCollisionMesh::CCollisionLine* CCollisionMesh::GetLine(uint16 Index)
|
||||
{
|
||||
return &mCollisionLines[Index];
|
||||
}
|
||||
|
||||
CCollisionMesh::CCollisionFace* CCollisionMesh::GetFace(u16 Index)
|
||||
CCollisionMesh::CCollisionFace* CCollisionMesh::GetFace(uint16 Index)
|
||||
{
|
||||
return &mCollisionFaces[Index];
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "CResource.h"
|
||||
#include "Core/OpenGL/CVertexBuffer.h"
|
||||
#include "Core/OpenGL/CIndexBuffer.h"
|
||||
#include <Math/CAABox.h>
|
||||
#include <Common/Math/CAABox.h>
|
||||
|
||||
class CCollisionMesh
|
||||
{
|
||||
|
@ -19,12 +19,12 @@ class CCollisionMesh
|
|||
struct SLeaf : public SOctreeNode
|
||||
{
|
||||
CAABox AABox;
|
||||
std::vector<u16> FaceIndices;
|
||||
std::vector<uint16> FaceIndices;
|
||||
};
|
||||
|
||||
struct SBranch : public SOctreeNode
|
||||
{
|
||||
u16 Flags;
|
||||
uint16 Flags;
|
||||
SOctreeNode *pChildren[8];
|
||||
};
|
||||
|
||||
|
@ -34,29 +34,29 @@ class CCollisionMesh
|
|||
class CCollisionVertex
|
||||
{
|
||||
public:
|
||||
u32 MaterialIdx;
|
||||
uint32 MaterialIdx;
|
||||
CVector3f Pos;
|
||||
};
|
||||
|
||||
class CCollisionLine
|
||||
{
|
||||
public:
|
||||
u32 MaterialIdx;
|
||||
u16 Vertices[2];
|
||||
uint32 MaterialIdx;
|
||||
uint16 Vertices[2];
|
||||
};
|
||||
|
||||
class CCollisionFace
|
||||
{
|
||||
public:
|
||||
u32 MaterialIdx;
|
||||
u16 Lines[3];
|
||||
uint32 MaterialIdx;
|
||||
uint16 Lines[3];
|
||||
};
|
||||
|
||||
CVertexBuffer mVBO;
|
||||
CIndexBuffer mIBO;
|
||||
u32 mVertexCount;
|
||||
u32 mLineCount;
|
||||
u32 mFaceCount;
|
||||
uint32 mVertexCount;
|
||||
uint32 mLineCount;
|
||||
uint32 mFaceCount;
|
||||
bool mBuffered;
|
||||
|
||||
CAABox mAABox;
|
||||
|
@ -65,12 +65,12 @@ class CCollisionMesh
|
|||
std::vector<CCollisionVertex> mCollisionVertices;
|
||||
std::vector<CCollisionLine> mCollisionLines;
|
||||
std::vector<CCollisionFace> mCollisionFaces;
|
||||
std::vector<u32> mMaterialOffsets;
|
||||
std::vector<uint32> mMaterialOffsets;
|
||||
bool mOctreeLoaded;
|
||||
|
||||
CCollisionVertex *GetVertex(u16 Index);
|
||||
CCollisionLine *GetLine(u16 Index);
|
||||
CCollisionFace *GetFace(u16 Index);
|
||||
CCollisionVertex *GetVertex(uint16 Index);
|
||||
CCollisionLine *GetLine(uint16 Index);
|
||||
CCollisionFace *GetFace(uint16 Index);
|
||||
|
||||
public:
|
||||
CCollisionMesh();
|
||||
|
@ -78,11 +78,11 @@ public:
|
|||
|
||||
void BufferGL();
|
||||
void Draw();
|
||||
void DrawMaterial(u32 MatIdx, bool Wireframe);
|
||||
void DrawMaterial(uint32 MatIdx, bool Wireframe);
|
||||
void DrawWireframe();
|
||||
|
||||
inline u32 NumMaterials() const { return mMaterials.size(); }
|
||||
inline CCollisionMaterial& GetMaterial(u32 Index) { return mMaterials[Index]; }
|
||||
inline uint32 NumMaterials() const { return mMaterials.size(); }
|
||||
inline CCollisionMaterial& GetMaterial(uint32 Index) { return mMaterials[Index]; }
|
||||
inline const CAABox& BoundingBox() const { return mAABox; }
|
||||
};
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
delete *it;
|
||||
}
|
||||
|
||||
inline u32 NumMeshes() const { return mMeshes.size(); }
|
||||
inline CCollisionMesh* MeshByIndex(u32 Index) const { return mMeshes[Index]; }
|
||||
inline uint32 NumMeshes() const { return mMeshes.size(); }
|
||||
inline CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; }
|
||||
inline void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); }
|
||||
|
||||
inline void Draw()
|
||||
|
|
|
@ -12,8 +12,8 @@ public:
|
|||
CDependencyGroup(CResourceEntry *pEntry = 0) : CResource(pEntry) {}
|
||||
|
||||
inline void Clear() { mDependencies.clear(); }
|
||||
inline u32 NumDependencies() const { return mDependencies.size(); }
|
||||
inline CAssetID DependencyByIndex(u32 Index) const { return mDependencies[Index]; }
|
||||
inline uint32 NumDependencies() const { return mDependencies.size(); }
|
||||
inline CAssetID DependencyByIndex(uint32 Index) const { return mDependencies[Index]; }
|
||||
|
||||
inline void AddDependency(const CAssetID& rkID)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
bool HasDependency(const CAssetID &rkID) const
|
||||
{
|
||||
for (u32 iDep = 0; iDep < mDependencies.size(); iDep++)
|
||||
for (uint32 iDep = 0; iDep < mDependencies.size(); iDep++)
|
||||
{
|
||||
if (mDependencies[iDep] == rkID)
|
||||
return true;
|
||||
|
|
|
@ -15,7 +15,7 @@ CFont::~CFont()
|
|||
{
|
||||
}
|
||||
|
||||
inline float PtsToFloat(s32 Pt)
|
||||
inline float PtsToFloat(int32 Pt)
|
||||
{
|
||||
// This is a bit of an arbitrary number but it works
|
||||
// 1 / (1280 / 1.333333f / 2)
|
||||
|
@ -30,7 +30,7 @@ CDependencyTree* CFont::BuildDependencyTree() const
|
|||
}
|
||||
|
||||
CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/, float /*AspectRatio*/,
|
||||
CVector2f /*Position*/, CColor FillColor, CColor StrokeColor, u32 FontSize)
|
||||
CVector2f /*Position*/, CColor FillColor, CColor StrokeColor, uint32 FontSize)
|
||||
{
|
||||
// WIP
|
||||
if (!smBuffersInitialized) InitBuffers();
|
||||
|
@ -55,7 +55,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
|||
if (FontSize == CFONT_DEFAULT_SIZE) Scale = 1.f;
|
||||
else Scale = (float) FontSize / (mDefaultSize != 0 ? mDefaultSize : 18);
|
||||
|
||||
for (u32 iChar = 0; iChar < rkString.Length(); iChar++)
|
||||
for (uint32 iChar = 0; iChar < rkString.Length(); iChar++)
|
||||
{
|
||||
// Get character, check for newline
|
||||
char Char = rkString[iChar];
|
||||
|
@ -80,7 +80,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
|||
{
|
||||
if (pPrevGlyph->KerningIndex != -1)
|
||||
{
|
||||
for (u32 iKern = pPrevGlyph->KerningIndex; iKern < mKerningTable.size(); iKern++)
|
||||
for (uint32 iKern = pPrevGlyph->KerningIndex; iKern < mKerningTable.size(); iKern++)
|
||||
{
|
||||
if (mKerningTable[iKern].CharacterA != pPrevGlyph->Character) break;
|
||||
if (mKerningTable[iKern].CharacterB == rkString[iChar])
|
||||
|
@ -110,7 +110,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
|||
GlyphTransform.Translate(CVector3f(XTrans, YTrans, 0.f));
|
||||
|
||||
// Get glyph layer
|
||||
u8 GlyphLayer = pGlyph->RGBAChannel;
|
||||
uint8 GlyphLayer = pGlyph->RGBAChannel;
|
||||
if (mTextureFormat == 3) GlyphLayer *= 2;
|
||||
else if (mTextureFormat == 8) GlyphLayer = 3;
|
||||
|
||||
|
@ -126,7 +126,7 @@ CVector2f CFont::RenderString(const TString& rkString, CRenderer* /*pRenderer*/,
|
|||
// Draw stroke
|
||||
if ((mTextureFormat == 1) || (mTextureFormat == 3) || (mTextureFormat == 8))
|
||||
{
|
||||
u8 StrokeLayer;
|
||||
uint8 StrokeLayer;
|
||||
if (mTextureFormat == 1) StrokeLayer = 1;
|
||||
else if (mTextureFormat == 3) StrokeLayer = GlyphLayer + 1;
|
||||
else if (mTextureFormat == 8) StrokeLayer = GlyphLayer - 2;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Core/Resource/Model/CVertex.h"
|
||||
#include "Core/OpenGL/CDynamicVertexBuffer.h"
|
||||
#include "Core/OpenGL/CIndexBuffer.h"
|
||||
#include <Common/types.h>
|
||||
#include <Common/BasicTypes.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
@ -24,35 +24,35 @@ class CFont : public CResource
|
|||
static CIndexBuffer smGlyphIndices; // This is the index buffer used to draw glyphs. It uses a triangle strip.
|
||||
static bool smBuffersInitialized; // This bool indicates whether the vertex/index buffer have been initialized. Checked at the start of RenderString().
|
||||
|
||||
u32 mUnknown; // Value at offset 0x8. Not sure what this is. Including for experimentation purposes.
|
||||
u32 mLineHeight; // Height of each line, in points
|
||||
u32 mLineMargin; // Gap between lines, in points - this is added to the line height
|
||||
u32 mVerticalOffset; // In points. This is used to reposition glyphs after the per-glyph vertical offset is applied
|
||||
u32 mDefaultSize; // In points.
|
||||
uint32 mUnknown; // Value at offset 0x8. Not sure what this is. Including for experimentation purposes.
|
||||
uint32 mLineHeight; // Height of each line, in points
|
||||
uint32 mLineMargin; // Gap between lines, in points - this is added to the line height
|
||||
uint32 mVerticalOffset; // In points. This is used to reposition glyphs after the per-glyph vertical offset is applied
|
||||
uint32 mDefaultSize; // In points.
|
||||
TString mFontName; // Self-explanatory
|
||||
TResPtr<CTexture> mpFontTexture; // The texture used by this font
|
||||
u32 mTextureFormat; // Indicates which layers on the texture are for what - multiple glyph layers or fill/stroke
|
||||
uint32 mTextureFormat; // Indicates which layers on the texture are for what - multiple glyph layers or fill/stroke
|
||||
|
||||
struct SGlyph
|
||||
{
|
||||
u16 Character; // The UTF-16 character that this glyph corresponds to
|
||||
uint16 Character; // The UTF-16 character that this glyph corresponds to
|
||||
CVector2f TexCoords[4]; // The format only lists the min/max X/Y values; tracking absolute coordinates in memory is faster
|
||||
s32 LeftPadding; // The amount of padding applied left of this glyph, in points
|
||||
s32 RightPadding; // The amount of padding applied right of this glyph, in points
|
||||
u32 Width; // The width of the glyph, in points
|
||||
u32 Height; // The height of the glyph, in points
|
||||
u32 PrintAdvance; // How far the print head advances horizontally after printing this glyph, in points
|
||||
u32 BaseOffset; // Vertical offset for this glyph, in points; the font-wide offset is added to this
|
||||
u32 KerningIndex; // Index into the kerning table of the first kerning pair for this glyph. -1 if no pairs.
|
||||
u8 RGBAChannel; // Fonts can store multiple glyphs in the same space on different RGBA channels. This value corresponds to R, G, B, or A.
|
||||
int32 LeftPadding; // The amount of padding applied left of this glyph, in points
|
||||
int32 RightPadding; // The amount of padding applied right of this glyph, in points
|
||||
uint32 Width; // The width of the glyph, in points
|
||||
uint32 Height; // The height of the glyph, in points
|
||||
uint32 PrintAdvance; // How far the print head advances horizontally after printing this glyph, in points
|
||||
uint32 BaseOffset; // Vertical offset for this glyph, in points; the font-wide offset is added to this
|
||||
uint32 KerningIndex; // Index into the kerning table of the first kerning pair for this glyph. -1 if no pairs.
|
||||
uint8 RGBAChannel; // Fonts can store multiple glyphs in the same space on different RGBA channels. This value corresponds to R, G, B, or A.
|
||||
};
|
||||
std::unordered_map<u16, SGlyph> mGlyphs;
|
||||
std::unordered_map<uint16, SGlyph> mGlyphs;
|
||||
|
||||
struct SKerningPair
|
||||
{
|
||||
u16 CharacterA; // Left character
|
||||
u16 CharacterB; // Right character
|
||||
s32 Adjust; // The horizontal offset to apply to CharacterB if this pair is encountered, in points
|
||||
uint16 CharacterA; // Left character
|
||||
uint16 CharacterB; // Right character
|
||||
int32 Adjust; // The horizontal offset to apply to CharacterB if this pair is encountered, in points
|
||||
};
|
||||
std::vector<SKerningPair> mKerningTable; // The kerning table should be laid out in alphabetical order for the indices to work properly
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio,
|
||||
CVector2f Position = CVector2f(0,0),
|
||||
CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack,
|
||||
u32 FontSize = CFONT_DEFAULT_SIZE);
|
||||
uint32 FontSize = CFONT_DEFAULT_SIZE);
|
||||
|
||||
// Accessors
|
||||
inline TString FontName() const { return mFontName; }
|
||||
|
|
|
@ -177,7 +177,7 @@ CStructProperty* CLight::GetProperties() const
|
|||
// ************ OTHER ************
|
||||
void CLight::Load() const
|
||||
{
|
||||
u8 Index = (u8) CGraphics::sNumLights;
|
||||
uint8 Index = (uint8) CGraphics::sNumLights;
|
||||
if (Index >= 8) return;
|
||||
|
||||
CGraphics::SLightBlock::SGXLight *pLight = &CGraphics::sLightBlock.Lights[Index];
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "Core/Resource/Script/Property/Properties.h"
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/FileIO/IInputStream.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <Common/Math/CVector3f.h>
|
||||
|
||||
/* CLight is currently heavily based on the lights system from Metroid Prime,
|
||||
* including code reverse engineered from the game's executable. Not yet sure
|
||||
|
@ -20,7 +20,7 @@ enum ELightType
|
|||
class CLight
|
||||
{
|
||||
ELightType mType;
|
||||
u32 mLayerIndex;
|
||||
uint32 mLayerIndex;
|
||||
CVector3f mPosition;
|
||||
CVector3f mDirection;
|
||||
CColor mColor;
|
||||
|
@ -30,7 +30,7 @@ class CLight
|
|||
|
||||
mutable float mCachedRadius;
|
||||
mutable float mCachedIntensity;
|
||||
mutable u8 mDirtyFlags;
|
||||
mutable uint8 mDirtyFlags;
|
||||
|
||||
public:
|
||||
CLight();
|
||||
|
@ -44,14 +44,14 @@ private:
|
|||
public:
|
||||
// Accessors
|
||||
inline ELightType Type() const { return mType; }
|
||||
inline u32 LayerIndex() const { return mLayerIndex; }
|
||||
inline uint32 LayerIndex() const { return mLayerIndex; }
|
||||
inline CVector3f Position() const { return mPosition; }
|
||||
inline CVector3f Direction() const { return mDirection; }
|
||||
inline CColor Color() const { return mColor; }
|
||||
inline CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
||||
inline CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||
|
||||
inline void SetLayer(u32 Index) { mLayerIndex = Index; }
|
||||
inline void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||
inline void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||
inline void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <iostream>
|
||||
#include <GL/glew.h>
|
||||
|
||||
u64 CMaterial::sCurrentMaterial = 0;
|
||||
uint64 CMaterial::sCurrentMaterial = 0;
|
||||
CColor CMaterial::sCurrentTint = CColor::skWhite;
|
||||
std::map<u64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
|
||||
std::map<uint64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
|
||||
|
||||
CMaterial::CMaterial()
|
||||
: mpShader(nullptr)
|
||||
|
@ -62,7 +62,7 @@ CMaterial::CMaterial(EGame Version, FVertexDescription VtxDesc)
|
|||
|
||||
CMaterial::~CMaterial()
|
||||
{
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
delete mPasses[iPass];
|
||||
|
||||
ClearShader();
|
||||
|
@ -76,7 +76,7 @@ CMaterial* CMaterial::Clone()
|
|||
pOut->mVersion = mVersion;
|
||||
pOut->mOptions = mOptions;
|
||||
pOut->mVtxDesc = mVtxDesc;
|
||||
for (u32 iKonst = 0; iKonst < 4; iKonst++)
|
||||
for (uint32 iKonst = 0; iKonst < 4; iKonst++)
|
||||
pOut->mKonstColors[iKonst] = mKonstColors[iKonst];
|
||||
pOut->mBlendSrcFac = mBlendSrcFac;
|
||||
pOut->mBlendDstFac = mBlendDstFac;
|
||||
|
@ -86,7 +86,7 @@ CMaterial* CMaterial::Clone()
|
|||
pOut->mpIndirectTexture = mpIndirectTexture;
|
||||
|
||||
pOut->mPasses.resize(mPasses.size());
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
pOut->mPasses[iPass] = mPasses[iPass]->Clone(pOut);
|
||||
|
||||
return pOut;
|
||||
|
@ -193,7 +193,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
|||
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
|
||||
// Set konst inputs
|
||||
for (u32 iKonst = 0; iKonst < 4; iKonst++)
|
||||
for (uint32 iKonst = 0; iKonst < 4; iKonst++)
|
||||
CGraphics::sPixelBlock.Konst[iKonst] = mKonstColors[iKonst];
|
||||
|
||||
// Set color channels
|
||||
|
@ -205,7 +205,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
|||
else glDepthMask(GL_FALSE);
|
||||
|
||||
// Load uniforms
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
mPasses[iPass]->SetAnimCurrent(Options, iPass);
|
||||
|
||||
sCurrentMaterial = HashParameters();
|
||||
|
@ -214,7 +214,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
|||
// If the passes are otherwise the same, update UV anims that use the model matrix
|
||||
else
|
||||
{
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
{
|
||||
EUVAnimMode mode = mPasses[iPass]->AnimMode();
|
||||
|
||||
|
@ -225,7 +225,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
|||
}
|
||||
|
||||
// Set up shader uniforms
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
mPasses[iPass]->LoadTexture(iPass);
|
||||
|
||||
CShader *pShader = CShader::CurrentShader();
|
||||
|
@ -239,7 +239,7 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
|||
return true;
|
||||
}
|
||||
|
||||
u64 CMaterial::HashParameters()
|
||||
uint64 CMaterial::HashParameters()
|
||||
{
|
||||
if (mRecalcHash)
|
||||
{
|
||||
|
@ -255,10 +255,10 @@ u64 CMaterial::HashParameters()
|
|||
Hash.HashLong(mEchoesUnknownA);
|
||||
Hash.HashLong(mEchoesUnknownB);
|
||||
|
||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
mPasses[iPass]->HashParameters(Hash);
|
||||
|
||||
u64 NewHash = Hash.GetHash64();
|
||||
uint64 NewHash = Hash.GetHash64();
|
||||
|
||||
if (mParametersHash != NewHash)
|
||||
ClearShader();
|
||||
|
@ -276,20 +276,20 @@ void CMaterial::Update()
|
|||
mShaderStatus = eNoShader;
|
||||
}
|
||||
|
||||
void CMaterial::SetNumPasses(u32 NumPasses)
|
||||
void CMaterial::SetNumPasses(uint32 NumPasses)
|
||||
{
|
||||
if (NumPasses < mPasses.size())
|
||||
{
|
||||
for (u32 iPass = NumPasses; iPass < mPasses.size(); iPass++)
|
||||
for (uint32 iPass = NumPasses; iPass < mPasses.size(); iPass++)
|
||||
delete mPasses[iPass];
|
||||
}
|
||||
|
||||
u32 OldCount = mPasses.size();
|
||||
uint32 OldCount = mPasses.size();
|
||||
mPasses.resize(NumPasses);
|
||||
|
||||
if (NumPasses > OldCount)
|
||||
{
|
||||
for (u32 iPass = OldCount; iPass < NumPasses; iPass++)
|
||||
for (uint32 iPass = OldCount; iPass < NumPasses; iPass++)
|
||||
mPasses[iPass] = new CMaterialPass(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#include "Core/Render/FRenderOptions.h"
|
||||
#include "Core/OpenGL/CShader.h"
|
||||
|
||||
#include <Common/BasicTypes.h>
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/EGame.h>
|
||||
#include <Common/Flags.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/FileIO/IInputStream.h>
|
||||
|
||||
class CMaterialSet;
|
||||
|
@ -48,14 +48,14 @@ private:
|
|||
};
|
||||
|
||||
// Statics
|
||||
static u64 sCurrentMaterial; // The hash for the currently bound material
|
||||
static uint64 sCurrentMaterial; // The hash for the currently bound material
|
||||
static CColor sCurrentTint; // The tint for the currently bound material
|
||||
|
||||
// Members
|
||||
TString mName; // Name of the material
|
||||
CShader *mpShader; // This material's generated shader. Created with GenerateShader().
|
||||
EShaderStatus mShaderStatus; // A status variable so that PWE won't crash if a shader fails to compile.
|
||||
u64 mParametersHash; // A hash of all the parameters that can identify this TEV setup.
|
||||
uint64 mParametersHash; // A hash of all the parameters that can identify this TEV setup.
|
||||
bool mRecalcHash; // Indicates the hash needs to be recalculated. Set true when parameters are changed.
|
||||
bool mEnableBloom; // Bool that toggles bloom on or off. On by default on MP3 materials, off by default on MP1 materials.
|
||||
|
||||
|
@ -66,8 +66,8 @@ private:
|
|||
GLenum mBlendSrcFac; // Source blend factor
|
||||
GLenum mBlendDstFac; // Dest blend factor
|
||||
bool mLightingEnabled; // Color channel control flags; indicate whether lighting is enabled
|
||||
u32 mEchoesUnknownA; // First unknown value introduced in Echoes. Included for cooking.
|
||||
u32 mEchoesUnknownB; // Second unknown value introduced in Echoes. Included for cooking.
|
||||
uint32 mEchoesUnknownA; // First unknown value introduced in Echoes. Included for cooking.
|
||||
uint32 mEchoesUnknownB; // Second unknown value introduced in Echoes. Included for cooking.
|
||||
TResPtr<CTexture> mpIndirectTexture; // Optional texture used for the indirect stage for reflections
|
||||
|
||||
std::vector<CMaterialPass*> mPasses;
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
int NumReferences;
|
||||
CShader *pShader;
|
||||
};
|
||||
static std::map<u64, SMaterialShader> smShaderMap;
|
||||
static std::map<uint64, SMaterialShader> smShaderMap;
|
||||
|
||||
public:
|
||||
CMaterial();
|
||||
|
@ -89,9 +89,9 @@ public:
|
|||
void GenerateShader(bool AllowRegen = true);
|
||||
void ClearShader();
|
||||
bool SetCurrent(FRenderOptions Options);
|
||||
u64 HashParameters();
|
||||
uint64 HashParameters();
|
||||
void Update();
|
||||
void SetNumPasses(u32 NumPasses);
|
||||
void SetNumPasses(uint32 NumPasses);
|
||||
|
||||
// Accessors
|
||||
inline TString Name() const { return mName; }
|
||||
|
@ -100,19 +100,19 @@ public:
|
|||
inline FVertexDescription VtxDesc() const { return mVtxDesc; }
|
||||
inline GLenum BlendSrcFac() const { return mBlendSrcFac; }
|
||||
inline GLenum BlendDstFac() const { return mBlendDstFac; }
|
||||
inline CColor Konst(u32 KIndex) const { return mKonstColors[KIndex]; }
|
||||
inline CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; }
|
||||
inline CTexture* IndTexture() const { return mpIndirectTexture; }
|
||||
inline bool IsLightingEnabled() const { return mLightingEnabled; }
|
||||
inline u32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
||||
inline u32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
||||
inline u32 PassCount() const { return mPasses.size(); }
|
||||
inline CMaterialPass* Pass(u32 PassIndex) const { return mPasses[PassIndex]; }
|
||||
inline uint32 EchoesUnknownA() const { return mEchoesUnknownA; }
|
||||
inline uint32 EchoesUnknownB() const { return mEchoesUnknownB; }
|
||||
inline uint32 PassCount() const { return mPasses.size(); }
|
||||
inline CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex]; }
|
||||
|
||||
inline void SetName(const TString& rkName) { mName = rkName; }
|
||||
inline void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); }
|
||||
inline void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); }
|
||||
inline void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; }
|
||||
inline void SetKonst(const CColor& Konst, u32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
||||
inline void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); }
|
||||
inline void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; }
|
||||
inline void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); }
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ CMaterialPass::CMaterialPass(CMaterial *pParent)
|
|||
, mTexCoordSource(0xFF)
|
||||
, mAnimMode(eNoUVAnim)
|
||||
{
|
||||
for (u32 iParam = 0; iParam < 4; iParam++)
|
||||
for (uint32 iParam = 0; iParam < 4; iParam++)
|
||||
{
|
||||
mColorInputs[iParam] = eZeroRGB;
|
||||
mAlphaInputs[iParam] = eZeroAlpha;
|
||||
|
@ -35,7 +35,7 @@ CMaterialPass* CMaterialPass::Clone(CMaterial *pParent)
|
|||
pOut->mPassType = mPassType;
|
||||
pOut->mSettings = mSettings;
|
||||
|
||||
for (u32 iIn = 0; iIn < 4; iIn++)
|
||||
for (uint32 iIn = 0; iIn < 4; iIn++)
|
||||
{
|
||||
pOut->mColorInputs[iIn] = mColorInputs[iIn];
|
||||
pOut->mAlphaInputs[iIn] = mAlphaInputs[iIn];
|
||||
|
@ -50,7 +50,7 @@ CMaterialPass* CMaterialPass::Clone(CMaterial *pParent)
|
|||
pOut->mpTexture = mpTexture;
|
||||
pOut->mAnimMode = mAnimMode;
|
||||
|
||||
for (u32 iParam = 0; iParam < 4; iParam++)
|
||||
for (uint32 iParam = 0; iParam < 4; iParam++)
|
||||
pOut->mAnimParams[iParam] = mAnimParams[iParam];
|
||||
|
||||
pOut->mEnabled = mEnabled;
|
||||
|
@ -78,13 +78,13 @@ void CMaterialPass::HashParameters(CFNV1A& rHash)
|
|||
}
|
||||
}
|
||||
|
||||
void CMaterialPass::LoadTexture(u32 PassIndex)
|
||||
void CMaterialPass::LoadTexture(uint32 PassIndex)
|
||||
{
|
||||
if (mpTexture)
|
||||
mpTexture->Bind(PassIndex);
|
||||
}
|
||||
|
||||
void CMaterialPass::SetAnimCurrent(FRenderOptions Options, u32 PassIndex)
|
||||
void CMaterialPass::SetAnimCurrent(FRenderOptions Options, uint32 PassIndex)
|
||||
{
|
||||
if (mAnimMode == eNoUVAnim) return;
|
||||
|
||||
|
@ -269,7 +269,7 @@ void CMaterialPass::SetRasSel(ETevRasSel Sel)
|
|||
mpParentMat->Update();
|
||||
}
|
||||
|
||||
void CMaterialPass::SetTexCoordSource(u32 Source)
|
||||
void CMaterialPass::SetTexCoordSource(uint32 Source)
|
||||
{
|
||||
mTexCoordSource = Source;
|
||||
mpParentMat->Update();
|
||||
|
@ -286,7 +286,7 @@ void CMaterialPass::SetAnimMode(EUVAnimMode Mode)
|
|||
mpParentMat->Update();
|
||||
}
|
||||
|
||||
void CMaterialPass::SetAnimParam(u32 ParamIndex, float Value)
|
||||
void CMaterialPass::SetAnimParam(uint32 ParamIndex, float Value)
|
||||
{
|
||||
mAnimParams[ParamIndex] = Value;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
ETevKSel mKColorSel;
|
||||
ETevKSel mKAlphaSel;
|
||||
ETevRasSel mRasSel;
|
||||
u32 mTexCoordSource; // Should maybe be an enum but worried about conflicts with EVertexDescriptionn
|
||||
uint32 mTexCoordSource; // Should maybe be an enum but worried about conflicts with EVertexDescriptionn
|
||||
TResPtr<CTexture> mpTexture;
|
||||
EUVAnimMode mAnimMode;
|
||||
float mAnimParams[4];
|
||||
|
@ -46,8 +46,8 @@ public:
|
|||
~CMaterialPass();
|
||||
CMaterialPass* Clone(CMaterial *pParent);
|
||||
void HashParameters(CFNV1A& rHash);
|
||||
void LoadTexture(u32 PassIndex);
|
||||
void SetAnimCurrent(FRenderOptions Options, u32 PassIndex);
|
||||
void LoadTexture(uint32 PassIndex);
|
||||
void SetAnimCurrent(FRenderOptions Options, uint32 PassIndex);
|
||||
|
||||
// Setters
|
||||
void SetType(CFourCC Type);
|
||||
|
@ -58,26 +58,26 @@ public:
|
|||
void SetKColorSel(ETevKSel Sel);
|
||||
void SetKAlphaSel(ETevKSel Sel);
|
||||
void SetRasSel(ETevRasSel Sel);
|
||||
void SetTexCoordSource(u32 Source);
|
||||
void SetTexCoordSource(uint32 Source);
|
||||
void SetTexture(CTexture *pTex);
|
||||
void SetAnimMode(EUVAnimMode Mode);
|
||||
void SetAnimParam(u32 ParamIndex, float Value);
|
||||
void SetAnimParam(uint32 ParamIndex, float Value);
|
||||
void SetEnabled(bool Enabled);
|
||||
|
||||
// Getters
|
||||
inline CFourCC Type() const { return mPassType; }
|
||||
inline TString NamedType() const { return PassTypeName(mPassType); }
|
||||
inline ETevColorInput ColorInput(u32 Input) const { return mColorInputs[Input]; }
|
||||
inline ETevAlphaInput AlphaInput(u32 Input) const { return mAlphaInputs[Input]; }
|
||||
inline ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; }
|
||||
inline ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; }
|
||||
inline ETevOutput ColorOutput() const { return mColorOutput; }
|
||||
inline ETevOutput AlphaOutput() const { return mAlphaOutput; }
|
||||
inline ETevKSel KColorSel() const { return mKColorSel; }
|
||||
inline ETevKSel KAlphaSel() const { return mKAlphaSel; }
|
||||
inline ETevRasSel RasSel() const { return mRasSel; }
|
||||
inline u32 TexCoordSource() const { return mTexCoordSource; }
|
||||
inline uint32 TexCoordSource() const { return mTexCoordSource; }
|
||||
inline CTexture* Texture() const { return mpTexture; }
|
||||
inline EUVAnimMode AnimMode() const { return mAnimMode; }
|
||||
inline float AnimParam(u32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
||||
inline float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; }
|
||||
inline bool IsEnabled() const { return mEnabled; }
|
||||
|
||||
// Static
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
|
||||
~CMaterialSet()
|
||||
{
|
||||
for (u32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
delete mMaterials[iMat];
|
||||
}
|
||||
|
||||
|
@ -27,18 +27,18 @@ public:
|
|||
CMaterialSet *pOut = new CMaterialSet();
|
||||
|
||||
pOut->mMaterials.resize(mMaterials.size());
|
||||
for (u32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
pOut->mMaterials[iMat] = mMaterials[iMat]->Clone();
|
||||
|
||||
return pOut;
|
||||
}
|
||||
|
||||
u32 NumMaterials()
|
||||
uint32 NumMaterials()
|
||||
{
|
||||
return mMaterials.size();
|
||||
}
|
||||
|
||||
CMaterial* MaterialByIndex(u32 Index)
|
||||
CMaterial* MaterialByIndex(uint32 Index)
|
||||
{
|
||||
if (Index >= NumMaterials()) return nullptr;
|
||||
return mMaterials[Index];
|
||||
|
@ -52,9 +52,9 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
u32 MaterialIndexByName(const TString& rkName)
|
||||
uint32 MaterialIndexByName(const TString& rkName)
|
||||
{
|
||||
for (u32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
if (mMaterials[iMat]->Name() == rkName) return iMat;
|
||||
|
||||
return -1;
|
||||
|
@ -62,12 +62,12 @@ public:
|
|||
|
||||
void GetUsedTextureIDs(std::set<CAssetID>& rOut)
|
||||
{
|
||||
for (u32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
for (uint32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
{
|
||||
CMaterial *pMat = mMaterials[iMat];
|
||||
if (pMat->IndTexture()) rOut.insert(pMat->IndTexture()->ID());
|
||||
|
||||
for (u32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
for (uint32 iPass = 0; iPass < pMat->PassCount(); iPass++)
|
||||
{
|
||||
CTexture *pTex = pMat->Pass(iPass)->Texture();
|
||||
if (pTex) rOut.insert(pTex->ID());
|
||||
|
|
|
@ -11,7 +11,7 @@ CPoiToWorld::~CPoiToWorld()
|
|||
delete *it;
|
||||
}
|
||||
|
||||
void CPoiToWorld::AddPoi(u32 PoiID)
|
||||
void CPoiToWorld::AddPoi(uint32 PoiID)
|
||||
{
|
||||
// Check if this POI already exists
|
||||
auto it = mPoiLookupMap.find(PoiID);
|
||||
|
@ -26,7 +26,7 @@ void CPoiToWorld::AddPoi(u32 PoiID)
|
|||
}
|
||||
}
|
||||
|
||||
void CPoiToWorld::AddPoiMeshMap(u32 PoiID, u32 ModelID)
|
||||
void CPoiToWorld::AddPoiMeshMap(uint32 PoiID, uint32 ModelID)
|
||||
{
|
||||
// Make sure the POI exists; the add function won't do anything if it does
|
||||
AddPoi(PoiID);
|
||||
|
@ -43,7 +43,7 @@ void CPoiToWorld::AddPoiMeshMap(u32 PoiID, u32 ModelID)
|
|||
pMap->ModelIDs.push_back(ModelID);
|
||||
}
|
||||
|
||||
void CPoiToWorld::RemovePoi(u32 PoiID)
|
||||
void CPoiToWorld::RemovePoi(uint32 PoiID)
|
||||
{
|
||||
for (auto it = mMaps.begin(); it != mMaps.end(); it++)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ void CPoiToWorld::RemovePoi(u32 PoiID)
|
|||
}
|
||||
}
|
||||
|
||||
void CPoiToWorld::RemovePoiMeshMap(u32 PoiID, u32 ModelID)
|
||||
void CPoiToWorld::RemovePoiMeshMap(uint32 PoiID, uint32 ModelID)
|
||||
{
|
||||
auto MapIt = mPoiLookupMap.find(PoiID);
|
||||
|
||||
|
|
|
@ -13,34 +13,34 @@ class CPoiToWorld : public CResource
|
|||
public:
|
||||
struct SPoiMap
|
||||
{
|
||||
u32 PoiID;
|
||||
std::list<u32> ModelIDs;
|
||||
uint32 PoiID;
|
||||
std::list<uint32> ModelIDs;
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<SPoiMap*> mMaps;
|
||||
std::map<u32,SPoiMap*> mPoiLookupMap;
|
||||
std::map<uint32,SPoiMap*> mPoiLookupMap;
|
||||
|
||||
public:
|
||||
CPoiToWorld(CResourceEntry *pEntry = 0);
|
||||
~CPoiToWorld();
|
||||
|
||||
void AddPoi(u32 PoiID);
|
||||
void AddPoiMeshMap(u32 PoiID, u32 ModelID);
|
||||
void RemovePoi(u32 PoiID);
|
||||
void RemovePoiMeshMap(u32 PoiID, u32 ModelID);
|
||||
void AddPoi(uint32 PoiID);
|
||||
void AddPoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||
void RemovePoi(uint32 PoiID);
|
||||
void RemovePoiMeshMap(uint32 PoiID, uint32 ModelID);
|
||||
|
||||
inline u32 NumMappedPOIs() const
|
||||
inline uint32 NumMappedPOIs() const
|
||||
{
|
||||
return mMaps.size();
|
||||
}
|
||||
|
||||
inline const SPoiMap* MapByIndex(u32 Index) const
|
||||
inline const SPoiMap* MapByIndex(uint32 Index) const
|
||||
{
|
||||
return mMaps[Index];
|
||||
}
|
||||
|
||||
inline const SPoiMap* MapByID(u32 InstanceID) const
|
||||
inline const SPoiMap* MapByID(uint32 InstanceID) const
|
||||
{
|
||||
auto it = mPoiLookupMap.find(InstanceID);
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool HasPoiMappings(u32 InstanceID) const
|
||||
bool HasPoiMappings(uint32 InstanceID) const
|
||||
{
|
||||
auto it = mPoiLookupMap.find(InstanceID);
|
||||
return (it != mPoiLookupMap.end());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "CResTypeInfo.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
#include <Common/Macros.h>
|
||||
#include <algorithm>
|
||||
|
||||
std::unordered_map<EResType, CResTypeInfo*> CResTypeInfo::smTypeMap;
|
||||
|
@ -19,7 +19,7 @@ CResTypeInfo::CResTypeInfo(EResType Type, const TString& rkTypeName, const TStri
|
|||
|
||||
bool CResTypeInfo::IsInGame(EGame Game) const
|
||||
{
|
||||
for (u32 iGame = 0; iGame < mCookedExtensions.size(); iGame++)
|
||||
for (uint32 iGame = 0; iGame < mCookedExtensions.size(); iGame++)
|
||||
{
|
||||
if (mCookedExtensions[iGame].Game == Game)
|
||||
return true;
|
||||
|
@ -33,7 +33,7 @@ CFourCC CResTypeInfo::CookedExtension(EGame Game) const
|
|||
if (Game == EGame::Invalid)
|
||||
Game = EGame::Prime;
|
||||
|
||||
for (u32 iGame = 0; iGame < mCookedExtensions.size(); iGame++)
|
||||
for (uint32 iGame = 0; iGame < mCookedExtensions.size(); iGame++)
|
||||
{
|
||||
if (mCookedExtensions[iGame].Game == Game)
|
||||
return mCookedExtensions[iGame].CookedExt;
|
||||
|
@ -90,7 +90,7 @@ CResTypeInfo* CResTypeInfo::TypeForCookedExtension(EGame Game, CFourCC Ext)
|
|||
// Note UNKN is used to indicate unknown asset type
|
||||
if (Ext != FOURCC('UNKN'))
|
||||
{
|
||||
Log::Error("Failed to find resource type for cooked extension: " + Ext.ToString());
|
||||
errorf("Failed to find resource type for cooked extension: %s", *Ext.ToString());
|
||||
DEBUG_BREAK;
|
||||
}
|
||||
sCachedTypeMap[Ext] = nullptr;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/CFourCC.h>
|
||||
#include <Common/types.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/Serialization/IArchive.h>
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue