PerCameraData.bslinc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Parameters =
  2. {
  3. float3 gViewDir : auto("ViewDir");
  4. float3 gViewOrigin : auto("ViewOrigin");
  5. mat4x4 gMatViewProj : auto("VP");
  6. mat4x4 gMatView : auto("V");
  7. mat4x4 gMatProj : auto("P");
  8. mat4x4 gMatInvProj : auto("IP");
  9. mat4x4 gMatInvViewProj : auto("IVP");
  10. // Special inverse view-projection matrix that had projection entries that affect z and w eliminated.
  11. // Used to transform a vector(clip_x, clip_y, view_z, view_w), where clip_x/clip_y are in clip space,
  12. // and view_z/view_w in view space, into world space
  13. mat4x4 gMatScreenToWorld : auto("ScreenToWorld");
  14. // Converts device Z to world Z using this formula: worldZ = (1 / (deviceZ + y)) * x
  15. float2 gDeviceZToWorldZ : auto("DeviceToWorldZ");
  16. // xy - (Viewport size in pixels / 2) / Target size in pixels
  17. // zw - (Viewport offset in pixels + (Viewport size in pixels / 2) + Optional pixel center offset) / Target size in pixels
  18. float4 gClipToUVScaleOffset : auto("ClipToUVScaleOffset");
  19. };
  20. Blocks =
  21. {
  22. Block PerCamera : auto("PerCamera");
  23. };
  24. Technique : base("PerCameraData") =
  25. {
  26. Language = "HLSL11";
  27. Pass =
  28. {
  29. Common =
  30. {
  31. cbuffer PerCamera
  32. {
  33. float3 gViewDir;
  34. float3 gViewOrigin;
  35. float4x4 gMatViewProj;
  36. float4x4 gMatView;
  37. float4x4 gMatProj;
  38. float4x4 gMatInvProj;
  39. float4x4 gMatInvViewProj;
  40. float4x4 gMatScreenToWorld;
  41. float2 gDeviceZToWorldZ;
  42. float4 gClipToUVScaleOffset;
  43. }
  44. };
  45. };
  46. };
  47. Technique : base("PerCameraData") =
  48. {
  49. Language = "GLSL";
  50. Pass =
  51. {
  52. Common =
  53. {
  54. layout(std140) uniform PerCamera
  55. {
  56. vec3 gViewDir;
  57. vec3 gViewOrigin;
  58. mat4 gMatViewProj;
  59. mat4 gMatView;
  60. mat4 gMatProj;
  61. mat4 gMatInvProj;
  62. mat4 gMatInvViewProj;
  63. mat4 gMatScreenToWorld;
  64. vec2 gDeviceZToWorldZ;
  65. vec4 gClipToUVScaleOffset;
  66. };
  67. };
  68. };
  69. };