Fixed synth parts adding the wrong mesh to the scene when in a submodel. Fixes #42.

This commit is contained in:
Leonardo Zide 2017-03-26 18:28:31 -07:00
parent ba9a2532a0
commit 49a88e1ab4
3 changed files with 16 additions and 10 deletions

View file

@ -1141,16 +1141,8 @@ void lcModel::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat
{
lcPiece* Piece = mPieces[PieceIdx];
if (Piece->GetStepHide() != LC_STEP_MAX)
continue;
int ColorIndex = Piece->mColorIndex;
if (ColorIndex == gDefaultColor)
ColorIndex = DefaultColorIndex;
PieceInfo* Info = Piece->mPieceInfo;
Info->AddRenderMeshes(Scene, lcMul(Piece->mModelWorld, WorldMatrix), ColorIndex, Focused, Selected);
if (Piece->GetStepHide() == LC_STEP_MAX)
Piece->SubModelAddRenderMeshes(Scene, WorldMatrix, DefaultColorIndex, Focused, Selected);
}
}

View file

@ -648,6 +648,19 @@ void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface) const
Scene.mInterfaceObjects.Add(this);
}
void lcPiece::SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const
{
int ColorIndex = mColorIndex;
if (ColorIndex == gDefaultColor)
ColorIndex = DefaultColorIndex;
if (!mMesh)
mPieceInfo->AddRenderMeshes(Scene, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused, Selected);
else
Scene.AddMesh(mMesh, lcMul(mModelWorld, WorldMatrix), ColorIndex, Focused ? LC_RENDERMESH_FOCUSED : (Selected ? LC_RENDERMESH_SELECTED : LC_RENDERMESH_NONE), mPieceInfo->mFlags);
}
void lcPiece::Move(lcStep Step, bool AddKey, const lcVector3& Distance)
{
lcuint32 Section = GetFocusSection();

View file

@ -347,6 +347,7 @@ public:
virtual void DrawInterface(lcContext* Context) const;
void AddRenderMeshes(lcScene& Scene, bool DrawInterface) const;
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const;
void InsertTime(lcStep Start, lcStep Time);
void RemoveTime(lcStep Start, lcStep Time);