Changeset 972
- Timestamp:
- 10/15/07 15:39:48 (1 year ago)
- Files:
-
- branches/fcptr_stable_jun07/Source/System/Window/Base/OSGCamera.cpp (modified) (1 diff)
- branches/fcptr_stable_jun07/Source/System/Window/Base/OSGViewport.cpp (modified) (1 diff)
- branches/fcptr_stable_jun07/Source/System/Window/Base/OSGViewport.h (modified) (1 diff)
- branches/fcptr_stable_jun07/Source/System/Window/Utilities/OSGNavigator.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/fcptr_stable_jun07/Source/System/Window/Base/OSGCamera.cpp
r714 r972 319 319 cctowc.invertFrom(wctocc); 320 320 321 Real32 rx = 322 (x - port.getPixelLeft()) / 323 (Real32) port.getPixelWidth() * 2.f - 1.f; 324 325 Real32 ry = 1.f - ( 326 ( y - (port.getParent()->getHeight() - port.getPixelTop()) ) / 327 (Real32) port.getPixelHeight()) * 2.f; 321 Real32 rx(0.f), ry(0.f); 322 port.getNormalizedCoordinates(rx, ry, x, y); 328 323 329 324 Pnt3f from, at; branches/fcptr_stable_jun07/Source/System/Window/Base/OSGViewport.cpp
r714 r972 215 215 { 216 216 return cast_dynamic<WindowPtrConst>(_sfParent.getValue()); 217 } 218 219 /*! Returns normalized coordintes from viewport coordinates. 220 221 @param normX Normalized X coordinate in the range [-1.0,1.0]. 222 @param normY Normalized Y coordinate in the range [-1.0,1.0]. 223 @param vpX X coordinate of this viewport in the range [0,width]. 224 @param vpY Y coordinate of this viewport in the range [0,height]. 225 226 @note Out-of-range input values lead to out-of-range output values. 227 */ 228 void Viewport::getNormalizedCoordinates( Real32& normX, 229 Real32& normY, 230 const Int32 vpX , 231 const Int32 vpY ) const 232 { 233 normX = 234 (vpX - getPixelLeft()) / 235 static_cast<Real32>(getPixelWidth()) * 2.f - 1.f; 236 237 normY = 1.f - ( 238 (vpY - (getParent()->getHeight() - getPixelTop())) / 239 static_cast<Real32>(getPixelHeight())) * 2.f; 217 240 } 218 241 branches/fcptr_stable_jun07/Source/System/Window/Base/OSGViewport.h
r714 r972 96 96 WindowPtrConst getParent(void) const; 97 97 98 void getNormalizedCoordinates( Real32& normX, 99 Real32& normY, 100 const Int32 vpX , 101 const Int32 vpY ) const; 102 98 103 /*! \} */ 99 104 /*---------------------------------------------------------------------*/ branches/fcptr_stable_jun07/Source/System/Window/Utilities/OSGNavigator.cpp
r714 r972 375 375 _moved = true; 376 376 377 Real32 width = Real32(_vp->getPixelWidth()); 378 Real32 height = Real32(_vp->getPixelHeight()); 379 380 if(width <= 0 || height <= 0) 381 return; 382 383 WindowPtr par = _vp->getParent(); 384 Real32 winHeight; 385 386 if(par != NullFC) 387 winHeight = (Real32)par->getHeight(); 388 else 389 winHeight = height; 390 391 Real32 fromX = (2.0f * (_lastX - _vp->getPixelLeft())- width)/ width; 392 Real32 fromY = (2.0f * (winHeight - _lastY - _vp->getPixelBottom()) 393 - height) / height; 394 Real32 toX = (2.0f * (x - _vp->getPixelLeft()) - width) / width; 395 Real32 toY = (2.0f * (winHeight - y - _vp->getPixelBottom()) 396 - height)/height; 377 Real32 fromX(0.f), fromY(0.f); 378 _vp->getNormalizedCoordinates(fromX, fromY, _lastX, _lastY); 379 Real32 toX(0.f), toY(0.f); 380 _vp->getNormalizedCoordinates(toX, toY, x, y); 381 397 382 switch (_currentMode) 398 383 {
