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