mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#168 Save and restore of parallel projection
This commit is contained in:
parent
d13d0775b4
commit
4eddcc859a
@ -75,11 +75,14 @@ RimView::RimView(void)
|
||||
|
||||
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
||||
showWindow.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "");
|
||||
cameraPosition.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&cameraPointOfInterest, "CameraPointOfInterest", cvf::Vec3d::ZERO, "", "", "", "");
|
||||
cameraPointOfInterest.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&isPerspectiveView, "PerspectiveProjection", true, "Perspective Projection", "", "", "");
|
||||
//isPerspectiveView.uiCapability()->setUiHidden(true); // For now as this is experimental
|
||||
|
||||
double defaultScaleFactor = preferences->defaultScaleFactorZ;
|
||||
CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", "");
|
||||
@ -216,7 +219,12 @@ void RimView::updateViewerWidget()
|
||||
|
||||
RiuMainWindow::instance()->setActiveViewer(m_viewer->layoutWidget());
|
||||
|
||||
if (isViewerCreated) m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
||||
if(isViewerCreated)
|
||||
{
|
||||
m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
||||
m_viewer->setPointOfInterest(cameraPointOfInterest());
|
||||
m_viewer->enableParallelProjection(!isPerspectiveView());
|
||||
}
|
||||
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||
|
||||
this->updateGridBoxData();
|
||||
@ -322,6 +330,7 @@ void RimView::createDisplayModelAndRedraw()
|
||||
{
|
||||
setDefaultView();
|
||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||
cameraPointOfInterest = m_viewer->pointOfInterest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,6 +369,7 @@ void RimView::setupBeforeSave()
|
||||
{
|
||||
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||
cameraPointOfInterest = m_viewer->pointOfInterest();
|
||||
|
||||
setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RivCellSetEnum.h"
|
||||
@ -79,6 +80,7 @@ public:
|
||||
|
||||
caf::PdmField<bool> showWindow;
|
||||
caf::PdmField<cvf::Mat4d> cameraPosition;
|
||||
caf::PdmField<cvf::Vec3d> cameraPointOfInterest;
|
||||
caf::PdmField<bool> isPerspectiveView;
|
||||
caf::PdmField< cvf::Color3f > backgroundColor;
|
||||
|
||||
|
@ -183,6 +183,7 @@ RiuViewer::~RiuViewer()
|
||||
m_rimView->uiCapability()->updateUiIconFromToggleField();
|
||||
|
||||
m_rimView->cameraPosition = m_mainCamera->viewMatrix();
|
||||
m_rimView->cameraPointOfInterest = pointOfInterest();
|
||||
}
|
||||
delete m_infoLabel;
|
||||
delete m_animationProgress;
|
||||
|
Loading…
Reference in New Issue
Block a user