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"
|
#include "object.h"
|
||||||
|
|
||||||
lcScene::lcScene()
|
lcScene::lcScene()
|
||||||
: mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024)
|
|
||||||
{
|
{
|
||||||
mActiveSubmodelInstance = nullptr;
|
mActiveSubmodelInstance = nullptr;
|
||||||
mDrawInterface = false;
|
mDrawInterface = false;
|
||||||
|
@ -24,10 +23,10 @@ void lcScene::Begin(const lcMatrix44& ViewMatrix)
|
||||||
mViewMatrix = ViewMatrix;
|
mViewMatrix = ViewMatrix;
|
||||||
mActiveSubmodelInstance = nullptr;
|
mActiveSubmodelInstance = nullptr;
|
||||||
mPreTranslucentCallback = nullptr;
|
mPreTranslucentCallback = nullptr;
|
||||||
mRenderMeshes.RemoveAll();
|
mRenderMeshes.clear();
|
||||||
mOpaqueMeshes.RemoveAll();
|
mOpaqueMeshes.clear();
|
||||||
mTranslucentMeshes.RemoveAll();
|
mTranslucentMeshes.clear();
|
||||||
mInterfaceObjects.RemoveAll();
|
mInterfaceObjects.clear();
|
||||||
|
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
mHighlightColor = lcVector4FromColor(Preferences.mHighlightNewPartsColor);
|
mHighlightColor = lcVector4FromColor(Preferences.mHighlightNewPartsColor);
|
||||||
|
@ -64,7 +63,7 @@ void lcScene::End()
|
||||||
|
|
||||||
void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State)
|
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.WorldMatrix = WorldMatrix;
|
||||||
RenderMesh.Mesh = Mesh;
|
RenderMesh.Mesh = Mesh;
|
||||||
|
@ -79,7 +78,7 @@ void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorInde
|
||||||
mHasFadedParts |= State == lcRenderMeshState::Faded;
|
mHasFadedParts |= State == lcRenderMeshState::Faded;
|
||||||
|
|
||||||
if ((Flags & (lcMeshFlag::HasSolid | lcMeshFlag::HasLines)) || ((Flags & lcMeshFlag::HasDefault) && !Translucent))
|
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))
|
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 lcVector3 Center = (Section->BoundingBox.Min + Section->BoundingBox.Max) / 2;
|
||||||
const float InstanceDistance = fabsf(lcMul31(lcMul31(Center, WorldMatrix), mViewMatrix).z);
|
const float InstanceDistance = fabsf(lcMul31(lcMul31(Center, WorldMatrix), mViewMatrix).z);
|
||||||
|
|
||||||
lcTranslucentMeshInstance& Instance = mTranslucentMeshes.Add();
|
lcTranslucentMeshInstance& Instance = mTranslucentMeshes.emplace_back();
|
||||||
Instance.Section = Section;
|
Instance.Section = Section;
|
||||||
Instance.Distance = InstanceDistance;
|
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
|
void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTypes, bool DrawFaded, bool DrawNonFaded) const
|
||||||
{
|
{
|
||||||
if (mOpaqueMeshes.IsEmpty())
|
if (mOpaqueMeshes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lcMaterialType FlatMaterial, TexturedMaterial;
|
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
|
void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawFadePrepass, bool DrawFaded, bool DrawNonFaded) const
|
||||||
{
|
{
|
||||||
if (mTranslucentMeshes.IsEmpty())
|
if (mTranslucentMeshes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lcMaterialType FlatMaterial, TexturedMaterial;
|
lcMaterialType FlatMaterial, TexturedMaterial;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
void AddInterfaceObject(const lcObject* Object)
|
void AddInterfaceObject(const lcObject* Object)
|
||||||
{
|
{
|
||||||
mInterfaceObjects.Add(Object);
|
mInterfaceObjects.emplace_back(Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw(lcContext* Context) const;
|
void Draw(lcContext* Context) const;
|
||||||
|
@ -115,8 +115,8 @@ protected:
|
||||||
bool mTranslucentFade;
|
bool mTranslucentFade;
|
||||||
|
|
||||||
std::function<void()> mPreTranslucentCallback;
|
std::function<void()> mPreTranslucentCallback;
|
||||||
lcArray<lcRenderMesh> mRenderMeshes;
|
std::vector<lcRenderMesh> mRenderMeshes;
|
||||||
lcArray<int> mOpaqueMeshes;
|
std::vector<int> mOpaqueMeshes;
|
||||||
lcArray<lcTranslucentMeshInstance> mTranslucentMeshes;
|
std::vector<lcTranslucentMeshInstance> mTranslucentMeshes;
|
||||||
lcArray<const lcObject*> mInterfaceObjects;
|
std::vector<const lcObject*> mInterfaceObjects;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue