Exemple #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);
	}
Exemple #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 );
}
Exemple #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 );
}
void Camera::Resize()
{
    RECT rect = DXUTGetWindowClientRect();
    
    float fAspectRatio = (FLOAT)rect.right / (FLOAT)rect.bottom;

    D3DXVECTOR4 modelInView;
    D3DXVec3Transform(&modelInView, &m_vModelCenter, &m_mView);

    SetProjParams( D3DX_PI/4, fAspectRatio, max(0.1f, modelInView.z-(m_fMaxRadius*2)) , modelInView.z+(m_fMaxRadius*2) );
    SetWindow( rect.right, rect.bottom );
}
Exemple #5
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;
  }
Exemple #6
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 );
}
//--------------------------------------------------------------------------------------
// 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;
}
Exemple #8
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
VOID C3DCamera::SetNearAndFarPlanes( FLOAT fNear, FLOAT fFar )
{
	m_fNearPlane = fNear;
	m_fFarPlane = fFar;
	SetProjParams( m_fFOV, m_fAspect, fNear, fFar );
}
Exemple #9
0
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
VOID C3DCamera::SetFieldOfView( FLOAT fFOV )
{
	m_fFOV = fFOV;
	SetProjParams( fFOV, m_fAspect, m_fNearPlane, m_fFarPlane );
}