mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed selection tinting when editing submodels.
This commit is contained in:
parent
4a9cd5556b
commit
718b31a2bd
13 changed files with 93 additions and 57 deletions
|
@ -96,13 +96,13 @@ public:
|
||||||
int mIndexType;
|
int mIndexType;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcRenderMeshState
|
enum class lcRenderMeshState : int
|
||||||
{
|
{
|
||||||
LC_RENDERMESH_NONE,
|
NORMAL,
|
||||||
LC_RENDERMESH_SELECTED,
|
SELECTED,
|
||||||
LC_RENDERMESH_FOCUSED,
|
FOCUSED,
|
||||||
LC_RENDERMESH_DISABLED,
|
DISABLED,
|
||||||
LC_RENDERMESH_HIGHLIGHT
|
HIGHLIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lcRenderMesh
|
struct lcRenderMesh
|
||||||
|
|
|
@ -1254,12 +1254,14 @@ void lcModel::DuplicateSelectedPieces()
|
||||||
void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const
|
void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const
|
||||||
{
|
{
|
||||||
Scene.Begin(ViewCamera->mWorldView);
|
Scene.Begin(ViewCamera->mWorldView);
|
||||||
|
Scene.SetActiveSubmodelInstance(ActiveSubmodelInstance);
|
||||||
|
Scene.SetDrawInterface(DrawInterface);
|
||||||
|
|
||||||
mPieceInfo->AddRenderMesh(Scene);
|
mPieceInfo->AddRenderMesh(Scene);
|
||||||
|
|
||||||
for (lcPiece* Piece : mPieces)
|
for (lcPiece* Piece : mPieces)
|
||||||
if (Piece->IsVisible(mCurrentStep))
|
if (Piece->IsVisible(mCurrentStep))
|
||||||
Piece->AddRenderMeshes(Scene, DrawInterface, Highlight && Piece->GetStepShow() == mCurrentStep, ActiveSubmodelInstance);
|
Piece->AddMainModelRenderMeshes(Scene, Highlight && Piece->GetStepShow() == mCurrentStep);
|
||||||
|
|
||||||
if (DrawInterface && !ActiveSubmodelInstance)
|
if (DrawInterface && !ActiveSubmodelInstance)
|
||||||
{
|
{
|
||||||
|
@ -1283,11 +1285,11 @@ void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface,
|
||||||
Scene.End();
|
Scene.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected, bool Disabled, lcPiece* ActiveSubmodelInstance) const
|
void lcModel::AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const
|
||||||
{
|
{
|
||||||
for (lcPiece* Piece : mPieces)
|
for (lcPiece* Piece : mPieces)
|
||||||
if (Piece->GetStepHide() == LC_STEP_MAX)
|
if (Piece->GetStepHide() == LC_STEP_MAX)
|
||||||
Piece->SubModelAddRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, Focused, Selected, Disabled, ActiveSubmodelInstance);
|
Piece->AddSubModelRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, RenderMeshState, ParentActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModel::DrawBackground(lcGLWidget* Widget)
|
void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#define LC_SEL_CAN_REMOVE_CONTROL_POINT 0x1000 // Can remove control points from focused piece
|
#define LC_SEL_CAN_REMOVE_CONTROL_POINT 0x1000 // Can remove control points from focused piece
|
||||||
|
|
||||||
class lcGLWidget;
|
class lcGLWidget;
|
||||||
|
enum class lcRenderMeshState : int;
|
||||||
|
|
||||||
enum class lcSelectionMode
|
enum class lcSelectionMode
|
||||||
{
|
{
|
||||||
|
@ -233,7 +234,7 @@ public:
|
||||||
void DuplicateSelectedPieces();
|
void DuplicateSelectedPieces();
|
||||||
|
|
||||||
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const;
|
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const;
|
||||||
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected, bool Disabled, lcPiece* ActiveSubmodelInstance) const;
|
void AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
|
||||||
void DrawBackground(lcGLWidget* Widget);
|
void DrawBackground(lcGLWidget* Widget);
|
||||||
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End);
|
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End);
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex)
|
||||||
lcScene Scene;
|
lcScene Scene;
|
||||||
Scene.Begin(ViewMatrix);
|
Scene.Begin(ViewMatrix);
|
||||||
|
|
||||||
Info->AddRenderMeshes(Scene, lcMatrix44Identity(), mColorIndex, false, false, false, false, nullptr);
|
Info->AddRenderMeshes(Scene, lcMatrix44Identity(), mColorIndex, lcRenderMeshState::NORMAL, true);
|
||||||
|
|
||||||
Scene.End();
|
Scene.End();
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,14 @@
|
||||||
lcScene::lcScene()
|
lcScene::lcScene()
|
||||||
: mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024)
|
: mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024)
|
||||||
{
|
{
|
||||||
|
mActiveSubmodelInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcScene::Begin(const lcMatrix44& ViewMatrix)
|
void lcScene::Begin(const lcMatrix44& ViewMatrix)
|
||||||
{
|
{
|
||||||
mViewMatrix = ViewMatrix;
|
mViewMatrix = ViewMatrix;
|
||||||
|
mActiveSubmodelInstance = nullptr;
|
||||||
|
mDrawInterface = false;
|
||||||
mRenderMeshes.RemoveAll();
|
mRenderMeshes.RemoveAll();
|
||||||
mOpaqueMeshes.RemoveAll();
|
mOpaqueMeshes.RemoveAll();
|
||||||
mTranslucentMeshes.RemoveAll();
|
mTranslucentMeshes.RemoveAll();
|
||||||
|
@ -94,20 +97,20 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
|
||||||
|
|
||||||
switch (RenderMesh.State)
|
switch (RenderMesh.State)
|
||||||
{
|
{
|
||||||
case LC_RENDERMESH_NONE:
|
case lcRenderMeshState::NORMAL:
|
||||||
case LC_RENDERMESH_HIGHLIGHT:
|
case lcRenderMeshState::HIGHLIGHT:
|
||||||
Context->SetColorIndex(ColorIndex);
|
Context->SetColorIndex(ColorIndex);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_SELECTED:
|
case lcRenderMeshState::SELECTED:
|
||||||
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_SELECTED, 0.5f);
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_SELECTED, 0.5f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_FOCUSED:
|
case lcRenderMeshState::FOCUSED:
|
||||||
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_FOCUSED, 0.5f);
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_FOCUSED, 0.5f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_DISABLED:
|
case lcRenderMeshState::DISABLED:
|
||||||
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_DISABLED, 0.25f);
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_DISABLED, 0.25f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -116,26 +119,26 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
|
||||||
{
|
{
|
||||||
switch (RenderMesh.State)
|
switch (RenderMesh.State)
|
||||||
{
|
{
|
||||||
case LC_RENDERMESH_NONE:
|
case lcRenderMeshState::NORMAL:
|
||||||
if (ColorIndex == gEdgeColor)
|
if (ColorIndex == gEdgeColor)
|
||||||
Context->SetEdgeColorIndex(RenderMesh.ColorIndex);
|
Context->SetEdgeColorIndex(RenderMesh.ColorIndex);
|
||||||
else
|
else
|
||||||
Context->SetColorIndex(ColorIndex);
|
Context->SetColorIndex(ColorIndex);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_SELECTED:
|
case lcRenderMeshState::SELECTED:
|
||||||
Context->SetInterfaceColor(LC_COLOR_SELECTED);
|
Context->SetInterfaceColor(LC_COLOR_SELECTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_FOCUSED:
|
case lcRenderMeshState::FOCUSED:
|
||||||
Context->SetInterfaceColor(LC_COLOR_FOCUSED);
|
Context->SetInterfaceColor(LC_COLOR_FOCUSED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_HIGHLIGHT:
|
case lcRenderMeshState::HIGHLIGHT:
|
||||||
Context->SetInterfaceColor(LC_COLOR_HIGHLIGHT);
|
Context->SetInterfaceColor(LC_COLOR_HIGHLIGHT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_RENDERMESH_DISABLED:
|
case lcRenderMeshState::DISABLED:
|
||||||
Context->SetInterfaceColor(LC_COLOR_DISABLED);
|
Context->SetInterfaceColor(LC_COLOR_DISABLED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,26 @@ class lcScene
|
||||||
public:
|
public:
|
||||||
lcScene();
|
lcScene();
|
||||||
|
|
||||||
|
void SetActiveSubmodelInstance(lcPiece* ActiveSubmodelInstance)
|
||||||
|
{
|
||||||
|
mActiveSubmodelInstance = ActiveSubmodelInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
lcPiece* GetActiveSubmodelInstance() const
|
||||||
|
{
|
||||||
|
return mActiveSubmodelInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDrawInterface(bool DrawInterface)
|
||||||
|
{
|
||||||
|
mDrawInterface = DrawInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetDrawInterface() const
|
||||||
|
{
|
||||||
|
return mDrawInterface;
|
||||||
|
}
|
||||||
|
|
||||||
void Begin(const lcMatrix44& ViewMatrix);
|
void Begin(const lcMatrix44& ViewMatrix);
|
||||||
void End();
|
void End();
|
||||||
void AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State, int Flags);
|
void AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State, int Flags);
|
||||||
|
@ -24,6 +44,9 @@ protected:
|
||||||
void DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool EnableNormals, bool DrawTranslucent, bool DrawTextured) const;
|
void DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool EnableNormals, bool DrawTranslucent, bool DrawTextured) const;
|
||||||
|
|
||||||
lcMatrix44 mViewMatrix;
|
lcMatrix44 mViewMatrix;
|
||||||
|
lcPiece* mActiveSubmodelInstance;
|
||||||
|
bool mDrawInterface;
|
||||||
|
|
||||||
lcArray<lcRenderMesh> mRenderMeshes;
|
lcArray<lcRenderMesh> mRenderMeshes;
|
||||||
lcArray<int> mOpaqueMeshes;
|
lcArray<int> mOpaqueMeshes;
|
||||||
lcArray<int> mTranslucentMeshes;
|
lcArray<int> mTranslucentMeshes;
|
||||||
|
|
|
@ -350,7 +350,7 @@ void MinifigWizard::OnDraw()
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < LC_MFW_NUMITEMS; PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < LC_MFW_NUMITEMS; PieceIdx++)
|
||||||
if (mMinifig.Parts[PieceIdx])
|
if (mMinifig.Parts[PieceIdx])
|
||||||
mMinifig.Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig.Matrices[PieceIdx], mMinifig.Colors[PieceIdx], false, false, false, false, nullptr);
|
mMinifig.Parts[PieceIdx]->AddRenderMeshes(Scene, mMinifig.Matrices[PieceIdx], mMinifig.Colors[PieceIdx], lcRenderMeshState::NORMAL, true);
|
||||||
|
|
||||||
Scene.End();
|
Scene.End();
|
||||||
|
|
||||||
|
|
|
@ -646,46 +646,55 @@ void lcPiece::RemoveKeyFrames()
|
||||||
ChangeKey(mRotationKeys, lcMatrix33(mModelWorld), 1, true);
|
ChangeKey(mRotationKeys, lcMatrix33(mModelWorld), 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const
|
void lcPiece::AddMainModelRenderMeshes(lcScene& Scene, bool Highlight) const
|
||||||
{
|
{
|
||||||
bool Focused, Selected, Disabled;
|
lcRenderMeshState RenderMeshState = lcRenderMeshState::NORMAL;
|
||||||
|
bool ParentActive = false;
|
||||||
|
|
||||||
if (DrawInterface)
|
if (Scene.GetDrawInterface())
|
||||||
{
|
{
|
||||||
Focused = IsFocused();
|
lcPiece* ActiveSubmodelInstance = Scene.GetActiveSubmodelInstance();
|
||||||
Selected = IsSelected();
|
|
||||||
Disabled = ActiveSubmodelInstance && (ActiveSubmodelInstance != this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Focused = false;
|
|
||||||
Selected = false;
|
|
||||||
Disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ActiveSubmodelInstance == this)
|
if (!ActiveSubmodelInstance)
|
||||||
ActiveSubmodelInstance = nullptr;
|
RenderMeshState = IsFocused() ? lcRenderMeshState::FOCUSED : (IsSelected() ? lcRenderMeshState::SELECTED : lcRenderMeshState::NORMAL);
|
||||||
|
else if (ActiveSubmodelInstance == this)
|
||||||
|
ParentActive = true;
|
||||||
|
else
|
||||||
|
RenderMeshState = lcRenderMeshState::DISABLED;
|
||||||
|
}
|
||||||
|
else if (Highlight)
|
||||||
|
RenderMeshState = lcRenderMeshState::HIGHLIGHT;
|
||||||
|
|
||||||
if (!mMesh)
|
if (!mMesh)
|
||||||
mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, Focused, Selected, Disabled, Highlight, ActiveSubmodelInstance);
|
mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, RenderMeshState, ParentActive);
|
||||||
else
|
else
|
||||||
Scene.AddMesh(mMesh, mModelWorld, mColorIndex, Disabled ? LC_RENDERMESH_DISABLED : (Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE)), mPieceInfo->mFlags);
|
Scene.AddMesh(mMesh, mModelWorld, mColorIndex, RenderMeshState, mPieceInfo->mFlags);
|
||||||
|
|
||||||
if (Selected)
|
if (RenderMeshState == lcRenderMeshState::FOCUSED || RenderMeshState == lcRenderMeshState::SELECTED)
|
||||||
Scene.AddInterfaceObject(this);
|
Scene.AddInterfaceObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected, bool Disabled, lcPiece* ActiveSubmodelInstance) const
|
void lcPiece::AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const
|
||||||
{
|
{
|
||||||
int ColorIndex = mColorIndex;
|
int ColorIndex = mColorIndex;
|
||||||
|
|
||||||
if (ColorIndex == gDefaultColor)
|
if (ColorIndex == gDefaultColor)
|
||||||
ColorIndex = DefaultColorIndex;
|
ColorIndex = DefaultColorIndex;
|
||||||
|
|
||||||
|
lcPiece* ActiveSubmodelInstance = Scene.GetActiveSubmodelInstance();
|
||||||
|
|
||||||
|
if (ActiveSubmodelInstance == this)
|
||||||
|
RenderMeshState = lcRenderMeshState::NORMAL;
|
||||||
|
else if (ParentActive)
|
||||||
|
RenderMeshState = IsFocused() ? lcRenderMeshState::FOCUSED : (IsSelected() ? lcRenderMeshState::SELECTED : lcRenderMeshState::NORMAL);
|
||||||
|
|
||||||
if (!mMesh)
|
if (!mMesh)
|
||||||
mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused, Selected, Disabled, false, ActiveSubmodelInstance);
|
mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, RenderMeshState, ActiveSubmodelInstance == this);
|
||||||
else
|
else
|
||||||
Scene.AddMesh(mMesh, lcMul(mModelWorld, WorldMatrix), ColorIndex, Disabled ? LC_RENDERMESH_DISABLED : (Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE)), mPieceInfo->mFlags);
|
Scene.AddMesh(mMesh, lcMul(mModelWorld, WorldMatrix), ColorIndex, RenderMeshState, mPieceInfo->mFlags);
|
||||||
|
|
||||||
|
if (ParentActive && (RenderMeshState == lcRenderMeshState::FOCUSED || RenderMeshState == lcRenderMeshState::SELECTED))
|
||||||
|
Scene.AddInterfaceObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPiece::MoveSelected(lcStep Step, bool AddKey, const lcVector3& Distance)
|
void lcPiece::MoveSelected(lcStep Step, bool AddKey, const lcVector3& Distance)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class PieceInfo;
|
class PieceInfo;
|
||||||
|
enum class lcRenderMeshState : int;
|
||||||
|
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "lc_colors.h"
|
#include "lc_colors.h"
|
||||||
|
@ -346,8 +347,8 @@ public:
|
||||||
virtual void DrawInterface(lcContext* Context) const override;
|
virtual void DrawInterface(lcContext* Context) const override;
|
||||||
virtual void RemoveKeyFrames() override;
|
virtual void RemoveKeyFrames() override;
|
||||||
|
|
||||||
void AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight, lcPiece* ActiveSubmodelInstance) const;
|
void AddMainModelRenderMeshes(lcScene& Scene, bool Highlight) const;
|
||||||
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected, bool Disabled, lcPiece* ActiveSubmodelInstance) const;
|
void AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
|
||||||
|
|
||||||
void InsertTime(lcStep Start, lcStep Time);
|
void InsertTime(lcStep Start, lcStep Time);
|
||||||
void RemoveTime(lcStep Start, lcStep Time);
|
void RemoveTime(lcStep Start, lcStep Time);
|
||||||
|
|
|
@ -303,21 +303,21 @@ void PieceInfo::ZoomExtents(float FoV, float AspectRatio, lcMatrix44& Projection
|
||||||
void PieceInfo::AddRenderMesh(lcScene& Scene)
|
void PieceInfo::AddRenderMesh(lcScene& Scene)
|
||||||
{
|
{
|
||||||
if (mMesh)
|
if (mMesh)
|
||||||
Scene.AddMesh(mMesh, lcMatrix44Identity(), gDefaultColor, LC_RENDERMESH_NONE, mFlags);
|
Scene.AddMesh(mMesh, lcMatrix44Identity(), gDefaultColor, lcRenderMeshState::NORMAL, mFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, bool Disabled, bool Highlight, lcPiece* ActiveSubmodelInstance) const
|
void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const
|
||||||
{
|
{
|
||||||
if ((mMesh) || (mFlags & LC_PIECE_PLACEHOLDER))
|
if ((mMesh) || (mFlags & LC_PIECE_PLACEHOLDER))
|
||||||
Scene.AddMesh((mFlags & LC_PIECE_PLACEHOLDER) ? gPlaceholderMesh : mMesh, WorldMatrix, ColorIndex, Disabled ? LC_RENDERMESH_DISABLED : (Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : (Highlight ? LC_RENDERMESH_HIGHLIGHT : LC_RENDERMESH_NONE))), mFlags);
|
Scene.AddMesh((mFlags & LC_PIECE_PLACEHOLDER) ? gPlaceholderMesh : mMesh, WorldMatrix, ColorIndex, RenderMeshState, mFlags);
|
||||||
|
|
||||||
if (mFlags & LC_PIECE_MODEL)
|
if (mFlags & LC_PIECE_MODEL)
|
||||||
mModel->SubModelAddRenderMeshes(Scene, WorldMatrix, ColorIndex, Focused, Selected, Disabled, ActiveSubmodelInstance);
|
mModel->AddSubModelRenderMeshes(Scene, WorldMatrix, ColorIndex, RenderMeshState, ParentActive);
|
||||||
else if (mFlags & LC_PIECE_PROJECT)
|
else if (mFlags & LC_PIECE_PROJECT)
|
||||||
{
|
{
|
||||||
lcModel* Model = mProject->GetMainModel();
|
lcModel* Model = mProject->GetMainModel();
|
||||||
if (Model)
|
if (Model)
|
||||||
Model->SubModelAddRenderMeshes(Scene, WorldMatrix, ColorIndex, Focused, Selected, Disabled, ActiveSubmodelInstance);
|
Model->AddSubModelRenderMeshes(Scene, WorldMatrix, ColorIndex, RenderMeshState, ParentActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public:
|
||||||
|
|
||||||
void ZoomExtents(float FoV, float AspectRatio, lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix) const;
|
void ZoomExtents(float FoV, float AspectRatio, lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix) const;
|
||||||
void AddRenderMesh(lcScene& Scene);
|
void AddRenderMesh(lcScene& Scene);
|
||||||
void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, bool Disabled, bool Highlight, lcPiece* ActiveSubmodelInstance) const;
|
void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
|
||||||
|
|
||||||
void CreatePlaceholder(const char* Name);
|
void CreatePlaceholder(const char* Name);
|
||||||
|
|
||||||
|
|
|
@ -1554,7 +1554,7 @@ QImage Project::CreatePartsListImage(lcModel* Model, lcStep Step)
|
||||||
lcScene Scene;
|
lcScene Scene;
|
||||||
Scene.Begin(ViewMatrix);
|
Scene.Begin(ViewMatrix);
|
||||||
|
|
||||||
Image.Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Image.ColorIndex, false, false, false, false, nullptr);
|
Image.Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Image.ColorIndex, lcRenderMeshState::NORMAL, true);
|
||||||
|
|
||||||
Scene.End();
|
Scene.End();
|
||||||
|
|
||||||
|
@ -1942,7 +1942,7 @@ void Project::ExportHTML(const lcHTMLExportOptions& Options)
|
||||||
lcScene Scene;
|
lcScene Scene;
|
||||||
Scene.Begin(ViewMatrix);
|
Scene.Begin(ViewMatrix);
|
||||||
|
|
||||||
Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Options.PartImagesColor, false, false, false, false, nullptr);
|
Info->AddRenderMeshes(Scene, lcMatrix44Identity(), Options.PartImagesColor, lcRenderMeshState::NORMAL, true);
|
||||||
|
|
||||||
Scene.End();
|
Scene.End();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ void View::SetSelectedSubmodelActive()
|
||||||
{
|
{
|
||||||
lcModel* Model = mActiveSubmodelInstance->mPieceInfo->GetModel();
|
lcModel* Model = mActiveSubmodelInstance->mPieceInfo->GetModel();
|
||||||
Model->SetActive(false);
|
Model->SetActive(false);
|
||||||
Model->ClearSelection(true);
|
|
||||||
mActiveSubmodelInstance = nullptr;
|
mActiveSubmodelInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,13 +66,11 @@ void View::SetSelectedSubmodelActive()
|
||||||
|
|
||||||
if (Piece->mPieceInfo->IsModel())
|
if (Piece->mPieceInfo->IsModel())
|
||||||
{
|
{
|
||||||
ActiveModel->ClearSelection(false);
|
|
||||||
mActiveSubmodelMatrix = lcMatrix44Identity();
|
mActiveSubmodelMatrix = lcMatrix44Identity();
|
||||||
mModel->GetPieceWorldMatrix(Piece, mActiveSubmodelMatrix);
|
mModel->GetPieceWorldMatrix(Piece, mActiveSubmodelMatrix);
|
||||||
mActiveSubmodelInstance = Piece;
|
mActiveSubmodelInstance = Piece;
|
||||||
lcModel* Model = mActiveSubmodelInstance->mPieceInfo->GetModel();
|
lcModel* Model = mActiveSubmodelInstance->mPieceInfo->GetModel();
|
||||||
Model->SetActive(true);
|
Model->SetActive(true);
|
||||||
Model->ClearSelection(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -722,7 +719,7 @@ void View::OnDraw()
|
||||||
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
||||||
|
|
||||||
if (Info)
|
if (Info)
|
||||||
Info->AddRenderMeshes(mScene, GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo()), gMainWindow->mColorIndex, true, true, false, false, nullptr);
|
Info->AddRenderMeshes(mScene, GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo()), gMainWindow->mColorIndex, lcRenderMeshState::FOCUSED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TotalTileRows = 1;
|
int TotalTileRows = 1;
|
||||||
|
|
Loading…
Reference in a new issue