@@ -40,8 +40,8 @@ namespace Render {
4040// ------------------------------------------------------------------------------
4141SRCamera::SRCamera (SRInterface& iface) :
4242 mTrafoSeq (0 ),
43- mInvertVal (-1 ),
4443 mPerspective (true ),
44+ mInvertVal (-1 ),
4545 mFOV (getDefaultFOVY()),
4646 mZNear (getDefaultZNear()),
4747 mZFar (getDefaultZFar()),
@@ -54,17 +54,12 @@ SRCamera::SRCamera(SRInterface& iface) :
5454 cam[3 ] = (glm::vec4 (0 .0f , 0 .0f , 7 .0f , 1 .0f ));
5555}
5656
57- // ------------------------------------------------------------------------------
58- SRCamera::~SRCamera ()
59- {
60- }
61-
6257// ------------------------------------------------------------------------------
6358void SRCamera::setAsPerspective ()
6459{
6560 mPerspective = true ;
6661
67- float aspect = static_cast <float >(mInterface .getScreenWidthPixels ()) /
62+ float aspect = static_cast <float >(mInterface .getScreenWidthPixels ()) /
6863 static_cast <float >(mInterface .getScreenHeightPixels ());
6964 mP = glm::perspective (mFOV , aspect, mZNear , mZFar );
7065}
@@ -74,8 +69,8 @@ void SRCamera::setAsOrthographic(float halfWidth, float halfHeight)
7469{
7570 mPerspective = false ;
7671
77- mP = glm::ortho (-halfWidth, halfWidth,
78- -halfHeight, halfHeight,
72+ mP = glm::ortho (-halfWidth, halfWidth,
73+ -halfHeight, halfHeight,
7974 mZNear , mZFar );
8075}
8176
@@ -109,22 +104,22 @@ void SRCamera::mouseMoveEvent(const glm::ivec2& pos, SRInterface::MouseButton bt
109104 switch (mInterface .getMouseMode ())
110105 {
111106 case SRInterface::MOUSE_OLDSCIRUN:
112- if (btn == SRInterface::MOUSE_LEFT) mArcLookAt ->doPan (screenSpace);
113- if (btn == SRInterface::MOUSE_RIGHT) mArcLookAt ->doZoom (screenSpace);
114- if (btn == SRInterface::MOUSE_MIDDLE) mArcLookAt ->doRotation (screenSpace);
107+ if (btn == SRInterface::MOUSE_LEFT && !lockPanning_ ) mArcLookAt ->doPan (screenSpace);
108+ if (btn == SRInterface::MOUSE_RIGHT && !lockZoom_ ) mArcLookAt ->doZoom (screenSpace);
109+ if (btn == SRInterface::MOUSE_MIDDLE && !lockRotation_ ) mArcLookAt ->doRotation (screenSpace);
115110 break ;
116111
117112 case SRInterface::MOUSE_NEWSCIRUN:
118- if (btn == SRInterface::MOUSE_LEFT) mArcLookAt ->doRotation (screenSpace);
119- if (btn == SRInterface::MOUSE_RIGHT) mArcLookAt ->doPan (screenSpace);
113+ if (btn == SRInterface::MOUSE_LEFT && !lockRotation_ ) mArcLookAt ->doRotation (screenSpace);
114+ if (btn == SRInterface::MOUSE_RIGHT && !lockPanning_ ) mArcLookAt ->doPan (screenSpace);
120115 break ;
121116 }
122117}
123118
124119// ------------------------------------------------------------------------------
125120void SRCamera::mouseWheelEvent (int32_t delta, int zoomSpeed)
126121{
127- if (mInterface .getMouseMode () != SRInterface::MOUSE_OLDSCIRUN)
122+ if (mInterface .getMouseMode () != SRInterface::MOUSE_OLDSCIRUN && !lockZoom_ )
128123 {
129124 // mArcLookAt->doZoom(-static_cast<float>(delta) / 100.0f, zoomSpeed);
130125 mArcLookAt ->doZoom (mInvertVal *static_cast <float >(delta) / 100 .0f , zoomSpeed);
@@ -169,7 +164,7 @@ glm::vec2 SRCamera::calculateScreenSpaceCoords(const glm::ivec2& mousePos)
169164
170165 // Transform incoming mouse coordinates into screen space.
171166 glm::vec2 mouseScreenSpace;
172- mouseScreenSpace.x = 2 .0f * (static_cast <float >(mousePos.x ) - windowOriginX)
167+ mouseScreenSpace.x = 2 .0f * (static_cast <float >(mousePos.x ) - windowOriginX)
173168 / static_cast <float >(mInterface .getScreenWidthPixels ()) - 1 .0f ;
174169 mouseScreenSpace.y = 2 .0f * (static_cast <float >(mousePos.y ) - windowOriginY)
175170 / static_cast <float >(mInterface .getScreenHeightPixels ()) - 1 .0f ;
@@ -183,5 +178,4 @@ glm::vec2 SRCamera::calculateScreenSpaceCoords(const glm::ivec2& mousePos)
183178}
184179
185180} // namespace Render
186- } // namespace SCIRun
187-
181+ } // namespace SCIRun
0 commit comments