Jump to content
  • Advertisement
Sign in to follow this  
sheeja

Directx Camera rotation

This topic is 4112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I tried to rotate the camera position using the following code.Then my volume is going out of screen.How is projection and view matrix is connected.How can i set a projection matrix so that my volume never go out of screen here is my code to set view matrix and projection matrix. //Set the View Matrix D3DXMATRIXA16 matView; D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 0.0f, -3.0f ); D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f ); D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 1.0f, 0.0f ); D3DXMATRIX yawpitchMatrix; D3DXMatrixRotationYawPitchRoll &yawpitchMatrix,m_stRenderingParams.m_fOrbitY,m_stRenderingParams.m_fOrbitX,0.0); D3DXVec3TransformCoord(&vUpVec ,&vUpVec , &yawpitchMatrix); vFromPt = vLookatPt + vUpVec * 1; D3DXMatrixLookAtLH( &matView, &vFromPt, &vLookatPt, &vUpVec ); m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); //Orthogonal // Set the projection matrix D3DXMATRIX matProj; FLOAT fAspect = ((FLOAT)m_d3dsdBackBuffer.Width) / m_d3dsdBackBuffer.Height; D3DXMatrixOrthoLH( &matProj,fAspect,1.0f,-5.0f, 5.0f ); m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );

Share this post


Link to post
Share on other sites
Advertisement

This topic is 4112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!