Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualThePointingMan

Posted 04 April 2013 - 01:47 AM


If you mean that you went from using a 2-d orthographic projection matrix to using a 3-d perspective projection matrix, then you are going to have to think in terms of a view frustum. Because the virtual world your camera is looking at is now 3-d dimensional along the z-axis, the width of the horizon is now specified in world coordinates, not simply 0..599 like in 2-d.

 

Can you give more details about your projection matrix and what you are trying to accomplish?

1So these are the Matrices I have set up for my camera.

 D3DXMatrixLookAtLH(&mCamera,	
    &D3DXVECTOR3 (0, 0, 600),    // the camera position
    &D3DXVECTOR3 (0, 0, 0.0f),      // the look-at position
    &D3DXVECTOR3 (0.0f, -1.0f, 0.0f));    // the up direction

	D3DXMatrixPerspectiveFovLH(&mLense,
                               D3DXToRadian(45),//Field of view
                               _w / _h,//dimensions or somethin
                               1.0f,    // the near view-plane
                               1000.0f);    // the far view-plane
// set the view transform
d3ddev->SetTransform(D3DTS_VIEW, &(camera->GetCamera()));
 
    // set the projection transform
d3ddev->SetTransform(D3DTS_PROJECTION, &(camera->GetLense()));
 

What I'm doing is creating a level editing program for a game I am making, there is a grid on the screen and I wish to make it so that when I click on one of the tiles it changes to the type of tile i have selected. I have just been using the getcursorpos() and screentoclient() to find the mouse position, but since this isn't a flat 2d program those co-ordinates aren't lining up with what I see on screen.


#1ThePointingMan

Posted 04 April 2013 - 01:46 AM

So these are the Matrices I have set up for my camera.

 D3DXMatrixLookAtLH(&mCamera,	
    &D3DXVECTOR3 (0, 0, 600),    // the camera position
    &D3DXVECTOR3 (0, 0, 0.0f),      // the look-at position
    &D3DXVECTOR3 (0.0f, -1.0f, 0.0f));    // the up direction

	D3DXMatrixPerspectiveFovLH(&mLense,
                               D3DXToRadian(45),//Field of view
                               _w / _h,//dimensions or somethin
                               1.0f,    // the near view-plane
                               1000.0f);    // the far view-plane
// set the view transform
d3ddev->SetTransform(D3DTS_VIEW, &(camera->GetCamera()));
 
    // set the projection transform
d3ddev->SetTransform(D3DTS_PROJECTION, &(camera->GetLense()));
 

What I'm doing is creating a level editing program for a game I am making, there is a grid on the screen and I wish to make it so that when I click on one of the tiles it changes to the type of tile i have selected. I have just been using the getcursorpos() and screentoclient() to find the mouse position, but since this isn't a flat 2d program those co-ordinates aren't lining up with what I see on screen.


PARTNERS