diff --git a/common/lc_scene.cpp b/common/lc_scene.cpp index 2982abbc..d8c1129c 100644 --- a/common/lc_scene.cpp +++ b/common/lc_scene.cpp @@ -8,7 +8,6 @@ #include "object.h" lcScene::lcScene() - : mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024) { mActiveSubmodelInstance = nullptr; mDrawInterface = false; @@ -24,10 +23,10 @@ void lcScene::Begin(const lcMatrix44& ViewMatrix) mViewMatrix = ViewMatrix; mActiveSubmodelInstance = nullptr; mPreTranslucentCallback = nullptr; - mRenderMeshes.RemoveAll(); - mOpaqueMeshes.RemoveAll(); - mTranslucentMeshes.RemoveAll(); - mInterfaceObjects.RemoveAll(); + mRenderMeshes.clear(); + mOpaqueMeshes.clear(); + mTranslucentMeshes.clear(); + mInterfaceObjects.clear(); const lcPreferences& Preferences = lcGetPreferences(); mHighlightColor = lcVector4FromColor(Preferences.mHighlightNewPartsColor); @@ -64,7 +63,7 @@ void lcScene::End() void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State) { - lcRenderMesh& RenderMesh = mRenderMeshes.Add(); + lcRenderMesh& RenderMesh = mRenderMeshes.emplace_back(); RenderMesh.WorldMatrix = WorldMatrix; RenderMesh.Mesh = Mesh; @@ -79,7 +78,7 @@ void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorInde mHasFadedParts |= State == lcRenderMeshState::Faded; if ((Flags & (lcMeshFlag::HasSolid | lcMeshFlag::HasLines)) || ((Flags & lcMeshFlag::HasDefault) && !Translucent)) - mOpaqueMeshes.Add(mRenderMeshes.GetSize() - 1); + mOpaqueMeshes.emplace_back(static_cast(mRenderMeshes.size()) - 1); if ((Flags & lcMeshFlag::HasTranslucent) || ((Flags & lcMeshFlag::HasDefault) && Translucent)) { @@ -103,10 +102,10 @@ void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorInde const lcVector3 Center = (Section->BoundingBox.Min + Section->BoundingBox.Max) / 2; const float InstanceDistance = fabsf(lcMul31(lcMul31(Center, WorldMatrix), mViewMatrix).z); - lcTranslucentMeshInstance& Instance = mTranslucentMeshes.Add(); + lcTranslucentMeshInstance& Instance = mTranslucentMeshes.emplace_back(); Instance.Section = Section; Instance.Distance = InstanceDistance; - Instance.RenderMeshIndex = mRenderMeshes.GetSize() - 1; + Instance.RenderMeshIndex = static_cast(mRenderMeshes.size()) - 1; } } } @@ -137,7 +136,7 @@ void lcScene::DrawDebugNormals(lcContext* Context, const lcMesh* Mesh) const void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTypes, bool DrawFaded, bool DrawNonFaded) const { - if (mOpaqueMeshes.IsEmpty()) + if (mOpaqueMeshes.empty()) return; lcMaterialType FlatMaterial, TexturedMaterial; @@ -310,7 +309,7 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawFadePrepass, bool DrawFaded, bool DrawNonFaded) const { - if (mTranslucentMeshes.IsEmpty()) + if (mTranslucentMeshes.empty()) return; lcMaterialType FlatMaterial, TexturedMaterial; diff --git a/common/lc_scene.h b/common/lc_scene.h index 0e404dfb..951fe55a 100644 --- a/common/lc_scene.h +++ b/common/lc_scene.h @@ -90,7 +90,7 @@ public: void AddInterfaceObject(const lcObject* Object) { - mInterfaceObjects.Add(Object); + mInterfaceObjects.emplace_back(Object); } void Draw(lcContext* Context) const; @@ -115,8 +115,8 @@ protected: bool mTranslucentFade; std::function mPreTranslucentCallback; - lcArray mRenderMeshes; - lcArray mOpaqueMeshes; - lcArray mTranslucentMeshes; - lcArray mInterfaceObjects; + std::vector mRenderMeshes; + std::vector mOpaqueMeshes; + std::vector mTranslucentMeshes; + std::vector mInterfaceObjects; };