Highlight parts added in the current step.

This commit is contained in:
Alistair Buxton 2017-06-20 02:30:54 +01:00 committed by Leonardo Zide
parent 7daf13b51e
commit 2de2e2c187
13 changed files with 23 additions and 15 deletions

View file

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

View file

@ -39,6 +39,7 @@ enum lcInterfaceColor
LC_COLOR_LIGHT,
LC_COLOR_CONTROL_POINT,
LC_COLOR_CONTROL_POINT_FOCUSED,
LC_COLOR_HIGHLIGHT,
LC_NUM_INTERFACECOLORS
};

View file

@ -101,7 +101,8 @@ enum lcRenderMeshState
{
LC_RENDERMESH_NONE,
LC_RENDERMESH_SELECTED,
LC_RENDERMESH_FOCUSED
LC_RENDERMESH_FOCUSED,
LC_RENDERMESH_HIGHLIGHT
};
struct lcRenderMesh

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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