Skybox.bsl 832 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "$ENGINE$\PerCameraData.bslinc"
  2. technique Skybox
  3. {
  4. mixin PerCameraData;
  5. raster
  6. {
  7. cull = cw;
  8. };
  9. depth
  10. {
  11. compare = lte;
  12. write = false;
  13. };
  14. code
  15. {
  16. void vsmain(
  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. TextureCube gSkyTex;
  27. SamplerState gSkySamp;
  28. [internal]
  29. cbuffer Params
  30. {
  31. float4 gClearColor;
  32. }
  33. float4 fsmain(
  34. in float4 inPos : SV_Position,
  35. in float3 dir : TEXCOORD0) : SV_Target
  36. {
  37. #if SOLID_COLOR
  38. return gClearColor;
  39. #else
  40. return gSkyTex.SampleLevel(gSkySamp, dir, 0);
  41. #endif
  42. }
  43. };
  44. };