mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Removed lcArray instances.
This commit is contained in:
parent
03d0ff5540
commit
a3646c9728
2 changed files with 15 additions and 16 deletions
|
@ -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<int>(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<int>(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;
|
||||
|
|
|
@ -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<void()> mPreTranslucentCallback;
|
||||
lcArray<lcRenderMesh> mRenderMeshes;
|
||||
lcArray<int> mOpaqueMeshes;
|
||||
lcArray<lcTranslucentMeshInstance> mTranslucentMeshes;
|
||||
lcArray<const lcObject*> mInterfaceObjects;
|
||||
std::vector<lcRenderMesh> mRenderMeshes;
|
||||
std::vector<int> mOpaqueMeshes;
|
||||
std::vector<lcTranslucentMeshInstance> mTranslucentMeshes;
|
||||
std::vector<const lcObject*> mInterfaceObjects;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue