CGameGacCamera::CGameGacCamera(CCameraManager* camMgr) :CCameraBase(camMgr) ,EventProc(NULL) { m_pRTSCameraCtrller = new CRTSCameraCtrller; m_fCamDist = 0.0f; this->LoadGameCameraConfig(); //类型 SetCamType(eCT_GameView); //消息处理 EventProc=new CGameGacCameraNode(this); }
void XM_CALLCONV Camera::Update( float deltaTime ) { if( GetAsyncKeyState( VK_HOME ) ) { SetCamType(); } if( GetCamType()==1 ) { if( GetAsyncKeyState( VK_LEFT ) ) { RotateY( 5.0f * deltaTime ); } if( GetAsyncKeyState( VK_RIGHT ) ) { RotateY( -5.0f * deltaTime ); } if( GetAsyncKeyState( VK_UP ) ) { Walk( -15.0f * deltaTime ); } if( GetAsyncKeyState( VK_DOWN ) ) { Walk( 15.0f * deltaTime ); } if( GetAsyncKeyState( VK_PRIOR ) ) { Pitch( 1.0f * deltaTime ); } if( GetAsyncKeyState( VK_NEXT ) ) { Pitch( -1.0f * deltaTime ); } if( GetAsyncKeyState( VK_OEM_COMMA ) ) { Strafe( -15.0f * deltaTime ); } if( GetAsyncKeyState( VK_OEM_PERIOD ) ) { Strafe( 15.0f * deltaTime ); } } else { // default camera //XMStoreFloat3( &target1, goblin1Pos); //XMVECTOR posV = XMLoadFloat3( &pos ); //XMVECTOR targetV = goblin1Pos; //XMVECTOR upV = GetUpXM(); //LookAt( posV, targetV, upV ); } UpdateViewMatrix(); }