Example #1
0
	Camera::Camera()
	{
		// Setup the view matrix
		SetViewParams(g_XMZero, g_XMIdentityR2);

		// Setup the projection matrix
		SetProjParams(XM_PI / 4, 1.0f, 0.1f, 200.0f);
	}
Example #2
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
C3DCamera::C3DCamera()
{
  // Set attributes for the view matrix
  SetViewParams( D3DXVECTOR3(0.0f,0.0f,0.0f), D3DXVECTOR3(0.0f,0.0f,1.0f),
                 D3DXVECTOR3(0.0f,1.0f,0.0f) );

  // Set attributes for the projection matrix
  SetProjParams( D3DX_PI/4, 1.0f, 1.0f, 1000.0f );
}
Example #3
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
CD3DCamera::CD3DCamera()
{
    // Set attributes for the view matrix
    D3DXVECTOR3 vEyePt(0.0f,0.0f,0.0f);
    D3DXVECTOR3 vLookatPt(0.0f,0.0f,1.0f);
    D3DXVECTOR3 vUpVec(0.0f,1.0f,0.0f);
    SetViewParams( vEyePt, vLookatPt, vUpVec );

    // Set attributes for the projection matrix
    SetProjParams( D3DX_PI/4, 1.0f, 1.0f, 1000.0f );
}
Example #4
0
  //--------------------------------------------------------------------------------------
  // Constructor
  //--------------------------------------------------------------------------------------
  CBaseCamera::CBaseCamera()
  {
      mKeysDown = 0;
      mZAxisUp = false;
      ZeroMemory( mKeys, sizeof( BYTE ) * CAM_MAX_KEYS );

      // Set attributes for the view matrix
      dvec3 vEyePt = dvec3( 0.0, 0.0, 0.0 );
      dvec3 vLookatPt = dvec3( 0.0, 0.0, 1.0 );

      // Setup the view matrix
      SetViewParams( vEyePt, vLookatPt );

      // Setup the projection matrix
      SetProjParams( pi<double>() / 4, 1.0, 1.0, 1000.0 );

      //GetCursorPos( &m_ptLastMousePosition );
      mMouseLButtonDown = false;
      mMouseMButtonDown = false;
      mMouseRButtonDown = false;
      mCurrentButtonMask = 0;
      mMouseWheelDelta = 0;

      mCameraYawAngle = 0.0;
      mCameraPitchAngle = 0.0;

      //SetRect( &m_rcDrag, LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX );
      mVelocity = dvec3( 0, 0, 0 );
      mMovementDrag = false;
      mVelocityDrag = dvec3( 0, 0, 0 );
      mDragTimer = 0.0f;
      mTotalDragTimeToZero = 0.25;
      mRotVelocity = dvec2( 0, 0 );

      mRotationScaler = 0.01;
      mKeyboardMoveScaler = sKeyboardMovementScale;
      mMouseMoveScaler = sMouseMovementScale;

      mInvertPitch = false;
      mEnableYAxisMovement = true;
      mEnablePositionMovement = true;

      mMouseDelta = dvec2( 0, 0 );
      mFramesToSmoothMouseData = 10.0f;

      mClipToBoundary = false;
      mMinBoundary = dvec3( -1, -1, -1 );
      mMaxBoundary = dvec3( 1, 1, 1 );

      mResetCursorAfterMove = false;

      mMouseRotates = true;
  }
Example #5
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
C3DCamera::C3DCamera()
{
	m_vInitialEyePt = D3DXVECTOR3(0.0f,0.0f,0.0f);
	m_vInitialLookatPt = D3DXVECTOR3(0.0f,0.0f,1.0f);
	m_vInitialUpVec = D3DXVECTOR3(0.0f,1.0f,0.0f);

  // Set attributes for the view matrix
  SetViewParams( D3DXVECTOR3(0.0f,0.0f,0.0f), D3DXVECTOR3(0.0f,0.0f,1.0f),
                 D3DXVECTOR3(0.0f,1.0f,0.0f) );

  // Set attributes for the projection matrix
  SetProjParams( D3DX_PI/4, 1.0f, 1.0f, 30.0f );
}
Example #6
0
//--------------------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------------------
CBaseCamera::CBaseCamera()
{
    ZeroMemory( m_aKeys, sizeof(BYTE)*CAM_MAX_KEYS );

    // Set attributes for the view matrix
    D3DXVECTOR3 vEyePt    = D3DXVECTOR3(0.0f,0.0f,0.0f);
    D3DXVECTOR3 vLookatPt = D3DXVECTOR3(0.0f,0.0f,1.0f);

    // Setup the view matrix
    SetViewParams( &vEyePt, &vLookatPt );

    // Setup the projection matrix
    SetProjParams( D3DX_PI/4, 1.0f, 1.0f, 1000.0f );

    GetCursorPos( &m_ptLastMousePosition );
    m_bMouseLButtonDown = false;
    m_bMouseMButtonDown = false;
    m_bMouseRButtonDown = false;
    m_nCurrentButtonMask = 0;
    m_nMouseWheelDelta = 0;

    m_fCameraYawAngle = 0.0f;
    m_fCameraPitchAngle = 0.0f;

    SetRect( &m_rcDrag, LONG_MIN, LONG_MIN, LONG_MAX, LONG_MAX );
    m_vVelocity     = D3DXVECTOR3(0,0,0);
    m_bMovementDrag = false;
    m_vVelocityDrag = D3DXVECTOR3(0,0,0);
    m_fDragTimer    = 0.0f;
    m_fTotalDragTimeToZero = 0.25;
    m_vRotVelocity = D3DXVECTOR2(0,0);

    m_fRotationScaler = 0.01f;           
    m_fMoveScaler = 5.0f;           

    m_bInvertPitch = false;
    m_bEnableYAxisMovement = true;
    m_bEnablePositionMovement = true;

    m_vMouseDelta   = D3DXVECTOR2(0,0);
    m_fFramesToSmoothMouseData = 2.0f;

    m_bClipToBoundary = false;
    m_vMinBoundary = D3DXVECTOR3(-1,-1,-1);
    m_vMaxBoundary = D3DXVECTOR3(1,1,1);

    m_bResetCursorAfterMove = false;
}
Example #7
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
VOID C3DCamera::SetUpVec( FLOAT fX, FLOAT fY, FLOAT fZ )
{
	m_vUpVec = D3DXVECTOR3( fX, fY, fZ );
	SetViewParams( m_vEyePt, m_vLookatPt, m_vUpVec );
}
Example #8
0
 //--------------------------------------------------------------------------------------
 // Reset the camera's position back to the default
 //--------------------------------------------------------------------------------------
 void CBaseCamera::Reset()
 {
     SetViewParams( mDefaultEye, mDefaultLookAt );
 }
Example #9
0
//--------------------------------------------------------------------------------------
// Reset the camera's position back to the default
//--------------------------------------------------------------------------------------
VOID CBaseCamera::Reset()
{
    SetViewParams( &m_vDefaultEye, &m_vDefaultLookAt );
}