CCollisionMeshData: Make use of size_t where applicable
Plays nicer with standard types.
This commit is contained in:
parent
ce97d79fa3
commit
65482ba272
|
@ -17,8 +17,8 @@ public:
|
|||
explicit CCollisionMeshGroup(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {}
|
||||
~CCollisionMeshGroup() = default;
|
||||
|
||||
uint32 NumMeshes() const { return mMeshes.size(); }
|
||||
CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index].get(); }
|
||||
size_t NumMeshes() const { return mMeshes.size(); }
|
||||
CCollisionMesh* MeshByIndex(size_t Index) const { return mMeshes[Index].get(); }
|
||||
void AddMesh(std::unique_ptr<CCollisionMesh>&& pMesh) { mMeshes.push_back(std::move(pMesh)); }
|
||||
|
||||
void BuildRenderData()
|
||||
|
|
|
@ -47,13 +47,13 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
|||
|
||||
CColor BaseTint = TintColor(rkViewInfo);
|
||||
|
||||
for (uint32 MeshIdx = 0; MeshIdx < mpCollision->NumMeshes(); MeshIdx++)
|
||||
for (size_t MeshIdx = 0; MeshIdx < mpCollision->NumMeshes(); MeshIdx++)
|
||||
{
|
||||
CCollisionMesh *pMesh = mpCollision->MeshByIndex(MeshIdx);
|
||||
CCollisionRenderData& RenderData = pMesh->GetRenderData();
|
||||
const SCollisionIndexData& kIndexData = pMesh->GetIndexData();
|
||||
|
||||
for (int MatIdx = 0; MatIdx < (int) kIndexData.Materials.size(); MatIdx++)
|
||||
for (int MatIdx = 0; MatIdx < static_cast<int>(kIndexData.Materials.size()); MatIdx++)
|
||||
{
|
||||
const CCollisionMaterial& kMat = kIndexData.Materials[MatIdx];
|
||||
|
||||
|
@ -83,9 +83,9 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
|||
// Render bounding hierarchy
|
||||
if (rkViewInfo.CollisionSettings.DrawBoundingHierarchy)
|
||||
{
|
||||
int Depth = rkViewInfo.CollisionSettings.BoundingHierarchyRenderDepth;
|
||||
const int Depth = rkViewInfo.CollisionSettings.BoundingHierarchyRenderDepth;
|
||||
|
||||
for (uint MeshIdx = 0; MeshIdx < mpCollision->NumMeshes(); MeshIdx++)
|
||||
for (size_t MeshIdx = 0; MeshIdx < mpCollision->NumMeshes(); MeshIdx++)
|
||||
{
|
||||
mpCollision->MeshByIndex(MeshIdx)->GetRenderData().RenderBoundingHierarchy(Depth);
|
||||
}
|
||||
|
@ -124,17 +124,17 @@ void CCollisionNode::SetCollision(CCollisionMeshGroup *pCollision)
|
|||
{
|
||||
mpCollision = pCollision;
|
||||
|
||||
if (mpCollision)
|
||||
{
|
||||
if (!mpCollision)
|
||||
return;
|
||||
|
||||
mpCollision->BuildRenderData();
|
||||
|
||||
// Update bounds
|
||||
mLocalAABox = CAABox::Infinite();
|
||||
|
||||
for (uint MeshIdx = 0; MeshIdx < pCollision->NumMeshes(); MeshIdx++)
|
||||
for (size_t MeshIdx = 0; MeshIdx < pCollision->NumMeshes(); MeshIdx++)
|
||||
{
|
||||
CCollisionMesh* pMesh = pCollision->MeshByIndex(MeshIdx);
|
||||
const CCollisionMesh* pMesh = pCollision->MeshByIndex(MeshIdx);
|
||||
mLocalAABox.ExpandBounds(pMesh->Bounds());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ CCollisionEditor::CCollisionEditor(CCollisionMeshGroup* pCollisionMesh, QWidget*
|
|||
mpUI->ToolBar->addWidget( new QLabel("OBBTree: ", this) );
|
||||
|
||||
int MaxDepth = 0;
|
||||
for (uint MeshIdx = 0; MeshIdx < pCollisionMesh->NumMeshes(); MeshIdx++)
|
||||
for (size_t MeshIdx = 0; MeshIdx < pCollisionMesh->NumMeshes(); MeshIdx++)
|
||||
{
|
||||
CCollisionMesh* pMesh = pCollisionMesh->MeshByIndex(MeshIdx);
|
||||
int MeshDepth = pMesh->GetRenderData().MaxBoundingHierarchyDepth();
|
||||
MaxDepth = Math::Max(MeshDepth, MaxDepth);
|
||||
const CCollisionMesh* pMesh = pCollisionMesh->MeshByIndex(MeshIdx);
|
||||
const int MeshDepth = pMesh->GetRenderData().MaxBoundingHierarchyDepth();
|
||||
MaxDepth = std::max(MeshDepth, MaxDepth);
|
||||
}
|
||||
|
||||
QSlider* pOBBTreeSlider = new QSlider(this);
|
||||
|
|
Loading…
Reference in New Issue