mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Have the view use signals to pass camera changes to the main window.
This commit is contained in:
parent
fd8aca92df
commit
1ce80b8c2c
10 changed files with 206 additions and 217 deletions
|
@ -67,6 +67,7 @@ class PieceInfo;
|
|||
typedef std::map<const PieceInfo*, std::map<int, int>> lcPartsList;
|
||||
struct lcModelPartsEntry;
|
||||
struct lcMinifig;
|
||||
enum class lcViewpoint;
|
||||
|
||||
class lcVector2;
|
||||
class lcVector3;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "lc_model.h"
|
||||
#include "lc_scene.h"
|
||||
|
||||
lcGLWidget* lcGLWidget::mLastFocusView;
|
||||
lcGLWidget* lcGLWidget::mLastFocusedView;
|
||||
|
||||
lcGLWidget::lcGLWidget(lcModel* Model)
|
||||
: mModel(Model), mScene(new lcScene())
|
||||
|
@ -19,8 +19,8 @@ lcGLWidget::lcGLWidget(lcModel* Model)
|
|||
|
||||
lcGLWidget::~lcGLWidget()
|
||||
{
|
||||
if (mLastFocusView == this)
|
||||
mLastFocusView = nullptr;
|
||||
if (mLastFocusedView == this)
|
||||
mLastFocusedView = nullptr;
|
||||
|
||||
if (mDeleteContext)
|
||||
delete mContext;
|
||||
|
@ -34,7 +34,7 @@ lcModel* lcGLWidget::GetActiveModel() const
|
|||
void lcGLWidget::SetFocus(bool Focus)
|
||||
{
|
||||
if (Focus)
|
||||
mLastFocusView = this;
|
||||
mLastFocusedView = this;
|
||||
}
|
||||
|
||||
void lcGLWidget::SetMousePosition(int MouseX, int MouseY)
|
||||
|
@ -261,6 +261,142 @@ void lcGLWidget::UnprojectPoints(lcVector3* Points, int NumPoints) const
|
|||
lcUnprojectPoints(Points, NumPoints, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
|
||||
}
|
||||
|
||||
void lcGLWidget::ZoomExtents()
|
||||
{
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
if (ActiveModel)
|
||||
ActiveModel->ZoomExtents(mCamera, (float)mWidth / (float)mHeight);
|
||||
}
|
||||
|
||||
void lcGLWidget::SetViewpoint(lcViewpoint Viewpoint)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Viewpoint);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
|
||||
emit CameraChanged();
|
||||
}
|
||||
|
||||
void lcGLWidget::SetViewpoint(const lcVector3& Position)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Position);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
|
||||
emit CameraChanged();
|
||||
}
|
||||
|
||||
void lcGLWidget::SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Position, Target, Up);
|
||||
Redraw();
|
||||
|
||||
emit CameraChanged();
|
||||
}
|
||||
|
||||
void lcGLWidget::SetCameraAngles(float Latitude, float Longitude)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetAngles(Latitude, Longitude, 1.0f);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void lcGLWidget::SetDefaultCamera()
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
|
||||
emit CameraChanged();
|
||||
}
|
||||
|
||||
void lcGLWidget::SetCamera(lcCamera* Camera, bool ForceCopy)
|
||||
{
|
||||
if (Camera->IsSimple() || ForceCopy)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->CopyPosition(Camera);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mCamera && mCamera->IsSimple())
|
||||
delete mCamera;
|
||||
|
||||
mCamera = Camera;
|
||||
}
|
||||
}
|
||||
|
||||
void lcGLWidget::SetCamera(const char* CameraName)
|
||||
{
|
||||
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
||||
|
||||
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++)
|
||||
{
|
||||
if (qstricmp(CameraName, Cameras[CameraIdx]->m_strName) == 0)
|
||||
{
|
||||
SetCameraIndex(CameraIdx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcGLWidget::SetCameraIndex(int Index)
|
||||
{
|
||||
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
||||
|
||||
if (Index >= Cameras.GetSize())
|
||||
return;
|
||||
|
||||
lcCamera* Camera = Cameras[Index];
|
||||
SetCamera(Camera, false);
|
||||
|
||||
emit CameraChanged();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void lcGLWidget::StartTracking(lcTrackButton TrackButton)
|
||||
{
|
||||
mTrackButton = TrackButton;
|
||||
|
@ -410,7 +546,7 @@ void lcGLWidget::DrawViewport() const
|
|||
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
|
||||
if (mLastFocusView == this)
|
||||
if (mLastFocusedView == this)
|
||||
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mActiveViewColor));
|
||||
else
|
||||
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mInactiveViewColor));
|
||||
|
|
|
@ -80,8 +80,10 @@ enum class lcTrackTool
|
|||
Count
|
||||
};
|
||||
|
||||
class lcGLWidget
|
||||
class lcGLWidget : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
lcGLWidget(lcModel* Model);
|
||||
virtual ~lcGLWidget();
|
||||
|
@ -96,6 +98,11 @@ public:
|
|||
return mCamera;
|
||||
}
|
||||
|
||||
bool IsLastFocused() const
|
||||
{
|
||||
return mLastFocusedView == this;
|
||||
}
|
||||
|
||||
bool IsTracking() const
|
||||
{
|
||||
return mTrackButton != lcTrackButton::None;
|
||||
|
@ -124,6 +131,17 @@ public:
|
|||
void UnprojectPoints(lcVector3* Points, int NumPoints) const;
|
||||
lcMatrix44 GetProjectionMatrix() const;
|
||||
|
||||
void ZoomExtents();
|
||||
|
||||
void SetViewpoint(lcViewpoint Viewpoint);
|
||||
void SetViewpoint(const lcVector3& Position);
|
||||
void SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up);
|
||||
void SetCameraAngles(float Latitude, float Longitude);
|
||||
void SetDefaultCamera();
|
||||
void SetCamera(lcCamera* Camera, bool ForceCopy);
|
||||
void SetCamera(const char* CameraName);
|
||||
void SetCameraIndex(int Index);
|
||||
|
||||
void DrawBackground() const;
|
||||
void DrawViewport() const;
|
||||
void DrawAxes() const;
|
||||
|
@ -151,6 +169,9 @@ public:
|
|||
QGLWidget* mWidget = nullptr;
|
||||
lcContext* mContext = nullptr;
|
||||
|
||||
signals:
|
||||
void CameraChanged();
|
||||
|
||||
protected:
|
||||
lcCursor GetCursor() const;
|
||||
void SetCursor(lcCursor Cursor);
|
||||
|
@ -178,5 +199,5 @@ protected:
|
|||
lcCamera* mCamera = nullptr;
|
||||
bool mDeleteContext = true;
|
||||
|
||||
static lcGLWidget* mLastFocusView;
|
||||
static lcGLWidget* mLastFocusedView;
|
||||
};
|
||||
|
|
|
@ -760,14 +760,23 @@ void lcMainWindow::CreateToolBars()
|
|||
tabifyDockWidget(mPartsToolBar, mPropertiesToolBar);
|
||||
tabifyDockWidget(mPropertiesToolBar, mTimelineToolBar);
|
||||
|
||||
connect(mPropertiesToolBar, SIGNAL (topLevelChanged(bool)), this, SLOT (EnableWindowFlags(bool)));
|
||||
connect(mTimelineToolBar, SIGNAL (topLevelChanged(bool)), this, SLOT (EnableWindowFlags(bool)));
|
||||
connect(mPartsToolBar, SIGNAL (topLevelChanged(bool)), this, SLOT (EnableWindowFlags(bool)));
|
||||
connect(mColorsToolBar, SIGNAL (topLevelChanged(bool)), this, SLOT (EnableWindowFlags(bool)));
|
||||
connect(mPropertiesToolBar, SIGNAL(topLevelChanged(bool)), this, SLOT(EnableWindowFlags(bool)));
|
||||
connect(mTimelineToolBar, SIGNAL(topLevelChanged(bool)), this, SLOT(EnableWindowFlags(bool)));
|
||||
connect(mPartsToolBar, SIGNAL(topLevelChanged(bool)), this, SLOT(EnableWindowFlags(bool)));
|
||||
connect(mColorsToolBar, SIGNAL(topLevelChanged(bool)), this, SLOT(EnableWindowFlags(bool)));
|
||||
|
||||
mPartsToolBar->raise();
|
||||
}
|
||||
|
||||
View* lcMainWindow::CreateView(lcModel* Model)
|
||||
{
|
||||
View* NewView = new View(Model);
|
||||
|
||||
connect(NewView, SIGNAL(CameraChanged()), this, SLOT(ViewCameraChanged()));
|
||||
|
||||
return NewView;
|
||||
}
|
||||
|
||||
void lcMainWindow::PreviewPiece(const QString &PartType, int ColorCode)
|
||||
{
|
||||
if (mPreviewWidget) {
|
||||
|
@ -789,7 +798,7 @@ void lcMainWindow::CreatePreviewWidget()
|
|||
|
||||
tabifyDockWidget(mTimelineToolBar, mPreviewToolBar);
|
||||
|
||||
connect(mPreviewToolBar, SIGNAL (topLevelChanged(bool)), this, SLOT (EnableWindowFlags(bool)));
|
||||
connect(mPreviewToolBar, SIGNAL(topLevelChanged(bool)), this, SLOT(EnableWindowFlags(bool)));
|
||||
}
|
||||
|
||||
void lcMainWindow::TogglePreviewWidget(bool visible)
|
||||
|
@ -1599,7 +1608,7 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
|
|||
QGridLayout* CentralLayout = new QGridLayout(TabWidget);
|
||||
CentralLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
NewView = new View(Model);
|
||||
NewView = CreateView(Model);
|
||||
ViewWidget = new lcQGLWidget(TabWidget, NewView);
|
||||
CentralLayout->addWidget(ViewWidget, 0, 0, 1, 1);
|
||||
|
||||
|
@ -1610,7 +1619,7 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
|
|||
TabWidget = EmptyWidget;
|
||||
TabWidget->SetModel(Model);
|
||||
|
||||
NewView = new View(Model);
|
||||
NewView = CreateView(Model);
|
||||
ViewWidget = (lcQGLWidget*)TabWidget->layout()->itemAt(0)->widget();
|
||||
ViewWidget->mWidget = NewView;
|
||||
NewView->mWidget = ViewWidget;
|
||||
|
@ -1825,7 +1834,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(), new View(GetCurrentTabModel())));
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), CreateView(GetCurrentTabModel())));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1836,7 +1845,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(), new View(GetCurrentTabModel())));
|
||||
Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), CreateView(GetCurrentTabModel())));
|
||||
|
||||
ParentSplitter->setSizes(Sizes);
|
||||
}
|
||||
|
@ -2154,6 +2163,16 @@ void lcMainWindow::UpdateUndoRedo(const QString& UndoText, const QString& RedoTe
|
|||
}
|
||||
}
|
||||
|
||||
void lcMainWindow::ViewCameraChanged()
|
||||
{
|
||||
lcGLWidget* View = dynamic_cast<lcGLWidget*>(sender());
|
||||
|
||||
if (!View || !View->IsLastFocused())
|
||||
return;
|
||||
|
||||
UpdateCameraMenu();
|
||||
}
|
||||
|
||||
void lcMainWindow::UpdateCameraMenu()
|
||||
{
|
||||
const lcArray<lcCamera*>& Cameras = lcGetActiveModel()->GetCameras();
|
||||
|
|
|
@ -362,6 +362,7 @@ public slots:
|
|||
void TogglePreviewWidget(bool);
|
||||
|
||||
protected slots:
|
||||
void ViewCameraChanged();
|
||||
void UpdateDockWidgetActions();
|
||||
void UpdateGamepads();
|
||||
void ModelTabContextMenuRequested(const QPoint& Point);
|
||||
|
@ -384,6 +385,7 @@ protected:
|
|||
void CreateMenus();
|
||||
void CreateToolBars();
|
||||
void CreateStatusBar();
|
||||
View* CreateView(lcModel* Model);
|
||||
void ToggleDockWidget(QWidget* DockWidget);
|
||||
void SplitView(Qt::Orientation Orientation);
|
||||
void ShowSearchDialog();
|
||||
|
|
|
@ -188,31 +188,6 @@ void lcPreviewWidget::UpdatePreview()
|
|||
SetCurrentPiece(PartType, ColorCode);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::SetDefaultCamera()
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::SetCamera(lcCamera* Camera) // called by lcModel::DeleteModel()
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->CopyPosition(Camera);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::ZoomExtents()
|
||||
{
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
if (ActiveModel)
|
||||
{
|
||||
ActiveModel->ZoomExtents(mCamera, float(mWidth) / float(mHeight));
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void lcPreviewWidget::StartOrbitTracking() // called by viewSphere
|
||||
{
|
||||
mTrackTool = lcTrackTool::OrbitXY;
|
||||
|
@ -222,23 +197,6 @@ void lcPreviewWidget::StartOrbitTracking() // called by viewSphere
|
|||
OnButtonDown(lcTrackButton::Left);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::SetViewpoint(const lcVector3& Position)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Position);
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void lcPreviewWidget::StopTracking(bool Accept)
|
||||
{
|
||||
if (mTrackButton == lcTrackButton::None)
|
||||
|
|
|
@ -40,22 +40,17 @@ public:
|
|||
return mDescription;
|
||||
}
|
||||
|
||||
void ClearPreview();
|
||||
void UpdatePreview();
|
||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||
void SetCamera(lcCamera* Camera);
|
||||
void SetDefaultCamera();
|
||||
void ZoomExtents();
|
||||
|
||||
// exclusively called from viewSphere
|
||||
void SetViewpoint(const lcVector3& Position);
|
||||
void StartOrbitTracking();
|
||||
|
||||
bool IsModel() const
|
||||
{
|
||||
return mIsModel;
|
||||
}
|
||||
|
||||
|
||||
void ClearPreview();
|
||||
void UpdatePreview();
|
||||
bool SetCurrentPiece(const QString& PartType, int ColorCode);
|
||||
|
||||
void StartOrbitTracking();
|
||||
|
||||
void OnDraw() override;
|
||||
void OnLeftButtonDown() override;
|
||||
void OnLeftButtonUp() override;
|
||||
|
|
|
@ -283,7 +283,7 @@ bool lcViewSphere::OnLeftButtonUp()
|
|||
Position[AxisIdx] = -1250.0f;
|
||||
}
|
||||
|
||||
mIsPreview ? mPreview->SetViewpoint(Position) : mView->SetViewpoint(Position);
|
||||
mWidget->SetViewpoint(Position);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
138
common/view.cpp
138
common/view.cpp
|
@ -257,139 +257,10 @@ void View::RemoveCamera()
|
|||
else
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
emit CameraChanged();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void View::SetCamera(lcCamera* Camera, bool ForceCopy)
|
||||
{
|
||||
if (Camera->IsSimple() || ForceCopy)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->CopyPosition(Camera);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mCamera && mCamera->IsSimple())
|
||||
delete mCamera;
|
||||
|
||||
mCamera = Camera;
|
||||
}
|
||||
}
|
||||
|
||||
void View::SetCamera(const char* CameraName)
|
||||
{
|
||||
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
||||
|
||||
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++)
|
||||
{
|
||||
if (qstricmp(CameraName, Cameras[CameraIdx]->m_strName) == 0)
|
||||
{
|
||||
SetCameraIndex(CameraIdx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void View::SetCameraIndex(int Index)
|
||||
{
|
||||
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
|
||||
|
||||
if (Index >= Cameras.GetSize())
|
||||
return;
|
||||
|
||||
lcCamera* Camera = Cameras[Index];
|
||||
SetCamera(Camera, false);
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(Index);
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void View::SetViewpoint(lcViewpoint Viewpoint)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Viewpoint);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
}
|
||||
|
||||
void View::SetViewpoint(const lcVector3& Position)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Position);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
}
|
||||
|
||||
void View::SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetViewpoint(Position, Target, Up);
|
||||
Redraw();
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
}
|
||||
|
||||
void View::SetCameraAngles(float Latitude, float Longitude)
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
{
|
||||
lcCamera* OldCamera = mCamera;
|
||||
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
if (OldCamera)
|
||||
mCamera->CopySettings(OldCamera);
|
||||
}
|
||||
|
||||
mCamera->SetAngles(Latitude, Longitude, 1.0f);
|
||||
ZoomExtents();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void View::SetDefaultCamera()
|
||||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
}
|
||||
|
||||
lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int CurrentTileWidth, int CurrentTileHeight) const
|
||||
{
|
||||
int ImageWidth = mRenderImage.width();
|
||||
|
@ -1791,13 +1662,6 @@ void View::LookAt()
|
|||
ActiveModel->LookAt(mCamera);
|
||||
}
|
||||
|
||||
void View::ZoomExtents()
|
||||
{
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
if (ActiveModel)
|
||||
ActiveModel->ZoomExtents(mCamera, (float)mWidth / (float)mHeight);
|
||||
}
|
||||
|
||||
void View::MoveCamera(const lcVector3& Direction)
|
||||
{
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
class View : public lcGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
View(lcModel* Model);
|
||||
~View();
|
||||
|
@ -53,19 +55,10 @@ public:
|
|||
|
||||
void SetProjection(bool Ortho);
|
||||
void LookAt();
|
||||
void ZoomExtents();
|
||||
void MoveCamera(const lcVector3& Direction);
|
||||
void Zoom(float Amount);
|
||||
|
||||
void RemoveCamera();
|
||||
void SetCamera(lcCamera* Camera, bool ForceCopy);
|
||||
void SetCamera(const char* CameraName);
|
||||
void SetCameraIndex(int Index);
|
||||
void SetViewpoint(lcViewpoint Viewpoint);
|
||||
void SetViewpoint(const lcVector3& Position);
|
||||
void SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up);
|
||||
void SetCameraAngles(float Latitude, float Longitude);
|
||||
void SetDefaultCamera();
|
||||
void ShowContextMenu() const;
|
||||
|
||||
lcVector3 GetMoveDirection(const lcVector3& Direction) const;
|
||||
|
|
Loading…
Reference in a new issue