00001 //============================================================================= 00002 // filename: RmUtilTrackball.h 00003 // 00004 // ATI Research, Inc. 00005 // 3D Application Research Group 00006 // 00007 // Description: declaration file for Trackball Utility. 00008 // 00009 //============================================================================= 00010 // (C) 2004 ATI Research, Inc. All rights reserved. 00011 //============================================================================= 00012 00013 #ifndef _RM_UTILITIES_TRACKBALL_H_ 00014 #define _RM_UTILITIES_TRACKBALL_H_ 00015 00016 //============================================================================= 00020 //============================================================================= 00021 00022 //============================================================================= 00027 //============================================================================= 00028 class RMUTIL_API RmUtilTrackball 00029 { 00030 public : 00031 //-------------------------------------------------------------------------- 00035 //-------------------------------------------------------------------------- 00036 RmUtilTrackball( RmCoordinateSystem coordinateSystem ); 00037 00038 //-------------------------------------------------------------------------- 00040 //-------------------------------------------------------------------------- 00041 virtual ~RmUtilTrackball(); 00042 00043 //-------------------------------------------------------------------------- 00056 //-------------------------------------------------------------------------- 00057 void RotateCamera( const RECT &windowSize, 00058 const RmVector3D &viewLookAt, 00059 const RmMatrix4x4 &viewMatrix, 00060 const RmMatrix4x4 &projectionMatrix, 00061 const float nearPlane, const float farPlane, 00062 const float FOV, 00063 const POINT &mousePt0, const POINT &mousePt1, 00064 /*[out]*/ RmMatrix4x4 &cameraMatrix ); 00065 00066 //-------------------------------------------------------------------------- 00074 //-------------------------------------------------------------------------- 00075 void ZoomCamera( const RmVector3D &viewLookAt, 00076 const POINT &mousePt0, const POINT &mousePt1, 00077 /*[out]*/ RmMatrix4x4 &cameraMatrix ); 00078 00079 //-------------------------------------------------------------------------- 00087 //-------------------------------------------------------------------------- 00088 void PanCamera( const RmVector3D &viewLookAt, 00089 const POINT &mousePt0, const POINT &mousePt1, 00090 /*[out]*/ RmMatrix4x4 &cameraMatrix); 00091 00092 private : 00093 RmCoordinateSystem m_coordinateSystem; 00094 00095 //-------------------------------------------------------------------------- 00105 //-------------------------------------------------------------------------- 00106 void ScreenToViewSpace( const RECT &windowSize, 00107 const RmMatrix4x4 &invProjectionMatrix, 00108 const float nearPlane, const float farPlane, 00109 const RmVector3D &vecInScreen, 00110 /*[out]*/ RmVector3D &vecInView ); 00111 00112 //-------------------------------------------------------------------------- 00119 //-------------------------------------------------------------------------- 00120 void viewToWorldSpace( const RmMatrix4x4 &invViewMatrix, 00121 const RmVector3D &vecInView, 00122 /*[out]*/ RmVector3D &vecInWorld ); 00123 }; // End of RmUtilTrackball 00124 00125 #endif
1.3.6