Advertisement
pavedaf

Untitled

May 30th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. void Box(int x, int y, int w, int h, D3DCOLOR Color, LPDIRECT3DDEVICE9 pD3D9)
  2. {
  3. pD3D9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
  4.  
  5. struct vertex
  6. {
  7. FLOAT x, y, z, rhw;
  8. DWORD color;
  9. };
  10.  
  11. vertex p[4];
  12. p[0].x = float(x);
  13. p[0].y = float(y);
  14. p[0].z = 0;
  15. p[0].rhw = 1;
  16. p[0].color = Color;
  17.  
  18. p[1].x = float(x + w);
  19. p[1].y = float(y);
  20. p[1].z = 0;
  21. p[1].rhw = 1;
  22. p[1].color = Color;
  23.  
  24. p[2].x = float(x + w);
  25. p[2].y = float(y + h);
  26. p[2].z = 0;
  27. p[2].rhw = 1;
  28. p[2].color = Color;
  29.  
  30. p[3].x = float(x);
  31. p[3].y = float(y + h);
  32. p[3].z = 0;
  33. p[3].rhw = 1;
  34. p[3].color = Color;
  35.  
  36. pD3D9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
  37. pD3D9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
  38. pD3D9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
  39. pD3D9->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
  40. pD3D9->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
  41. pD3D9->SetRenderState(D3DRS_FOGENABLE, FALSE);
  42. pD3D9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
  43.  
  44. pD3D9->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
  45. pD3D9->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
  46. pD3D9->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
  47. pD3D9->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
  48.  
  49. pD3D9->SetTexture(0, NULL);
  50. pD3D9->SetPixelShader(0);
  51.  
  52. pD3D9->SetRenderState(D3DRS_ZENABLE, FALSE);
  53. pD3D9->SetRenderState(D3DRS_STENCILENABLE, FALSE);
  54.  
  55. pD3D9->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, p, sizeof(vertex));
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement