forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVS_Skybox.hlsl
32 lines (26 loc) · 918 Bytes
/
VS_Skybox.hlsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "ShaderStructs.hlsli"
// Data from our primary constant buffer
cbuffer PrimaryBuffer : register(b0)
{
float4x4 tfView;
float4x4 tfProjection;
}
VertexToPixel_Sky main(VertexShaderInput input)
{
// Set up output struct
VertexToPixel_Sky output;
float4x4 tfViewNoTranslation = tfView;
tfViewNoTranslation._14 = 0;
tfViewNoTranslation._24 = 0;
tfViewNoTranslation._34 = 0;
// Build View/Projection matrix and find the screen position
matrix viewProjection = mul(tfProjection, tfViewNoTranslation);
output.screenPosition = mul(viewProjection, float4(input.localPosition, 1.0f));
// Sets skybox depth to 1
output.screenPosition.z = output.screenPosition.w;
// Sets the direction to sample in
output.sampleDirection = input.localPosition;
// Whatever we return will make its way through the pipeline to the
// next programmable stage we're using (the pixel shader for now)
return output;
}