mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 01:15:26 +00:00
CBasicModel: Make use of size_t where applicable
Same behavior, but without some internal variable truncation.
This commit is contained in:
@@ -61,18 +61,17 @@ void CGameArea::MergeTerrain()
|
||||
if (mTerrainMerged) return;
|
||||
|
||||
// Nothing really complicated here - iterate through every terrain submesh, add each to a static model
|
||||
for (uint32 iMdl = 0; iMdl < mWorldModels.size(); iMdl++)
|
||||
for (auto& pMdl : mWorldModels)
|
||||
{
|
||||
auto& pMdl = mWorldModels[iMdl];
|
||||
uint32 SubmeshCount = pMdl->GetSurfaceCount();
|
||||
const size_t SubmeshCount = pMdl->GetSurfaceCount();
|
||||
|
||||
for (uint32 iSurf = 0; iSurf < SubmeshCount; iSurf++)
|
||||
for (size_t iSurf = 0; iSurf < SubmeshCount; iSurf++)
|
||||
{
|
||||
SSurface *pSurf = pMdl->GetSurface(iSurf);
|
||||
CMaterial *pMat = mpMaterialSet->MaterialByIndex(pSurf->MaterialID, false);
|
||||
|
||||
bool NewMat = true;
|
||||
for (auto it = mStaticWorldModels.begin(); it != mStaticWorldModels.end(); it++)
|
||||
for (auto it = mStaticWorldModels.begin(); it != mStaticWorldModels.end(); ++it)
|
||||
{
|
||||
if ((*it)->GetMaterial() == pMat)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ void CAreaCooker::DetermineSectionNumbersPrime()
|
||||
// Determine how many sections are taken up by geometry...
|
||||
// Each world mesh has 7-9 sections (depending on game) plus one section per surface.
|
||||
uint32 GeometrySections = 0;
|
||||
uint32 OriginalMeshCount = mpArea->mOriginalWorldMeshCount;
|
||||
const uint32 OriginalMeshCount = mpArea->mOriginalWorldMeshCount;
|
||||
|
||||
switch (mVersion)
|
||||
{
|
||||
@@ -38,8 +38,10 @@ void CAreaCooker::DetermineSectionNumbersPrime()
|
||||
|
||||
// Set section numbers
|
||||
uint32 SecNum = GeometrySections;
|
||||
if (mVersion <= EGame::Prime) mAROTSecNum = SecNum++;
|
||||
if (mVersion >= EGame::EchoesDemo) mFFFFSecNum = SecNum++;
|
||||
if (mVersion <= EGame::Prime)
|
||||
mAROTSecNum = SecNum++;
|
||||
if (mVersion >= EGame::EchoesDemo)
|
||||
mFFFFSecNum = SecNum++;
|
||||
|
||||
if (mVersion >= EGame::EchoesDemo)
|
||||
{
|
||||
@@ -48,7 +50,9 @@ void CAreaCooker::DetermineSectionNumbersPrime()
|
||||
mSCGNSecNum = SecNum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSCLYSecNum = SecNum++;
|
||||
}
|
||||
|
||||
mCollisionSecNum = SecNum++;
|
||||
mUnknownSecNum = SecNum++;
|
||||
|
||||
@@ -86,9 +86,9 @@ void CAreaLoader::ReadGeometryPrime()
|
||||
else // For Echoes+, load surface mesh IDs, then skip to the start of the next mesh
|
||||
{
|
||||
auto& pModel = FileModels.emplace_back(CModelLoader::LoadWorldModel(*mpMREA, *mpSectionMgr, *mpArea->mpMaterialSet, mVersion));
|
||||
const uint16 NumSurfaces = mpMREA->ReadShort();
|
||||
const size_t NumSurfaces = mpMREA->ReadShort();
|
||||
|
||||
for (uint32 iSurf = 0; iSurf < NumSurfaces; iSurf++)
|
||||
for (size_t iSurf = 0; iSurf < NumSurfaces; iSurf++)
|
||||
{
|
||||
mpMREA->Seek(0x2, SEEK_CUR);
|
||||
pModel->GetSurface(iSurf)->MeshID = mpMREA->ReadShort();
|
||||
@@ -391,9 +391,9 @@ void CAreaLoader::ReadGeometryCorruption()
|
||||
|
||||
// Load surface mesh IDs
|
||||
mpSectionMgr->ToSection(CurWOBJSection - 2);
|
||||
uint16 NumSurfaces = mpMREA->ReadShort();
|
||||
const size_t NumSurfaces = mpMREA->ReadShort();
|
||||
|
||||
for (uint32 iSurf = 0; iSurf < NumSurfaces; iSurf++)
|
||||
for (size_t iSurf = 0; iSurf < NumSurfaces; iSurf++)
|
||||
{
|
||||
mpMREA->Seek(0x2, SEEK_CUR);
|
||||
pWorldModel->GetSurface(iSurf)->MeshID = mpMREA->ReadShort();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "CBasicModel.h"
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
CBasicModel::CBasicModel(CResourceEntry *pEntry)
|
||||
: CResource(pEntry)
|
||||
@@ -14,12 +12,12 @@ CBasicModel::~CBasicModel()
|
||||
delete mSurfaces[iSurf];
|
||||
}
|
||||
|
||||
uint32 CBasicModel::GetVertexCount() const
|
||||
size_t CBasicModel::GetVertexCount() const
|
||||
{
|
||||
return mVertexCount;
|
||||
}
|
||||
|
||||
uint32 CBasicModel::GetTriangleCount() const
|
||||
size_t CBasicModel::GetTriangleCount() const
|
||||
{
|
||||
return mTriangleCount;
|
||||
}
|
||||
@@ -34,17 +32,17 @@ bool CBasicModel::IsBuffered() const
|
||||
return mBuffered;
|
||||
}
|
||||
|
||||
uint32 CBasicModel::GetSurfaceCount() const
|
||||
size_t CBasicModel::GetSurfaceCount() const
|
||||
{
|
||||
return mSurfaces.size();
|
||||
}
|
||||
|
||||
CAABox CBasicModel::GetSurfaceAABox(uint32 Surface) const
|
||||
CAABox CBasicModel::GetSurfaceAABox(size_t Surface) const
|
||||
{
|
||||
return mSurfaces[Surface]->AABox;
|
||||
}
|
||||
|
||||
SSurface* CBasicModel::GetSurface(uint32 Surface)
|
||||
SSurface* CBasicModel::GetSurface(size_t Surface)
|
||||
{
|
||||
return mSurfaces[Surface];
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ public:
|
||||
explicit CBasicModel(CResourceEntry *pEntry = nullptr);
|
||||
~CBasicModel();
|
||||
|
||||
uint32 GetVertexCount() const;
|
||||
uint32 GetTriangleCount() const;
|
||||
size_t GetVertexCount() const;
|
||||
size_t GetTriangleCount() const;
|
||||
CAABox AABox() const;
|
||||
bool IsBuffered() const;
|
||||
uint32 GetSurfaceCount() const;
|
||||
CAABox GetSurfaceAABox(uint32 Surface) const;
|
||||
SSurface* GetSurface(uint32 Surface);
|
||||
size_t GetSurfaceCount() const;
|
||||
CAABox GetSurfaceAABox(size_t Surface) const;
|
||||
SSurface* GetSurface(size_t Surface);
|
||||
virtual void ClearGLBuffer() = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user