Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // pdev is the IDirect3DDevice9 pointer
- D3DVIEWPORT9 viewport;
- pdev->GetViewport(&viewport);
- // Short variable names to make the matrix readable
- int w = viewport.Width; int h = viewport.Height;
- int vx = viewport.X; int vy = viewport.Y;
- // The scaling factors
- float sx = 1.0f / w;
- float sy = 1.0f / h;
- // The projection matrix
- D3DMATRIX matProj = {
- sx * 2.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, -sy * 2.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- -sx * (w + 2 * vx + 1), sy * (h + 2 * vy + 1), 0.0f, 1.0f
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement