Sort piece insert preview with the rest of the scene.

This commit is contained in:
Leonardo Zide 2019-11-30 12:19:13 -08:00
parent 2bd9b837dc
commit e9cdeed008
3 changed files with 11 additions and 11 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;