From e9cdeed00836d6ecc533e7be1cef7ed63a9de705 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 30 Nov 2019 12:19:13 -0800 Subject: [PATCH] Sort piece insert preview with the rest of the scene. --- common/lc_model.cpp | 10 ++-------- common/lc_model.h | 2 +- common/view.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 4165a71f..5602de5f 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -1248,19 +1248,15 @@ void lcModel::DuplicateSelectedPieces() SaveCheckpoint(tr("Duplicating Pieces")); } -void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance, const lcMatrix44& ActiveSubmodelTransform) const +void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool Highlight) const { - Scene.Begin(ViewCamera->mWorldView); - Scene.SetActiveSubmodelInstance(ActiveSubmodelInstance, ActiveSubmodelTransform); - Scene.SetDrawInterface(DrawInterface); - mPieceInfo->AddRenderMesh(Scene); for (lcPiece* Piece : mPieces) if (Piece->IsVisible(mCurrentStep)) Piece->AddMainModelRenderMeshes(Scene, Highlight && Piece->GetStepShow() == mCurrentStep); - if (DrawInterface && !ActiveSubmodelInstance) + if (Scene.GetDrawInterface() && !Scene.GetActiveSubmodelInstance()) { for (lcCamera* Camera : mCameras) if (Camera != ViewCamera && Camera->IsVisible()) @@ -1270,8 +1266,6 @@ void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, if (Light->IsVisible()) Scene.AddInterfaceObject(Light); } - - Scene.End(); } void lcModel::AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const diff --git a/common/lc_model.h b/common/lc_model.h index f2e27675..5c9a5712 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -225,7 +225,7 @@ public: void Paste(); void DuplicateSelectedPieces(); - void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance, const lcMatrix44& ActiveSubmodelTransform) const; + void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool Highlight) const; void AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const; void DrawBackground(lcGLWidget* Widget); void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End); diff --git a/common/view.cpp b/common/view.cpp index 897bc2fb..4d2048bf 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -805,11 +805,15 @@ void View::OnDraw() return; const lcPreferences& Preferences = lcGetPreferences(); + const bool DrawInterface = mWidget != nullptr; - bool DrawInterface = mWidget != nullptr; mScene.SetAllowLOD(Preferences.mAllowLOD && mWidget != nullptr); + mScene.SetActiveSubmodelInstance(mActiveSubmodelInstance, mActiveSubmodelTransform); + mScene.SetDrawInterface(DrawInterface); - mModel->GetScene(mScene, mCamera, DrawInterface, mHighlight, mActiveSubmodelInstance, mActiveSubmodelTransform); + mScene.Begin(mCamera->mWorldView); + + mModel->GetScene(mScene, mCamera, mHighlight); if (DrawInterface && mTrackTool == LC_TRACKTOOL_INSERT) { @@ -829,6 +833,8 @@ void View::OnDraw() if (DrawInterface) mScene.SetPreTranslucentCallback([this]() { DrawGrid(); }); + mScene.End(); + int TotalTileRows = 1; int TotalTileColumns = 1;