diff --git a/Giants.WebApi.Clients/Clients.cs b/Giants.WebApi.Clients/Clients.cs
index 3ccae81..0bf85a0 100644
--- a/Giants.WebApi.Clients/Clients.cs
+++ b/Giants.WebApi.Clients/Clients.cs
@@ -790,8 +790,8 @@ namespace Giants.WebApi.Clients
[Newtonsoft.Json.JsonProperty("numPlayers", Required = Newtonsoft.Json.Required.Always)]
public int NumPlayers { get; set; }
-
- [Newtonsoft.Json.JsonProperty("maxPlayers", Required = Newtonsoft.Json.Required.Always)]
+
+ [Newtonsoft.Json.JsonProperty("maxPlayers", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int MaxPlayers { get; set; }
[Newtonsoft.Json.JsonProperty("gameState", Required = Newtonsoft.Json.Required.Always)]
@@ -930,4 +930,4 @@ namespace Giants.WebApi.Clients
#pragma warning restore 1573
#pragma warning restore 472
#pragma warning restore 114
-#pragma warning restore 108
+#pragma warning restore 108
\ No newline at end of file
diff --git a/GiantsTools.sln b/GiantsTools.sln
index 3dc81dc..5878134 100644
--- a/GiantsTools.sln
+++ b/GiantsTools.sln
@@ -17,9 +17,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shaders", "Shaders\Shaders.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.BinTools", "Giants.BinTools\Giants.BinTools.csproj", "{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Giants.EffectCompiler", "Giants.EffectCompiler\Giants.EffectCompiler.csproj", "{F5F3D216-9787-4CFF-88DF-8259CF667F88}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.EffectCompiler", "Giants.EffectCompiler\Giants.EffectCompiler.csproj", "{F5F3D216-9787-4CFF-88DF-8259CF667F88}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Giants.EffectCompiler.Tests", "Giants.EffectCompiler.Tests\Giants.EffectCompiler.Tests.csproj", "{49423BA5-4A9F-47A3-9D2D-E83936272DD0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.EffectCompiler.Tests", "Giants.EffectCompiler.Tests\Giants.EffectCompiler.Tests.csproj", "{49423BA5-4A9F-47A3-9D2D-E83936272DD0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -92,11 +92,13 @@ Global
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|x86.ActiveCfg = Release|Any CPU
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|x86.Build.0 = Release|Any CPU
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|Any CPU.Build.0 = Debug|Win32
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x64.ActiveCfg = Debug|x64
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x64.Build.0 = Debug|x64
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x86.ActiveCfg = Debug|Win32
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x86.Build.0 = Debug|Win32
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|Any CPU.ActiveCfg = Release|Win32
+ {9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|Any CPU.Build.0 = Release|Win32
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x64.ActiveCfg = Release|x64
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x64.Build.0 = Release|x64
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x86.ActiveCfg = Release|Win32
diff --git a/Shaders/Shaders.vcxproj b/Shaders/Shaders.vcxproj
index b343fb5..f2f0071 100644
--- a/Shaders/Shaders.vcxproj
+++ b/Shaders/Shaders.vcxproj
@@ -67,6 +67,7 @@
Effect
2.0
+ /Gec %(AdditionalOptions)
@@ -74,19 +75,42 @@
Effect
2.0
+ /Gec %(AdditionalOptions)
-
-
- /Gec %(AdditionalOptions)
- /Gec %(AdditionalOptions)
-
-
+
+ Document
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+
+
+ Document
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+
+
-
-
+ Document
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+
+
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ Document
+ fxo\%(Filename).fxo
+ fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+ "$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo
+
diff --git a/Shaders/fx/LandBump.fx b/Shaders/fx/LandBump.fx
index b76ef1f..30eb416 100644
--- a/Shaders/fx/LandBump.fx
+++ b/Shaders/fx/LandBump.fx
@@ -21,19 +21,6 @@ float4 g_TextureFactor : TextureFactor;
int g_NumLights = 0;
//////////////////////////////////////////////////////
-//The sizes of the various terrain UV Coordinates
-float detailScale = 1;
-float diffuseScale = 5;
-float globalScale;
-float detailMapStrength = 1;
-
-float3 sunlightVector = float3(.5,.5,.8);
-
-//The Colour (and brightness) of the Sunlight
-float3 lightColour = float3(2,2,2);
-//The colour (and birghtness) of the ambient light
-float3 ambientColour = float3(.1,.1,.1);
-
texture g_LandTexture;
texture g_LandBumpTexture;
@@ -99,11 +86,11 @@ float4 bx2(float4 x)
return float4(2.0f * x.xyzw - 1.0f);
}
-
-VS_OUTPUT_BUMP LandBumpVS( float4 vPos : POSITION,
- float3 vNormal : NORMAL,
- float4 vDiffuse : COLOR0,
- float4 vDiffuse2 : COLOR1)
+VS_OUTPUT_BUMP LandBumpVS(
+ float4 vPos : POSITION,
+ float3 vNormal : NORMAL,
+ float4 vDiffuse : COLOR0,
+ float4 vDiffuse2 : COLOR1)
{
VS_OUTPUT_BUMP Output;
@@ -137,17 +124,9 @@ float4 LandBumpPS(VS_OUTPUT_BUMP input) : COLOR0
float3 normalMap;
normalMap = saturate((float4)dot((float3)normal, (float3)normalcol)).xyz;
-#ifdef MIX_4X
- float3 texel = tex2D(g_LandTextureSampler, input.LandTextureUV).rgb * tex2D(g_LandTextureSampler, input.LandTextureUV * -0.25).rgb * 4;
- float3 finalColor = 2.0 * (normalMap * (texel) + input.LandBumpDiffuse);
-#else
float3 finalColor = 2.0 * (normalMap * (tex2D(g_LandTextureSampler, input.LandTextureUV)) + input.LandBumpDiffuse);
- //finalColor *= tex2D(g_ShoreTextureSampler, input.ShoreTextureUV);
-#endif
- //finalColor = (g_TextureFactor * (1 - input.LandDiffuse)) + finalColor;
-
- for (int i = 0; i < MAX_LIGHTS; i++)
+ for (int i = 0; i < g_NumLights; i++)
{
// Get light direction for this fragment
float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
@@ -171,135 +150,7 @@ technique LandBump
pass P0
{
VertexShader = compile vs_2_0 LandBumpVS();
- PixelShader = compile ps_2_0 LandBumpPS();
- }
-}
-
-VS_OUTPUT_BUMP LandNormalVS( float4 vPos : POSITION,
- float3 vNormal : NORMAL,
- float4 vDiffuse : COLOR0,
- float4 vDiffuse2 : COLOR1)
-{
- VS_OUTPUT_BUMP Output;
-
- // Transform the position from object space to homogeneous projection space
- Output.Position = mul(vPos, g_mWorldViewProjection);
-
- Output.LandBumpDiffuse = vDiffuse2 * .5f;
- Output.LandBumpDiffuse.a = 1.0f;
-
- //Output.LandDiffuse
- Output.LandDiffuse.rgb = vDiffuse;
- Output.LandDiffuse.a = 1.0f;
-
- Output.WorldPos = mul(vPos, g_World);
-
- // Set dynamically generated tex coords
- Output.LandBumpTextureUV = mul(vPos, g_TexGenTransform0);
- Output.LandTextureUV = mul(vPos, g_TexGenTransform1);
- Output.ShoreTextureUV = mul(vPos, g_ShoreGen);
-
- // Transform the normal from object space to world space
- Output.Normal = normalize(mul(vNormal, (float3x3)g_World)); // normal (world space)
-
- return Output;
-}
-
-float4 LandNormalPS(VS_OUTPUT_BUMP input) : COLOR0
-{
- float4 Output;
- //Get Global Normal from the full terrain normal map
- float3 Normal = tex2D(g_LandBumpTextureSampler, input.LandTextureUV);
- Normal[0] -= .5;
- Normal[1] -= .5;
- Normal[2] -= .5;
- Normal = normalize(Normal);
-
-
- //{
- //
- // //Get Detail Normal from the detail map
- // float3 detailNormalMap = (tex2D(g_LandDetailTextureSampler, input.LandTextureUV*100/detailScale));
- // detailNormalMap[0] -= .5;
- // detailNormalMap[1] -= .5;
- // detailNormalMap[2] -= .5;
- // //Multiply Detail Normal by detailMapStrength
- // detailNormalMap[0] = mul(detailNormalMap[0], detailMapStrength);
- // detailNormalMap[1] = mul(detailNormalMap[1], detailMapStrength);
- //
- // //Normalize detail Normal
- // detailNormalMap = normalize(detailNormalMap);
- //
- // if(false)
- // {
- // //Generate the Tangent Basis for the Detail Normal Map.
- // float3x3 tangentBasis;
- //
- // tangentBasis[0] = cross(Normal, float3(1,0,0));
- // tangentBasis[1] = cross(Normal, tangentBasis[0]);
- // tangentBasis[2] = Normal;
- //
- // detailNormalMap = detailNormalMap, detailMapStrength;
- //
- // Normal = mul(detailNormalMap, tangentBasis);
- // Normal = normalize(Normal);
- // }
- // else
- // {
- // Normal = normalize(Normal*2+detailNormalMap*detailMapStrength);
- // }
- //}
-
- float3 sv = normalize(sunlightVector);
- float3 lightLevel;
- lightLevel[0] = max(dot(Normal, sv), 0)*lightColour[0]*2;//+ambientColour[0];
- lightLevel[1] = max(dot(Normal, sv), 0)*lightColour[1]*2;//+ambientColour[1];
- lightLevel[2] = max(dot(Normal, sv), 0)*lightColour[2]*2;//+ambientColour[2];
-
- return float4(tex2D(g_LandTextureSampler, input.LandTextureUV) * lightLevel, 1) + input.LandBumpDiffuse;
-
-
-
- float4 normal = bx2(tex2D(g_LandBumpTextureSampler, input.LandBumpTextureUV));
- float4 normalcol = bx2(input.LandDiffuse);
-
- float3 normalMap;
- normalMap = saturate((float4)dot((float3)normal, (float3)normalcol)).xyz;
-#ifdef MIX_4X
- float3 texel = tex2D(g_LandTextureSampler, input.LandTextureUV).rgb * tex2D(g_LandTextureSampler, input.LandTextureUV * -0.25).rgb * 4;
- float3 finalColor = 2.0 * (normalMap * (texel) + input.LandBumpDiffuse);
-#else
- float3 finalColor = 2.0 * (normalMap * (tex2D(g_LandTextureSampler, input.LandTextureUV)) + input.LandBumpDiffuse);
- //finalColor *= tex2D(g_ShoreTextureSampler, input.ShoreTextureUV);
-#endif
-
- //finalColor = (g_TextureFactor * (1 - input.LandDiffuse)) + finalColor;
-
- for (int i = 0; i < MAX_LIGHTS; i++)
- {
- // Get light direction for this fragment
- float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
-
- // Note: Non-uniform scaling not supported
- float diffuseLighting = saturate(dot(input.Normal, -lightDir));
-
- // Introduce fall-off of light intensity
- diffuseLighting *= (g_LightRangeSquared[i] / dot(g_LightPositions[i] - input.WorldPos, g_LightPositions[i] - input.WorldPos));
-
- float4 diffuseColor = diffuseLighting * g_LightDiffuseColors[i];
-
- finalColor += diffuseColor;
- }
-
- return float4(finalColor, 1);
-}
-
-technique LandNormal
-{
- pass P0
- {
- VertexShader = compile vs_2_0 LandNormalVS();
- PixelShader = compile ps_2_0 LandNormalPS();
+ PixelShader = compile ps_2_0 LandBumpPS();
}
}
@@ -315,9 +166,10 @@ struct VS_OUTPUT
float3 WorldPos : TEXCOORD2;
};
-VS_OUTPUT LandscapeVS( float4 vPos : POSITION,
- float3 vNormal : NORMAL,
- float4 vDiffuse : COLOR0)
+VS_OUTPUT LandscapeVS(
+ float4 vPos : POSITION,
+ float3 vNormal : NORMAL,
+ float4 vDiffuse : COLOR0)
{
VS_OUTPUT Output;
@@ -342,7 +194,7 @@ float4 LandscapePS(VS_OUTPUT input) : COLOR0
{
float4 finalColor = 0;
- for (int i = 0; i < MAX_LIGHTS; i++)
+ for (int i = 0; i < g_NumLights; i++)
{
// Get light direction for this fragment
float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
@@ -358,11 +210,7 @@ float4 LandscapePS(VS_OUTPUT input) : COLOR0
finalColor += diffuseColor;
}
-#ifdef MIX_4X
- float3 texel = tex2D(g_LandTextureSampler, input.TextureUV).rgb * tex2D(g_LandTextureSampler, input.TextureUV * -0.25).rgb * 4;
-#else
float3 texel = tex2D(g_LandTextureSampler, input.TextureUV);
-#endif
return float4(saturate((texel.xyz + input.Diffuse) + (finalColor)), 1.0f);
}
diff --git a/Shaders/fx/Sky.fx b/Shaders/fx/Sky.fx
index 951c61b..c3ddc6c 100644
--- a/Shaders/fx/Sky.fx
+++ b/Shaders/fx/Sky.fx
@@ -29,9 +29,6 @@ void RenderSceneVS(
out float2 oTexCoord0 : TEXCOORD0 )
{
oPosition = mul(iPosition, g_mWorldViewProjection);
- //oPosition = mul(iPosition, g_World);
- //oPosition = mul(oPosition, g_View);
- //oPosition = mul(oPosition, g_Projection);
oColor0 = float4(1, 1, 1, 1);
oTexCoord0 = iTexCoord0;
}
@@ -40,12 +37,7 @@ float4 RenderScenePS(
float4 iColor : COLOR,
float2 iTexCoord0 : TEXCOORD0) : COLOR0
{
- //return float4(1, 1, 1, 1);
return tex2D(g_SkyTextureSampler, iTexCoord0);
- //oColor0 = tex2D(TextureDiffuse0Sampler, iTexCoord0);
- //float intensity = dot(oColor0.rgb, float3(0.3, 0.59, 0.11));
- //float p = smoothstep(intensityThreshold, 1.f, intensity);
- //oColor0 = oColor0 * p * colorMultiplier;
}
technique RenderWithPixelShader
diff --git a/Shaders/fxo/LandBump.fxo b/Shaders/fxo/LandBump.fxo
new file mode 100644
index 0000000..327e6f1
Binary files /dev/null and b/Shaders/fxo/LandBump.fxo differ
diff --git a/Shaders/fxo/Ocean.fxo b/Shaders/fxo/Ocean.fxo
new file mode 100644
index 0000000..c5085a7
Binary files /dev/null and b/Shaders/fxo/Ocean.fxo differ
diff --git a/Shaders/fxo/Sky.fxo b/Shaders/fxo/Sky.fxo
new file mode 100644
index 0000000..8a4d88b
Binary files /dev/null and b/Shaders/fxo/Sky.fxo differ
diff --git a/Shaders/fxo/Water.fxo b/Shaders/fxo/Water.fxo
new file mode 100644
index 0000000..5653d55
Binary files /dev/null and b/Shaders/fxo/Water.fxo differ