Advertisement
Guest User

tess_shadow.ds

a guest
May 24th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include "common.h"
  2. #include "DX11\tess.h"
  3.  
  4. //if you use ccw then corresponding coefs are w, v, u
  5. //if you use cw then corresponding coefs are u, v, w
  6. [domain("tri")]
  7. v2p_shadow_direct main( HS_CONSTANT_DATA_OUTPUT input,
  8. float3 uvw : SV_DomainLocation,
  9. const OutputPatch<p_bumped, 3> bp )
  10. {
  11. v2p_shadow_direct output;
  12. float u = uvw.x;
  13. float v = uvw.y;
  14. float w = uvw.z;
  15.  
  16. float3 Pos = bp[0].position.xyz*w + bp[1].position.xyz*v + bp[2].position.xyz*u;
  17. float3 M1 = bp[0].M1*w + bp[1].M1*v + bp[2].M1*u;
  18. float3 M2 = bp[0].M2*w + bp[1].M2*v + bp[2].M2*u;
  19. float3 M3 = bp[0].M3*w + bp[1].M3*v + bp[2].M3*u;
  20. float3 Norm = normalize(float3(M1.z, M2.z, M3.z));
  21. float2 tc = bp[0].tcdh*w + bp[1].tcdh*v + bp[2].tcdh*u;
  22. # ifdef USE_TDETAIL
  23. float2 tcd = bp[0].tcdbump*w + bp[1].tcdbump*v + bp[2].tcdbump*u;
  24. # else
  25. float2 tcd = 0;
  26. # endif
  27.  
  28.  
  29. #if TESS_PN
  30. float3 N[3] =
  31. {
  32. float3(bp[0].M1.z, bp[0].M2.z, bp[0].M3.z),
  33. float3(bp[1].M1.z, bp[1].M2.z, bp[1].M3.z),
  34. float3(bp[2].M1.z, bp[2].M2.z, bp[2].M3.z)
  35. };
  36.  
  37. float3 P[3] =
  38. {
  39. bp[0].position.xyz,
  40. bp[1].position.xyz,
  41. bp[2].position.xyz
  42. };
  43.  
  44. ComputePatchVertex(P, N, uvw, input.patch, Pos, Norm);
  45. #endif
  46.  
  47. #if TESS_HM
  48. ComputeDisplacedVertex(Pos, Norm, tc, tcd);
  49. #endif
  50.  
  51. output.hpos = mul(m_P, float4(Pos,1));
  52.  
  53. return output;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement