Don't show hidden pieces in submodels.
This commit is contained in:
+4
-9
@@ -283,7 +283,7 @@ void lcModel::UpdatePieceInfo(lcArray<lcModel*>& UpdatedModels)
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->GetStepHide() == LC_STEP_MAX)
|
||||
if (Piece->IsVisibleInSubModel())
|
||||
{
|
||||
Piece->mPieceInfo->UpdateBoundingBox(UpdatedModels);
|
||||
Piece->CompareBoundingBox(Min, Max);
|
||||
@@ -1269,7 +1269,7 @@ void lcModel::GetScene(lcScene& Scene, lcCamera* ViewCamera, bool DrawInterface,
|
||||
void lcModel::AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->GetStepHide() == LC_STEP_MAX)
|
||||
if (Piece->IsVisibleInSubModel())
|
||||
Piece->AddSubModelRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, RenderMeshState, ParentActive);
|
||||
}
|
||||
|
||||
@@ -1463,7 +1463,7 @@ bool lcModel::SubModelMinIntersectDist(const lcVector3& WorldStart, const lcVect
|
||||
lcVector3 Start = lcMul31(WorldStart, InverseWorldMatrix);
|
||||
lcVector3 End = lcMul31(WorldEnd, InverseWorldMatrix);
|
||||
|
||||
if (Piece->GetStepHide() == LC_STEP_MAX && Piece->mPieceInfo->MinIntersectDist(Start, End, MinDistance)) // todo: this should check for piece->mMesh first
|
||||
if (Piece->IsVisibleInSubModel() && Piece->mPieceInfo->MinIntersectDist(Start, End, MinDistance)) // todo: this should check for piece->mMesh first
|
||||
MinIntersect = true;
|
||||
}
|
||||
|
||||
@@ -1473,13 +1473,8 @@ bool lcModel::SubModelMinIntersectDist(const lcVector3& WorldStart, const lcVect
|
||||
bool lcModel::SubModelBoxTest(const lcVector4 Planes[6]) const
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
{
|
||||
if (Piece->GetStepHide() != LC_STEP_MAX)
|
||||
continue;
|
||||
|
||||
if (Piece->mPieceInfo->BoxTest(Piece->mModelWorld, Planes))
|
||||
if (Piece->IsVisibleInSubModel() && Piece->mPieceInfo->BoxTest(Piece->mModelWorld, Planes))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+6
-1
@@ -850,7 +850,7 @@ const char* lcPiece::GetName() const
|
||||
return mPieceInfo->m_strDescription;
|
||||
}
|
||||
|
||||
bool lcPiece::IsVisible(lcStep Step)
|
||||
bool lcPiece::IsVisible(lcStep Step) const
|
||||
{
|
||||
if (mState & LC_PIECE_HIDDEN)
|
||||
return false;
|
||||
@@ -858,6 +858,11 @@ bool lcPiece::IsVisible(lcStep Step)
|
||||
return (mStepShow <= Step) && (mStepHide > Step || mStepHide == LC_STEP_MAX);
|
||||
}
|
||||
|
||||
bool lcPiece::IsVisibleInSubModel() const
|
||||
{
|
||||
return (mStepHide == LC_STEP_MAX) && !(mState & LC_PIECE_HIDDEN);
|
||||
}
|
||||
|
||||
const lcBoundingBox& lcPiece::GetBoundingBox() const
|
||||
{
|
||||
if (!mMesh)
|
||||
|
||||
+2
-1
@@ -394,7 +394,8 @@ public:
|
||||
void UpdateID();
|
||||
|
||||
const char* GetName() const override;
|
||||
bool IsVisible(lcStep Step);
|
||||
bool IsVisible(lcStep Step) const;
|
||||
bool IsVisibleInSubModel() const;
|
||||
void Initialize(const lcMatrix44& WorldMatrix, lcStep Step);
|
||||
const lcBoundingBox& GetBoundingBox() const;
|
||||
void CompareBoundingBox(lcVector3& Min, lcVector3& Max) const;
|
||||
|
||||
Reference in New Issue
Block a user