Skybox.bsl 1003 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "$ENGINE$\PerCameraData.bslinc"
  2. Parameters =
  3. {
  4. SamplerCUBE gSkySamp : alias("gSkyTex");
  5. TextureCUBE gSkyTex;
  6. };
  7. Technique : inherits("PerCameraData") =
  8. {
  9. Pass =
  10. {
  11. Cull = CW;
  12. CompareFunc = LTE;
  13. DepthWrite = false;
  14. Vertex =
  15. {
  16. void main(
  17. in float3 inPos : POSITION,
  18. out float4 oPosition : SV_Position,
  19. out float3 oDir : TEXCOORD0)
  20. {
  21. float4 pos = mul(gMatViewProj, float4(inPos.xyz + gViewOrigin, 1));
  22. // Set Z = W so that final depth is 1.0f and it renders behind everything else
  23. oPosition = pos.xyww;
  24. oDir = inPos;
  25. }
  26. };
  27. Fragment =
  28. {
  29. TextureCube gSkyTex : register(t0);
  30. SamplerState gSkySamp : register(s0);
  31. cbuffer Params : register(b0)
  32. {
  33. float4 gClearColor;
  34. }
  35. float4 main(
  36. in float4 inPos : SV_Position,
  37. in float3 dir : TEXCOORD0) : SV_Target
  38. {
  39. #ifdef SOLID_COLOR
  40. return gClearColor;
  41. #else
  42. return gSkyTex.SampleLevel(gSkySamp, dir, 0);
  43. #endif
  44. }
  45. };
  46. };
  47. };