From 05cf0d6b90f9eaf939a2697824541f2b35bd3da1 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 7 Apr 2018 15:28:44 -0700 Subject: [PATCH] Don't render the preview in wireframe mode. Closes #219. --- common/lc_partselectionwidget.cpp | 1 + common/lc_scene.cpp | 3 +++ common/lc_scene.h | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index e8619a22..2be848f6 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -368,6 +368,7 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex) Context->SetProjectionMatrix(ProjectionMatrix); lcScene Scene; + Scene.SetAllowWireframe(false); Scene.Begin(ViewMatrix); Info->AddRenderMeshes(Scene, lcMatrix44Identity(), mColorIndex, lcRenderMeshState::NORMAL, true); diff --git a/common/lc_scene.cpp b/common/lc_scene.cpp index 691f2bb6..90b8321f 100644 --- a/common/lc_scene.cpp +++ b/common/lc_scene.cpp @@ -11,6 +11,7 @@ lcScene::lcScene() : mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024) { mActiveSubmodelInstance = nullptr; + mAllowWireframe = true; } void lcScene::Begin(const lcMatrix44& ViewMatrix) @@ -239,6 +240,8 @@ void lcScene::Draw(lcContext* Context) const const bool DrawConditional = false; lcShadingMode ShadingMode = lcGetPreferences().mShadingMode; + if (ShadingMode == LC_SHADING_WIREFRAME && !mAllowWireframe) + ShadingMode = LC_SHADING_FLAT; if (ShadingMode == LC_SHADING_WIREFRAME) { diff --git a/common/lc_scene.h b/common/lc_scene.h index 268cbff3..5c02d909 100644 --- a/common/lc_scene.h +++ b/common/lc_scene.h @@ -28,6 +28,11 @@ public: return mDrawInterface; } + void SetAllowWireframe(bool AllowWireframe) + { + mAllowWireframe = AllowWireframe; + } + void Begin(const lcMatrix44& ViewMatrix); void End(); void AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State, int Flags); @@ -46,6 +51,7 @@ protected: lcMatrix44 mViewMatrix; lcPiece* mActiveSubmodelInstance; bool mDrawInterface; + bool mAllowWireframe; lcArray mRenderMeshes; lcArray mOpaqueMeshes;