home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 18759 / ROE.7z / PARTIAL_VIEW_9.PROJ < prev    next >
Encoding:
Text File  |  2020-09-17  |  2.4 KB  |  121 lines

  1. #if FIREWALL
  2. #define FOG 1
  3. #endif
  4. #if ICEWALL
  5. #define DIR_LIGHT 1
  6. #endif
  7.  
  8. #include "DX12Defines.fxh"
  9. #include "QSConstant.fxh"
  10. #include "FunctionLib.fxh"
  11. #include "QSLighting.fxh"
  12. #include "PostFx.fxh"
  13. #include "QSPhysicalLighting.fxh"
  14. #include "QSScreenSpaceDepth.fxh"
  15. #include "ZFade.fxh"
  16. #include "QSShaderAtmosphere.fxh"
  17.  
  18.  
  19. float4            BlockInfo;//x height, y refract index, zw uv tiling
  20. #ifndef PARTIAL_VIEW_PROJ
  21. #define PARTIAL_VIEW_PROJ
  22. float4x4 PartialViewProj;
  23. #endif
  24.  
  25. #ifndef VIEW_PROJ
  26. #define VIEW_PROJ
  27. float4x4 view;
  28. #endif
  29.  
  30. #if DEPTH
  31.  
  32. struct VsIn
  33. {
  34.     float3 pos            :POSITION;
  35.     float2 uv            :TEXCOORD0;
  36.     
  37.     uint4 normal            :NORMAL;
  38.     uint4 binormal        :BINORMAL;
  39.     uint4 tangent        :TANGENT;
  40. };
  41.  
  42. struct VSOut
  43. {
  44.     float4 pos  : POSITION;
  45.     float2 uv   : TEXCOORD0;    //xy texture uv, zw normal map uv
  46.     float3 posWorld    :TEXCOORD1;
  47. };
  48.  
  49. VSOut MainVS(VsIn param)
  50. {
  51.     //const
  52.     float height = BlockInfo.x;
  53.  
  54.     VSOut result;    
  55.     float3 posWorld = param.pos;
  56.     posWorld.z += param.uv.x*height;
  57.     
  58.     float4 screenPos = mul(float4(posWorld.xyz - cameraPos, 1), PartialViewProj);
  59.     result.pos = screenPos;
  60.     result.uv = param.uv;
  61.  
  62.     result.posWorld = posWorld;
  63.  
  64.     return result;
  65. }
  66. #else//icewall / firewall
  67.  
  68.  
  69. //common for icewall/firewall
  70. struct VsIn
  71. {
  72.     float3 pos            :POSITION;
  73.     float2 uv            :TEXCOORD0;
  74.     
  75.     int4 normal            :NORMAL;
  76.     int4 binormal        :BINORMAL;
  77.     int4 tangent        :TANGENT;
  78. };
  79.  
  80. struct VSOut
  81. {
  82.     float4 pos  : POSITION;
  83.     float2 uv   : TEXCOORD0;    //xy texture uv, zw normal map uv
  84.     float3 viewDir : TEXCOORD1;
  85.     float3 tangent:TEXCOORD2;
  86.     float3 binormal:TEXCOORD3;
  87.     float3 normal:TEXCOORD4;
  88.     float4 posWorld    :TEXCOORD5;
  89. };
  90.  
  91.  
  92. VSOut MainVS(VsIn param)
  93. {
  94.     //const
  95.     float height = BlockInfo.x;
  96.     
  97.  
  98.     VSOut result;    
  99.     float3 posWorld = param.pos;
  100.     posWorld.z += param.uv.x*height;
  101.     
  102.     float4 screenPos = mul(float4(posWorld.xyz - cameraPos, 1), PartialViewProj);
  103.     result.pos = screenPos;
  104.     result.uv = param.uv;
  105.  
  106.     result.normal = DecompressCharToFloat(param.normal);
  107.     result.tangent = DecompressCharToFloat(param.tangent);
  108.     result.binormal = DecompressCharToFloat(param.binormal);
  109.     result.normal = normalize(result.normal);
  110.  
  111.     float3 toCamera = posWorld.xyz - cameraPos.xyz;
  112.     result.viewDir = normalize(toCamera);
  113.  
  114.     float4 posView = mul(float4(posWorld,1.0f), view);
  115.     result.posWorld = float4(posWorld, posView.y);
  116.  
  117.     return result;
  118. }
  119.  
  120. #endif
  121.