diff --git a/common/lc_colors.cpp b/common/lc_colors.cpp index 9a59b73c..ec21c99a 100644 --- a/common/lc_colors.cpp +++ b/common/lc_colors.cpp @@ -16,7 +16,8 @@ lcVector4 gInterfaceColors[LC_NUM_INTERFACECOLORS] = // todo: make the colors co lcVector4(0.500f, 0.800f, 0.500f, 1.000f), // LC_COLOR_CAMERA lcVector4(0.500f, 0.800f, 0.500f, 1.000f), // LC_COLOR_LIGHT lcVector4(0.500f, 0.800f, 0.500f, 0.500f), // LC_COLOR_CONTROL_POINT - lcVector4(0.400f, 0.298f, 0.898f, 0.500f) // LC_COLOR_CONTROL_POINT_FOCUSED + lcVector4(0.400f, 0.298f, 0.898f, 0.500f), // LC_COLOR_CONTROL_POINT_FOCUSED + lcVector4(0.098f, 0.898f, 0.500f, 1.000f) // LC_COLOR_HIGHLIGHT }; static void GetToken(char*& Ptr, char* Token) diff --git a/common/lc_colors.h b/common/lc_colors.h index e951414f..6bc8767b 100644 --- a/common/lc_colors.h +++ b/common/lc_colors.h @@ -39,6 +39,7 @@ enum lcInterfaceColor LC_COLOR_LIGHT, LC_COLOR_CONTROL_POINT, LC_COLOR_CONTROL_POINT_FOCUSED, + LC_COLOR_HIGHLIGHT, LC_NUM_INTERFACECOLORS }; diff --git a/common/lc_mesh.h b/common/lc_mesh.h index a995e4bc..01f6d093 100644 --- a/common/lc_mesh.h +++ b/common/lc_mesh.h @@ -101,7 +101,8 @@ enum lcRenderMeshState { LC_RENDERMESH_NONE, LC_RENDERMESH_SELECTED, - LC_RENDERMESH_FOCUSED + LC_RENDERMESH_FOCUSED, + LC_RENDERMESH_HIGHLIGHT }; struct lcRenderMesh diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 141a6e47..b645f073 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -1088,7 +1088,7 @@ void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface) lcPiece* Piece = mPieces[PieceIdx]; if (Piece->IsVisible(mCurrentStep)) - Piece->AddRenderMeshes(Scene, DrawInterface); + Piece->AddRenderMeshes(Scene, DrawInterface, Piece->GetStepShow()==mCurrentStep); } if (DrawInterface) diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index 120ccdfb..c360dd17 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -353,7 +353,7 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex) lcScene Scene; Scene.Begin(ViewMatrix); - Info->AddRenderMeshes(Scene, lcMatrix44Identity(), mColorIndex, false, false); + Info->AddRenderMeshes(Scene, lcMatrix44Identity(), mColorIndex, false, false, false); Scene.End(); diff --git a/common/lc_scene.cpp b/common/lc_scene.cpp index 6feec86c..2f8677b8 100644 --- a/common/lc_scene.cpp +++ b/common/lc_scene.cpp @@ -95,6 +95,7 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab switch (RenderMesh.State) { case LC_RENDERMESH_NONE: + case LC_RENDERMESH_HIGHLIGHT: Context->SetColorIndex(ColorIndex); break; @@ -125,6 +126,10 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab case LC_RENDERMESH_FOCUSED: Context->SetInterfaceColor(LC_COLOR_FOCUSED); break; + + case LC_RENDERMESH_HIGHLIGHT: + Context->SetInterfaceColor(LC_COLOR_HIGHLIGHT); + break; } } else if (Section->PrimitiveType == LC_MESH_CONDITIONAL_LINES) diff --git a/common/minifig.cpp b/common/minifig.cpp index a51f66d5..9205e162 100644 --- a/common/minifig.cpp +++ b/common/minifig.cpp @@ -282,7 +282,7 @@ void MinifigWizard::OnDraw() for (int PieceIdx = 0; PieceIdx < LC_MFW_NUMITEMS; PieceIdx++) if (mMinifig.Parts[PieceIdx]) - mMinifig.Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig.Matrices[PieceIdx], mMinifig.Colors[PieceIdx], false, false); + mMinifig.Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig.Matrices[PieceIdx], mMinifig.Colors[PieceIdx], false, false, false); Scene.End(); diff --git a/common/piece.cpp b/common/piece.cpp index f511f2cd..671c19c0 100644 --- a/common/piece.cpp +++ b/common/piece.cpp @@ -625,7 +625,7 @@ void lcPiece::DrawInterface(lcContext* Context) const } } -void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface) const +void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight) const { bool Focused, Selected; @@ -641,7 +641,7 @@ void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface) const } if (!mMesh) - mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, Focused, Selected); + mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, Focused, Selected, Highlight); else Scene.AddMesh(mMesh, mModelWorld, mColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE), mPieceInfo->mFlags); @@ -657,7 +657,7 @@ void lcPiece::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat ColorIndex = DefaultColorIndex; if (!mMesh) - mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused, Selected); + mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused, Selected, false); else Scene.AddMesh(mMesh, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE), mPieceInfo->mFlags); } diff --git a/common/piece.h b/common/piece.h index ac6c1635..25af1d64 100644 --- a/common/piece.h +++ b/common/piece.h @@ -346,7 +346,7 @@ public: virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const override; virtual void DrawInterface(lcContext* Context) const override; - void AddRenderMeshes(lcScene& Scene, bool DrawInterface) const; + void AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight) const; void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const; void InsertTime(lcStep Start, lcStep Time); diff --git a/common/pieceinf.cpp b/common/pieceinf.cpp index e1e550e9..f0501e29 100644 --- a/common/pieceinf.cpp +++ b/common/pieceinf.cpp @@ -314,10 +314,10 @@ void PieceInfo::AddRenderMesh(lcScene& Scene) Scene.AddMesh(mMesh, lcMatrix44Identity(), gDefaultColor, LC_RENDERMESH_NONE, mFlags); } -void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected) const +void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, bool Highlight) const { - if (mMesh || (mFlags & LC_PIECE_PLACEHOLDER)) - Scene.AddMesh((mFlags & LC_PIECE_PLACEHOLDER) ? gPlaceholderMesh : mMesh, WorldMatrix, ColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE), mFlags); + if ((mMesh) || (mFlags & LC_PIECE_PLACEHOLDER)) + Scene.AddMesh((mFlags & LC_PIECE_PLACEHOLDER) ? gPlaceholderMesh : mMesh, WorldMatrix, ColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : (Highlight ? LC_RENDERMESH_HIGHLIGHT : LC_RENDERMESH_NONE)), mFlags); if (mFlags & LC_PIECE_MODEL) mModel->SubModelAddRenderMeshes(Scene, WorldMatrix, ColorIndex, Focused, Selected); diff --git a/common/pieceinf.h b/common/pieceinf.h index 38ff06d3..3fa5881f 100644 --- a/common/pieceinf.h +++ b/common/pieceinf.h @@ -134,7 +134,7 @@ public: void ZoomExtents(const lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix, float* EyePos = nullptr) const; void AddRenderMesh(lcScene& Scene); - void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected) const; + void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, bool Highlight) const; void CreatePlaceholder(const char* Name); diff --git a/common/project.cpp b/common/project.cpp index ab1248e6..12a6b9d8 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -1286,7 +1286,7 @@ void Project::ExportHTML() lcScene Scene; Scene.Begin(ViewMatrix); - Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Options.PartImagesColor, false, false); + Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Options.PartImagesColor, false, false, false); Scene.End(); diff --git a/common/view.cpp b/common/view.cpp index d16f01da..d748d48a 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -556,7 +556,7 @@ void View::OnDraw() PieceInfo* Info = gMainWindow->GetCurrentPieceInfo(); if (Info) - Info->AddRenderMeshes(mScene, GetPieceInsertPosition(), gMainWindow->mColorIndex, true, true); + Info->AddRenderMeshes(mScene, GetPieceInsertPosition(), gMainWindow->mColorIndex, true, true, false); } mContext->SetDefaultState();