mirror of
https://github.com/leozide/leocad
synced 2025-02-06 08:46:06 +01:00
Fixed crash dragging models from the parts tree.
This commit is contained in:
parent
c6b27f2d05
commit
b537f4c9a1
3 changed files with 12 additions and 22 deletions
|
@ -220,11 +220,6 @@ void PieceInfo::ZoomExtents(const lcMatrix44& ProjectionMatrix, lcMatrix44& View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PieceInfo::RenderPiece(int nColor)
|
|
||||||
{
|
|
||||||
mMesh->Render(nColor, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected)
|
void PieceInfo::AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected)
|
||||||
{
|
{
|
||||||
if (mFlags & LC_PIECE_MODEL)
|
if (mFlags & LC_PIECE_MODEL)
|
||||||
|
|
|
@ -90,9 +90,7 @@ public:
|
||||||
(m_fDimensions[2] + m_fDimensions[5]) * 0.5f);
|
(m_fDimensions[2] + m_fDimensions[5]) * 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
|
||||||
void ZoomExtents(const lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix, float* EyePos = NULL) const;
|
void ZoomExtents(const lcMatrix44& ProjectionMatrix, lcMatrix44& ViewMatrix, float* EyePos = NULL) const;
|
||||||
void RenderPiece(int nColor);
|
|
||||||
void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected);
|
void AddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected);
|
||||||
void AddRenderMeshes(const lcMatrix44& ViewMatrix, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, lcArray<lcRenderMesh>& OpaqueMeshes, lcArray<lcRenderMesh>& TranslucentMeshes);
|
void AddRenderMeshes(const lcMatrix44& ViewMatrix, const lcMatrix44& WorldMatrix, int ColorIndex, bool Focused, bool Selected, lcArray<lcRenderMesh>& OpaqueMeshes, lcArray<lcRenderMesh>& TranslucentMeshes);
|
||||||
|
|
||||||
|
|
|
@ -355,6 +355,18 @@ void View::OnDraw()
|
||||||
lcScene Scene;
|
lcScene Scene;
|
||||||
mModel->GetScene(Scene, mCamera, DrawInterface);
|
mModel->GetScene(Scene, mCamera, DrawInterface);
|
||||||
|
|
||||||
|
if (DrawInterface && mTrackTool == LC_TRACKTOOL_INSERT)
|
||||||
|
{
|
||||||
|
lcVector3 Position;
|
||||||
|
lcVector4 Rotation;
|
||||||
|
GetPieceInsertPosition(Position, Rotation);
|
||||||
|
|
||||||
|
lcMatrix44 WorldMatrix = lcMatrix44FromAxisAngle(lcVector3(Rotation[0], Rotation[1], Rotation[2]), Rotation[3] * LC_DTOR);
|
||||||
|
WorldMatrix.SetTranslation(Position);
|
||||||
|
|
||||||
|
gMainWindow->mPreviewWidget->GetCurrentPiece()->AddRenderMeshes(Scene, WorldMatrix, gMainWindow->mColorIndex, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
mContext->SetDefaultState();
|
mContext->SetDefaultState();
|
||||||
mContext->SetViewport(0, 0, mWidth, mHeight);
|
mContext->SetViewport(0, 0, mWidth, mHeight);
|
||||||
|
|
||||||
|
@ -416,21 +428,6 @@ void View::OnDraw()
|
||||||
|
|
||||||
if (DrawInterface)
|
if (DrawInterface)
|
||||||
{
|
{
|
||||||
if (mTrackTool == LC_TRACKTOOL_INSERT)
|
|
||||||
{
|
|
||||||
lcVector3 Position;
|
|
||||||
lcVector4 Rotation;
|
|
||||||
GetPieceInsertPosition(Position, Rotation);
|
|
||||||
|
|
||||||
lcMatrix44 WorldMatrix = lcMatrix44FromAxisAngle(lcVector3(Rotation[0], Rotation[1], Rotation[2]), Rotation[3] * LC_DTOR);
|
|
||||||
WorldMatrix.SetTranslation(Position);
|
|
||||||
|
|
||||||
mContext->SetWorldViewMatrix(lcMul(WorldMatrix, ViewMatrix));
|
|
||||||
|
|
||||||
mContext->SetLineWidth(2.0f * Preferences.mLineWidth);
|
|
||||||
gMainWindow->mPreviewWidget->GetCurrentPiece()->RenderPiece(gMainWindow->mColorIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
mContext->DrawInterfaceObjects(ViewMatrix, Scene.InterfaceObjects);
|
mContext->DrawInterfaceObjects(ViewMatrix, Scene.InterfaceObjects);
|
||||||
|
|
||||||
mContext->SetLineWidth(Preferences.mLineWidth); // context remove
|
mContext->SetLineWidth(Preferences.mLineWidth); // context remove
|
||||||
|
|
Loading…
Add table
Reference in a new issue