Advertisement
Guest User

Untitled

a guest
Apr 9th, 2019
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #include "stdafx.h"
  2.  
  3. void CRenderTarget::phase_lut()
  4. {
  5. u32 Offset = 0;
  6. Fvector2 p0, p1;
  7.  
  8. //
  9. struct v_aa {
  10. Fvector4 p;
  11. Fvector2 uv0;
  12. Fvector2 uv1;
  13. Fvector2 uv2;
  14. Fvector2 uv3;
  15. Fvector2 uv4;
  16. Fvector4 uv5;
  17. Fvector4 uv6;
  18. };
  19.  
  20. float _w = float(Device.dwWidth);
  21. float _h = float(Device.dwHeight);
  22. float ddw = 1.f / _w;
  23. float ddh = 1.f / _h;
  24. p0.set(.5f / _w, .5f / _h);
  25. p1.set((_w + .5f) / _w, (_h + .5f) / _h);
  26.  
  27.  
  28.  
  29. // Set RT's
  30. u_setrt(rt_Generic_0, 0, 0, HW.pBaseZB);
  31. RCache.set_CullMode(CULL_NONE);
  32. RCache.set_Stencil(FALSE);
  33.  
  34. // Fill vertex buffer
  35. v_aa* pv = (v_aa*)RCache.Vertex.Lock(4, g_aa_AA->vb_stride, Offset);
  36. pv->p.set(EPS, float(_h + EPS), EPS, 1.f); pv->uv0.set(p0.x, p1.y); pv->uv1.set(p0.x - ddw, p1.y - ddh); pv->uv2.set(p0.x + ddw, p1.y + ddh); pv->uv3.set(p0.x + ddw, p1.y - ddh); pv->uv4.set(p0.x - ddw, p1.y + ddh); pv->uv5.set(p0.x - ddw, p1.y, p1.y, p0.x + ddw); pv->uv6.set(p0.x, p1.y - ddh, p1.y + ddh, p0.x); pv++;
  37. pv->p.set(EPS, EPS, EPS, 1.f); pv->uv0.set(p0.x, p0.y); pv->uv1.set(p0.x - ddw, p0.y - ddh); pv->uv2.set(p0.x + ddw, p0.y + ddh); pv->uv3.set(p0.x + ddw, p0.y - ddh); pv->uv4.set(p0.x - ddw, p0.y + ddh); pv->uv5.set(p0.x - ddw, p0.y, p0.y, p0.x + ddw); pv->uv6.set(p0.x, p0.y - ddh, p0.y + ddh, p0.x); pv++;
  38. pv->p.set(float(_w + EPS), float(_h + EPS), EPS, 1.f); pv->uv0.set(p1.x, p1.y); pv->uv1.set(p1.x - ddw, p1.y - ddh); pv->uv2.set(p1.x + ddw, p1.y + ddh); pv->uv3.set(p1.x + ddw, p1.y - ddh); pv->uv4.set(p1.x - ddw, p1.y + ddh); pv->uv5.set(p1.x - ddw, p1.y, p1.y, p1.x + ddw); pv->uv6.set(p1.x, p1.y - ddh, p1.y + ddh, p1.x); pv++;
  39. pv->p.set(float(_w + EPS), EPS, EPS, 1.f); pv->uv0.set(p1.x, p0.y); pv->uv1.set(p1.x - ddw, p0.y - ddh); pv->uv2.set(p1.x + ddw, p0.y + ddh); pv->uv3.set(p1.x + ddw, p0.y - ddh); pv->uv4.set(p1.x - ddw, p0.y + ddh); pv->uv5.set(p1.x - ddw, p0.y, p0.y, p1.x + ddw); pv->uv6.set(p1.x, p0.y - ddh, p0.y + ddh, p1.x); pv++;
  40. RCache.Vertex.Unlock(4, g_aa_AA->vb_stride);
  41.  
  42. // Draw COLOR
  43. RCache.set_Element(s_lut->E[0]);
  44. RCache.set_c("lut_control", ps_r2_lut_control, 0, 0, 0);
  45. RCache.set_Geometry(g_aa_AA);
  46. RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);
  47. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement