Removed old preview widget.
This commit is contained in:
@@ -1259,6 +1259,13 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
||||
return Mesh;
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::ReleaseBuffers(lcContext* Context)
|
||||
{
|
||||
Context->DestroyVertexBuffer(mVertexBuffer);
|
||||
Context->DestroyIndexBuffer(mIndexBuffer);
|
||||
mBuffersDirty = true;
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::UpdateBuffers(lcContext* Context)
|
||||
{
|
||||
if (!gSupportsVertexBufferObject || !mBuffersDirty)
|
||||
|
||||
@@ -160,6 +160,7 @@ public:
|
||||
|
||||
bool ReadMeshData(lcFile& File, const lcMatrix44& CurrentTransform, lcuint32 CurrentColorCode, lcArray<lcLibraryTextureMap>& TextureStack, lcLibraryMeshData& MeshData, lcMeshDataType MeshDataType, bool Optimize);
|
||||
lcMesh* CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData);
|
||||
void ReleaseBuffers(lcContext* Context);
|
||||
void UpdateBuffers(lcContext* Context);
|
||||
void UnloadUnusedParts();
|
||||
|
||||
|
||||
+15
-58
@@ -12,7 +12,6 @@
|
||||
#include "lc_qupdatedialog.h"
|
||||
#include "lc_qaboutdialog.h"
|
||||
#include "lc_profile.h"
|
||||
#include "preview.h"
|
||||
#include "view.h"
|
||||
#include "project.h"
|
||||
#include "piece.h"
|
||||
@@ -27,7 +26,6 @@ lcMainWindow::lcMainWindow()
|
||||
{
|
||||
memset(mActions, 0, sizeof(mActions));
|
||||
|
||||
mPreviewWidget = NULL;
|
||||
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION;
|
||||
|
||||
mColorIndex = lcGetColorIndex(4);
|
||||
@@ -93,10 +91,6 @@ void lcMainWindow::CreateWidgets()
|
||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipboardChanged()));
|
||||
ClipboardChanged();
|
||||
|
||||
PiecePreview* Preview = (PiecePreview*)mPiecePreviewWidget->widget;
|
||||
mPreviewWidget = Preview;
|
||||
mPreviewWidget->SetDefaultPiece();
|
||||
|
||||
QSettings Settings;
|
||||
Settings.beginGroup("MainWindow");
|
||||
resize(QSize(800, 600));
|
||||
@@ -586,47 +580,10 @@ void lcMainWindow::CreateToolBars()
|
||||
|
||||
mColorsToolBar = new QDockWidget(tr("Colors"), this);
|
||||
mColorsToolBar->setObjectName("ColorsToolbar");
|
||||
mColorsToolBar->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
QWidget* PartsContents = new QWidget();
|
||||
QGridLayout* PartsLayout = new QGridLayout(PartsContents);
|
||||
PartsLayout->setSpacing(6);
|
||||
PartsLayout->setContentsMargins(6, 6, 6, 6);
|
||||
QSplitter* PartsSplitter = new QSplitter(Qt::Vertical, PartsContents);
|
||||
|
||||
QFrame* PreviewFrame = new QFrame(PartsSplitter);
|
||||
PreviewFrame->setFrameShape(QFrame::StyledPanel);
|
||||
PreviewFrame->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
QGridLayout* PreviewLayout = new QGridLayout(PreviewFrame);
|
||||
PreviewLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
int AASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
||||
if (AASamples > 1)
|
||||
{
|
||||
QGLFormat format;
|
||||
format.setSampleBuffers(true);
|
||||
format.setSamples(AASamples);
|
||||
QGLFormat::setDefaultFormat(format);
|
||||
}
|
||||
|
||||
mPiecePreviewWidget = new lcQGLWidget(PreviewFrame, NULL, new PiecePreview(), false);
|
||||
mPiecePreviewWidget->preferredSize = QSize(200, 100);
|
||||
PreviewLayout->addWidget(mPiecePreviewWidget, 0, 0, 1, 1);
|
||||
|
||||
QFrame* ColorFrame = new QFrame(PartsSplitter);
|
||||
ColorFrame->setFrameShape(QFrame::StyledPanel);
|
||||
ColorFrame->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
QGridLayout* ColorLayout = new QGridLayout(ColorFrame);
|
||||
ColorLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
mColorList = new lcQColorList(PartsSplitter);
|
||||
ColorLayout->addWidget(mColorList);
|
||||
mColorList = new lcQColorList();
|
||||
connect(mColorList, SIGNAL(colorChanged(int)), this, SLOT(ColorChanged(int)));
|
||||
|
||||
PartsLayout->addWidget(PartsSplitter, 0, 0, 1, 1);
|
||||
|
||||
mColorsToolBar->setWidget(PartsContents);
|
||||
mColorsToolBar->setWidget(mColorList);
|
||||
addDockWidget(Qt::RightDockWidgetArea, mColorsToolBar);
|
||||
|
||||
mPropertiesToolBar = new QDockWidget(tr("Properties"), this);
|
||||
@@ -719,7 +676,8 @@ QMenu* lcMainWindow::createPopupMenu()
|
||||
|
||||
void lcMainWindow::ModelTabClosed(int Index)
|
||||
{
|
||||
delete mModelTabWidget->widget(Index);
|
||||
if (mModelTabWidget->count() != 1)
|
||||
delete mModelTabWidget->widget(Index);
|
||||
}
|
||||
|
||||
void lcMainWindow::ModelTabChanged(int Index)
|
||||
@@ -811,8 +769,8 @@ void lcMainWindow::Print(QPrinter* Printer)
|
||||
Ascending = false;
|
||||
}
|
||||
|
||||
mPreviewWidget->MakeCurrent();
|
||||
lcContext* Context = mPreviewWidget->mContext;
|
||||
GetActiveView()->MakeCurrent();
|
||||
lcContext* Context = GetActiveView()->mContext;
|
||||
|
||||
QRect PageRect = Printer->pageRect();
|
||||
|
||||
@@ -1125,7 +1083,7 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
|
||||
CentralLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
View* NewView = new View(Model);
|
||||
QWidget* ViewWidget = new lcQGLWidget(TabWidget, mPiecePreviewWidget, NewView, true);
|
||||
QWidget* ViewWidget = new lcQGLWidget(TabWidget, NewView, true);
|
||||
CentralLayout->addWidget(ViewWidget, 0, 0, 1, 1);
|
||||
ViewWidget->show();
|
||||
ViewWidget->setFocus();
|
||||
@@ -1216,8 +1174,8 @@ void lcMainWindow::SetColorIndex(int ColorIndex)
|
||||
{
|
||||
mColorIndex = ColorIndex;
|
||||
|
||||
if (mPreviewWidget)
|
||||
mPreviewWidget->Redraw();
|
||||
if (mPartSelectionWidget)
|
||||
mPartSelectionWidget->Redraw();
|
||||
|
||||
UpdateColor();
|
||||
}
|
||||
@@ -1298,7 +1256,7 @@ void lcMainWindow::SetTransformType(lcTransformType TransformType)
|
||||
|
||||
void lcMainWindow::SetCurrentPieceInfo(PieceInfo* Info)
|
||||
{
|
||||
mPreviewWidget->MakeCurrent();
|
||||
GetActiveView()->MakeCurrent();
|
||||
|
||||
if (mCurrentPieceInfo)
|
||||
mCurrentPieceInfo->Release();
|
||||
@@ -1336,7 +1294,7 @@ void lcMainWindow::SplitView(Qt::Orientation Orientation)
|
||||
Splitter = new QSplitter(Orientation, Parent);
|
||||
Parent->layout()->addWidget(Splitter);
|
||||
Splitter->addWidget(Focus);
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), mPiecePreviewWidget, new View(lcGetActiveModel()), true));
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(lcGetActiveModel()), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1347,7 +1305,7 @@ void lcMainWindow::SplitView(Qt::Orientation Orientation)
|
||||
Splitter = new QSplitter(Orientation, Parent);
|
||||
ParentSplitter->insertWidget(FocusIndex, Splitter);
|
||||
Splitter->addWidget(Focus);
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), mPiecePreviewWidget, new View(lcGetActiveModel()), true));
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(lcGetActiveModel()), true));
|
||||
|
||||
ParentSplitter->setSizes(Sizes);
|
||||
}
|
||||
@@ -1417,7 +1375,7 @@ void lcMainWindow::ResetViews()
|
||||
TabLayout->removeWidget(TopWidget);
|
||||
TopWidget->deleteLater();
|
||||
View* NewView = new View(lcGetActiveModel());
|
||||
QWidget* ViewWidget = new lcQGLWidget(TabWidget, mPiecePreviewWidget, NewView, true);
|
||||
QWidget* ViewWidget = new lcQGLWidget(TabWidget, NewView, true);
|
||||
TabLayout->addWidget(ViewWidget);
|
||||
ViewWidget->show();
|
||||
ViewWidget->setFocus();
|
||||
@@ -1734,9 +1692,8 @@ void lcMainWindow::UpdateModels()
|
||||
|
||||
mPartSelectionWidget->UpdateModels();
|
||||
|
||||
PieceInfo* CurPiece = GetCurrentPieceInfo();
|
||||
if (CurPiece && CurPiece->GetModel() == CurrentModel)
|
||||
mPreviewWidget->SetDefaultPiece();
|
||||
if (mCurrentPieceInfo && mCurrentPieceInfo->IsModel())
|
||||
SetCurrentPieceInfo(NULL);
|
||||
}
|
||||
|
||||
void lcMainWindow::UpdateCategories()
|
||||
|
||||
@@ -188,6 +188,11 @@ public:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lcPartSelectionWidget* GetPartSelectionWidget() const
|
||||
{
|
||||
return mPartSelectionWidget;
|
||||
}
|
||||
|
||||
QMenu* GetCameraMenu() const
|
||||
{
|
||||
return mCameraMenu;
|
||||
@@ -264,7 +269,6 @@ public:
|
||||
lcVector3 GetTransformAmount();
|
||||
|
||||
QString mRecentFiles[LC_MAX_RECENT_FILES];
|
||||
PiecePreview* mPreviewWidget;
|
||||
int mColorIndex;
|
||||
lcSearchOptions mSearchOptions;
|
||||
QAction* mActions[LC_NUM_COMMANDS];
|
||||
@@ -331,7 +335,6 @@ protected:
|
||||
QDockWidget* mTimelineToolBar;
|
||||
|
||||
lcPartSelectionWidget* mPartSelectionWidget;
|
||||
lcQGLWidget* mPiecePreviewWidget;
|
||||
lcQColorList* mColorList;
|
||||
lcQPropertiesTree* mPropertiesWidget;
|
||||
lcTimelineWidget* mTimelineWidget;
|
||||
|
||||
+5
-5
@@ -13,7 +13,6 @@
|
||||
#include "lc_file.h"
|
||||
#include "pieceinf.h"
|
||||
#include "view.h"
|
||||
#include "preview.h"
|
||||
#include "minifig.h"
|
||||
#include "lc_qarraydialog.h"
|
||||
#include "lc_qselectdialog.h"
|
||||
@@ -165,7 +164,7 @@ lcModel::~lcModel()
|
||||
if (mPieceInfo)
|
||||
{
|
||||
if (gMainWindow && gMainWindow->GetCurrentPieceInfo() == mPieceInfo)
|
||||
gMainWindow->mPreviewWidget->SetDefaultPiece();
|
||||
gMainWindow->SetCurrentPieceInfo(NULL);
|
||||
|
||||
if (mPieceInfo->GetModel() == this)
|
||||
mPieceInfo->SetPlaceholder();
|
||||
@@ -1184,8 +1183,9 @@ void lcModel::DrawBackground(lcContext* Context)
|
||||
|
||||
void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, int Width, int Height, lcStep Start, lcStep End)
|
||||
{
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
lcContext* Context = gMainWindow->mPreviewWidget->mContext;
|
||||
View* ActiveView = gMainWindow->GetActiveView();
|
||||
ActiveView->MakeCurrent();
|
||||
lcContext* Context = ActiveView->mContext;
|
||||
|
||||
if (!Context->BeginRenderToTexture(Width, Height))
|
||||
{
|
||||
@@ -3923,7 +3923,7 @@ void lcModel::ShowMinifigDialog()
|
||||
if (Dialog.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
gMainWindow->GetActiveView()->MakeCurrent();
|
||||
|
||||
lcGroup* Group = AddGroup(tr("Minifig #"), NULL);
|
||||
lcArray<lcObject*> Pieces(LC_MFW_NUMITEMS);
|
||||
|
||||
@@ -169,15 +169,16 @@ Qt::ItemFlags lcPartSelectionListModel::flags(const QModelIndex& Index) const
|
||||
}
|
||||
|
||||
#include "lc_mainwindow.h"
|
||||
#include "preview.h"
|
||||
#include "view.h"
|
||||
|
||||
void lcPartSelectionListModel::DrawPreview(int InfoIndex)
|
||||
{
|
||||
if (!mIconSize || !mParts[InfoIndex].second.isNull())
|
||||
return;
|
||||
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
lcContext* Context = gMainWindow->mPreviewWidget->mContext;
|
||||
View* View = gMainWindow->GetActiveView();
|
||||
View->MakeCurrent();
|
||||
lcContext* Context = View->mContext;
|
||||
int Width = mIconSize;
|
||||
int Height = mIconSize;
|
||||
|
||||
@@ -404,6 +405,24 @@ void lcPartSelectionWidget::PartChanged(const QModelIndex& Current, const QModel
|
||||
gMainWindow->SetCurrentPieceInfo(mPartsWidget->GetCurrentPart());
|
||||
}
|
||||
|
||||
void lcPartSelectionWidget::Redraw()
|
||||
{
|
||||
}
|
||||
|
||||
void lcPartSelectionWidget::SetDefaultPart()
|
||||
{
|
||||
for (int CategoryIdx = 0; CategoryIdx < mCategoriesWidget->topLevelItemCount(); CategoryIdx++)
|
||||
{
|
||||
QTreeWidgetItem* CategoryItem = mCategoriesWidget->topLevelItem(CategoryIdx);
|
||||
|
||||
if (CategoryItem->text(0) == "Brick")
|
||||
{
|
||||
mCategoriesWidget->setCurrentItem(CategoryItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcPartSelectionWidget::UpdateCategories()
|
||||
{
|
||||
mCategoriesWidget->clear();
|
||||
|
||||
@@ -115,6 +115,8 @@ class lcPartSelectionWidget : public QWidget
|
||||
public:
|
||||
lcPartSelectionWidget(QWidget* Parent);
|
||||
|
||||
void Redraw();
|
||||
void SetDefaultPart();
|
||||
void UpdateModels();
|
||||
void UpdateCategories();
|
||||
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
#include "lc_global.h"
|
||||
#include "preview.h"
|
||||
#include "project.h"
|
||||
#include "lc_model.h"
|
||||
#include "pieceinf.h"
|
||||
#include "lc_application.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "lc_library.h"
|
||||
|
||||
PiecePreview::PiecePreview()
|
||||
{
|
||||
m_RotateX = 60.0f;
|
||||
m_RotateZ = 225.0f;
|
||||
m_Distance = 10.0f;
|
||||
m_AutoZoom = true;
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
PiecePreview::~PiecePreview()
|
||||
{
|
||||
}
|
||||
|
||||
void PiecePreview::OnDraw()
|
||||
{
|
||||
PieceInfo* Info = gMainWindow->GetCurrentPieceInfo();
|
||||
|
||||
if (Info == NULL)
|
||||
return;
|
||||
|
||||
mContext->SetDefaultState();
|
||||
|
||||
float aspect = (float)mWidth/(float)mHeight;
|
||||
mContext->SetViewport(0, 0, mWidth, mHeight);
|
||||
|
||||
lcModel* Model = lcGetActiveModel();
|
||||
if (Model)
|
||||
Model->DrawBackground(mContext);
|
||||
|
||||
lcVector3 Eye(0.0f, 0.0f, 1.0f);
|
||||
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationX(-m_RotateX * LC_DTOR));
|
||||
Eye = lcMul30(Eye, lcMatrix44RotationZ(-m_RotateZ * LC_DTOR));
|
||||
|
||||
lcMatrix44 ProjectionMatrix = lcMatrix44Perspective(30.0f, aspect, 1.0f, 2500.0f);
|
||||
lcMatrix44 ViewMatrix;
|
||||
|
||||
const lcBoundingBox& BoundingBox = Info->GetBoundingBox();
|
||||
lcVector3 Center = (BoundingBox.Min + BoundingBox.Max) / 2.0f;
|
||||
|
||||
if (m_AutoZoom)
|
||||
{
|
||||
Eye = Eye * 100.0f;
|
||||
Info->ZoomExtents(ProjectionMatrix, ViewMatrix, Eye);
|
||||
|
||||
// Update the new camera distance.
|
||||
lcVector3 d = Eye - Center;
|
||||
m_Distance = d.Length();
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewMatrix = lcMatrix44LookAt(Eye * m_Distance, Center, lcVector3(0, 0, 1));
|
||||
}
|
||||
|
||||
mContext->SetViewMatrix(ViewMatrix);
|
||||
mContext->SetProjectionMatrix(ProjectionMatrix);
|
||||
mContext->SetProgram(LC_PROGRAM_SIMPLE);
|
||||
|
||||
lcScene Scene;
|
||||
Scene.Begin(ViewMatrix);
|
||||
|
||||
Info->AddRenderMeshes(Scene, lcMatrix44Identity(), gMainWindow->mColorIndex, false, false);
|
||||
|
||||
Scene.End();
|
||||
|
||||
mContext->DrawOpaqueMeshes(Scene.mOpaqueMeshes);
|
||||
mContext->DrawTranslucentMeshes(Scene.mTranslucentMeshes);
|
||||
|
||||
mContext->UnbindMesh(); // context remove
|
||||
}
|
||||
|
||||
void PiecePreview::SetCurrentPiece(PieceInfo *pInfo)
|
||||
{
|
||||
/*
|
||||
MakeCurrent();
|
||||
|
||||
if (m_PieceInfo != NULL)
|
||||
m_PieceInfo->Release();
|
||||
|
||||
m_PieceInfo = pInfo;
|
||||
|
||||
if (m_PieceInfo != NULL)
|
||||
{
|
||||
m_PieceInfo->AddRef();
|
||||
Redraw();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void PiecePreview::SetDefaultPiece()
|
||||
{
|
||||
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||
PieceInfo* Info = Library->FindPiece("3005", NULL, false, false);
|
||||
|
||||
if (!Info)
|
||||
Info = Library->mPieces[0];
|
||||
|
||||
if (Info)
|
||||
SetCurrentPiece(Info);
|
||||
}
|
||||
|
||||
void PiecePreview::OnLeftButtonDown()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_NONE)
|
||||
{
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
m_Tracking = LC_TRACK_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
void PiecePreview::OnLeftButtonUp()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_LEFT)
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
void PiecePreview::OnLeftButtonDoubleClick()
|
||||
{
|
||||
m_AutoZoom = true;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void PiecePreview::OnRightButtonDown()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_NONE)
|
||||
{
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
m_Tracking = LC_TRACK_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
void PiecePreview::OnRightButtonUp()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_RIGHT)
|
||||
m_Tracking = LC_TRACK_NONE;
|
||||
}
|
||||
|
||||
void PiecePreview::OnMouseMove()
|
||||
{
|
||||
if (m_Tracking == LC_TRACK_LEFT)
|
||||
{
|
||||
// Rotate.
|
||||
m_RotateZ += mInputState.x - m_DownX;
|
||||
m_RotateX += mInputState.y - m_DownY;
|
||||
|
||||
if (m_RotateX > 179.5f)
|
||||
m_RotateX = 179.5f;
|
||||
else if (m_RotateX < 0.5f)
|
||||
m_RotateX = 0.5f;
|
||||
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
else if (m_Tracking == LC_TRACK_RIGHT)
|
||||
{
|
||||
// Zoom.
|
||||
m_Distance += (float)(m_DownY - mInputState.y) * 0.2f;
|
||||
m_AutoZoom = false;
|
||||
|
||||
if (m_Distance < 0.5f)
|
||||
m_Distance = 0.5f;
|
||||
|
||||
m_DownX = mInputState.x;
|
||||
m_DownY = mInputState.y;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef _PREVIEW_H_
|
||||
#define _PREVIEW_H_
|
||||
|
||||
#include "lc_glwidget.h"
|
||||
|
||||
class PieceInfo;
|
||||
|
||||
class PiecePreview : public lcGLWidget
|
||||
{
|
||||
public:
|
||||
PiecePreview();
|
||||
virtual ~PiecePreview();
|
||||
|
||||
void OnDraw();
|
||||
void OnLeftButtonDown();
|
||||
void OnLeftButtonUp();
|
||||
void OnLeftButtonDoubleClick();
|
||||
void OnRightButtonDown();
|
||||
void OnRightButtonUp();
|
||||
void OnMouseMove();
|
||||
|
||||
void SetCurrentPiece(PieceInfo* Info);
|
||||
void SetDefaultPiece();
|
||||
|
||||
protected:
|
||||
// Mouse tracking.
|
||||
int m_Tracking;
|
||||
int m_DownX;
|
||||
int m_DownY;
|
||||
|
||||
// Current camera settings.
|
||||
float m_Distance;
|
||||
float m_RotateX;
|
||||
float m_RotateZ;
|
||||
bool m_AutoZoom;
|
||||
};
|
||||
|
||||
#endif // _PREVIEW_H_
|
||||
|
||||
+3
-3
@@ -12,7 +12,6 @@
|
||||
#include "lc_application.h"
|
||||
#include "lc_profile.h"
|
||||
#include "lc_file.h"
|
||||
#include "preview.h"
|
||||
#include "lc_qimagedialog.h"
|
||||
#include "lc_qmodellistdialog.h"
|
||||
#include "lc_qpovraydialog.h"
|
||||
@@ -1298,8 +1297,9 @@ void Project::ExportHTML()
|
||||
|
||||
if (Options.PartsListImages)
|
||||
{
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
lcContext* Context = gMainWindow->mPreviewWidget->mContext;
|
||||
View* View = gMainWindow->GetActiveView();
|
||||
View->MakeCurrent();
|
||||
lcContext* Context = View->mContext;
|
||||
int Width = Options.PartImagesWidth;
|
||||
int Height = Options.PartImagesHeight;
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ SOURCES += common/view.cpp \
|
||||
common/texfont.cpp \
|
||||
common/str.cpp \
|
||||
common/project.cpp \
|
||||
common/preview.cpp \
|
||||
common/pieceinf.cpp \
|
||||
common/piece.cpp \
|
||||
common/object.cpp \
|
||||
@@ -186,7 +185,6 @@ HEADERS += \
|
||||
common/system.h \
|
||||
common/str.h \
|
||||
common/project.h \
|
||||
common/preview.h \
|
||||
common/pieceinf.h \
|
||||
common/piece.h \
|
||||
common/object.h \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "lc_qaboutdialog.h"
|
||||
#include "ui_lc_qaboutdialog.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "preview.h"
|
||||
#include "view.h"
|
||||
#include "lc_glextensions.h"
|
||||
|
||||
lcQAboutDialog::lcQAboutDialog(QWidget *parent) :
|
||||
@@ -13,7 +13,7 @@ lcQAboutDialog::lcQAboutDialog(QWidget *parent) :
|
||||
|
||||
ui->version->setText(tr("LeoCAD Version %1").arg(QString::fromLatin1(LC_VERSION_TEXT)));
|
||||
|
||||
gMainWindow->mPreviewWidget->MakeCurrent();
|
||||
gMainWindow->GetActiveView()->MakeCurrent();
|
||||
|
||||
GLint Red, Green, Blue, Alpha, Depth, Stencil;
|
||||
GLboolean DoubleBuffer, RGBA;
|
||||
|
||||
+18
-7
@@ -11,8 +11,9 @@
|
||||
#include "texfont.h"
|
||||
#include "lc_texture.h"
|
||||
#include "lc_mesh.h"
|
||||
#include "lc_profile.h"
|
||||
|
||||
static int gWidgetCount;
|
||||
static QList<QGLWidget*> gWidgetList;
|
||||
|
||||
void lcGLWidget::MakeCurrent()
|
||||
{
|
||||
@@ -76,8 +77,8 @@ void lcGLWidget::SetCursor(LC_CURSOR_TYPE CursorType)
|
||||
}
|
||||
}
|
||||
|
||||
lcQGLWidget::lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner, bool view)
|
||||
: QGLWidget(parent, share)
|
||||
lcQGLWidget::lcQGLWidget(QWidget *parent, lcGLWidget *owner, bool view)
|
||||
: QGLWidget(parent, gWidgetList.isEmpty() ? NULL : gWidgetList.first())
|
||||
{
|
||||
mWheelAccumulator = 0;
|
||||
widget = owner;
|
||||
@@ -90,7 +91,7 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner,
|
||||
|
||||
// TODO: Find a better place for the grid texture and font
|
||||
gTexFont.Load();
|
||||
if (!gWidgetCount)
|
||||
if (gWidgetList.isEmpty())
|
||||
{
|
||||
lcInitializeGLExtensions(context());
|
||||
lcContext::CreateResources();
|
||||
@@ -98,8 +99,17 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner,
|
||||
|
||||
gPlaceholderMesh = new lcMesh;
|
||||
gPlaceholderMesh->CreateBox();
|
||||
|
||||
int AASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
||||
if (AASamples > 1)
|
||||
{
|
||||
QGLFormat format;
|
||||
format.setSampleBuffers(true);
|
||||
format.setSamples(AASamples);
|
||||
QGLFormat::setDefaultFormat(format);
|
||||
}
|
||||
}
|
||||
gWidgetCount++;
|
||||
gWidgetList.append(this);
|
||||
|
||||
widget->OnInitialUpdate();
|
||||
|
||||
@@ -116,11 +126,12 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner,
|
||||
|
||||
lcQGLWidget::~lcQGLWidget()
|
||||
{
|
||||
gWidgetCount--;
|
||||
gWidgetList.removeOne(this);
|
||||
gTexFont.Release();
|
||||
makeCurrent();
|
||||
if (!gWidgetCount)
|
||||
if (gWidgetList.isEmpty())
|
||||
{
|
||||
lcGetPiecesLibrary()->ReleaseBuffers(widget->mContext);
|
||||
View::DestroyResources(widget->mContext);
|
||||
lcContext::DestroyResources();
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class lcGLWidget;
|
||||
class lcQGLWidget : public QGLWidget
|
||||
{
|
||||
public:
|
||||
lcQGLWidget(QWidget *parent, lcQGLWidget *share, lcGLWidget *owner, bool view);
|
||||
lcQGLWidget(QWidget *parent, lcGLWidget *owner, bool view);
|
||||
~lcQGLWidget();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "lc_qcolorpicker.h"
|
||||
#include "minifig.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "preview.h"
|
||||
|
||||
lcQMinifigDialog::lcQMinifigDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -18,7 +17,7 @@ lcQMinifigDialog::lcQMinifigDialog(QWidget *parent) :
|
||||
|
||||
mMinifigWidget = new MinifigWizard();
|
||||
|
||||
lcQGLWidget *minifigWidget = new lcQGLWidget(NULL, (lcQGLWidget*)gMainWindow->mPreviewWidget->mWidget, mMinifigWidget, false);
|
||||
lcQGLWidget *minifigWidget = new lcQGLWidget(NULL, mMinifigWidget, false);
|
||||
minifigWidget->setMinimumWidth(100);
|
||||
previewLayout->addWidget(minifigWidget);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "lc_mainwindow.h"
|
||||
#include "project.h"
|
||||
#include "lc_colors.h"
|
||||
#include "lc_partselectionwidget.h"
|
||||
#include <QApplication>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -179,6 +180,7 @@ int main(int argc, char *argv[])
|
||||
if (ShowWindow)
|
||||
{
|
||||
gMainWindow->SetColorIndex(lcGetColorIndex(4));
|
||||
gMainWindow->GetPartSelectionWidget()->SetDefaultPart();
|
||||
gMainWindow->UpdateRecentFiles();
|
||||
gMainWindow->show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user