| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #include "$ENGINE$\PerCameraData.bslinc"
- Parameters =
- {
- SamplerCUBE gSkySamp : alias("gSkyTex");
- TextureCUBE gSkyTex;
- };
- Technique : inherits("PerCameraData") =
- {
- Language = "HLSL11";
-
- Pass =
- {
- Cull = CW;
- CompareFunc = LTE;
- DepthWrite = false;
-
- Vertex =
- {
- void main(
- in float3 inPos : POSITION,
- out float4 oPosition : SV_Position,
- out float3 oDir : TEXCOORD0)
- {
- float4 pos = mul(gMatViewProj, float4(inPos.xyz + gViewOrigin, 1));
-
- // Set Z = W so that final depth is 1.0f and it renders behind everything else
- oPosition = pos.xyww;
- oDir = inPos;
- }
- };
-
- Fragment =
- {
- TextureCube gSkyTex : register(t0);
- SamplerState gSkySamp : register(s0);
-
- cbuffer Params : register(b0)
- {
- float4 gClearColor;
- }
-
- float4 main(
- in float4 inPos : SV_Position,
- in float3 dir : TEXCOORD0) : SV_Target
- {
- #ifdef SOLID_COLOR
- return gClearColor;
- #else
- return gSkyTex.SampleLevel(gSkySamp, dir, 0);
- #endif
- }
- };
- };
- };
- Technique : inherits("PerCameraData") =
- {
- Language = "GLSL";
-
- Pass =
- {
- Cull = CW;
- CompareFunc = LTE;
- DepthWrite = false;
-
- Vertex =
- {
- layout(location = 0) in vec3 bs_position;
- layout(location = 0) out vec3 dir;
-
- out gl_PerVertex
- {
- vec4 gl_Position;
- };
-
- void main()
- {
- vec4 pos = gMatViewProj * vec4(bs_position.xyz + gViewOrigin, 1);
-
- // Set Z = W so that final depth is 1.0f and it renders behind everything else
- gl_Position = pos.xyww;
- dir = bs_position;
- }
- };
-
- Fragment =
- {
- layout(location = 0) in vec3 dir;
-
- layout(binding = 1) uniform samplerCube gSkyTex;
- layout(binding = 2, std140) uniform Params
- {
- vec4 gClearColor;
- };
-
- layout(location = 0) out vec4 fragColor;
-
- void main()
- {
- #ifdef SOLID_COLOR
- fragColor = gClearColor;
- #else
- fragColor = textureLod(gSkyTex, dir, 0);
- #endif
- }
- };
- };
- };
|