Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // pdev is the IDirect3DDevice9 pointer
  2. D3DVIEWPORT9 viewport;
  3. pdev->GetViewport(&viewport);
  4.  
  5. // Short variable names to make the matrix readable
  6. int w = viewport.Width; int h = viewport.Height;
  7. int vx = viewport.X; int vy = viewport.Y;
  8.  
  9. // The scaling factors
  10. float sx = 1.0f / w;
  11. float sy = 1.0f / h;
  12.  
  13. // The projection matrix
  14. D3DMATRIX matProj = {
  15. sx * 2.0f, 0.0f, 0.0f, 0.0f,
  16. 0.0f, -sy * 2.0f, 0.0f, 0.0f,
  17. 0.0f, 0.0f, 1.0f, 0.0f,
  18. -sx * (w + 2 * vx + 1), sy * (h + 2 * vy + 1), 0.0f, 1.0f
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement