Skip to content

Commit 2817517

Browse files
authored
Merge pull request #25 from henrikvik/development
Sprint 2
2 parents 62d08ba + ffb2a26 commit 2817517

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1333
-278
lines changed

Engine/Engine.vcxproj

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,31 +184,14 @@
184184
<ItemGroup>
185185
<ClInclude Include="Constants.h" />
186186
<ClInclude Include="Engine.h" />
187-
</ItemGroup>
188-
<ItemGroup>
189-
<FxCompile Include="Resources\Shaders\LightGridCulling.hlsl">
190-
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CS</EntryPointName>
191-
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>
192-
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
193-
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CS</EntryPointName>
194-
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
195-
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
196-
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CS</EntryPointName>
197-
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType>
198-
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">5.0</ShaderModel>
199-
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CS</EntryPointName>
200-
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType>
201-
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
202-
</FxCompile>
187+
<ClInclude Include="Resources\Shaders\ShaderConstants.h" />
203188
</ItemGroup>
204189
<ItemGroup>
205190
<None Include="Resources\Data\Button.lw" />
206191
<None Include="Resources\Data\Cards.lw" />
207192
<None Include="Resources\Data\Effects.lw" />
193+
<None Include="Resources\Data\Highscore.lw" />
208194
<None Include="Resources\Data\Menu.lw" />
209-
<None Include="Resources\Shaders\Vertex.hlsl">
210-
<FileType>Document</FileType>
211-
</None>
212195
</ItemGroup>
213196
<ItemGroup>
214197
<Text Include="Resources\data\Text.lw" />

Engine/Engine.vcxproj.filters

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
<ClInclude Include="Constants.h">
3030
<Filter>Header Files</Filter>
3131
</ClInclude>
32+
<ClInclude Include="Resources\Shaders\ShaderConstants.h">
33+
<Filter>Header Files</Filter>
34+
</ClInclude>
3235
</ItemGroup>
3336
<ItemGroup>
34-
<None Include="Resources\Shaders\Vertex.hlsl" />
3537
<None Include="Resources\Data\Effects.lw" />
3638
<None Include="Resources\Data\Menu.lw" />
3739
<None Include="Resources\Data\Button.lw" />
3840
<None Include="Resources\Data\Cards.lw" />
41+
<None Include="Resources\Data\Highscore.lw" />
3942
</ItemGroup>
4043
<ItemGroup>
4144
<Text Include="Resources\data\Text.lw" />
4245
</ItemGroup>
43-
<ItemGroup>
44-
<FxCompile Include="Resources\Shaders\LightGridCulling.hlsl" />
45-
</ItemGroup>
4646
</Project>

Engine/Resources/Data/Highscore.lw

Whitespace-only changes.
132 KB
Binary file not shown.

Engine/Resources/Shaders/ForwardPlus.hlsl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ struct VSOutput {
6464
float3 tangent : TANGENT;
6565
};
6666

67+
struct PSOutput
68+
{
69+
float4 backBuffer : SV_Target0;
70+
float4 glowMap : SV_Target1;
71+
};
72+
6773
VSOutput VS(VSInput input, uint instanceId : SV_InstanceId) {
6874
VSOutput output;
6975

@@ -105,10 +111,7 @@ SamplerComparisonState cmpSampler : register(s1);
105111
Texture2D diffuseMap : register(t10);
106112
Texture2D normalMap : register(t11);
107113
Texture2D specularMap : register(t12);
108-
109-
struct PSOutput {
110-
float4 color : SV_Target;
111-
};
114+
Texture2D glowMap : register(t13);
112115

113116
//Returns the shadow amount of a given position
114117
float getShadowValue(float4 lightPos, int sampleCount = 1)
@@ -205,7 +208,8 @@ PSOutput PS(VSOutput input) {
205208

206209
float3 lighting = saturate(finalDiffuse + finalSpecular + ambient);
207210

208-
output.color = float4(lighting, 1);
211+
output.backBuffer = float4(lighting, 1);
212+
output.glowMap = glowMap.Sample(Sampler, input.uv);
209213

210214
return output;
211215
}

Engine/Resources/Shaders/Glow.hlsl

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
2-
static const float gaussianFilter[5] = {
3-
0.06136, 0.24477, 0.38774, 0.24477, 0.06136
4-
};
1+
#include "ShaderConstants.h"
52

63

74
Texture2D inputTexture : register(t0);
8-
RWTexture2D<float4> output;
5+
RWTexture2D<unorm float4> output : register(u0);
96

10-
[numthreads(16, 16, 1)]
11-
void main( uint3 DTid : SV_DispatchThreadID )
7+
[numthreads(16, 9, 1)]
8+
void CS(uint3 DTid : SV_DispatchThreadID)
129
{
10+
int3 textureLocation = DTid * 2 - int3(KERNELSIZE -1, 0, 0);
1311

14-
int3 textureLocation = DTid - int3(2, 0, 0);
15-
16-
float4 final = { 0.0, 0.0, 0.0, 1.0 };
17-
for (uint x = 0; x < 5; x++)
18-
final += inputTexture.Load(textureLocation + int3(x, 0, 0)) * gaussianFilter[x];
12+
float4 final = { 0.0, 0.0, 0.0, 1.0 };
13+
for (uint x = 0; x < KERNELSIZE; x++)
14+
final += inputTexture.Load(textureLocation + int3(x * 2, 0, 0)) * gaussianFilter[x];
1915

2016

21-
output[DTid.xy] = final;
17+
output[DTid.xy] = final;
2218
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Texture2D backBuffer : register(t0);
3+
Texture2D toMerge : register(t1);
4+
RWTexture2D<unorm float4> output : register(u0);
5+
sampler Sampler : register(s0);
6+
7+
[numthreads(16, 9, 1)]
8+
void CS( uint3 DTid : SV_DispatchThreadID )
9+
{
10+
float2 uv;
11+
uv.x = DTid.x / 1280.f;
12+
uv.y = DTid.y / 720.f;
13+
14+
15+
float3 color = backBuffer.SampleLevel(Sampler, uv, 0);
16+
color += toMerge.SampleLevel(Sampler, uv, 0);
17+
color = saturate(color);
18+
19+
output[DTid.xy] = float4(color, 1);
20+
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
#define KERNELSIZE 7
3+
static const float gaussianFilter[KERNELSIZE] =
4+
{
5+
0.070159, 0.131075, 0.190713, 0.216106, 0.190713, 0.131075, 0.070159
6+
};

Engine/Resources/Shaders/glowSecond.hlsl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
2-
static const float gaussianFilter[5] = {
3-
0.06136, 0.24477, 0.38774, 0.24477, 0.06136
4-
};
1+
#include "ShaderConstants.h"
52

63

74
Texture2D inputTexture : register(t0);
8-
RWTexture2D<float4> output;
5+
RWTexture2D<unorm float4> output : register(u0);
96

10-
[numthreads(16, 16, 1)]
11-
void main(uint3 DTid : SV_DispatchThreadID)
7+
[numthreads(16, 9, 1)]
8+
void CS(uint3 DTid : SV_DispatchThreadID)
129
{
13-
14-
int3 textureLocation = DTid - int3(0, 2, 0);
10+
int3 textureLocation = DTid - int3(0, KERNELSIZE / 2, 0);
1511

1612
float4 final = { 0.0, 0.0, 0.0, 1.0 };
17-
for (uint y = 0; y < 5; y++)
13+
for (uint y = 0; y < KERNELSIZE; y++)
1814
final += inputTexture.Load(textureLocation + int3(0, y, 0)) * gaussianFilter[y];
1915

2016

2.17 KB
Loading

0 commit comments

Comments
 (0)