diff --git a/DX11Starter.vcxproj b/DX11Starter.vcxproj
index 44720e9..b5c9303 100644
--- a/DX11Starter.vcxproj
+++ b/DX11Starter.vcxproj
@@ -186,6 +186,18 @@
Pixel
Pixel
+
+ Pixel
+ Pixel
+ Pixel
+ Pixel
+
+
+ Vertex
+ Vertex
+ Vertex
+ Vertex
+
Vertex
5.0
@@ -309,6 +321,7 @@
+
diff --git a/DX11Starter.vcxproj.filters b/DX11Starter.vcxproj.filters
index eb8cf4f..25bf041 100644
--- a/DX11Starter.vcxproj.filters
+++ b/DX11Starter.vcxproj.filters
@@ -112,6 +112,12 @@
Shaders
+
+ Shaders
+
+
+ Shaders
+
@@ -255,5 +261,8 @@
Shaders
+
+ Shaders
+
\ No newline at end of file
diff --git a/SkyboxDefines.hlsli b/SkyboxDefines.hlsli
new file mode 100644
index 0000000..f70fc71
--- /dev/null
+++ b/SkyboxDefines.hlsli
@@ -0,0 +1,20 @@
+#ifndef __SKYBOX_DEFINES__
+#define __SKYBOX_DEFINES__
+
+struct SkyboxVertexToPixel
+{
+ float4 screenPosition : SV_POSITION;
+ float3 sampleDir : DIRECTION;
+};
+
+// Struct representing a single vertex worth of data
+// - This should match Vertex.h
+struct SkyboxVertexShaderInput
+{
+ float3 localPosition : POSITION;
+ float3 normal : NORMAL;
+ float3 tangent : TANGENT;
+ float2 uv : TEXCOORD;
+};
+
+#endif
diff --git a/SkyboxPixelShader.hlsl b/SkyboxPixelShader.hlsl
new file mode 100644
index 0000000..cf63c2a
--- /dev/null
+++ b/SkyboxPixelShader.hlsl
@@ -0,0 +1,9 @@
+#include "SkyboxDefines.hlsli"
+
+TextureCube SkyTexture : register(t0);
+SamplerState Sampler : register(s0);
+
+float4 main(SkyboxVertexToPixel input) : SV_TARGET
+{
+ return SkyTexture.Sample(Sampler, input.sampleDir);
+}
diff --git a/SkyboxVertexShader.hlsl b/SkyboxVertexShader.hlsl
new file mode 100644
index 0000000..0b822ec
--- /dev/null
+++ b/SkyboxVertexShader.hlsl
@@ -0,0 +1,25 @@
+#include "SkyboxDefines.hlsli"
+
+cbuffer ExternalData : register(b0)
+{
+ matrix view;
+ matrix projection;
+}
+
+matrix RemoveTranslation(matrix m)
+{
+ m._14 = 0;
+ m._24 = 0;
+ m._34 = 0;
+ return m;
+}
+
+SkyboxVertexToPixel main(SkyboxVertexShaderInput input)
+{
+ SkyboxVertexToPixel output;
+ matrix worldViewProjection = mul(projection, RemoveTranslation(view));
+ output.screenPosition = mul(worldViewProjection, float4(input.localPosition, 1.0f));
+ output.screenPosition.z = output.screenPosition.w;
+ output.sampleDir = input.localPosition;
+ return output;
+}