Deferred shading

This commit is contained in:
dexy 2019-12-04 00:52:22 +11:00
parent 755477590d
commit 9a53c2147b
60 changed files with 2724 additions and 509 deletions

View File

@ -202,6 +202,9 @@
<setting name="ExplorerWindowTheme" serializeAs="String"> <setting name="ExplorerWindowTheme" serializeAs="String">
<value>Windows</value> <value>Windows</value>
</setting> </setting>
<setting name="Deferred" serializeAs="String">
<value>True</value>
</setting>
</CodeWalker.Properties.Settings> </CodeWalker.Properties.Settings>
</userSettings> </userSettings>
<runtime> <runtime>

View File

@ -38,6 +38,7 @@ namespace CodeWalker.GameFiles
public YmapEntityDef[] RootEntities; public YmapEntityDef[] RootEntities;
public YmapEntityDef[] MloEntities; public YmapEntityDef[] MloEntities;
public YmapFile Parent { get; set; }
public YmapFile[] ChildYmaps = null; public YmapFile[] ChildYmaps = null;
public bool MergedWithParent = false; public bool MergedWithParent = false;

View File

@ -2335,14 +2335,19 @@ namespace CodeWalker.GameFiles
} }
public enum LightType : byte
{
Point = 1,
Spot = 2,
Capsule = 4,
}
[TypeConverter(typeof(ExpandableObjectConverter))] public struct LightAttributes_s [TypeConverter(typeof(ExpandableObjectConverter))] public struct LightAttributes_s
{ {
// structure data // structure data
public uint Unknown_0h { get; set; } // 0x00000000 public uint Unknown_0h { get; set; } // 0x00000000
public uint Unknown_4h { get; set; } // 0x00000000 public uint Unknown_4h { get; set; } // 0x00000000
public float PositionX { get; set; } public Vector3 Position { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public uint Unknown_14h { get; set; } // 0x00000000 public uint Unknown_14h { get; set; } // 0x00000000
public byte ColorR { get; set; } public byte ColorR { get; set; }
public byte ColorG { get; set; } public byte ColorG { get; set; }
@ -2351,14 +2356,12 @@ namespace CodeWalker.GameFiles
public float Intensity { get; set; } public float Intensity { get; set; }
public uint Flags { get; set; } public uint Flags { get; set; }
public ushort BoneId { get; set; } public ushort BoneId { get; set; }
public byte Type { get; set; } public LightType Type { get; set; }
public byte GroupId { get; set; } public byte GroupId { get; set; }
public uint TimeFlags { get; set; } public uint TimeFlags { get; set; }
public float Falloff { get; set; } public float Falloff { get; set; }
public float FalloffExponent { get; set; } public float FalloffExponent { get; set; }
public float CullingPlaneNormalX { get; set; } public Vector3 CullingPlaneNormal { get; set; }
public float CullingPlaneNormalY { get; set; }
public float CullingPlaneNormalZ { get; set; }
public float CullingPlaneOffset { get; set; } public float CullingPlaneOffset { get; set; }
public byte ShadowBlur { get; set; } public byte ShadowBlur { get; set; }
public byte Unknown_45h { get; set; } public byte Unknown_45h { get; set; }
@ -2380,17 +2383,11 @@ namespace CodeWalker.GameFiles
public float ShadowNearClip { get; set; } public float ShadowNearClip { get; set; }
public float CoronaIntensity { get; set; } public float CoronaIntensity { get; set; }
public float CoronaZBias { get; set; } public float CoronaZBias { get; set; }
public float DirectionX { get; set; } public Vector3 Direction { get; set; }
public float DirectionY { get; set; } public Vector3 Tangent { get; set; }
public float DirectionZ { get; set; }
public float TangentX { get; set; }
public float TangentY { get; set; }
public float TangentZ { get; set; }
public float ConeInnerAngle { get; set; } public float ConeInnerAngle { get; set; }
public float ConeOuterAngle { get; set; } public float ConeOuterAngle { get; set; }
public float ExtentX { get; set; } public Vector3 Extent { get; set; }
public float ExtentY { get; set; }
public float ExtentZ { get; set; }
public uint ProjectedTextureHash { get; set; } public uint ProjectedTextureHash { get; set; }
public uint Unknown_A4h { get; set; } // 0x00000000 public uint Unknown_A4h { get; set; } // 0x00000000
} }

View File

@ -20,6 +20,27 @@ namespace CodeWalker
return new Vector3((float)Math.Round(v.X), (float)Math.Round(v.Y), (float)Math.Round(v.Z)); return new Vector3((float)Math.Round(v.X), (float)Math.Round(v.Y), (float)Math.Round(v.Z));
} }
public static Vector3 GetPerpVec(this Vector3 n)
{
//make a vector perpendicular to the given one
float nx = Math.Abs(n.X);
float ny = Math.Abs(n.Y);
float nz = Math.Abs(n.Z);
if ((nx < ny) && (nx < nz))
{
return Vector3.Cross(n, Vector3.Right);
}
else if (ny < nz)
{
return Vector3.Cross(n, Vector3.Up);
}
else
{
return Vector3.Cross(n, Vector3.ForwardLH);
}
}
public static Vector4 Floor(this Vector4 v) public static Vector4 Floor(this Vector4 v)
{ {
return new Vector4((float)Math.Floor(v.X), (float)Math.Floor(v.Y), (float)Math.Floor(v.Z), (float)Math.Floor(v.W)); return new Vector4((float)Math.Floor(v.X), (float)Math.Floor(v.Y), (float)Math.Floor(v.Z), (float)Math.Floor(v.W));

View File

@ -1,64 +1,4 @@
#include "Shadowmap.hlsli" #include "BasicPS.hlsli"
Texture2D<float4> Colourmap : register(t0);
Texture2D<float4> Bumpmap : register(t2);
Texture2D<float4> Specmap : register(t3);
Texture2D<float4> Detailmap : register(t4);
Texture2D<float4> Colourmap2 : register(t5);
Texture2D<float4> TintPalette : register(t6);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;//1+=diffuse1, 2+=diffuse2
uint EnableTint;//1=default, 2=weapons (use diffuse.a for tint lookup)
uint EnableNormalMap;
uint EnableSpecMap;
uint EnableDetailMap;
uint IsDecal;
uint IsEmissive;
uint IsDistMap;
float bumpiness;
float AlphaScale;
float HardAlphaBlend;
float useTessellation;
float4 detailSettings;
float3 specMapIntMask;
float specularIntensityMult;
float specularFalloffMult;
float specularFresnel;
float wetnessMultiplier;
uint SpecOnly;
float4 TextureAlphaMask;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float4 Tangent : TEXCOORD5;
float4 Bitangent : TEXCOORD6;
float3 CamRelPos : TEXCOORD7;
};
float4 main(VS_OUTPUT input) : SV_TARGET float4 main(VS_OUTPUT input) : SV_TARGET

View File

@ -0,0 +1,71 @@
#include "Shadowmap.hlsli"
Texture2D<float4> Colourmap : register(t0);
Texture2D<float4> Bumpmap : register(t2);
Texture2D<float4> Specmap : register(t3);
Texture2D<float4> Detailmap : register(t4);
Texture2D<float4> Colourmap2 : register(t5);
Texture2D<float4> TintPalette : register(t6);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;//1+=diffuse1, 2+=diffuse2
uint EnableTint;//1=default, 2=weapons (use diffuse.a for tint lookup)
uint EnableNormalMap;
uint EnableSpecMap;
uint EnableDetailMap;
uint IsDecal;
uint IsEmissive;
uint IsDistMap;
float bumpiness;
float AlphaScale;
float HardAlphaBlend;
float useTessellation;
float4 detailSettings;
float3 specMapIntMask;
float specularIntensityMult;
float specularFalloffMult;
float specularFresnel;
float wetnessMultiplier;
uint SpecOnly;
float4 TextureAlphaMask;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float4 Tangent : TEXCOORD5;
float4 Bitangent : TEXCOORD6;
float3 CamRelPos : TEXCOORD7;
};
struct PS_OUTPUT
{
float4 Diffuse : SV_Target0;
float4 Normal : SV_Target1;
float4 Specular : SV_Target2;
float4 Irradiance : SV_Target3;
};

View File

@ -0,0 +1,171 @@
#include "BasicPS.hlsli"
PS_OUTPUT main(VS_OUTPUT input)
{
float4 c = float4(0.5, 0.5, 0.5, 1);
if (RenderMode == 0) c = float4(1, 1, 1, 1);
if (EnableTexture > 0)
{
float2 texc = input.Texcoord0;
if (RenderMode >= 5)
{
if (RenderSamplerCoord == 2)
texc = input.Texcoord1;
else if (RenderSamplerCoord == 3)
texc = input.Texcoord2;
}
c = Colourmap.Sample(TextureSS, texc);
if (EnableTexture > 1) //2+ enables diffuse2
{
float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1);
c = c2.a * c2 + (1 - c2.a) * c;
}
if (EnableTint == 2)
{
//weapon tint
float tx = (round(c.a * 255.009995) - 32.0) * 0.007813; //okay R* this is just silly
float ty = 0.03125 * 0.5; // //1;//what to use for Y value? cb12[2].w in R* shader
float4 c3 = TintPalette.Sample(TextureSS, float2(tx, ty));
c.rgb *= c3.rgb;
c.a = 1;
}
if (IsDistMap) c = float4(c.rgb * 2, (c.r + c.g + c.b) - 1);
if ((IsDecal == 0) && (c.a <= 0.33)) discard;
if ((IsDecal == 1) && (c.a <= 0.0)) discard;
if (IsDecal == 0) c.a = 1;
if (IsDecal == 2)
{
float4 mask = TextureAlphaMask * c;
c.a = saturate(mask.r + mask.g + mask.b + mask.a);
c.rgb = 0;
}
c.a = saturate(c.a * AlphaScale);
}
if (EnableTint == 1)
{
c.rgb *= input.Tint.rgb;
}
if (IsDecal == 1)
{
c.a *= input.Colour0.a;
}
float3 norm = normalize(input.Normal);
if (RenderMode == 1) //normals
{
c.rgb = norm * 0.5 + 0.5;
}
else if (RenderMode == 2) //tangents
{
c.rgb = normalize(input.Tangent.rgb) * 0.5 + 0.5;
}
else if (RenderMode == 3) //colours
{
c.rgb = input.Colour0.rgb;
if (RenderModeIndex == 2)
c.rgb = input.Colour1.rgb;
}
else if (RenderMode == 4) //texcoords
{
c.rgb = float3(input.Texcoord0, 0);
if (RenderModeIndex == 2) c.rgb = float3(input.Texcoord1, 0);
if (RenderModeIndex == 3) c.rgb = float3(input.Texcoord2, 0);
}
float3 spec = 0;
if (RenderMode == 0)
{
float4 nv = Bumpmap.Sample(TextureSS, input.Texcoord0);
float4 sv = Specmap.Sample(TextureSS, input.Texcoord0);
float2 nmv = nv.xy;
float4 r0 = 0, r1, r2, r3;
if (EnableNormalMap)
{
if (EnableDetailMap)
{
//detail normalmapp
r0.xy = input.Texcoord0 * detailSettings.zw;
r0.zw = r0.xy * 3.17;
r0.xy = Detailmap.Sample(TextureSS, r0.xy).xy - 0.5;
r0.zw = Detailmap.Sample(TextureSS, r0.zw).xy - 0.5;
r0.xy = r0.xy + r0.zw;
r0.yz = r0.xy * detailSettings.y; //r0.x = -r0.x*detailSettings.x;
nmv = r0.yz * sv.w + nv.xy; //add detail to normal, using specmap(!)
}
norm = NormalMap(nmv, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
}
if (EnableSpecMap == 0)
{
sv = float4(0.1, 0.1, 0.1, 0.1);
}
float r1y = norm.z - 0.35;
float3 globalScalars = float3(0.5, 0.5, 0.5);
float globalScalars2z = 1; // 0.65; //wet darkness?
float wetness = 0; // 10.0;
r0.x = 0; // .5;
r0.z = 1 - globalScalars2z;
r0.y = saturate(r1y * 1.538462);
r0.y = r0.y * wetness;
r0.y = r0.y * r0.z;
r1.yz = input.Colour0.xy * globalScalars.zy;
r0.y = r0.y * r1.y;
r0.x = r0.x * sv.w + 1.0;
sv.xy = sv.xy * sv.xy;
r0.z = sv.w * specularFalloffMult;
r3.y = r0.z * 0.001953125; // (1/512)
r0.z = dot(sv.xyz, specMapIntMask);
r0.z = r0.z * specularIntensityMult;
r3.x = r0.x * r0.z;
r0.z = saturate(r0.z * r0.x + 0.4);
r0.z = 1 - r3.x * 0.5;
r0.z = r0.z * r0.y;
r0.y = r0.y * wetnessMultiplier;
r0.z = 1 - r0.z * 0.5;
float3 tc = c.rgb * r0.x;
c.rgb = tc * r0.z; //diffuse factors...
spec.xy = sqrt(r3.xy);
spec.z = r0.z;
}
float emiss = (IsEmissive == 1) ? 1.0 : 0.0;
c.a = saturate(c.a);
PS_OUTPUT output;
output.Diffuse = c;
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
output.Specular = float4(spec, c.a);
output.Irradiance = float4(input.Colour0.rg, emiss, c.a);
return output;
}

View File

@ -1,41 +1,4 @@
#include "Shadowmap.hlsli" #include "CablePS.hlsli"
Texture2D<float4> Colourmap : register(t0);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;
uint EnableTint;
uint Pad100;
uint Pad101;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float4 Tangent : TANGENT;
};
float4 main(VS_OUTPUT input) : SV_TARGET float4 main(VS_OUTPUT input) : SV_TARGET

View File

@ -0,0 +1,46 @@
#include "Shadowmap.hlsli"
Texture2D<float4> Colourmap : register(t0);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;
uint EnableTint;
uint Pad100;
uint Pad101;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float4 Tangent : TANGENT;
};
struct PS_OUTPUT
{
float4 Diffuse : SV_Target0;
float4 Normal : SV_Target1;
float4 Specular : SV_Target2;
float4 Irradiance : SV_Target3;
};

View File

@ -0,0 +1,71 @@
#include "CablePS.hlsli"
PS_OUTPUT main(VS_OUTPUT input)
{
float4 c = float4(0.2, 0.2, 0.2, 1);
if (EnableTexture == 1)
{
float2 texc = input.Texcoord0;
if (RenderMode >= 5)
{
if (RenderSamplerCoord == 2) texc = input.Texcoord1;
else if (RenderSamplerCoord == 3) texc = input.Texcoord2;
}
c = Colourmap.Sample(TextureSS, texc);
//c = Depthmap.SampleLevel(DepthmapSS, input.Texcoord, 0); c.a = 1;
//if ((IsDecal == 0) && (c.a <= 0.33)) discard;
//if ((IsDecal == 1) && (c.a <= 0.0)) discard;
//if(IsDecal==0) c.a = 1;
c.a = 1;
}
//else //if(RenderMode!=8)//
//{
// c = float4(input.Colour0.rgb, 1);
//}
if (EnableTint > 0)
{
c.rgb *= input.Tint.rgb;
}
//if (IsDecal == 1)
//{
// c.a *= input.Colour0.a;
//}
float3 norm = normalize(input.Normal);
if (RenderMode == 1) //normals
{
c.rgb = norm*0.5+0.5;
}
else if (RenderMode == 2) //tangents
{
c.rgb = normalize(input.Tangent.rgb)*0.5+0.5;
}
else if (RenderMode == 3) //colours
{
c.rgb = input.Colour0.rgb;
if (RenderModeIndex == 2) c.rgb = input.Colour1.rgb;
}
else if (RenderMode == 4) //texcoords
{
c.rgb = float3(input.Texcoord0, 0);
if (RenderModeIndex == 2) c.rgb = float3(input.Texcoord1, 0);
if (RenderModeIndex == 3) c.rgb = float3(input.Texcoord2, 0);
}
float3 spec = 0;
c.a = saturate(c.a);
PS_OUTPUT output;
output.Diffuse = c;
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
output.Specular = float4(spec, c.a);
output.Irradiance = float4(input.Colour0.rg, 0, c.a);
return output;
}

View File

@ -132,6 +132,16 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="BasicPS_Deferred.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="BasicVS_Box.hlsl"> <FxCompile Include="BasicVS_Box.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@ -344,6 +354,16 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="CablePS_Deferred.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="CableVS.hlsl"> <FxCompile Include="CableVS.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@ -374,6 +394,26 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="LightPS.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="LightVS.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="MarkerPS.hlsl"> <FxCompile Include="MarkerPS.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
@ -548,6 +588,16 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="TerrainPS_Deferred.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCT.hlsl"> <FxCompile Include="TerrainVS_PNCCT.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
@ -596,6 +646,16 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="TreesLodPS_Deferred.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="TreesLodVS.hlsl"> <FxCompile Include="TreesLodVS.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@ -608,6 +668,16 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile> </FxCompile>
<FxCompile Include="WaterPS_Deferred.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="WaterVS_PCT.hlsl"> <FxCompile Include="WaterVS_PCT.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@ -646,13 +716,18 @@
</FxCompile> </FxCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="BasicPS.hlsli" />
<None Include="BasicVS.hlsli" /> <None Include="BasicVS.hlsli" />
<None Include="CablePS.hlsli" />
<None Include="Clouds.hlsli" /> <None Include="Clouds.hlsli" />
<None Include="Common.hlsli" /> <None Include="Common.hlsli" />
<None Include="Quaternion.hlsli" /> <None Include="Quaternion.hlsli" />
<None Include="Shadowmap.hlsli" /> <None Include="Shadowmap.hlsli" />
<None Include="Skydome.hlsli" /> <None Include="Skydome.hlsli" />
<None Include="TerrainPS.hlsli" />
<None Include="TerrainVS.hlsli" /> <None Include="TerrainVS.hlsli" />
<None Include="TreesLodPS.hlsli" />
<None Include="WaterPS.hlsli" />
<None Include="WaterVS.hlsli" /> <None Include="WaterVS.hlsli" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -1,90 +1,336 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<FxCompile Include="BasicPS.hlsl" /> <FxCompile Include="BasicPS.hlsl">
<FxCompile Include="TerrainPS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="TerrainVS_PNCTTX.hlsl" /> </FxCompile>
<FxCompile Include="TerrainVS_PNCCT.hlsl" /> <FxCompile Include="BasicPS_Deferred.hlsl">
<FxCompile Include="TerrainVS_PNCCTT.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="TerrainVS_PNCCTTTX.hlsl" /> </FxCompile>
<FxCompile Include="TerrainVS_PNCCTTX.hlsl" /> <FxCompile Include="BasicVS_Box.hlsl">
<FxCompile Include="TerrainVS_PNCCTX.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="TerrainVS_PNCTTTX.hlsl" /> </FxCompile>
<FxCompile Include="MarkerVS.hlsl" /> <FxCompile Include="BasicVS_Capsule.hlsl">
<FxCompile Include="MarkerPS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="SkydomeVS.hlsl" /> </FxCompile>
<FxCompile Include="SkydomePS.hlsl" /> <FxCompile Include="BasicVS_Cylinder.hlsl">
<FxCompile Include="BoundingSphereVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BoundsPS.hlsl" /> </FxCompile>
<FxCompile Include="BoundingBoxVS.hlsl" /> <FxCompile Include="BasicVS_PBBNCCT.hlsl">
<FxCompile Include="TreesLodVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="TreesLodPS.hlsl" /> </FxCompile>
<FxCompile Include="ShadowVS.hlsl" /> <FxCompile Include="BasicVS_PBBNCCTTX.hlsl">
<FxCompile Include="ShadowPS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PNCT.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PNCTT.hlsl" /> <FxCompile Include="BasicVS_PBBNCCTX.hlsl">
<FxCompile Include="BasicVS_PNCTX.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PNCCT.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PNCCTT.hlsl" /> <FxCompile Include="BasicVS_PBBNCT.hlsl">
<FxCompile Include="BasicVS_PNCCTTT.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PNCCTX.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PNCTTX.hlsl" /> <FxCompile Include="BasicVS_PBBNCTT.hlsl">
<FxCompile Include="BasicVS_PNCCTTX.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PNCTTTX.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PNCCTTTX.hlsl" /> <FxCompile Include="BasicVS_PBBNCTTT.hlsl">
<FxCompile Include="BasicVS_Box.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_Sphere.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_Capsule.hlsl" /> <FxCompile Include="BasicVS_PBBNCTTX.hlsl">
<FxCompile Include="BasicVS_Cylinder.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="CableVS.hlsl" /> </FxCompile>
<FxCompile Include="CablePS.hlsl" /> <FxCompile Include="BasicVS_PBBNCTX.hlsl">
<FxCompile Include="DistantLightsVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="DistantLightsPS.hlsl" /> </FxCompile>
<FxCompile Include="PPBloomFilterBPHCS.hlsl" /> <FxCompile Include="BasicVS_PNCCT.hlsl">
<FxCompile Include="PPBloomFilterVCS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="PPCopyPixelsPS.hlsl" /> </FxCompile>
<FxCompile Include="PPFinalPassPS.hlsl" /> <FxCompile Include="BasicVS_PNCCTT.hlsl">
<FxCompile Include="PPFinalPassVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="PPLumBlendCS.hlsl" /> </FxCompile>
<FxCompile Include="PPReduceTo0DCS.hlsl" /> <FxCompile Include="BasicVS_PNCCTTT.hlsl">
<FxCompile Include="PPReduceTo1DCS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="SkySunVS.hlsl" /> </FxCompile>
<FxCompile Include="SkySunPS.hlsl" /> <FxCompile Include="BasicVS_PNCCTTTX.hlsl">
<FxCompile Include="CloudsVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="CloudsPS.hlsl" /> </FxCompile>
<FxCompile Include="WaterVS_PNCT.hlsl" /> <FxCompile Include="BasicVS_PNCCTTX.hlsl">
<FxCompile Include="WaterVS_PNCTX.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="WaterPS.hlsl" /> </FxCompile>
<FxCompile Include="WaterVS_PT.hlsl" /> <FxCompile Include="BasicVS_PNCCTX.hlsl">
<FxCompile Include="WaterVS_PCT.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="PathVS.hlsl" /> </FxCompile>
<FxCompile Include="PathPS.hlsl" /> <FxCompile Include="BasicVS_PNCT.hlsl">
<FxCompile Include="WidgetVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="WidgetPS.hlsl" /> </FxCompile>
<FxCompile Include="PathBoxVS.hlsl" /> <FxCompile Include="BasicVS_PNCTT.hlsl">
<FxCompile Include="PathBoxPS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="SkyMoonVS.hlsl" /> </FxCompile>
<FxCompile Include="SkyMoonPS.hlsl" /> <FxCompile Include="BasicVS_PNCTTT.hlsl">
<FxCompile Include="PathDynVS.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PBBNCT.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PBBNCTX.hlsl" /> <FxCompile Include="BasicVS_PNCTTTX.hlsl">
<FxCompile Include="BasicVS_PBBNCTT.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PBBNCTTT.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PNCTTT.hlsl" /> <FxCompile Include="BasicVS_PNCTTX.hlsl">
<FxCompile Include="BasicVS_PBBNCCT.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PBBNCCTX.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_PBBNCTTX.hlsl" /> <FxCompile Include="BasicVS_PNCTX.hlsl">
<FxCompile Include="ShadowVS_Skin.hlsl" /> <Filter>Basic</Filter>
<FxCompile Include="BasicVS_PBBNCCTTX.hlsl" /> </FxCompile>
<FxCompile Include="BasicVS_Sphere.hlsl">
<Filter>Basic</Filter>
</FxCompile>
<FxCompile Include="BoundsPS.hlsl">
<Filter>Bounds</Filter>
</FxCompile>
<FxCompile Include="BoundingBoxVS.hlsl">
<Filter>Bounds</Filter>
</FxCompile>
<FxCompile Include="BoundingSphereVS.hlsl">
<Filter>Bounds</Filter>
</FxCompile>
<FxCompile Include="CablePS.hlsl">
<Filter>Cable</Filter>
</FxCompile>
<FxCompile Include="CablePS_Deferred.hlsl">
<Filter>Cable</Filter>
</FxCompile>
<FxCompile Include="CableVS.hlsl">
<Filter>Cable</Filter>
</FxCompile>
<FxCompile Include="CloudsPS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="CloudsVS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkydomePS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkydomeVS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkyMoonPS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkyMoonVS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkySunPS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="SkySunVS.hlsl">
<Filter>Sky</Filter>
</FxCompile>
<FxCompile Include="MarkerPS.hlsl">
<Filter>Markers</Filter>
</FxCompile>
<FxCompile Include="MarkerVS.hlsl">
<Filter>Markers</Filter>
</FxCompile>
<FxCompile Include="PathBoxPS.hlsl">
<Filter>Paths</Filter>
</FxCompile>
<FxCompile Include="PathBoxVS.hlsl">
<Filter>Paths</Filter>
</FxCompile>
<FxCompile Include="PathDynVS.hlsl">
<Filter>Paths</Filter>
</FxCompile>
<FxCompile Include="PathPS.hlsl">
<Filter>Paths</Filter>
</FxCompile>
<FxCompile Include="PathVS.hlsl">
<Filter>Paths</Filter>
</FxCompile>
<FxCompile Include="PPBloomFilterBPHCS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPBloomFilterVCS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPCopyPixelsPS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPFinalPassPS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPFinalPassVS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPLumBlendCS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPReduceTo0DCS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="PPReduceTo1DCS.hlsl">
<Filter>PostProcessor</Filter>
</FxCompile>
<FxCompile Include="ShadowPS.hlsl">
<Filter>Shadows</Filter>
</FxCompile>
<FxCompile Include="ShadowVS.hlsl">
<Filter>Shadows</Filter>
</FxCompile>
<FxCompile Include="ShadowVS_Skin.hlsl">
<Filter>Shadows</Filter>
</FxCompile>
<FxCompile Include="TerrainPS.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainPS_Deferred.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCT.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCTT.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCTTTX.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCTTX.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCCTX.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCTTTX.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TerrainVS_PNCTTX.hlsl">
<Filter>Terrain</Filter>
</FxCompile>
<FxCompile Include="TreesLodPS.hlsl">
<Filter>Trees</Filter>
</FxCompile>
<FxCompile Include="TreesLodPS_Deferred.hlsl">
<Filter>Trees</Filter>
</FxCompile>
<FxCompile Include="TreesLodVS.hlsl">
<Filter>Trees</Filter>
</FxCompile>
<FxCompile Include="WaterPS.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WaterPS_Deferred.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WaterVS_PCT.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WaterVS_PNCT.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WaterVS_PNCTX.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WaterVS_PT.hlsl">
<Filter>Water</Filter>
</FxCompile>
<FxCompile Include="WidgetPS.hlsl">
<Filter>Widget</Filter>
</FxCompile>
<FxCompile Include="WidgetVS.hlsl">
<Filter>Widget</Filter>
</FxCompile>
<FxCompile Include="LightPS.hlsl">
<Filter>Lights</Filter>
</FxCompile>
<FxCompile Include="LightVS.hlsl">
<Filter>Lights</Filter>
</FxCompile>
<FxCompile Include="DistantLightsPS.hlsl">
<Filter>Lights</Filter>
</FxCompile>
<FxCompile Include="DistantLightsVS.hlsl">
<Filter>Lights</Filter>
</FxCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Quaternion.hlsli" /> <None Include="BasicPS.hlsli">
<None Include="Common.hlsli" /> <Filter>Basic</Filter>
<None Include="Shadowmap.hlsli" /> </None>
<None Include="TerrainVS.hlsli" /> <None Include="BasicVS.hlsli">
<None Include="BasicVS.hlsli" /> <Filter>Basic</Filter>
<None Include="Skydome.hlsli" /> </None>
<None Include="Clouds.hlsli" /> <None Include="CablePS.hlsli">
<None Include="WaterVS.hlsli" /> <Filter>Cable</Filter>
</None>
<None Include="Clouds.hlsli">
<Filter>Sky</Filter>
</None>
<None Include="Skydome.hlsli">
<Filter>Sky</Filter>
</None>
<None Include="Common.hlsli">
<Filter>Common</Filter>
</None>
<None Include="Quaternion.hlsli">
<Filter>Common</Filter>
</None>
<None Include="Shadowmap.hlsli">
<Filter>Shadows</Filter>
</None>
<None Include="TerrainPS.hlsli">
<Filter>Terrain</Filter>
</None>
<None Include="TerrainVS.hlsli">
<Filter>Terrain</Filter>
</None>
<None Include="TreesLodPS.hlsli">
<Filter>Trees</Filter>
</None>
<None Include="WaterPS.hlsli">
<Filter>Water</Filter>
</None>
<None Include="WaterVS.hlsli">
<Filter>Water</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="Basic">
<UniqueIdentifier>{2d5fa9c1-ac2c-4820-b3a2-e3417e5b4a75}</UniqueIdentifier>
</Filter>
<Filter Include="Bounds">
<UniqueIdentifier>{7b12481e-7e7c-45a2-aa19-26cf35acf33d}</UniqueIdentifier>
</Filter>
<Filter Include="Cable">
<UniqueIdentifier>{2fa3ba6e-67fe-49a0-bd2c-2b3b45702285}</UniqueIdentifier>
</Filter>
<Filter Include="Sky">
<UniqueIdentifier>{5fdc8b34-5e82-4786-9d6d-1af2248575b2}</UniqueIdentifier>
</Filter>
<Filter Include="Common">
<UniqueIdentifier>{0b5779e8-ab81-41e3-88e4-849c66a7a171}</UniqueIdentifier>
</Filter>
<Filter Include="Markers">
<UniqueIdentifier>{8f404e01-a627-4d6d-9037-c073a687d61d}</UniqueIdentifier>
</Filter>
<Filter Include="Paths">
<UniqueIdentifier>{6d63039e-7ce7-48f9-a503-76ec3782b5b0}</UniqueIdentifier>
</Filter>
<Filter Include="PostProcessor">
<UniqueIdentifier>{1d840a5b-3c41-4c7a-a363-6607e269b27b}</UniqueIdentifier>
</Filter>
<Filter Include="Shadows">
<UniqueIdentifier>{baaa8dee-0bc4-4b05-95a1-882640344212}</UniqueIdentifier>
</Filter>
<Filter Include="Terrain">
<UniqueIdentifier>{03608a54-3337-4feb-b010-3a454a02c4c0}</UniqueIdentifier>
</Filter>
<Filter Include="Trees">
<UniqueIdentifier>{f43e28c7-ea51-4960-a602-db412ac6bd2a}</UniqueIdentifier>
</Filter>
<Filter Include="Water">
<UniqueIdentifier>{342884aa-960f-460a-9d63-93cacab48de5}</UniqueIdentifier>
</Filter>
<Filter Include="Widget">
<UniqueIdentifier>{160d1dee-4be7-43ad-a6a8-511a8bb13865}</UniqueIdentifier>
</Filter>
<Filter Include="Lights">
<UniqueIdentifier>{215eb704-917e-43c0-8d5b-d24e75403db3}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -139,7 +139,7 @@ float3 GlobalLighting(float3 diff, float3 norm, float4 vc0, float lf, uniform Sh
{ {
float3 c = saturate(diff); float3 c = saturate(diff);
float3 fc = c; float3 fc = c;
float naturalDiffuseFactor = 1.0; float naturalDiffuseFactor = vc0.r;
float artificialDiffuseFactor = saturate(vc0.g); float artificialDiffuseFactor = saturate(vc0.g);
c *= BasicLighting(globalLights.LightDirColour, globalLights.LightDirAmbColour, lf); c *= BasicLighting(globalLights.LightDirColour, globalLights.LightDirAmbColour, lf);
c += AmbientLight(fc, norm.z, globalLights.LightNaturalAmbUp, globalLights.LightNaturalAmbDown, naturalDiffuseFactor); c += AmbientLight(fc, norm.z, globalLights.LightNaturalAmbUp, globalLights.LightNaturalAmbDown, naturalDiffuseFactor);

View File

@ -0,0 +1,161 @@
#include "Shadowmap.hlsli"
struct LODLight
{
float3 Position;
uint Colour;
float3 Direction;
uint TimeAndStateFlags;
float4 TangentX;
float4 TangentY;
float Falloff;
float FalloffExponent;
float InnerAngle; //for cone
float OuterAngleOrCapExt; //outer angle for cone, cap extent for capsule
};
struct VS_Output
{
float4 Pos : SV_POSITION;
float4 Screen : TEXCOORD0;
uint IID : SV_INSTANCEID;
};
struct PS_OUTPUT
{
float4 Colour : SV_TARGET;
float Depth : SV_DEPTH;
};
Texture2D DepthTex : register(t0);
Texture2D DiffuseTex : register(t2);
Texture2D NormalTex : register(t3);
Texture2D SpecularTex : register(t4);
Texture2D IrradianceTex : register(t5);
cbuffer PSLightVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
float4x4 ViewProjInv;
float4 CameraPos;
uint EnableShadows;
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
uint IsLOD; //useful or not?
uint Pad0;
uint Pad1;
}
StructuredBuffer<LODLight> LODLights : register(t6);
PS_OUTPUT main(VS_Output input)
{
PS_OUTPUT output;
output.Depth = input.Pos.z;
uint3 ssloc = uint3(input.Pos.xy, 0); //pixel location
float depth = DepthTex.Load(ssloc).r;
float4 diffuse = DiffuseTex.Load(ssloc);
float4 normal = NormalTex.Load(ssloc);
float4 specular = SpecularTex.Load(ssloc);
float4 irradiance = IrradianceTex.Load(ssloc);
if (depth == 0) discard; //no existing pixel rendered here
switch (RenderMode)
{
case 5: output.Colour = float4(diffuse.rgb, 1); return output;
case 6: output.Colour = float4(normal.rgb, 1); return output;
case 7: output.Colour = float4(specular.rgb, 1); return output;
}
float4 spos = float4(input.Screen.xy/input.Screen.w, depth, 1);
float4 cpos = mul(spos, ViewProjInv);
float3 camRel = cpos.xyz * (1/cpos.w);
float3 norm = normal.xyz * 2 - 1;
float3 incident = normalize(camRel);
float3 refl = normalize(reflect(incident, norm));
if (LightType == 0) //directional light
{
float specb = saturate(dot(refl, GlobalLights.LightDir));
float specp = max(exp(specb * 10) - 1, 0);
float3 spec = GlobalLights.LightDirColour.rgb * 0.00006 * specp * specular.r;
float4 lightspacepos;
float shadowdepth = ShadowmapSceneDepth(camRel, lightspacepos);
float3 c = FullLighting(diffuse.rgb, spec, norm, irradiance, GlobalLights, EnableShadows, shadowdepth, lightspacepos);
c += diffuse.rgb * irradiance.b;//emissive multiplier
PS_OUTPUT output;
output.Colour = float4(c, 1);
output.Depth = depth;
return output;
}
float3 wpos = camRel + CameraPos.xyz;
LODLight lodlight = LODLights[input.IID];
float3 srpos = lodlight.Position - wpos; //light position relative to surface position
float ldist = length(srpos);
if (ldist > lodlight.Falloff) discard; //out of range of the light... TODO: capsules!
if (ldist <= 0) discard;
float4 rgbi = Unpack4x8UNF(lodlight.Colour).gbar;
float3 lcol = rgbi.rgb * rgbi.a * 5.0f;
float3 ldir = srpos / ldist;
float pclit = saturate(dot(ldir, norm));
float lamt = 1;
if (LightType == 1)//point (sphere)
{
lamt *= saturate(1 - (ldist / lodlight.Falloff));
}
else if (LightType == 2)//spot (cone)
{
float ang = acos(-dot(ldir, lodlight.Direction));
float iang = lodlight.InnerAngle * 0.01745329;
float oang = lodlight.OuterAngleOrCapExt * 0.01745329 * 0.5;
if (ang > oang) discard;
lamt *= saturate(1 - ((ang - iang) / (oang - iang)));
lamt *= saturate(1 - (ldist / lodlight.Falloff));
}
else if (LightType == 4)//capsule
{
lamt *= saturate(1 - (ldist / lodlight.Falloff)); //TODO! proper capsule lighting... (use point-line dist!)
}
pclit *= lamt;
if (pclit <= 0) discard;
float specb = saturate(dot(refl, ldir));
float specp = max(exp(specb * 10) - 1, 0);
float3 spec = lcol * (0.00006 * specp * specular.r * lamt);
lcol = lcol * diffuse.rgb * pclit + spec;
output.Colour = float4(lcol, 0.5);
return output;
//return float4(diffuse.rgb, 1);
//return float4(normal.rgb, 1);
//return float4(specular.rgb, 1);
//return float4(irradiance.rgb, 1);
}

View File

@ -0,0 +1,76 @@
#include "Common.hlsli"
struct LODLight
{
float3 Position;
uint Colour;
float3 Direction;
uint TimeAndStateFlags;
float4 TangentX;
float4 TangentY;
float Falloff;
float FalloffExponent;
float InnerAngle; //for cone
float OuterAngleOrCapExt; //outer angle for cone, cap extent for capsule
};
struct VS_Output
{
float4 Pos : SV_POSITION;
float4 Screen : TEXCOORD0;
uint IID : SV_INSTANCEID;
};
cbuffer VSLightVars : register(b0)
{
float4x4 ViewProj;
float4 CameraPos;
uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
uint IsLOD; //useful or not?
uint Pad0;
uint Pad1;
}
StructuredBuffer<LODLight> LODLights : register(t0);
VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
{
float3 opos = 0;
if (LightType > 0)
{
LODLight lodlight = LODLights[iid];
float extent = lodlight.Falloff;
if (LightType == 1)//point (sphere)
{
opos = ipos.xyz * extent;
}
else if (LightType == 2)//spot (cone)
{
float arads = lodlight.OuterAngleOrCapExt * 0.01745329 * 1.5;//is this right?
float3 cpos = ipos.xyz * (atan(arads) * extent);
cpos.y += ipos.w * extent;
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
}
else if (LightType == 4)//capsule
{
float3 cpos = ipos.xyz * extent;
cpos.y += (ipos.w*2-1) * lodlight.OuterAngleOrCapExt * 0.1;
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
}
opos += (lodlight.Position - CameraPos.xyz);
}
else
{
opos = ipos.xyz;
}
float4 spos = mul(float4(opos, 1), ViewProj);
VS_Output output;
output.Pos = spos;
output.Screen = spos;
output.IID = iid;
return output;
}

View File

@ -1,61 +1,4 @@
#include "Shadowmap.hlsli" #include "TerrainPS.hlsli"
Texture2D<float4> Colourmap0 : register(t0);
Texture2D<float4> Colourmap1 : register(t2);
Texture2D<float4> Colourmap2 : register(t3);
Texture2D<float4> Colourmap3 : register(t4);
Texture2D<float4> Colourmap4 : register(t5);
Texture2D<float4> Colourmask : register(t6);
Texture2D<float4> Normalmap0 : register(t7);
Texture2D<float4> Normalmap1 : register(t8);
Texture2D<float4> Normalmap2 : register(t9);
Texture2D<float4> Normalmap3 : register(t10);
Texture2D<float4> Normalmap4 : register(t11);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex; //colour or texcoord index
uint RenderSamplerCoord;
}
cbuffer PSEntityVars : register(b2)
{
uint EnableTexture0;
uint EnableTexture1;
uint EnableTexture2;
uint EnableTexture3;
uint EnableTexture4;
uint EnableTextureMask;
uint EnableNormalMap;
uint ShaderName;
uint EnableTint;
uint EnableVertexColour;
float bumpiness;
uint Pad102;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD4;
float4 LightShadow : TEXCOORD5;
float4 Tangent : TEXCOORD6;
float4 Bitangent : TEXCOORD7;
float3 CamRelPos : TEXCOORD8;
};
float4 main(VS_OUTPUT input) : SV_TARGET float4 main(VS_OUTPUT input) : SV_TARGET

View File

@ -0,0 +1,67 @@
#include "Shadowmap.hlsli"
Texture2D<float4> Colourmap0 : register(t0);
Texture2D<float4> Colourmap1 : register(t2);
Texture2D<float4> Colourmap2 : register(t3);
Texture2D<float4> Colourmap3 : register(t4);
Texture2D<float4> Colourmap4 : register(t5);
Texture2D<float4> Colourmask : register(t6);
Texture2D<float4> Normalmap0 : register(t7);
Texture2D<float4> Normalmap1 : register(t8);
Texture2D<float4> Normalmap2 : register(t9);
Texture2D<float4> Normalmap3 : register(t10);
Texture2D<float4> Normalmap4 : register(t11);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex; //colour or texcoord index
uint RenderSamplerCoord;
}
cbuffer PSEntityVars : register(b2)
{
uint EnableTexture0;
uint EnableTexture1;
uint EnableTexture2;
uint EnableTexture3;
uint EnableTexture4;
uint EnableTextureMask;
uint EnableNormalMap;
uint ShaderName;
uint EnableTint;
uint EnableVertexColour;
float bumpiness;
uint Pad102;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float4 Colour0 : COLOR0;
float4 Colour1 : COLOR1;
float4 Tint : COLOR2;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float2 Texcoord2 : TEXCOORD2;
float4 Shadows : TEXCOORD4;
float4 LightShadow : TEXCOORD5;
float4 Tangent : TEXCOORD6;
float4 Bitangent : TEXCOORD7;
float3 CamRelPos : TEXCOORD8;
};
struct PS_OUTPUT
{
float4 Diffuse : SV_Target0;
float4 Normal : SV_Target1;
float4 Specular : SV_Target2;
float4 Irradiance : SV_Target3;
};

View File

@ -0,0 +1,227 @@
#include "TerrainPS.hlsli"
PS_OUTPUT main(VS_OUTPUT input)
{
float4 vc0 = input.Colour0;
float4 vc1 = input.Colour1;
float2 tc0 = input.Texcoord0;
float2 tc1 = input.Texcoord1;
float2 tc2 = input.Texcoord2;
float2 sc0 = tc0;
float2 sc1 = tc0;
float2 sc2 = tc0;
float2 sc3 = tc0;
float2 sc4 = tc0;
float2 scm = tc1;
////switch (ShaderName)
////{
//// case 3965214311: //terrain_cb_w_4lyr_cm_pxm_tnt vt: PNCTTTX_3 //vb_35_beache
//// case 4186046662: //terrain_cb_w_4lyr_cm_pxm vt: PNCTTTX_3 //cs6_08_struct08
//// //vc1 = vc0;
//// //sc1 = tc0*25;
//// //sc2 = sc1;
//// //sc3 = sc1;
//// //sc4 = sc1;
//// //scm = tc0;
//// break;
////}
float4 bc0 = float4(0.5, 0.5, 0.5, 1);
//if (EnableVertexColour)
//{
// bc0 = vc0;
//}
if (RenderMode == 8) //direct texture - choose texcoords
{
if (RenderSamplerCoord == 2) sc0 = tc1;
else if (RenderSamplerCoord == 3) sc0 = tc2;
}
float4 c0 = (EnableTexture0 == 1) ? Colourmap0.Sample(TextureSS, sc0) : bc0;
float4 c1 = (EnableTexture1 == 1) ? Colourmap1.Sample(TextureSS, sc1) : bc0;
float4 c2 = (EnableTexture2 == 1) ? Colourmap2.Sample(TextureSS, sc2) : bc0;
float4 c3 = (EnableTexture3 == 1) ? Colourmap3.Sample(TextureSS, sc3) : bc0;
float4 c4 = (EnableTexture4 == 1) ? Colourmap4.Sample(TextureSS, sc4) : bc0;
float4 m = (EnableTextureMask == 1) ? Colourmask.Sample(TextureSS, scm) : vc1;
float4 b0 = (EnableNormalMap == 1) ? Normalmap0.Sample(TextureSS, sc0) : float4(0.5, 0.5, 0.5, 1);// float4(input.Normal, 0);
float4 b1 = (EnableNormalMap == 1) ? Normalmap1.Sample(TextureSS, sc1) : b0;
float4 b2 = (EnableNormalMap == 1) ? Normalmap2.Sample(TextureSS, sc2) : b0;
float4 b3 = (EnableNormalMap == 1) ? Normalmap3.Sample(TextureSS, sc3) : b0;
float4 b4 = (EnableNormalMap == 1) ? Normalmap4.Sample(TextureSS, sc4) : b0;
float4 tv=0, nv=0;
float4 t1, t2, n1, n2;
switch (ShaderName)
{
case 137526804: //terrain_cb_w_4lyr_lod vt: PNCCT //brdgeplatform_01_lod..
//return float4(vc1.rgb, vc1.a*0.5 + 0.5);
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
default:
case 2535953532: //terrain_cb_w_4lyr_2tex_blend_lod vt: PNCCTT //cs1_12_riverbed1_lod..
//return float4(vc0.rgb, vc0.a*0.5 + 0.5);
//return float4(vc1.rgb, vc1.a*0.5 + 0.5);
vc1 = m*(1 - vc0.a) + vc1*vc0.a;
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
case 653544224: //terrain_cb_w_4lyr_2tex_blend_pxm_spm vt: PNCCTTTX //ch2_04_land06, rd_04_20..
case 2486206885: //terrain_cb_w_4lyr_2tex_blend_pxm vt: PNCCTTTX //cs2_06c_lkbed_05..
case 1888432890: //terrain_cb_w_4lyr_2tex_pxm vt: PNCCTTTX //ch1_04b_vineland01..
//return float4(0, 1, 0, 1);
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
case 3051127652: //terrain_cb_w_4lyr vt: PNCCTX //ss1_05_gr..
case 646532852: //terrain_cb_w_4lyr_spec vt: PNCCTX //hw1_07_grnd_c..
//return float4(1, 1, 0, 1);
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
case 2316006813: //terrain_cb_w_4lyr_2tex_blend vt: PNCCTTX //ch2_04_land02b, vb_34_beachn_01..
case 3112820305: //terrain_cb_w_4lyr_2tex vt: PNCCTTX //ch1_05_land5..
case 2601000386: //terrain_cb_w_4lyr_spec_pxm vt: PNCCTTX_2 //ch2_03_land05, grnd_low2.. _road
case 4105814572: //terrain_cb_w_4lyr_pxm vt: PNCCTTX_2 //ch2_06_house02.. vb_35_beache
case 3400824277: //terrain_cb_w_4lyr_pxm_spm vt: PNCCTTX_2 //ch2_04_land02b, ch2_06_terrain01a .. vb_35_beacha
//return float4(1, 1, 1, 1);
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
case 295525123: //terrain_cb_w_4lyr_cm vt: PNCTTX //_prewtrproxy_2..
case 417637541: //terrain_cb_w_4lyr_cm_tnt vt: PNCTTX //_prewtrproxy_2.. //golf course..
//tv = 1;// c1;// *vc0.r; //TODO!
//nv = b0;
vc1 = m; //needs work!
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
case 3965214311: //terrain_cb_w_4lyr_cm_pxm_tnt vt: PNCTTTX_3 //vb_35_beache
case 4186046662: //terrain_cb_w_4lyr_cm_pxm vt: PNCTTTX_3 //cs6_08_struct08
//m = min(m, vc0);
//return float4(m.rgb, m.a*0.5 + 0.5);
//return float4(vc0.rgb, vc0.a*0.5 + 0.5);
//return float4(0, 1, 1, 1);
//m = vc0;
vc1 = m; //needs work!
t1 = c1*(1 - vc1.b) + c2*vc1.b;
t2 = c3*(1 - vc1.b) + c4*vc1.b;
tv = t1*(1 - vc1.g) + t2*vc1.g;
n1 = b1*(1 - vc1.b) + b2*vc1.b;
n2 = b3*(1 - vc1.b) + b4*vc1.b;
nv = n1*(1 - vc1.g) + n2*vc1.g;
break;
}
if (EnableTint == 1)
{
tv.rgb *= input.Tint.rgb;
}
if (RenderMode == 1) //normals
{
tv.rgb = normalize(input.Normal)*0.5+0.5;
}
else if (RenderMode == 2) //tangents
{
tv.rgb = normalize(input.Tangent.xyz)*0.5+0.5;
}
else if (RenderMode == 3) //colours
{
tv.rgb = input.Colour0.rgb;
if (RenderModeIndex == 2) tv.rgb = input.Colour1.rgb;
}
else if (RenderMode == 4) //texcoords
{
tv.rgb = float3(input.Texcoord0, 0);
if (RenderModeIndex == 2) tv.rgb = float3(input.Texcoord1, 0);
if (RenderModeIndex == 3) tv.rgb = float3(input.Texcoord2, 0);
}
else if (RenderMode == 5) //render diffuse maps
{
//nothing to do here yet, diffuse maps rendered by default
}
else if (RenderMode == 6) //render normalmaps
{
tv.rgb = nv.rgb;
}
else if (RenderMode == 7) //render spec maps
{
tv.rgb = 0.5; //nothing to see here yet...
}
else if (RenderMode == 8) //render direct texture
{
tv = c0;
}
//nv = normalize(nv*2-1);
//float4 tang = input.Tangent;
float3 nz = normalize(input.Normal);
//float3 nx = normalize(tang.xyz);
//float3 ny = normalize(cross(nz, nx));
////float3 norm = normalize(nx*nv.x + ny*nv.y + nz*nv.z);
float3 norm = nz;// normalize(input.Normal)
if ((RenderMode == 0) && (EnableNormalMap == 1))
{
norm = NormalMap(nv.xy, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
}
float3 spec = float3(0, 0, 1);
tv.a = saturate(tv.a);
PS_OUTPUT output;
output.Diffuse = tv;
output.Normal = float4(saturate(norm * 0.5 + 0.5), tv.a);
output.Specular = float4(spec, tv.a);
output.Irradiance = float4(input.Colour0.rg, 0, tv.a);
return output;
}

View File

@ -1,30 +1,4 @@
#include "Common.hlsli" #include "TreesLodPS.hlsli"
Texture2D<float4> Colourmap : register(t0);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
}
cbuffer PSEntityVars : register(b1)
{
uint EnableTexture;
uint Pad1;
uint Pad2;
uint Pad3;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord : TEXCOORD0;
float4 Colour : COLOR0;
};
float4 main(VS_OUTPUT input) : SV_TARGET float4 main(VS_OUTPUT input) : SV_TARGET

View File

@ -0,0 +1,35 @@
#include "Common.hlsli"
Texture2D<float4> Colourmap : register(t0);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
}
cbuffer PSEntityVars : register(b1)
{
uint EnableTexture;
uint Pad1;
uint Pad2;
uint Pad3;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord : TEXCOORD0;
float4 Colour : COLOR0;
};
struct PS_OUTPUT
{
float4 Diffuse : SV_Target0;
float4 Normal : SV_Target1;
float4 Specular : SV_Target2;
float4 Irradiance : SV_Target3;
};

View File

@ -0,0 +1,35 @@
#include "TreesLodPS.hlsli"
PS_OUTPUT main(VS_OUTPUT input)
{
//return float4(1,0,0,1);//red
float4 c = 0; // float4(input.Colour.rgb, 1);
//return c;
if (EnableTexture == 1)
{
//c = Colourmap.SampleLevel(TextureSS, input.Texcoord, 0);
c = Colourmap.Sample(TextureSS, input.Texcoord);
if (c.a <= 0.25) discard;
c.a = 1;
// c = float4(input.Colour.rgb, 1);
}
float3 norm = input.Normal;
float3 spec = 0;
c.a = saturate(c.a);
PS_OUTPUT output;
output.Diffuse = c;
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
output.Specular = float4(spec, c.a);
output.Irradiance = float4(1, 0, 0, c.a);
return output;
}

View File

@ -1,128 +1,4 @@
#include "Shadowmap.hlsli" #include "WaterPS.hlsli"
Texture2D<float4> Colourmap : register(t0);
Texture2D<float4> Bumpmap : register(t2);
Texture2D<float4> Foammap : register(t3);
Texture2D<float4> WaterBumpSampler : register(t4);// graphics.ytd, waterbump and waterbump2
Texture2D<float4> WaterBumpSampler2 : register(t5);
Texture2D<float4> WaterFog : register(t6);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
uint EnableWaterbumps;//if the waterbump textures are ready..
uint EnableFogtex; //if the fog texture is ready
uint ScnPad1;
uint ScnPad2;
float4 gFlowParams;
float4 CameraPos;
float4 WaterFogParams; //xy = base location, zw = inverse size
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;
uint EnableBumpMap;
uint EnableFoamMap;
uint ShaderMode;
float SpecularIntensity;
float SpecularFalloff;
float GeoPad1;
float GeoPad2;
float WaveOffset; //for terrainfoam
float WaterHeight; //for terrainfoam
float WaveMovement; //for terrainfoam
float HeightOpacity; //for terrainfoam
float RippleSpeed;
float RippleScale;
float RippleBumpiness;
float GeoPad3;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float4 Flow : TEXCOORD1;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Tangent : TEXCOORD5;
float4 Bitangent : TEXCOORD6;
float3 CamRelPos : TEXCOORD7;
};
float3 RippleNormal(VS_OUTPUT input, float3 worldpos)
{
////
//// Input signature:
////
//// Name Index Mask Register SysValue Format Used
//// -------------------- ----- ------ -------- -------- ------- ------
//// SV_Position 0 xyzw 0 POS float
//// TEXCOORD 0 xyzw 1 NONE float xyzw
//// TEXCOORD 1 xyzw 2 NONE float xyzw
//// TEXCOORD 2 xyzw 3 NONE float zw
//// TEXCOORD 3 xyzw 4 NONE float xyzw //NORMAL +half
//// TEXCOORD 4 xyzw 5 NONE float zw //FLOW
////
//
float3 norm = input.Normal.xyz;
float v2w = input.Colour0.r; //vertex red channel
float4 r0, r1, r2, r3, r4;
r0.xy = input.Flow.zw * RippleSpeed; //mul r0.xy, v5.zwzz, RippleSpeed
r1 = -r0.xyxy * gFlowParams.xxyy + worldpos.xyxy; //mad r1.xyzw, -r0.xyxy, gFlowParams.xxyy, v2.xyxy
r0.x = min(sqrt(dot(r0.xy, r0.xy)), 1.0); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x //min r0.x, r0.x, l(1.000000)
r0.yz = r1.xy * RippleScale; //mul r0.yz, r1.xxyx, RippleScale
r1.xy = r1.zw * RippleScale + 0.5; //mad r1.xy, r1.zwzz, RippleScale, l(0.500000, 0.500000, 0.000000, 0.000000)
r1.xy = r1.xy * 2.3; //mul r1.xy, r1.xyxx, l(2.300000, 2.300000, 0.000000, 0.000000)
r0.yz = r0.yz * 2.3; //mul r0.yz, r0.yyzy, l(0.000000, 2.300000, 2.300000, 0.000000)
r2 = WaterBumpSampler2.Sample(TextureSS, r0.yz); //sample r2.xyzw, r0.yzyy, WaterBumpSampler2.xyzw, s14
r3 = WaterBumpSampler.Sample(TextureSS, r0.yz); //sample r3.xyzw, r0.yzyy, WaterBumpSampler.xyzw, s10
r4 = WaterBumpSampler2.Sample(TextureSS, r1.xy); //sample r4.xyzw, r1.xyxx, WaterBumpSampler2.xyzw, s14
r1 = WaterBumpSampler.Sample(TextureSS, r1.xy); //sample r1.xyzw, r1.xyxx, WaterBumpSampler.xyzw, s10
r3.zw = r1.xy; //mov r3.zw, r1.xxxy
r2.zw = r4.xy; //mov r2.zw, r4.xxxy
r1 = r2 + r3; //add r1.xyzw, r2.xyzw, r3.xyzw
r2 = r3 + 0.5; //add r2.xyzw, r3.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
r1 = r1 - r2; //add r1.xyzw, r1.xyzw, -r2.xyzw
r0 = r1 * r0.x + r2; //mad r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
r0 = r0 * 2 - 2; //mad r0.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-2.000000, -2.000000, -2.000000, -2.000000)
r0 = r0 * gFlowParams.zzww; //mul r0.xyzw, r0.xyzw, gFlowParams.zzww
r0.xy = r0.xy + r0.zw; //add r0.xy, r0.zwzz, r0.xyxx
r0.zw = r0.xy * RippleBumpiness;//mul r0.zw, r0.xxxy, RippleBumpiness
//r0.x = sqrt(dot(r0.xy, r0.xy)); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x
//r0.x = r0.x * 0.27 + 0.44; //mad r0.x, r0.x, l(0.270000), l(0.440000)
r1.xy = r0.zw * v2w + norm.xy; //mad r1.xy, r0.zwzz, v2.wwww, v4.xyxx
r1.z = norm.z; //mov r1.z, v4.z
//return normalize(r1.xyz);
r0.y = dot(r1.xyz, r1.xyz); //dp3 r0.y, r1.xyzx, r1.xyzx
r0.y = 1.0 / sqrt(r0.y); //rsq r0.y, r0.y
r2.xyz = -r1.xyz * r0.y + float3(0, 0, 1); //mad r2.xyz, -r1.xyzx, r0.yyyy, l(0.000000, 0.000000, 1.000000, 0.000000)
r0.yzw = r1.xyz * r0.y; //mul r0.yzw, r0.yyyy, r1.xxyz
//r1.xyz = r2.xyz * 0.833333 + r0.yzw; //mad r1.xyz, r2.xyzx, l(0.833333, 0.833333, 0.833333, 0.000000), r0.yzwy
//r2.xyz = worldpos - //add r2.xyz, v2.xyzx, -gViewInverse[3].xyzx
return r0.yzw;
//return r0.wzy;
////return float3(r0.w, r0.z, r0.y);
////return normalize(input.Normal);
}
float4 main(VS_OUTPUT input) : SV_TARGET float4 main(VS_OUTPUT input) : SV_TARGET

View File

@ -0,0 +1,133 @@
#include "Shadowmap.hlsli"
Texture2D<float4> Colourmap : register(t0);
Texture2D<float4> Bumpmap : register(t2);
Texture2D<float4> Foammap : register(t3);
Texture2D<float4> WaterBumpSampler : register(t4); // graphics.ytd, waterbump and waterbump2
Texture2D<float4> WaterBumpSampler2 : register(t5);
Texture2D<float4> WaterFog : register(t6);
SamplerState TextureSS : register(s0);
cbuffer PSSceneVars : register(b0)
{
ShaderGlobalLightParams GlobalLights;
uint EnableShadows;
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
uint RenderModeIndex;
uint RenderSamplerCoord;
uint EnableWaterbumps; //if the waterbump textures are ready..
uint EnableFogtex; //if the fog texture is ready
uint ScnPad1;
uint ScnPad2;
float4 gFlowParams;
float4 CameraPos;
float4 WaterFogParams; //xy = base location, zw = inverse size
}
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;
uint EnableBumpMap;
uint EnableFoamMap;
uint ShaderMode;
float SpecularIntensity;
float SpecularFalloff;
float GeoPad1;
float GeoPad2;
float WaveOffset; //for terrainfoam
float WaterHeight; //for terrainfoam
float WaveMovement; //for terrainfoam
float HeightOpacity; //for terrainfoam
float RippleSpeed;
float RippleScale;
float RippleBumpiness;
float GeoPad3;
}
struct VS_OUTPUT
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float4 Flow : TEXCOORD1;
float4 Shadows : TEXCOORD3;
float4 LightShadow : TEXCOORD4;
float4 Colour0 : COLOR0;
float4 Tangent : TEXCOORD5;
float4 Bitangent : TEXCOORD6;
float3 CamRelPos : TEXCOORD7;
};
struct PS_OUTPUT
{
float4 Diffuse : SV_Target0;
float4 Normal : SV_Target1;
float4 Specular : SV_Target2;
float4 Irradiance : SV_Target3;
};
float3 RippleNormal(VS_OUTPUT input, float3 worldpos)
{
////
//// Input signature:
////
//// Name Index Mask Register SysValue Format Used
//// -------------------- ----- ------ -------- -------- ------- ------
//// SV_Position 0 xyzw 0 POS float
//// TEXCOORD 0 xyzw 1 NONE float xyzw
//// TEXCOORD 1 xyzw 2 NONE float xyzw
//// TEXCOORD 2 xyzw 3 NONE float zw
//// TEXCOORD 3 xyzw 4 NONE float xyzw //NORMAL +half
//// TEXCOORD 4 xyzw 5 NONE float zw //FLOW
////
//
float3 norm = input.Normal.xyz;
float v2w = input.Colour0.r; //vertex red channel
float4 r0, r1, r2, r3, r4;
r0.xy = input.Flow.zw * RippleSpeed; //mul r0.xy, v5.zwzz, RippleSpeed
r1 = -r0.xyxy * gFlowParams.xxyy + worldpos.xyxy; //mad r1.xyzw, -r0.xyxy, gFlowParams.xxyy, v2.xyxy
r0.x = min(sqrt(dot(r0.xy, r0.xy)), 1.0); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x //min r0.x, r0.x, l(1.000000)
r0.yz = r1.xy * RippleScale; //mul r0.yz, r1.xxyx, RippleScale
r1.xy = r1.zw * RippleScale + 0.5; //mad r1.xy, r1.zwzz, RippleScale, l(0.500000, 0.500000, 0.000000, 0.000000)
r1.xy = r1.xy * 2.3; //mul r1.xy, r1.xyxx, l(2.300000, 2.300000, 0.000000, 0.000000)
r0.yz = r0.yz * 2.3; //mul r0.yz, r0.yyzy, l(0.000000, 2.300000, 2.300000, 0.000000)
r2 = WaterBumpSampler2.Sample(TextureSS, r0.yz); //sample r2.xyzw, r0.yzyy, WaterBumpSampler2.xyzw, s14
r3 = WaterBumpSampler.Sample(TextureSS, r0.yz); //sample r3.xyzw, r0.yzyy, WaterBumpSampler.xyzw, s10
r4 = WaterBumpSampler2.Sample(TextureSS, r1.xy); //sample r4.xyzw, r1.xyxx, WaterBumpSampler2.xyzw, s14
r1 = WaterBumpSampler.Sample(TextureSS, r1.xy); //sample r1.xyzw, r1.xyxx, WaterBumpSampler.xyzw, s10
r3.zw = r1.xy; //mov r3.zw, r1.xxxy
r2.zw = r4.xy; //mov r2.zw, r4.xxxy
r1 = r2 + r3; //add r1.xyzw, r2.xyzw, r3.xyzw
r2 = r3 + 0.5; //add r2.xyzw, r3.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
r1 = r1 - r2; //add r1.xyzw, r1.xyzw, -r2.xyzw
r0 = r1 * r0.x + r2; //mad r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
r0 = r0 * 2 - 2; //mad r0.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-2.000000, -2.000000, -2.000000, -2.000000)
r0 = r0 * gFlowParams.zzww; //mul r0.xyzw, r0.xyzw, gFlowParams.zzww
r0.xy = r0.xy + r0.zw; //add r0.xy, r0.zwzz, r0.xyxx
r0.zw = r0.xy * RippleBumpiness; //mul r0.zw, r0.xxxy, RippleBumpiness
//r0.x = sqrt(dot(r0.xy, r0.xy)); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x
//r0.x = r0.x * 0.27 + 0.44; //mad r0.x, r0.x, l(0.270000), l(0.440000)
r1.xy = r0.zw * v2w + norm.xy; //mad r1.xy, r0.zwzz, v2.wwww, v4.xyxx
r1.z = norm.z; //mov r1.z, v4.z
//return normalize(r1.xyz);
r0.y = dot(r1.xyz, r1.xyz); //dp3 r0.y, r1.xyzx, r1.xyzx
r0.y = 1.0 / sqrt(r0.y); //rsq r0.y, r0.y
r2.xyz = -r1.xyz * r0.y + float3(0, 0, 1); //mad r2.xyz, -r1.xyzx, r0.yyyy, l(0.000000, 0.000000, 1.000000, 0.000000)
r0.yzw = r1.xyz * r0.y; //mul r0.yzw, r0.yyyy, r1.xxyz
//r1.xyz = r2.xyz * 0.833333 + r0.yzw; //mad r1.xyz, r2.xyzx, l(0.833333, 0.833333, 0.833333, 0.000000), r0.yzwy
//r2.xyz = worldpos - //add r2.xyz, v2.xyzx, -gViewInverse[3].xyzx
return r0.yzw;
//return r0.wzy;
////return float3(r0.w, r0.z, r0.y);
////return normalize(input.Normal);
}

View File

@ -0,0 +1,105 @@
#include "WaterPS.hlsli"
PS_OUTPUT main(VS_OUTPUT input)
{
float4 c = float4(0.1, 0.18, 0.25, 0.8);
//if (RenderMode == 0) c = float4(1, 1, 1, 1);
//c.a *= input.Colour0.a;
float3 camrel = input.CamRelPos;
float3 worldpos = camrel + CameraPos.xyz;
if ((EnableFoamMap == 0) && (EnableFogtex == 1))
{
float2 fogtc = saturate((worldpos.xy - WaterFogParams.xy) * WaterFogParams.zw);
fogtc.y = 1.0 - fogtc.y;
c = WaterFog.Sample(TextureSS, fogtc);
c.a = 0.9;
}
float3 norm = EnableFoamMap ? normalize(input.Normal) : RippleNormal(input, worldpos); // normalize(input.Normal);
if (RenderMode == 1) //normals
{
c.rgb = norm * 0.5 + 0.5;
}
else if (RenderMode == 2) //tangents
{
c.rgb = normalize(input.Tangent.rgb) * 0.5 + 0.5;
}
else if (RenderMode == 3) //colours
{
c.rgb = input.Colour0.rgb;
}
else if (RenderMode == 4) //texcoords
{
c.rgb = float3(input.Texcoord0, 0);
}
else if ((RenderMode == 8) || (EnableTexture == 1)) //single texture or diffuse enabled
{
c.rgb = Colourmap.Sample(TextureSS, input.Texcoord0).rgb;
}
else if (EnableFoamMap)
{
c = Foammap.Sample(TextureSS, input.Texcoord0);
}
float3 spec = 0;
if (RenderMode == 0)
{
float4 nv = Bumpmap.Sample(TextureSS, input.Texcoord0); //sample r1.xyzw, v2.xyxx, t3.xyzw, s3 (BumpSampler)
float2 nmv = nv.xy;
float4 r0 = 0, r1, r2, r3;
float bumpiness = 0.5;
if (EnableBumpMap)
{
norm = NormalMap(nmv, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
}
float3 tc = c.rgb;
c.rgb = tc; // *r0.z; //diffuse factors...
spec.xy = sqrt(10.0 * SpecularIntensity);
spec.z = 1;//r0.z;
if (ShaderMode == 1) //river foam
{
c.a *= input.Colour0.g;
}
else if (ShaderMode == 2) //terrain foam
{
c.a *= c.r;
c.a *= input.Colour0.r;
}
else
{
///c.a = 1;
}
}
c.a = saturate(c.a);
PS_OUTPUT output;
output.Diffuse = c;
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
output.Specular = float4(spec, c.a);
output.Irradiance = float4(1, 0, 0, c.a);
return output;
}

View File

@ -137,6 +137,8 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Rendering\Shaders\DeferredScene.cs" />
<Compile Include="Rendering\Utils\UnitCone.cs" />
<Compile Include="Tools\AboutForm.cs"> <Compile Include="Tools\AboutForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -214,6 +214,9 @@ namespace CodeWalker.Forms
camera.TargetRotation.X = 0.5f * (float)Math.PI; camera.TargetRotation.X = 0.5f * (float)Math.PI;
camera.CurrentRotation.X = 0.5f * (float)Math.PI; camera.CurrentRotation.X = 0.5f * (float)Math.PI;
Renderer.shaders.deferred = false; //no point using this here yet
LoadSettings(); LoadSettings();

View File

@ -181,6 +181,8 @@ namespace CodeWalker.Peds
camera.TargetRotation.X = 1.0f * (float)Math.PI; camera.TargetRotation.X = 1.0f * (float)Math.PI;
camera.CurrentRotation.X = 1.0f * (float)Math.PI; camera.CurrentRotation.X = 1.0f * (float)Math.PI;
Renderer.shaders.deferred = false; //no point using this here yet
LoadSettings(); LoadSettings();

View File

@ -195,8 +195,8 @@ namespace CodeWalker.Project.Panels
Vector3 lpos = new Vector3(la.PositionX, la.PositionY, la.PositionZ); Vector3 lpos = la.Position;
Vector3 ldir = new Vector3(la.DirectionX, la.DirectionY, la.DirectionZ); Vector3 ldir = la.Direction;
Vector3 bpos = xform.Multiply(lpos); Vector3 bpos = xform.Multiply(lpos);
Vector3 bdir = xform.MultiplyRot(ldir); Vector3 bdir = xform.MultiplyRot(ldir);
Vector3 epos = ent.Orientation.Multiply(bpos) + ent.Position; Vector3 epos = ent.Orientation.Multiply(bpos) + ent.Position;
@ -229,11 +229,11 @@ namespace CodeWalker.Project.Panels
//1 = point //1 = point
//2 = spot //2 = spot
//4 = capsule //4 = capsule
uint type = la.Type; uint type = (uint)la.Type;
uint unk = isStreetLight ? 1u : 0;//2 bits - isStreetLight low bit, unk high bit uint unk = isStreetLight ? 1u : 0;//2 bits - isStreetLight low bit, unk high bit
uint t = la.TimeFlags | (type << 26) | (unk << 24); uint t = la.TimeFlags | (type << 26) | (unk << 24);
var maxext = (byte)Math.Max(Math.Max(la.ExtentX, la.ExtentY), la.ExtentZ); var maxext = (byte)Math.Max(Math.Max(la.Extent.X, la.Extent.Y), la.Extent.Z);

View File

@ -734,5 +734,17 @@ namespace CodeWalker.Properties {
this["ExplorerWindowTheme"] = value; this["ExplorerWindowTheme"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Deferred {
get {
return ((bool)(this["Deferred"]));
}
set {
this["Deferred"] = value;
}
}
} }
} }

View File

@ -192,5 +192,8 @@
<Setting Name="ExplorerWindowTheme" Type="System.String" Scope="User"> <Setting Name="ExplorerWindowTheme" Type="System.String" Scope="User">
<Value Profile="(Default)">Windows</Value> <Value Profile="(Default)">Windows</Value>
</Setting> </Setting>
<Setting Name="Deferred" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -1355,6 +1355,136 @@ namespace CodeWalker.Rendering
} }
} }
public class RenderableLODLights : RenderableCacheItem<YmapFile>
{
public struct LODLight
{
public Vector3 Position;
public uint Colour;
public Vector3 Direction;
public uint TimeAndStateFlags;
public Vector4 TangentX;
public Vector4 TangentY;
public float Falloff;
public float FalloffExponent;
public float InnerAngle;//for cone
public float OuterAngleOrCapExt;//outer angle for cone, cap extent for capsule
}
public LODLight[] Points;
public LODLight[] Spots;
public LODLight[] Caps;
public GpuSBuffer<LODLight> PointsBuffer { get; set; }
public GpuSBuffer<LODLight> SpotsBuffer { get; set; }
public GpuSBuffer<LODLight> CapsBuffer { get; set; }
public override void Init(YmapFile key)
{
Key = key;
var ll = key.LODLights;
var dll = key.Parent?.DistantLODLights;
if (ll == null) return;
if (dll == null) return;
var n = dll.positions?.Length ?? 0;
n = Math.Min(n, dll.colours?.Length ?? 0);
n = Math.Min(n, ll.direction?.Length ?? 0);
n = Math.Min(n, ll.falloff?.Length ?? 0);
n = Math.Min(n, ll.falloffExponent?.Length ?? 0);
n = Math.Min(n, ll.timeAndStateFlags?.Length ?? 0);
n = Math.Min(n, ll.hash?.Length ?? 0);
n = Math.Min(n, ll.coneInnerAngle?.Length ?? 0);
n = Math.Min(n, ll.coneOuterAngleOrCapExt?.Length ?? 0);
n = Math.Min(n, ll.coronaIntensity?.Length ?? 0);
if (n <= 0)
{ return; }
var points = new List<LODLight>();
var spots = new List<LODLight>();
var caps = new List<LODLight>();
for (int i = 0; i < n; i++)
{
var light = new LODLight();
light.Position = dll.positions[i].ToVector3();
light.Colour = dll.colours[i];
light.Direction = ll.direction[i].ToVector3();
light.TimeAndStateFlags = ll.timeAndStateFlags[i];
light.TangentX = new Vector4(Vector3.Normalize(light.Direction.GetPerpVec()), 0.0f);
light.TangentY = new Vector4(Vector3.Cross(light.Direction, light.TangentX.XYZ()), 0.0f);
light.Falloff = ll.falloff[i];
light.FalloffExponent = ll.falloffExponent[i];
light.InnerAngle = ll.coneInnerAngle[i];
light.OuterAngleOrCapExt = ll.coneOuterAngleOrCapExt[i];
var type = (LightType)((light.TimeAndStateFlags >> 26) & 7);
switch (type)
{
case LightType.Point:
points.Add(light);
break;
case LightType.Spot:
spots.Add(light);
break;
case LightType.Capsule:
caps.Add(light);
break;
default: break;//just checking...
}
}
Points = points.ToArray();
Spots = spots.ToArray();
Caps = caps.ToArray();
}
public override void Load(Device device)
{
if ((Points != null) && (Points.Length > 0))
{
PointsBuffer = new GpuSBuffer<LODLight>(device, Points);
}
if ((Spots != null) && (Spots.Length > 0))
{
SpotsBuffer = new GpuSBuffer<LODLight>(device, Spots);
}
if ((Caps != null) && (Caps.Length > 0))
{
CapsBuffer = new GpuSBuffer<LODLight>(device, Caps);
}
IsLoaded = true;
}
public override void Unload()
{
IsLoaded = false;
if (PointsBuffer != null)
{
PointsBuffer.Dispose();
PointsBuffer = null;
}
if (SpotsBuffer != null)
{
SpotsBuffer.Dispose();
SpotsBuffer = null;
}
if (CapsBuffer != null)
{
CapsBuffer.Dispose();
CapsBuffer = null;
}
}
}
public class RenderableDistantLODLights : RenderableCacheItem<YmapDistantLODLights> public class RenderableDistantLODLights : RenderableCacheItem<YmapDistantLODLights>
{ {
public struct DistLODLight public struct DistLODLight
@ -1815,7 +1945,7 @@ namespace CodeWalker.Rendering
p2 = bgeom.GetVertex(bcap.capsuleIndex2); p2 = bgeom.GetVertex(bcap.capsuleIndex2);
a1 = p2 - p1; a1 = p2 - p1;
n1 = Vector3.Normalize(a1); n1 = Vector3.Normalize(a1);
p3 = Vector3.Normalize(GetPerpVec(n1)); p3 = Vector3.Normalize(n1.GetPerpVec());
//p4 = Vector3.Normalize(Vector3.Cross(n1, p3)); //p4 = Vector3.Normalize(Vector3.Cross(n1, p3));
Quaternion q1 = Quaternion.Invert(Quaternion.LookAtRH(Vector3.Zero, p3, n1)); Quaternion q1 = Quaternion.Invert(Quaternion.LookAtRH(Vector3.Zero, p3, n1));
rcapsules[curcapsule].Point1 = p1; rcapsules[curcapsule].Point1 = p1;
@ -1848,7 +1978,7 @@ namespace CodeWalker.Rendering
p2 = bgeom.GetVertex(pcyl.cylinderIndex2); p2 = bgeom.GetVertex(pcyl.cylinderIndex2);
a1 = p2 - p1; a1 = p2 - p1;
n1 = Vector3.Normalize(a1); n1 = Vector3.Normalize(a1);
p3 = Vector3.Normalize(GetPerpVec(n1)); p3 = Vector3.Normalize(n1.GetPerpVec());
//p4 = Vector3.Normalize(Vector3.Cross(n1, p3)); //p4 = Vector3.Normalize(Vector3.Cross(n1, p3));
Quaternion q2 = Quaternion.Invert(Quaternion.LookAtRH(Vector3.Zero, p3, n1)); Quaternion q2 = Quaternion.Invert(Quaternion.LookAtRH(Vector3.Zero, p3, n1));
rcylinders[curcylinder].Point1 = p1; rcylinders[curcylinder].Point1 = p1;
@ -1898,26 +2028,6 @@ namespace CodeWalker.Rendering
index++; index++;
} }
private Vector3 GetPerpVec(Vector3 n)
{
//make a vector perpendicular to the given one
float nx = Math.Abs(n.X);
float ny = Math.Abs(n.Y);
float nz = Math.Abs(n.Z);
if ((nx < ny) && (nx < nz))
{
return Vector3.Cross(n, Vector3.Right);
}
else if (ny < nz)
{
return Vector3.Cross(n, Vector3.Up);
}
else
{
return Vector3.Cross(n, Vector3.ForwardLH);
}
}
public void Load(Device device) public void Load(Device device)
{ {

View File

@ -30,6 +30,7 @@ namespace CodeWalker.Rendering
+ textures.CacheUse + textures.CacheUse
+ boundcomps.CacheUse + boundcomps.CacheUse
+ instbatches.CacheUse + instbatches.CacheUse
+ lodlights.CacheUse
+ distlodlights.CacheUse + distlodlights.CacheUse
+ pathbatches.CacheUse + pathbatches.CacheUse
+ waterquads.CacheUse; + waterquads.CacheUse;
@ -43,6 +44,7 @@ namespace CodeWalker.Rendering
+ textures.CurrentLoadedCount + textures.CurrentLoadedCount
+ boundcomps.CurrentLoadedCount + boundcomps.CurrentLoadedCount
+ instbatches.CurrentLoadedCount + instbatches.CurrentLoadedCount
+ lodlights.CurrentLoadedCount
+ distlodlights.CurrentLoadedCount + distlodlights.CurrentLoadedCount
+ pathbatches.CurrentLoadedCount + pathbatches.CurrentLoadedCount
+ waterquads.CurrentLoadedCount; + waterquads.CurrentLoadedCount;
@ -56,6 +58,7 @@ namespace CodeWalker.Rendering
+ textures.QueueLength + textures.QueueLength
+ boundcomps.QueueLength + boundcomps.QueueLength
+ instbatches.QueueLength + instbatches.QueueLength
+ lodlights.QueueLength
+ distlodlights.QueueLength + distlodlights.QueueLength
+ pathbatches.QueueLength + pathbatches.QueueLength
+ waterquads.QueueLength; + waterquads.QueueLength;
@ -95,6 +98,7 @@ namespace CodeWalker.Rendering
private RenderableCacheLookup<Texture, RenderableTexture> textures = new RenderableCacheLookup<Texture, RenderableTexture>(Settings.Default.GPUTextureCacheSize, Settings.Default.GPUCacheTime); private RenderableCacheLookup<Texture, RenderableTexture> textures = new RenderableCacheLookup<Texture, RenderableTexture>(Settings.Default.GPUTextureCacheSize, Settings.Default.GPUCacheTime);
private RenderableCacheLookup<BoundComposite, RenderableBoundComposite> boundcomps = new RenderableCacheLookup<BoundComposite, RenderableBoundComposite>(Settings.Default.GPUBoundCompCacheSize, Settings.Default.GPUCacheTime); private RenderableCacheLookup<BoundComposite, RenderableBoundComposite> boundcomps = new RenderableCacheLookup<BoundComposite, RenderableBoundComposite>(Settings.Default.GPUBoundCompCacheSize, Settings.Default.GPUCacheTime);
private RenderableCacheLookup<YmapGrassInstanceBatch, RenderableInstanceBatch> instbatches = new RenderableCacheLookup<YmapGrassInstanceBatch, RenderableInstanceBatch>(67108864, Settings.Default.GPUCacheTime); //64MB - todo: make this a setting private RenderableCacheLookup<YmapGrassInstanceBatch, RenderableInstanceBatch> instbatches = new RenderableCacheLookup<YmapGrassInstanceBatch, RenderableInstanceBatch>(67108864, Settings.Default.GPUCacheTime); //64MB - todo: make this a setting
private RenderableCacheLookup<YmapFile, RenderableLODLights> lodlights = new RenderableCacheLookup<YmapFile, RenderableLODLights>(33554432, Settings.Default.GPUCacheTime); //32MB - todo: make this a setting
private RenderableCacheLookup<YmapDistantLODLights, RenderableDistantLODLights> distlodlights = new RenderableCacheLookup<YmapDistantLODLights, RenderableDistantLODLights>(33554432, Settings.Default.GPUCacheTime); //32MB - todo: make this a setting private RenderableCacheLookup<YmapDistantLODLights, RenderableDistantLODLights> distlodlights = new RenderableCacheLookup<YmapDistantLODLights, RenderableDistantLODLights>(33554432, Settings.Default.GPUCacheTime); //32MB - todo: make this a setting
private RenderableCacheLookup<BasePathData, RenderablePathBatch> pathbatches = new RenderableCacheLookup<BasePathData, RenderablePathBatch>(536870912 /*33554432*/, Settings.Default.GPUCacheTime); // 512MB /*32MB*/ - todo: make this a setting private RenderableCacheLookup<BasePathData, RenderablePathBatch> pathbatches = new RenderableCacheLookup<BasePathData, RenderablePathBatch>(536870912 /*33554432*/, Settings.Default.GPUCacheTime); // 512MB /*32MB*/ - todo: make this a setting
private RenderableCacheLookup<WaterQuad, RenderableWaterQuad> waterquads = new RenderableCacheLookup<WaterQuad, RenderableWaterQuad>(4194304, Settings.Default.GPUCacheTime); //4MB - todo: make this a setting private RenderableCacheLookup<WaterQuad, RenderableWaterQuad> waterquads = new RenderableCacheLookup<WaterQuad, RenderableWaterQuad>(4194304, Settings.Default.GPUCacheTime); //4MB - todo: make this a setting
@ -117,6 +121,7 @@ namespace CodeWalker.Rendering
textures.Clear(); textures.Clear();
boundcomps.Clear(); boundcomps.Clear();
instbatches.Clear(); instbatches.Clear();
lodlights.Clear();
distlodlights.Clear(); distlodlights.Clear();
pathbatches.Clear(); pathbatches.Clear();
waterquads.Clear(); waterquads.Clear();
@ -134,6 +139,7 @@ namespace CodeWalker.Rendering
int texturecount = textures.LoadProc(currentDevice, MaxItemsPerLoop); int texturecount = textures.LoadProc(currentDevice, MaxItemsPerLoop);
int boundcompcount = boundcomps.LoadProc(currentDevice, MaxItemsPerLoop); int boundcompcount = boundcomps.LoadProc(currentDevice, MaxItemsPerLoop);
int instbatchcount = instbatches.LoadProc(currentDevice, MaxItemsPerLoop); int instbatchcount = instbatches.LoadProc(currentDevice, MaxItemsPerLoop);
int lodlightcount = lodlights.LoadProc(currentDevice, MaxItemsPerLoop);
int distlodlightcount = distlodlights.LoadProc(currentDevice, MaxItemsPerLoop); int distlodlightcount = distlodlights.LoadProc(currentDevice, MaxItemsPerLoop);
int pathbatchcount = pathbatches.LoadProc(currentDevice, MaxItemsPerLoop); int pathbatchcount = pathbatches.LoadProc(currentDevice, MaxItemsPerLoop);
int waterquadcount = waterquads.LoadProc(currentDevice, MaxItemsPerLoop); int waterquadcount = waterquads.LoadProc(currentDevice, MaxItemsPerLoop);
@ -144,6 +150,7 @@ namespace CodeWalker.Rendering
(texturecount >= MaxItemsPerLoop) || (texturecount >= MaxItemsPerLoop) ||
(boundcompcount >= MaxItemsPerLoop) || (boundcompcount >= MaxItemsPerLoop) ||
(instbatchcount >= MaxItemsPerLoop) || (instbatchcount >= MaxItemsPerLoop) ||
(lodlightcount >= MaxItemsPerLoop) ||
(distlodlightcount >= MaxItemsPerLoop) || (distlodlightcount >= MaxItemsPerLoop) ||
(pathbatchcount >= MaxItemsPerLoop) || (pathbatchcount >= MaxItemsPerLoop) ||
(waterquadcount >= MaxItemsPerLoop); (waterquadcount >= MaxItemsPerLoop);
@ -161,6 +168,7 @@ namespace CodeWalker.Rendering
textures.UnloadProc(); textures.UnloadProc();
boundcomps.UnloadProc(); boundcomps.UnloadProc();
instbatches.UnloadProc(); instbatches.UnloadProc();
lodlights.UnloadProc();
distlodlights.UnloadProc(); distlodlights.UnloadProc();
pathbatches.UnloadProc(); pathbatches.UnloadProc();
waterquads.UnloadProc(); waterquads.UnloadProc();
@ -182,6 +190,7 @@ namespace CodeWalker.Rendering
textures.RenderThreadSync(); textures.RenderThreadSync();
boundcomps.RenderThreadSync(); boundcomps.RenderThreadSync();
instbatches.RenderThreadSync(); instbatches.RenderThreadSync();
lodlights.RenderThreadSync();
distlodlights.RenderThreadSync(); distlodlights.RenderThreadSync();
pathbatches.RenderThreadSync(); pathbatches.RenderThreadSync();
waterquads.RenderThreadSync(); waterquads.RenderThreadSync();
@ -207,6 +216,10 @@ namespace CodeWalker.Rendering
{ {
return distlodlights.Get(lights); return distlodlights.Get(lights);
} }
public RenderableLODLights GetRenderableLODLights(YmapFile ymap)
{
return lodlights.Get(ymap);
}
public RenderablePathBatch GetRenderablePathBatch(BasePathData pathdata) public RenderablePathBatch GetRenderablePathBatch(BasePathData pathdata)
{ {
return pathbatches.Get(pathdata); return pathbatches.Get(pathdata);

View File

@ -102,7 +102,9 @@ namespace CodeWalker.Rendering
public bool renderchildents = false;//when rendering single ymap, render root only or not... public bool renderchildents = false;//when rendering single ymap, render root only or not...
public bool renderentities = true; public bool renderentities = true;
public bool rendergrass = true; public bool rendergrass = true;
public bool renderdistlodlights = true; public bool renderlights = false; //render individual drawable lights (TODO!)
public bool renderlodlights = true; //render LOD lights from ymaps
public bool renderdistlodlights = true; //render distant lod lights (coronas)
public bool rendercars = false; public bool rendercars = false;
public bool rendercollisionmeshes = Settings.Default.ShowCollisionMeshes; public bool rendercollisionmeshes = Settings.Default.ShowCollisionMeshes;
@ -1575,10 +1577,14 @@ namespace CodeWalker.Rendering
for (int y = 0; y < VisibleYmaps.Count; y++) for (int y = 0; y < VisibleYmaps.Count; y++)
{ {
var ymap = VisibleYmaps[y]; var ymap = VisibleYmaps[y];
YmapFile pymap = ymap.Parent;
if ((pymap == null) && (ymap._CMapData.parent != 0))
{
renderworldVisibleYmapDict.TryGetValue(ymap._CMapData.parent, out pymap);
ymap.Parent = pymap;
}
if (ymap.RootEntities != null) if (ymap.RootEntities != null)
{ {
YmapFile pymap;
renderworldVisibleYmapDict.TryGetValue(ymap._CMapData.parent, out pymap);
for (int i = 0; i < ymap.RootEntities.Length; i++) for (int i = 0; i < ymap.RootEntities.Length; i++)
{ {
var ent = ymap.RootEntities[i]; var ent = ymap.RootEntities[i];
@ -1699,6 +1705,17 @@ namespace CodeWalker.Rendering
} }
} }
} }
if (renderlodlights && shaders.deferred)
{
for (int y = 0; y < VisibleYmaps.Count; y++)
{
var ymap = VisibleYmaps[y];
if (ymap.LODLights != null)
{
RenderYmapLODLights(ymap);
}
}
}
} }
private bool RenderWorldYmapIsVisible(YmapFile ymap) private bool RenderWorldYmapIsVisible(YmapFile ymap)
{ {
@ -2185,6 +2202,20 @@ namespace CodeWalker.Rendering
} }
private void RenderYmapLODLights(YmapFile ymap)
{
if (ymap.LODLights == null) return;
if (ymap.Parent?.DistantLODLights == null) return; //need to get lodlights positions from parent (distlodlights)
RenderableLODLights lights = renderableCache.GetRenderableLODLights(ymap);
if (!lights.IsLoaded) return;
shaders.Enqueue(lights);
}
private void RenderYmapDistantLODLights(YmapFile ymap) private void RenderYmapDistantLODLights(YmapFile ymap)
{ {
//enqueue ymap DistantLODLights instance batch for rendering //enqueue ymap DistantLODLights instance batch for rendering
@ -2211,7 +2242,7 @@ namespace CodeWalker.Rendering
Texture lighttex = null; Texture lighttex = null;
if ((graphicsytd != null) && (graphicsytd.Loaded) && (graphicsytd.TextureDict != null) && (graphicsytd.TextureDict.Dict != null)) if ((graphicsytd != null) && (graphicsytd.Loaded) && (graphicsytd.TextureDict != null) && (graphicsytd.TextureDict.Dict != null))
{ {
graphicsytd.TextureDict.Dict.TryGetValue(texhash, out lighttex); //starfield hash graphicsytd.TextureDict.Dict.TryGetValue(texhash, out lighttex);
} }
if (lighttex == null) return; if (lighttex == null) return;

View File

@ -32,9 +32,11 @@ namespace CodeWalker.Rendering
DepthStencilState dsDisableAll; DepthStencilState dsDisableAll;
DepthStencilState dsDisableComp; DepthStencilState dsDisableComp;
DepthStencilState dsDisableWrite; DepthStencilState dsDisableWrite;
DepthStencilState dsDisableWriteRev;
public DeferredScene DefScene { get; set; }
public PostProcessor HDR { get; set; } public PostProcessor HDR { get; set; }
public BasicShader Basic { get; set; } public BasicShader Basic { get; set; }
public CableShader Cable { get; set; } public CableShader Cable { get; set; }
@ -57,6 +59,7 @@ namespace CodeWalker.Rendering
List<ShaderBatch> shadowbatches = new List<ShaderBatch>(); List<ShaderBatch> shadowbatches = new List<ShaderBatch>();
int shadowcastercount = 0; //total casters rendered int shadowcastercount = 0; //total casters rendered
public bool deferred = Settings.Default.Deferred;
public bool hdr = Settings.Default.HDR; public bool hdr = Settings.Default.HDR;
public float hdrLumBlendSpeed = 1.0f; public float hdrLumBlendSpeed = 1.0f;
int Width; int Width;
@ -68,6 +71,7 @@ namespace CodeWalker.Rendering
public List<ShaderRenderBucket> RenderBuckets = new List<ShaderRenderBucket>(); public List<ShaderRenderBucket> RenderBuckets = new List<ShaderRenderBucket>();
public List<RenderableBoundGeometryInst> RenderBoundGeoms = new List<RenderableBoundGeometryInst>(); public List<RenderableBoundGeometryInst> RenderBoundGeoms = new List<RenderableBoundGeometryInst>();
public List<RenderableInstanceBatchInst> RenderInstBatches = new List<RenderableInstanceBatchInst>(); public List<RenderableInstanceBatchInst> RenderInstBatches = new List<RenderableInstanceBatchInst>();
public List<RenderableLODLights> RenderLODLights = new List<RenderableLODLights>();
public List<RenderableDistantLODLights> RenderDistLODLights = new List<RenderableDistantLODLights>(); public List<RenderableDistantLODLights> RenderDistLODLights = new List<RenderableDistantLODLights>();
public List<RenderablePathBatch> RenderPathBatches = new List<RenderablePathBatch>(); public List<RenderablePathBatch> RenderPathBatches = new List<RenderablePathBatch>();
public List<RenderableWaterQuad> RenderWaterQuads = new List<RenderableWaterQuad>(); public List<RenderableWaterQuad> RenderWaterQuads = new List<RenderableWaterQuad>();
@ -94,6 +98,10 @@ namespace CodeWalker.Rendering
get get
{ {
long u = 0; long u = 0;
if (DefScene != null)
{
u += DefScene.VramUsage;
}
if (HDR != null) if (HDR != null)
{ {
u += HDR.VramUsage; u += HDR.VramUsage;
@ -163,6 +171,9 @@ namespace CodeWalker.Rendering
bsd.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All; bsd.RenderTarget[0].RenderTargetWriteMask = ColorWriteMaskFlags.All;
bsd.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero; bsd.RenderTarget[0].SourceAlphaBlend = BlendOption.Zero;
bsd.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha; bsd.RenderTarget[0].SourceBlend = BlendOption.SourceAlpha;
bsd.RenderTarget[1] = bsd.RenderTarget[0];
bsd.RenderTarget[2] = bsd.RenderTarget[0];
bsd.RenderTarget[3] = bsd.RenderTarget[0];
bsDefault = new BlendState(device, bsd); bsDefault = new BlendState(device, bsd);
bsd.AlphaToCoverageEnable = true; bsd.AlphaToCoverageEnable = true;
@ -198,6 +209,8 @@ namespace CodeWalker.Rendering
dsEnabled = new DepthStencilState(device, dsd); dsEnabled = new DepthStencilState(device, dsd);
dsd.DepthWriteMask = DepthWriteMask.Zero; dsd.DepthWriteMask = DepthWriteMask.Zero;
dsDisableWrite = new DepthStencilState(device, dsd); dsDisableWrite = new DepthStencilState(device, dsd);
dsd.DepthComparison = Comparison.LessEqual;
dsDisableWriteRev = new DepthStencilState(device, dsd);
dsd.DepthComparison = Comparison.Always; dsd.DepthComparison = Comparison.Always;
dsDisableComp = new DepthStencilState(device, dsd); dsDisableComp = new DepthStencilState(device, dsd);
dsd.IsDepthEnabled = false; dsd.IsDepthEnabled = false;
@ -212,6 +225,7 @@ namespace CodeWalker.Rendering
disposed = true; disposed = true;
dsEnabled.Dispose(); dsEnabled.Dispose();
dsDisableWriteRev.Dispose();
dsDisableWrite.Dispose(); dsDisableWrite.Dispose();
dsDisableComp.Dispose(); dsDisableComp.Dispose();
dsDisableAll.Dispose(); dsDisableAll.Dispose();
@ -235,6 +249,13 @@ namespace CodeWalker.Rendering
Cable.Dispose(); Cable.Dispose();
Water.Dispose(); Water.Dispose();
if (DefScene != null)
{
DefScene.Dispose();
DefScene = null;
}
if (HDR != null) if (HDR != null)
{ {
HDR.Dispose(); HDR.Dispose();
@ -286,6 +307,16 @@ namespace CodeWalker.Rendering
HDR.Dispose(); HDR.Dispose();
HDR = null; HDR = null;
} }
if (deferred && (DefScene == null))
{
DefScene = new DeferredScene(DXMan);
DefScene.OnWindowResize(DXMan);
}
if (!deferred && (DefScene != null))
{
DefScene.Dispose();
DefScene = null;
}
foreach (var bucket in RenderBuckets) foreach (var bucket in RenderBuckets)
@ -295,10 +326,16 @@ namespace CodeWalker.Rendering
RenderBoundGeoms.Clear(); RenderBoundGeoms.Clear();
RenderInstBatches.Clear(); RenderInstBatches.Clear();
RenderLODLights.Clear();
RenderDistLODLights.Clear(); RenderDistLODLights.Clear();
RenderPathBatches.Clear(); RenderPathBatches.Clear();
RenderWaterQuads.Clear(); RenderWaterQuads.Clear();
if (DefScene != null)
{
DefScene.Clear(context);
}
if (HDR != null) if (HDR != null)
{ {
HDR.Clear(context); HDR.Clear(context);
@ -312,6 +349,12 @@ namespace CodeWalker.Rendering
Skydome.EnableHDR = hdr; Skydome.EnableHDR = hdr;
Clouds.EnableHDR = hdr; Clouds.EnableHDR = hdr;
Basic.Deferred = deferred;
Cable.Deferred = deferred;
Water.Deferred = deferred;
Terrain.Deferred = deferred;
TreesLod.Deferred = deferred;
} }
@ -384,7 +427,11 @@ namespace CodeWalker.Rendering
} }
if (HDR != null) if (DefScene != null)
{
DefScene.SetPrimary(context);
}
else if (HDR != null)
{ {
HDR.SetPrimary(context); HDR.SetPrimary(context);
} }
@ -459,22 +506,6 @@ namespace CodeWalker.Rendering
context.OutputMerger.BlendState = bsDefault; context.OutputMerger.BlendState = bsDefault;
} }
if (RenderDistLODLights.Count > 0) //LOD lights pass
{
context.Rasterizer.State = rsSolidDblSided;
context.OutputMerger.BlendState = bsAdd; //additive blend for distant lod lights...
context.OutputMerger.DepthStencilState = dsDisableWrite;
DistLights.SetShader(context);
DistLights.SetSceneVars(context, Camera, Shadowmap, GlobalLights);
for (int i = 0; i < RenderDistLODLights.Count; i++)
{
DistLights.RenderBatch(context, RenderDistLODLights[i]);
}
DistLights.UnbindResources(context);
context.OutputMerger.BlendState = bsDefault;
context.OutputMerger.DepthStencilState = dsEnabled;
}
@ -505,6 +536,9 @@ namespace CodeWalker.Rendering
Water.UnbindResources(context); Water.UnbindResources(context);
} }
//TODO: needs second gbuffer pass?
Basic.DecalMode = true; Basic.DecalMode = true;
for (int i = 0; i < RenderBuckets.Count; i++) //alphablended and glass pass for (int i = 0; i < RenderBuckets.Count; i++) //alphablended and glass pass
{ {
@ -525,6 +559,54 @@ namespace CodeWalker.Rendering
if (DefScene != null)
{
if (HDR != null)
{
HDR.SetPrimary(context);
}
else
{
DXMan.SetDefaultRenderTarget(context);
}
DefScene.RenderLights(context, camera, Shadowmap, GlobalLights);
if (RenderLODLights.Count > 0) //LOD lights pass
{
context.Rasterizer.State = rsSolid;
context.OutputMerger.BlendState = bsAdd; //additive blend for lights...
context.OutputMerger.DepthStencilState = dsDisableWriteRev;//only render parts behind or at surface
DefScene.RenderLights(context, camera, RenderLODLights);
}
}
Basic.Deferred = false;
if (RenderDistLODLights.Count > 0) //distant LOD lights pass
{
context.Rasterizer.State = rsSolidDblSided;
context.OutputMerger.BlendState = bsAdd; //additive blend for distant lod lights...
context.OutputMerger.DepthStencilState = dsDisableWrite;
DistLights.SetShader(context);
DistLights.SetSceneVars(context, Camera, Shadowmap, GlobalLights);
for (int i = 0; i < RenderDistLODLights.Count; i++)
{
DistLights.RenderBatch(context, RenderDistLODLights[i]);
}
DistLights.UnbindResources(context);
context.OutputMerger.BlendState = bsDefault;
context.OutputMerger.DepthStencilState = dsEnabled;
}
if (RenderBoundGeoms.Count > 0) //collision meshes pass if (RenderBoundGeoms.Count > 0) //collision meshes pass
{ {
ClearDepth(context); //draw over everything else ClearDepth(context); //draw over everything else
@ -550,6 +632,8 @@ namespace CodeWalker.Rendering
Basic.Deferred = deferred;
RenderedGeometries = GeometryCount; RenderedGeometries = GeometryCount;
} }
@ -696,7 +780,7 @@ namespace CodeWalker.Rendering
{ {
Basic.RenderMode = WorldRenderMode.VertexColour; Basic.RenderMode = WorldRenderMode.VertexColour;
Basic.SetShader(context); Basic.SetShader(context);
Basic.SetSceneVars(context, Camera, Shadowmap, GlobalLights); Basic.SetSceneVars(context, Camera, /*Shadowmap*/ null, GlobalLights);//should this be using shadows??
Basic.SetInputLayout(context, VertexType.Default); Basic.SetInputLayout(context, VertexType.Default);
GeometryCount += batch.Count; GeometryCount += batch.Count;
@ -764,6 +848,10 @@ namespace CodeWalker.Rendering
{ {
RenderInstBatches.Add(batch); RenderInstBatches.Add(batch);
} }
public void Enqueue(RenderableLODLights lights)
{
RenderLODLights.Add(lights);
}
public void Enqueue(RenderableDistantLODLights lights) public void Enqueue(RenderableDistantLODLights lights)
{ {
RenderDistLODLights.Add(lights); RenderDistLODLights.Add(lights);
@ -880,6 +968,10 @@ namespace CodeWalker.Rendering
{ {
Width = w; Width = w;
Height = h; Height = h;
if (DefScene != null)
{
DefScene.OnWindowResize(DXMan);
}
if (HDR != null) if (HDR != null)
{ {
HDR.OnWindowResize(DXMan); HDR.OnWindowResize(DXMan);

View File

@ -145,6 +145,7 @@ namespace CodeWalker.Rendering
VertexShader basicvscapsule; VertexShader basicvscapsule;
VertexShader basicvscylinder; VertexShader basicvscylinder;
PixelShader basicps; PixelShader basicps;
PixelShader basicpsdef;
GpuVarsBuffer<BasicShaderVSSceneVars> VSSceneVars; GpuVarsBuffer<BasicShaderVSSceneVars> VSSceneVars;
GpuVarsBuffer<BasicShaderVSEntityVars> VSEntityVars; GpuVarsBuffer<BasicShaderVSEntityVars> VSEntityVars;
GpuVarsBuffer<BasicShaderVSModelVars> VSModelVars; GpuVarsBuffer<BasicShaderVSModelVars> VSModelVars;
@ -174,6 +175,7 @@ namespace CodeWalker.Rendering
public int RenderTextureSamplerCoord = 1; public int RenderTextureSamplerCoord = 1;
public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler; public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler;
public bool SpecularEnable = true; public bool SpecularEnable = true;
public bool Deferred = false;
Matrix3_s[] defaultBoneMatrices; Matrix3_s[] defaultBoneMatrices;
bool defaultBoneMatricesBound = false; bool defaultBoneMatricesBound = false;
@ -209,6 +211,7 @@ namespace CodeWalker.Rendering
byte[] vscapsulebytes = File.ReadAllBytes("Shaders\\BasicVS_Capsule.cso"); byte[] vscapsulebytes = File.ReadAllBytes("Shaders\\BasicVS_Capsule.cso");
byte[] vscylinderbytes = File.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso"); byte[] vscylinderbytes = File.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\BasicPS.cso"); byte[] psbytes = File.ReadAllBytes("Shaders\\BasicPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\BasicPS_Deferred.cso");
basicvspnct = new VertexShader(device, vspnctbytes); basicvspnct = new VertexShader(device, vspnctbytes);
basicvspnctt = new VertexShader(device, vspncttbytes); basicvspnctt = new VertexShader(device, vspncttbytes);
@ -235,6 +238,7 @@ namespace CodeWalker.Rendering
basicvscapsule = new VertexShader(device, vscapsulebytes); basicvscapsule = new VertexShader(device, vscapsulebytes);
basicvscylinder = new VertexShader(device, vscylinderbytes); basicvscylinder = new VertexShader(device, vscylinderbytes);
basicps = new PixelShader(device, psbytes); basicps = new PixelShader(device, psbytes);
basicpsdef = new PixelShader(device, psdefbytes);
VSSceneVars = new GpuVarsBuffer<BasicShaderVSSceneVars>(device); VSSceneVars = new GpuVarsBuffer<BasicShaderVSSceneVars>(device);
VSEntityVars = new GpuVarsBuffer<BasicShaderVSEntityVars>(device); VSEntityVars = new GpuVarsBuffer<BasicShaderVSEntityVars>(device);
@ -491,7 +495,7 @@ namespace CodeWalker.Rendering
public override void SetShader(DeviceContext context) public override void SetShader(DeviceContext context)
{ {
context.PixelShader.Set(basicps); context.PixelShader.Set(Deferred ? basicpsdef : basicps);
} }
public override bool SetInputLayout(DeviceContext context, VertexType type) public override bool SetInputLayout(DeviceContext context, VertexType type)
@ -1035,6 +1039,7 @@ namespace CodeWalker.Rendering
ClothVertices.Dispose(); ClothVertices.Dispose();
basicps.Dispose(); basicps.Dispose();
basicpsdef.Dispose();
basicvspnct.Dispose(); basicvspnct.Dispose();
basicvspnctt.Dispose(); basicvspnctt.Dispose();
basicvspncttt.Dispose(); basicvspncttt.Dispose();

View File

@ -67,6 +67,7 @@ namespace CodeWalker.Rendering
VertexShader vs; VertexShader vs;
PixelShader ps; PixelShader ps;
PixelShader psdef;
GpuVarsBuffer<CableShaderVSSceneVars> VSSceneVars; GpuVarsBuffer<CableShaderVSSceneVars> VSSceneVars;
GpuVarsBuffer<CableShaderVSEntityVars> VSEntityVars; GpuVarsBuffer<CableShaderVSEntityVars> VSEntityVars;
GpuVarsBuffer<CableShaderVSModelVars> VSModelVars; GpuVarsBuffer<CableShaderVSModelVars> VSModelVars;
@ -80,6 +81,7 @@ namespace CodeWalker.Rendering
public int RenderTextureCoordIndex = 1; public int RenderTextureCoordIndex = 1;
public int RenderTextureSamplerCoord = 1; public int RenderTextureSamplerCoord = 1;
public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler; public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler;
public bool Deferred = false;
private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>(); private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>();
@ -88,9 +90,11 @@ namespace CodeWalker.Rendering
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\CableVS.cso"); byte[] vsbytes = File.ReadAllBytes("Shaders\\CableVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\CablePS.cso"); byte[] psbytes = File.ReadAllBytes("Shaders\\CablePS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\CablePS_Deferred.cso");
vs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);
psdef = new PixelShader(device, psdefbytes);
VSSceneVars = new GpuVarsBuffer<CableShaderVSSceneVars>(device); VSSceneVars = new GpuVarsBuffer<CableShaderVSSceneVars>(device);
@ -137,7 +141,7 @@ namespace CodeWalker.Rendering
public override void SetShader(DeviceContext context) public override void SetShader(DeviceContext context)
{ {
context.PixelShader.Set(ps); context.PixelShader.Set(Deferred ? psdef : ps);
} }
public override bool SetInputLayout(DeviceContext context, VertexType type) public override bool SetInputLayout(DeviceContext context, VertexType type)
@ -344,6 +348,7 @@ namespace CodeWalker.Rendering
ps.Dispose(); ps.Dispose();
psdef.Dispose();
vs.Dispose(); vs.Dispose();
disposed = true; disposed = true;

View File

@ -0,0 +1,375 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Device = SharpDX.Direct3D11.Device;
using Buffer = SharpDX.Direct3D11.Buffer;
using MapFlags = SharpDX.Direct3D11.MapFlags;
using SharpDX.Direct3D11;
using System.IO;
using CodeWalker.GameFiles;
using CodeWalker.World;
using SharpDX;
using SharpDX.DXGI;
using SharpDX.Mathematics.Interop;
namespace CodeWalker.Rendering
{
public struct DeferredLightVSVars
{
public Matrix ViewProj;
public Vector4 CameraPos;
public uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
public uint IsLOD; //useful or not?
public uint Pad0;
public uint Pad1;
}
public struct DeferredLightPSVars
{
public ShaderGlobalLightParams GlobalLights;
public Matrix ViewProjInv;
public Vector4 CameraPos;
public uint EnableShadows;
public uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
public uint RenderModeIndex; //colour/texcoord index
public uint RenderSamplerCoord; //which texcoord to use in single texture mode
public uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
public uint IsLOD; //useful or not?
public uint Pad0;
public uint Pad1;
}
public class DeferredScene
{
public GpuMultiTexture GBuffers; // diffuse, normals, specular, irradiance
SamplerState SampleStatePoint;
SamplerState SampleStateLinear;
BlendState BlendState;
long WindowSizeVramUsage = 0;
int Width = 0;
int Height = 0;
ViewportF Viewport;
VertexShader LightVS;
PixelShader LightPS;
UnitCone LightCone;
UnitSphere LightSphere;
UnitCapsule LightCapsule;
UnitQuad LightQuad;
InputLayout LightQuadLayout;
GpuVarsBuffer<DeferredLightVSVars> LightVSVars;
GpuVarsBuffer<DeferredLightPSVars> LightPSVars;
public long VramUsage
{
get
{
return WindowSizeVramUsage;
}
}
public DeferredScene(DXManager dxman)
{
var device = dxman.device;
byte[] bLightVS = File.ReadAllBytes("Shaders\\LightVS.cso");
byte[] bLightPS = File.ReadAllBytes("Shaders\\LightPS.cso");
LightVS = new VertexShader(device, bLightVS);
LightPS = new PixelShader(device, bLightPS);
LightCone = new UnitCone(device, bLightVS, 4, false);
LightSphere = new UnitSphere(device, bLightVS, 4, true);
LightCapsule = new UnitCapsule(device, bLightVS, 4, false);
LightQuad = new UnitQuad(device, true);
LightQuadLayout = new InputLayout(device, bLightVS, new[]
{
new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 16, 0),
});
LightVSVars = new GpuVarsBuffer<DeferredLightVSVars>(device);
LightPSVars = new GpuVarsBuffer<DeferredLightPSVars>(device);
TextureAddressMode a = TextureAddressMode.Clamp;
Color4 b = new Color4(0.0f, 0.0f, 0.0f, 0.0f);
Comparison c = Comparison.Always;
SampleStatePoint = DXUtility.CreateSamplerState(device, a, b, c, Filter.MinMagMipPoint, 0, 1.0f, 1.0f, 0.0f);
SampleStateLinear = DXUtility.CreateSamplerState(device, a, b, c, Filter.MinMagMipLinear, 0, 1.0f, 1.0f, 0.0f);
BlendState = DXUtility.CreateBlendState(device, false, BlendOperation.Add, BlendOption.One, BlendOption.Zero, BlendOperation.Add, BlendOption.One, BlendOption.Zero, ColorWriteMaskFlags.All);
}
public void Dispose()
{
DisposeBuffers();
if (BlendState != null)
{
BlendState.Dispose();
BlendState = null;
}
if (SampleStateLinear != null)
{
SampleStateLinear.Dispose();
SampleStateLinear = null;
}
if (SampleStatePoint != null)
{
SampleStatePoint.Dispose();
SampleStatePoint = null;
}
if (LightVSVars != null)
{
LightVSVars.Dispose();
LightVSVars = null;
}
if (LightPSVars != null)
{
LightPSVars.Dispose();
LightPSVars = null;
}
if (LightQuadLayout != null)
{
LightQuadLayout.Dispose();
LightQuadLayout = null;
}
if (LightQuad != null)
{
LightQuad.Dispose();
LightQuad = null;
}
if (LightCone != null)
{
LightCone.Dispose();
LightCone = null;
}
if (LightSphere != null)
{
LightSphere.Dispose();
LightSphere = null;
}
if (LightCapsule != null)
{
LightCapsule.Dispose();
LightCapsule = null;
}
if (LightPS != null)
{
LightPS.Dispose();
LightPS = null;
}
if (LightVS != null)
{
LightVS.Dispose();
LightVS = null;
}
}
public void OnWindowResize(DXManager dxman)
{
DisposeBuffers();
var device = dxman.device;
int uw = Width = dxman.backbuffer.Description.Width;
int uh = Height = dxman.backbuffer.Description.Height;
Viewport = new ViewportF();
Viewport.Width = (float)uw;
Viewport.Height = (float)uh;
Viewport.MinDepth = 0.0f;
Viewport.MaxDepth = 1.0f;
Viewport.X = 0.0f;
Viewport.Y = 0.0f;
GBuffers = new GpuMultiTexture(device, uw, uh, 4, Format.R8G8B8A8_UNorm, true, Format.D32_Float);
WindowSizeVramUsage += GBuffers.VramUsage;
}
public void DisposeBuffers()
{
if (GBuffers != null)
{
GBuffers.Dispose();
GBuffers = null;
}
WindowSizeVramUsage = 0;
}
public void Clear(DeviceContext context)
{
//Color4 clearColour = new Color4(0.2f, 0.4f, 0.6f, 0.0f);
Color4 clearColour = new Color4(0.0f, 0.0f, 0.0f, 0.0f);
GBuffers.Clear(context, clearColour);
}
public void ClearDepth(DeviceContext context)
{
GBuffers.ClearDepth(context);
}
public void SetPrimary(DeviceContext context)
{
GBuffers.SetRenderTargets(context);
context.Rasterizer.SetViewport(Viewport);
}
public void RenderLights(DeviceContext context, Camera camera, Shadowmap globalShadows, ShaderGlobalLights globalLights)
{
uint rendermode = 0;
uint rendermodeind = 1;
//first full-screen directional light pass, for sun/moon
//discard pixels where scene depth is 0, since nothing was rendered there
//blend mode: overwrite
context.VertexShader.Set(LightVS);
context.PixelShader.Set(LightPS);
LightVSVars.Vars.ViewProj = Matrix.Identity; //Matrix.Transpose(camera.ViewProjMatrix);
LightVSVars.Vars.CameraPos = Vector4.Zero; //new Vector4(camera.Position, 0.0f);
LightVSVars.Vars.LightType = 0;
LightVSVars.Vars.IsLOD = 0;
LightVSVars.Vars.Pad0 = 0;
LightVSVars.Vars.Pad1 = 0;
LightVSVars.Update(context);
LightVSVars.SetVSCBuffer(context, 0);
LightPSVars.Vars.GlobalLights = globalLights.Params;
LightPSVars.Vars.ViewProjInv = Matrix.Transpose(camera.ViewProjInvMatrix);
LightPSVars.Vars.CameraPos = Vector4.Zero; //new Vector4(camera.Position, 0.0f);
LightPSVars.Vars.EnableShadows = (globalShadows != null) ? 1u : 0u;
LightPSVars.Vars.RenderMode = rendermode;
LightPSVars.Vars.RenderModeIndex = rendermodeind;
LightPSVars.Vars.RenderSamplerCoord = 0;// (uint)RenderTextureSamplerCoord;
LightPSVars.Vars.LightType = 0;
LightPSVars.Vars.IsLOD = 0;
LightPSVars.Vars.Pad0 = 0;
LightPSVars.Vars.Pad1 = 0;
LightPSVars.Update(context);
LightPSVars.SetPSCBuffer(context, 0);
context.PixelShader.SetShaderResources(0, GBuffers.DepthSRV);
context.PixelShader.SetShaderResources(2, GBuffers.SRVs);
if (globalShadows != null)
{
globalShadows.SetFinalRenderResources(context);
}
context.InputAssembler.InputLayout = LightQuadLayout;
LightQuad.Draw(context);
context.VertexShader.Set(null);
context.PixelShader.Set(null);
context.PixelShader.SetShaderResources(0, null, null, null);
context.PixelShader.SetSamplers(0, null, null);
}
public void RenderLights(DeviceContext context, Camera camera, List<RenderableLODLights> lodlights)
{
//instanced rendering of all other lights, using appropriate shapes
//blend mode: additive
context.VertexShader.Set(LightVS);
context.PixelShader.Set(LightPS);
LightVSVars.Vars.ViewProj = Matrix.Transpose(camera.ViewProjMatrix);
LightVSVars.Vars.CameraPos = new Vector4(camera.Position, 0.0f);
LightVSVars.Vars.LightType = 0;
LightVSVars.Vars.IsLOD = 0;
LightVSVars.Vars.Pad0 = 0;
LightVSVars.Vars.Pad1 = 0;
//LightPSVars.Vars.GlobalLights = globalLights.Params;
LightPSVars.Vars.ViewProjInv = Matrix.Transpose(camera.ViewProjInvMatrix);
LightPSVars.Vars.CameraPos = new Vector4(camera.Position, 0.0f);
LightPSVars.Vars.EnableShadows = 0;// (globalShadows != null) ? 1u : 0u;
LightPSVars.Vars.RenderMode = 0;// rendermode;
LightPSVars.Vars.RenderModeIndex = 1;// rendermodeind;
LightPSVars.Vars.RenderSamplerCoord = 0;// (uint)RenderTextureSamplerCoord;
LightPSVars.Vars.LightType = 0;
LightPSVars.Vars.IsLOD = 0;
LightPSVars.Vars.Pad0 = 0;
LightPSVars.Vars.Pad1 = 0;
context.PixelShader.SetShaderResources(0, GBuffers.DepthSRV);
context.PixelShader.SetShaderResources(2, GBuffers.SRVs);
//if (globalShadows != null)
//{
// globalShadows.SetFinalRenderResources(context);
//}
foreach (var rll in lodlights)
{
if (rll.PointsBuffer != null)
{
context.VertexShader.SetShaderResources(0, rll.PointsBuffer.SRV);
context.PixelShader.SetShaderResources(6, rll.PointsBuffer.SRV);
LightVSVars.Vars.LightType = 1;
LightVSVars.Update(context);
LightVSVars.SetVSCBuffer(context, 0);
LightPSVars.Vars.LightType = 1;
LightPSVars.Update(context);
LightPSVars.SetPSCBuffer(context, 0);
LightSphere.DrawInstanced(context, rll.PointsBuffer.StructCount);
}
if (rll.SpotsBuffer != null)
{
context.VertexShader.SetShaderResources(0, rll.SpotsBuffer.SRV);
context.PixelShader.SetShaderResources(6, rll.SpotsBuffer.SRV);
LightVSVars.Vars.LightType = 2;
LightVSVars.Update(context);
LightVSVars.SetVSCBuffer(context, 0);
LightPSVars.Vars.LightType = 2;
LightPSVars.Update(context);
LightPSVars.SetPSCBuffer(context, 0);
LightCone.DrawInstanced(context, rll.SpotsBuffer.StructCount);
}
if (rll.CapsBuffer != null)
{
context.VertexShader.SetShaderResources(0, rll.CapsBuffer.SRV);
context.PixelShader.SetShaderResources(6, rll.CapsBuffer.SRV);
LightVSVars.Vars.LightType = 4;
LightVSVars.Update(context);
LightVSVars.SetVSCBuffer(context, 0);
LightPSVars.Vars.LightType = 4;
LightPSVars.Update(context);
LightPSVars.SetPSCBuffer(context, 0);
LightCapsule.DrawInstanced(context, rll.CapsBuffer.StructCount);
}
}
context.VertexShader.Set(null);
context.PixelShader.Set(null);
context.PixelShader.SetShaderResources(0, null, null, null);
context.PixelShader.SetSamplers(0, null, null);
}
}
}

View File

@ -78,6 +78,7 @@ namespace CodeWalker.Rendering
VertexShader pnctttxvs; VertexShader pnctttxvs;
VertexShader pncttxvs; VertexShader pncttxvs;
PixelShader terrainps; PixelShader terrainps;
PixelShader terrainpsdef;
GpuVarsBuffer<TerrainShaderVSSceneVars> VSSceneVars; GpuVarsBuffer<TerrainShaderVSSceneVars> VSSceneVars;
GpuVarsBuffer<TerrainShaderVSEntityVars> VSEntityVars; GpuVarsBuffer<TerrainShaderVSEntityVars> VSEntityVars;
GpuVarsBuffer<TerrainShaderVSModelVars> VSModelVars; GpuVarsBuffer<TerrainShaderVSModelVars> VSModelVars;
@ -93,6 +94,7 @@ namespace CodeWalker.Rendering
public int RenderTextureCoordIndex = 1; public int RenderTextureCoordIndex = 1;
public int RenderTextureSamplerCoord = 1; public int RenderTextureSamplerCoord = 1;
public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler; public ShaderParamNames RenderTextureSampler = ShaderParamNames.DiffuseSampler;
public bool Deferred = false;
private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>(); private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>();
@ -107,6 +109,7 @@ namespace CodeWalker.Rendering
byte[] vspnctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso"); byte[] vspnctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso");
byte[] vspncttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso"); byte[] vspncttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\TerrainPS.cso"); byte[] psbytes = File.ReadAllBytes("Shaders\\TerrainPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\TerrainPS_Deferred.cso");
pncctvs = new VertexShader(device, vspncct); pncctvs = new VertexShader(device, vspncct);
pnccttvs = new VertexShader(device, vspncctt); pnccttvs = new VertexShader(device, vspncctt);
@ -116,6 +119,7 @@ namespace CodeWalker.Rendering
pnctttxvs = new VertexShader(device, vspnctttx); pnctttxvs = new VertexShader(device, vspnctttx);
pncttxvs = new VertexShader(device, vspncttx); pncttxvs = new VertexShader(device, vspncttx);
terrainps = new PixelShader(device, psbytes); terrainps = new PixelShader(device, psbytes);
terrainpsdef = new PixelShader(device, psdefbytes);
VSSceneVars = new GpuVarsBuffer<TerrainShaderVSSceneVars>(device); VSSceneVars = new GpuVarsBuffer<TerrainShaderVSSceneVars>(device);
VSEntityVars = new GpuVarsBuffer<TerrainShaderVSEntityVars>(device); VSEntityVars = new GpuVarsBuffer<TerrainShaderVSEntityVars>(device);
@ -259,7 +263,7 @@ namespace CodeWalker.Rendering
public override void SetShader(DeviceContext context) public override void SetShader(DeviceContext context)
{ {
context.PixelShader.Set(terrainps); context.PixelShader.Set(Deferred ? terrainpsdef : terrainps);
} }
public override bool SetInputLayout(DeviceContext context, VertexType type) public override bool SetInputLayout(DeviceContext context, VertexType type)
@ -639,6 +643,7 @@ namespace CodeWalker.Rendering
PSGeomVars.Dispose(); PSGeomVars.Dispose();
terrainps.Dispose(); terrainps.Dispose();
terrainpsdef.Dispose();
pncctvs.Dispose(); pncctvs.Dispose();
pnccttvs.Dispose(); pnccttvs.Dispose();
pnccttxvs.Dispose(); pnccttxvs.Dispose();

View File

@ -59,8 +59,9 @@ namespace CodeWalker.Rendering
{ {
bool disposed = false; bool disposed = false;
VertexShader basicvs; VertexShader vs;
PixelShader basicps; PixelShader ps;
PixelShader psdef;
GpuVarsBuffer<TreesLodShaderVSSceneVars> VSSceneVars; GpuVarsBuffer<TreesLodShaderVSSceneVars> VSSceneVars;
GpuVarsBuffer<TreesLodShaderVSEntityVars> VSEntityVars; GpuVarsBuffer<TreesLodShaderVSEntityVars> VSEntityVars;
GpuVarsBuffer<TreesLodShaderVSModelVars> VSModelVars; GpuVarsBuffer<TreesLodShaderVSModelVars> VSModelVars;
@ -71,14 +72,18 @@ namespace CodeWalker.Rendering
private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>(); private Dictionary<VertexType, InputLayout> layouts = new Dictionary<VertexType, InputLayout>();
public bool Deferred = false;
public TreesLodShader(Device device) public TreesLodShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\TreesLodVS.cso"); byte[] vsbytes = File.ReadAllBytes("Shaders\\TreesLodVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\TreesLodPS.cso"); byte[] psbytes = File.ReadAllBytes("Shaders\\TreesLodPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\TreesLodPS_Deferred.cso");
basicvs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
basicps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);
psdef = new PixelShader(device, psdefbytes);
VSSceneVars = new GpuVarsBuffer<TreesLodShaderVSSceneVars>(device); VSSceneVars = new GpuVarsBuffer<TreesLodShaderVSSceneVars>(device);
VSEntityVars = new GpuVarsBuffer<TreesLodShaderVSEntityVars>(device); VSEntityVars = new GpuVarsBuffer<TreesLodShaderVSEntityVars>(device);
@ -112,8 +117,8 @@ namespace CodeWalker.Rendering
public override void SetShader(DeviceContext context) public override void SetShader(DeviceContext context)
{ {
context.VertexShader.Set(basicvs); context.VertexShader.Set(vs);
context.PixelShader.Set(basicps); context.PixelShader.Set(Deferred ? psdef : ps);
} }
public override bool SetInputLayout(DeviceContext context, VertexType type) public override bool SetInputLayout(DeviceContext context, VertexType type)
@ -311,8 +316,9 @@ namespace CodeWalker.Rendering
PSSceneVars.Dispose(); PSSceneVars.Dispose();
PSEntityVars.Dispose(); PSEntityVars.Dispose();
basicps.Dispose(); psdef.Dispose();
basicvs.Dispose(); ps.Dispose();
vs.Dispose();
disposed = true; disposed = true;
} }

View File

@ -84,6 +84,7 @@ namespace CodeWalker.Rendering
VertexShader vspnct; VertexShader vspnct;
VertexShader vspnctx; VertexShader vspnctx;
PixelShader ps; PixelShader ps;
PixelShader psdef;
GpuVarsBuffer<WaterShaderVSSceneVars> VSSceneVars; GpuVarsBuffer<WaterShaderVSSceneVars> VSSceneVars;
GpuVarsBuffer<WaterShaderVSEntityVars> VSEntityVars; GpuVarsBuffer<WaterShaderVSEntityVars> VSEntityVars;
@ -107,6 +108,7 @@ namespace CodeWalker.Rendering
public double CurrentRealTime = 0; public double CurrentRealTime = 0;
public float CurrentElapsedTime = 0; public float CurrentElapsedTime = 0;
public bool SpecularEnable = true; public bool SpecularEnable = true;
public bool Deferred = false;
public RenderableTexture waterbump { get; set; } public RenderableTexture waterbump { get; set; }
@ -124,6 +126,7 @@ namespace CodeWalker.Rendering
byte[] vspnctbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCT.cso"); byte[] vspnctbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCT.cso");
byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso"); byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\WaterPS.cso"); byte[] psbytes = File.ReadAllBytes("Shaders\\WaterPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\WaterPS_Deferred.cso");
vspt = new VertexShader(device, vsptbytes); vspt = new VertexShader(device, vsptbytes);
@ -131,6 +134,7 @@ namespace CodeWalker.Rendering
vspnct = new VertexShader(device, vspnctbytes); vspnct = new VertexShader(device, vspnctbytes);
vspnctx = new VertexShader(device, vspnctxbytes); vspnctx = new VertexShader(device, vspnctxbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);
psdef = new PixelShader(device, psdefbytes);
VSSceneVars = new GpuVarsBuffer<WaterShaderVSSceneVars>(device); VSSceneVars = new GpuVarsBuffer<WaterShaderVSSceneVars>(device);
VSEntityVars = new GpuVarsBuffer<WaterShaderVSEntityVars>(device); VSEntityVars = new GpuVarsBuffer<WaterShaderVSEntityVars>(device);
@ -213,7 +217,7 @@ namespace CodeWalker.Rendering
public override void SetShader(DeviceContext context) public override void SetShader(DeviceContext context)
{ {
context.PixelShader.Set(ps); context.PixelShader.Set(Deferred ? psdef : ps);
} }
public override bool SetInputLayout(DeviceContext context, VertexType type) public override bool SetInputLayout(DeviceContext context, VertexType type)
@ -552,6 +556,7 @@ namespace CodeWalker.Rendering
PSGeomVars.Dispose(); PSGeomVars.Dispose();
ps.Dispose(); ps.Dispose();
psdef.Dispose();
vspt.Dispose(); vspt.Dispose();
vspct.Dispose(); vspct.Dispose();
vspnct.Dispose(); vspnct.Dispose();

View File

@ -421,4 +421,133 @@ namespace CodeWalker.Rendering
} }
public class GpuMultiTexture //multiple texture and render targets (depth).
{
public Texture2D[] Textures;
public Texture2D Depth;
public RenderTargetView[] RTVs;
public DepthStencilView DSV;
public ShaderResourceView[] SRVs;
public ShaderResourceView DepthSRV;
public int VramUsage;
public bool UseDepth;
public int Count;
public void Init(Device device, int w, int h, int count, Format f, bool depth, Format df)
{
Count = count;
VramUsage = 0;
UseDepth = depth;
ResourceUsage u = ResourceUsage.Default;
BindFlags b = BindFlags.RenderTarget | BindFlags.ShaderResource;
RenderTargetViewDimension rtvd = RenderTargetViewDimension.Texture2D;
ShaderResourceViewDimension srvd = ShaderResourceViewDimension.Texture2D;// D3D11_SRV_DIMENSION_TEXTURE2D;
int fs = DXUtility.ElementSize(f);
int wh = w * h;
BindFlags db = BindFlags.DepthStencil | BindFlags.ShaderResource;// D3D11_BIND_DEPTH_STENCIL;
DepthStencilViewDimension dsvd = DepthStencilViewDimension.Texture2D;
Textures = new Texture2D[count];
RTVs = new RenderTargetView[count];
SRVs = new ShaderResourceView[count];
for (int i = 0; i < count; i++)
{
Textures[i] = DXUtility.CreateTexture2D(device, w, h, 1, 1, f, 1, 0, u, b, 0, 0);
RTVs[i] = DXUtility.CreateRenderTargetView(device, Textures[i], f, rtvd, 0, 0, 0);
SRVs[i] = DXUtility.CreateShaderResourceView(device, Textures[i], f, srvd, 1, 0, 0, 0);
VramUsage += (wh * fs);
}
if (depth)
{
Format dtexf = Format.R32_Typeless;
Format dsrvf = Format.R32_Float;
switch (df)
{
case Format.D16_UNorm:
dtexf = Format.R16_Typeless;
dsrvf = Format.R16_UNorm;
break;
case Format.D24_UNorm_S8_UInt:
dtexf = Format.R24G8_Typeless;
dsrvf = Format.R24_UNorm_X8_Typeless;
break;
case Format.D32_Float:
dtexf = Format.R32_Typeless;
dsrvf = Format.R32_Float;
break;
case Format.D32_Float_S8X24_UInt:
dtexf = Format.R32G8X24_Typeless;//is this right? who uses this anyway??
dsrvf = Format.R32_Float_X8X24_Typeless;
break;
}
Depth = DXUtility.CreateTexture2D(device, w, h, 1, 1, dtexf, 1, 0, u, db, 0, 0);
DSV = DXUtility.CreateDepthStencilView(device, Depth, df, dsvd);
DepthSRV = DXUtility.CreateShaderResourceView(device, Depth, dsrvf, srvd, 1, 0, 0, 0);
VramUsage += (wh * DXUtility.ElementSize(df));
}
}
public void Dispose()
{
for (int i = 0; i < Count; i++)
{
SRVs[i].Dispose();
RTVs[i].Dispose();
Textures[i].Dispose();
}
SRVs = null;
RTVs = null;
Textures = null;
if (DSV != null)
{
DSV.Dispose();
DSV = null;
}
if (DepthSRV != null)
{
DepthSRV.Dispose();
DepthSRV = null;
}
if (Depth != null)
{
Depth.Dispose();
Depth = null;
}
}
public GpuMultiTexture(Device device, int w, int h, int count, Format f, bool depth, Format df)
{
Init(device, w, h, count, f, depth, df);
}
public GpuMultiTexture(Device device, int w, int h, int count, Format f)
{
Init(device, w, h, count, f, false, Format.Unknown);
}
public void Clear(DeviceContext context, Color4 colour)
{
for (int i = 0; i < Count; i++)
{
context.ClearRenderTargetView(RTVs[i], colour);
}
if (UseDepth)
{
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 0.0f, 0);
}
}
public void ClearDepth(DeviceContext context)
{
if (!UseDepth) return;
context.ClearDepthStencilView(DSV, DepthStencilClearFlags.Depth, 0.0f, 0);
}
public void SetRenderTargets(DeviceContext context)
{
context.OutputMerger.SetRenderTargets(UseDepth ? DSV : null, RTVs);
}
}
} }

View File

@ -33,7 +33,7 @@ namespace CodeWalker.Rendering
} }
} }
public UnitCapsule(Device device, byte[] vsbytes, int detail) public UnitCapsule(Device device, byte[] vsbytes, int detail, bool invert = false)
{ {
InputLayout = new InputLayout(device, vsbytes, new[] InputLayout = new InputLayout(device, vsbytes, new[]
@ -208,8 +208,8 @@ namespace CodeWalker.Rendering
foreach (var tri in curtris) foreach (var tri in curtris)
{ {
idata.Add((uint)tri.v1); idata.Add((uint)tri.v1);
idata.Add((uint)tri.v2); idata.Add((uint)(invert ? tri.v3 : tri.v2));
idata.Add((uint)tri.v3); idata.Add((uint)(invert ? tri.v2 : tri.v3));
} }

152
Rendering/Utils/UnitCone.cs Normal file
View File

@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpDX;
using SharpDX.Direct3D;
using SharpDX.Direct3D11;
using Device = SharpDX.Direct3D11.Device;
using Buffer = SharpDX.Direct3D11.Buffer;
using SharpDX.DXGI;
namespace CodeWalker.Rendering
{
public class UnitCone
{
private Buffer VertexBuffer { get; set; }
private Buffer IndexBuffer { get; set; }
private InputLayout InputLayout { get; set; }
private VertexBufferBinding vbbinding;
private int indexcount;
private struct SphTri
{
public int v1;
public int v2;
public int v3;
public SphTri(int i1, int i2, int i3)
{
v1 = i1;
v2 = i2;
v3 = i3;
}
}
public UnitCone(Device device, byte[] vsbytes, int detail, bool invert = false)
{
InputLayout = new InputLayout(device, vsbytes, new[]
{
new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
new InputElement("NORMAL", 0, Format.R32G32B32A32_Float, 16, 0),
});
List<Vector4> verts = new List<Vector4>();
Dictionary<Vector4, int> vdict = new Dictionary<Vector4, int>();
List<SphTri> curtris = new List<SphTri>();
verts.Add(new Vector4(0.0f, 0.0f, 0.0f, 0.0f));//top end (translated by VS!)
verts.Add(new Vector4(0.0f, -1.0f, 0.0f, 0.0f));//top normal
verts.Add(new Vector4(0.0f, 0.0f, 0.0f, 1.0f));//bottom end
verts.Add(new Vector4(0.0f, 1.0f, 0.0f, 1.0f));//bottom normal
int nlons = detail * 4;
int lastlon = nlons - 1;
float latrng = 1.0f / (detail);
float lonrng = 1.0f / (nlons);
float twopi = (float)(2.0 * Math.PI);
for (int lon = 0; lon < nlons; lon++)
{
float tlon = lon * lonrng;
float rlon = tlon * twopi;
float lonx = (float)Math.Sin(rlon);
float lonz = (float)Math.Cos(rlon);
verts.Add(new Vector4(lonx, 0.0f, lonz, 1.0f));//2
verts.Add(new Vector4(lonx, 0.0f, lonz, 0.0f));//side normal
verts.Add(new Vector4(lonx, 0.0f, lonz, 1.0f));//3
verts.Add(new Vector4(0.0f, 1.0f, 0.0f, 0.0f));//bottom normal
}
for (int lon = 0; lon < nlons; lon++)
{
int i0 = 2 + lon * 2;
int i1 = i0 + 2;
if (lon == lastlon)
{
i1 = 2;
}
curtris.Add(new SphTri(0, i0, i1)); //fill the cone
curtris.Add(new SphTri(1, i1+1, i0+1)); //bottom cap triangles
}
List<uint> idata = new List<uint>();
foreach (var tri in curtris)
{
idata.Add((uint)tri.v1);
idata.Add((uint)(invert ? tri.v2 : tri.v3));
idata.Add((uint)(invert ? tri.v3 : tri.v2));
}
VertexBuffer = Buffer.Create(device, BindFlags.VertexBuffer, verts.ToArray());
vbbinding = new VertexBufferBinding(VertexBuffer, 32, 0);
IndexBuffer = Buffer.Create(device, BindFlags.IndexBuffer, idata.ToArray());
indexcount = idata.Count;
}
public void Draw(DeviceContext context)
{
context.InputAssembler.InputLayout = InputLayout;
context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
context.InputAssembler.SetVertexBuffers(0, vbbinding);
context.InputAssembler.SetIndexBuffer(IndexBuffer, Format.R32_UInt, 0);
context.DrawIndexed(indexcount, 0, 0);
}
public void DrawInstanced(DeviceContext context, int count)
{
context.InputAssembler.InputLayout = InputLayout;
context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
context.InputAssembler.SetVertexBuffers(0, vbbinding);
context.InputAssembler.SetIndexBuffer(IndexBuffer, Format.R32_UInt, 0);
context.DrawIndexedInstanced(indexcount, count, 0, 0, 0);
}
public void Dispose()
{
if (VertexBuffer != null)
{
VertexBuffer.Dispose();
VertexBuffer = null;
}
if (IndexBuffer != null)
{
IndexBuffer.Dispose();
IndexBuffer = null;
}
if (InputLayout != null)
{
InputLayout.Dispose();
InputLayout = null;
}
}
}
}

View File

@ -33,7 +33,7 @@ namespace CodeWalker.Rendering
} }
} }
public UnitSphere(Device device, byte[] vsbytes, int detail) public UnitSphere(Device device, byte[] vsbytes, int detail, bool invert = false)
{ {
InputLayout = new InputLayout(device, vsbytes, new[] InputLayout = new InputLayout(device, vsbytes, new[]
@ -121,8 +121,8 @@ namespace CodeWalker.Rendering
foreach (var tri in curtris) foreach (var tri in curtris)
{ {
idata.Add((uint)tri.v1); idata.Add((uint)tri.v1);
idata.Add((uint)tri.v2); idata.Add((uint)(invert ? tri.v3 : tri.v2));
idata.Add((uint)tri.v3); idata.Add((uint)(invert ? tri.v2 : tri.v3));
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Shaders/LightPS.cso Normal file

Binary file not shown.

BIN
Shaders/LightVS.cso Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -132,6 +132,8 @@ namespace CodeWalker.Vehicles
camera.TargetRotation.X = 0.5f * (float)Math.PI; camera.TargetRotation.X = 0.5f * (float)Math.PI;
camera.CurrentRotation.X = 0.5f * (float)Math.PI; camera.CurrentRotation.X = 0.5f * (float)Math.PI;
Renderer.shaders.deferred = false; //no point using this here yet
LoadSettings(); LoadSettings();

32
WorldForm.Designer.cs generated
View File

@ -295,6 +295,7 @@ namespace CodeWalker
this.ToolbarPanel = new System.Windows.Forms.Panel(); this.ToolbarPanel = new System.Windows.Forms.Panel();
this.SubtitleLabel = new System.Windows.Forms.Label(); this.SubtitleLabel = new System.Windows.Forms.Label();
this.SubtitleTimer = new System.Windows.Forms.Timer(this.components); this.SubtitleTimer = new System.Windows.Forms.Timer(this.components);
this.DeferredShadingCheckBox = new System.Windows.Forms.CheckBox();
this.StatusStrip.SuspendLayout(); this.StatusStrip.SuspendLayout();
this.ToolsPanel.SuspendLayout(); this.ToolsPanel.SuspendLayout();
this.ToolsTabControl.SuspendLayout(); this.ToolsTabControl.SuspendLayout();
@ -2200,6 +2201,7 @@ namespace CodeWalker
// //
// tabPage10 // tabPage10
// //
this.tabPage10.Controls.Add(this.DeferredShadingCheckBox);
this.tabPage10.Controls.Add(this.WeatherRegionComboBox); this.tabPage10.Controls.Add(this.WeatherRegionComboBox);
this.tabPage10.Controls.Add(this.label29); this.tabPage10.Controls.Add(this.label29);
this.tabPage10.Controls.Add(this.CloudParamTrackBar); this.tabPage10.Controls.Add(this.CloudParamTrackBar);
@ -2361,7 +2363,7 @@ namespace CodeWalker
this.ArtificialAmbientLightCheckBox.AutoSize = true; this.ArtificialAmbientLightCheckBox.AutoSize = true;
this.ArtificialAmbientLightCheckBox.Checked = true; this.ArtificialAmbientLightCheckBox.Checked = true;
this.ArtificialAmbientLightCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.ArtificialAmbientLightCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.ArtificialAmbientLightCheckBox.Location = new System.Drawing.Point(10, 129); this.ArtificialAmbientLightCheckBox.Location = new System.Drawing.Point(10, 137);
this.ArtificialAmbientLightCheckBox.Name = "ArtificialAmbientLightCheckBox"; this.ArtificialAmbientLightCheckBox.Name = "ArtificialAmbientLightCheckBox";
this.ArtificialAmbientLightCheckBox.Size = new System.Drawing.Size(124, 17); this.ArtificialAmbientLightCheckBox.Size = new System.Drawing.Size(124, 17);
this.ArtificialAmbientLightCheckBox.TabIndex = 36; this.ArtificialAmbientLightCheckBox.TabIndex = 36;
@ -2374,7 +2376,7 @@ namespace CodeWalker
this.NaturalAmbientLightCheckBox.AutoSize = true; this.NaturalAmbientLightCheckBox.AutoSize = true;
this.NaturalAmbientLightCheckBox.Checked = true; this.NaturalAmbientLightCheckBox.Checked = true;
this.NaturalAmbientLightCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.NaturalAmbientLightCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.NaturalAmbientLightCheckBox.Location = new System.Drawing.Point(10, 106); this.NaturalAmbientLightCheckBox.Location = new System.Drawing.Point(10, 115);
this.NaturalAmbientLightCheckBox.Name = "NaturalAmbientLightCheckBox"; this.NaturalAmbientLightCheckBox.Name = "NaturalAmbientLightCheckBox";
this.NaturalAmbientLightCheckBox.Size = new System.Drawing.Size(122, 17); this.NaturalAmbientLightCheckBox.Size = new System.Drawing.Size(122, 17);
this.NaturalAmbientLightCheckBox.TabIndex = 35; this.NaturalAmbientLightCheckBox.TabIndex = 35;
@ -2387,7 +2389,7 @@ namespace CodeWalker
this.DistantLODLightsCheckBox.AutoSize = true; this.DistantLODLightsCheckBox.AutoSize = true;
this.DistantLODLightsCheckBox.Checked = true; this.DistantLODLightsCheckBox.Checked = true;
this.DistantLODLightsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.DistantLODLightsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.DistantLODLightsCheckBox.Location = new System.Drawing.Point(10, 83); this.DistantLODLightsCheckBox.Location = new System.Drawing.Point(10, 93);
this.DistantLODLightsCheckBox.Name = "DistantLODLightsCheckBox"; this.DistantLODLightsCheckBox.Name = "DistantLODLightsCheckBox";
this.DistantLODLightsCheckBox.Size = new System.Drawing.Size(111, 17); this.DistantLODLightsCheckBox.Size = new System.Drawing.Size(111, 17);
this.DistantLODLightsCheckBox.TabIndex = 34; this.DistantLODLightsCheckBox.TabIndex = 34;
@ -2400,7 +2402,7 @@ namespace CodeWalker
this.HDRRenderingCheckBox.AutoSize = true; this.HDRRenderingCheckBox.AutoSize = true;
this.HDRRenderingCheckBox.Checked = true; this.HDRRenderingCheckBox.Checked = true;
this.HDRRenderingCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.HDRRenderingCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.HDRRenderingCheckBox.Location = new System.Drawing.Point(10, 9); this.HDRRenderingCheckBox.Location = new System.Drawing.Point(10, 27);
this.HDRRenderingCheckBox.Name = "HDRRenderingCheckBox"; this.HDRRenderingCheckBox.Name = "HDRRenderingCheckBox";
this.HDRRenderingCheckBox.Size = new System.Drawing.Size(97, 17); this.HDRRenderingCheckBox.Size = new System.Drawing.Size(97, 17);
this.HDRRenderingCheckBox.TabIndex = 31; this.HDRRenderingCheckBox.TabIndex = 31;
@ -2413,7 +2415,7 @@ namespace CodeWalker
this.ControlTimeOfDayCheckBox.AutoSize = true; this.ControlTimeOfDayCheckBox.AutoSize = true;
this.ControlTimeOfDayCheckBox.Checked = true; this.ControlTimeOfDayCheckBox.Checked = true;
this.ControlTimeOfDayCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.ControlTimeOfDayCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.ControlTimeOfDayCheckBox.Location = new System.Drawing.Point(10, 180); this.ControlTimeOfDayCheckBox.Location = new System.Drawing.Point(10, 181);
this.ControlTimeOfDayCheckBox.Name = "ControlTimeOfDayCheckBox"; this.ControlTimeOfDayCheckBox.Name = "ControlTimeOfDayCheckBox";
this.ControlTimeOfDayCheckBox.Size = new System.Drawing.Size(166, 17); this.ControlTimeOfDayCheckBox.Size = new System.Drawing.Size(166, 17);
this.ControlTimeOfDayCheckBox.TabIndex = 38; this.ControlTimeOfDayCheckBox.TabIndex = 38;
@ -2479,7 +2481,7 @@ namespace CodeWalker
// ControlLightDirectionCheckBox // ControlLightDirectionCheckBox
// //
this.ControlLightDirectionCheckBox.AutoSize = true; this.ControlLightDirectionCheckBox.AutoSize = true;
this.ControlLightDirectionCheckBox.Location = new System.Drawing.Point(10, 157); this.ControlLightDirectionCheckBox.Location = new System.Drawing.Point(10, 159);
this.ControlLightDirectionCheckBox.Name = "ControlLightDirectionCheckBox"; this.ControlLightDirectionCheckBox.Name = "ControlLightDirectionCheckBox";
this.ControlLightDirectionCheckBox.Size = new System.Drawing.Size(177, 17); this.ControlLightDirectionCheckBox.Size = new System.Drawing.Size(177, 17);
this.ControlLightDirectionCheckBox.TabIndex = 37; this.ControlLightDirectionCheckBox.TabIndex = 37;
@ -2492,7 +2494,7 @@ namespace CodeWalker
this.SkydomeCheckBox.AutoSize = true; this.SkydomeCheckBox.AutoSize = true;
this.SkydomeCheckBox.Checked = true; this.SkydomeCheckBox.Checked = true;
this.SkydomeCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.SkydomeCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.SkydomeCheckBox.Location = new System.Drawing.Point(10, 55); this.SkydomeCheckBox.Location = new System.Drawing.Point(10, 71);
this.SkydomeCheckBox.Name = "SkydomeCheckBox"; this.SkydomeCheckBox.Name = "SkydomeCheckBox";
this.SkydomeCheckBox.Size = new System.Drawing.Size(70, 17); this.SkydomeCheckBox.Size = new System.Drawing.Size(70, 17);
this.SkydomeCheckBox.TabIndex = 33; this.SkydomeCheckBox.TabIndex = 33;
@ -2503,7 +2505,7 @@ namespace CodeWalker
// ShadowsCheckBox // ShadowsCheckBox
// //
this.ShadowsCheckBox.AutoSize = true; this.ShadowsCheckBox.AutoSize = true;
this.ShadowsCheckBox.Location = new System.Drawing.Point(10, 32); this.ShadowsCheckBox.Location = new System.Drawing.Point(10, 49);
this.ShadowsCheckBox.Name = "ShadowsCheckBox"; this.ShadowsCheckBox.Name = "ShadowsCheckBox";
this.ShadowsCheckBox.Size = new System.Drawing.Size(70, 17); this.ShadowsCheckBox.Size = new System.Drawing.Size(70, 17);
this.ShadowsCheckBox.TabIndex = 32; this.ShadowsCheckBox.TabIndex = 32;
@ -3413,6 +3415,19 @@ namespace CodeWalker
// //
this.SubtitleTimer.Tick += new System.EventHandler(this.SubtitleTimer_Tick); this.SubtitleTimer.Tick += new System.EventHandler(this.SubtitleTimer_Tick);
// //
// DeferredShadingCheckBox
//
this.DeferredShadingCheckBox.AutoSize = true;
this.DeferredShadingCheckBox.Checked = true;
this.DeferredShadingCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.DeferredShadingCheckBox.Location = new System.Drawing.Point(10, 5);
this.DeferredShadingCheckBox.Name = "DeferredShadingCheckBox";
this.DeferredShadingCheckBox.Size = new System.Drawing.Size(107, 17);
this.DeferredShadingCheckBox.TabIndex = 30;
this.DeferredShadingCheckBox.Text = "Deferred shading";
this.DeferredShadingCheckBox.UseVisualStyleBackColor = true;
this.DeferredShadingCheckBox.CheckedChanged += new System.EventHandler(this.DeferredShadingCheckBox_CheckedChanged);
//
// WorldForm // WorldForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -3767,5 +3782,6 @@ namespace CodeWalker
private System.Windows.Forms.ToolStripMenuItem ToolsMenuCutsceneViewer; private System.Windows.Forms.ToolStripMenuItem ToolsMenuCutsceneViewer;
private System.Windows.Forms.Label SubtitleLabel; private System.Windows.Forms.Label SubtitleLabel;
private System.Windows.Forms.Timer SubtitleTimer; private System.Windows.Forms.Timer SubtitleTimer;
private System.Windows.Forms.CheckBox DeferredShadingCheckBox;
} }
} }

View File

@ -4659,6 +4659,7 @@ namespace CodeWalker
WindowState = s.WindowMaximized ? FormWindowState.Maximized : WindowState; WindowState = s.WindowMaximized ? FormWindowState.Maximized : WindowState;
FullScreenCheckBox.Checked = s.FullScreen; FullScreenCheckBox.Checked = s.FullScreen;
WireframeCheckBox.Checked = s.Wireframe; WireframeCheckBox.Checked = s.Wireframe;
DeferredShadingCheckBox.Checked = s.Deferred;
HDRRenderingCheckBox.Checked = s.HDR; HDRRenderingCheckBox.Checked = s.HDR;
ShadowsCheckBox.Checked = s.Shadows; ShadowsCheckBox.Checked = s.Shadows;
SkydomeCheckBox.Checked = s.Skydome; SkydomeCheckBox.Checked = s.Skydome;
@ -4693,6 +4694,7 @@ namespace CodeWalker
s.WindowMaximized = (WindowState == FormWindowState.Maximized); s.WindowMaximized = (WindowState == FormWindowState.Maximized);
s.FullScreen = FullScreenCheckBox.Checked; s.FullScreen = FullScreenCheckBox.Checked;
s.Wireframe = WireframeCheckBox.Checked; s.Wireframe = WireframeCheckBox.Checked;
s.Deferred = DeferredShadingCheckBox.Checked;
s.HDR = HDRRenderingCheckBox.Checked; s.HDR = HDRRenderingCheckBox.Checked;
s.Shadows = ShadowsCheckBox.Checked; s.Shadows = ShadowsCheckBox.Checked;
s.Skydome = SkydomeCheckBox.Checked; s.Skydome = SkydomeCheckBox.Checked;
@ -7258,6 +7260,14 @@ namespace CodeWalker
Renderer.renderchildents = ShowYmapChildrenCheckBox.Checked; Renderer.renderchildents = ShowYmapChildrenCheckBox.Checked;
} }
private void DeferredShadingCheckBox_CheckedChanged(object sender, EventArgs e)
{
lock (Renderer.RenderSyncRoot)
{
Renderer.shaders.deferred = DeferredShadingCheckBox.Checked;
}
}
private void HDRRenderingCheckBox_CheckedChanged(object sender, EventArgs e) private void HDRRenderingCheckBox_CheckedChanged(object sender, EventArgs e)
{ {
lock (Renderer.RenderSyncRoot) lock (Renderer.RenderSyncRoot)

View File

@ -240,14 +240,6 @@ ufo
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhP3ZC7DcAgDEQZKTMwHOvSIFriS7BlEB+HMic9 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhP3ZC7DcAgDEQZKTMwHOvSIFriS7BlEB+HMic9
QJbvFThLUkpXzjkSpaeuzMPlEELx3jdsBauyCHBY6UWYPQI93KEljQD3jL6EGzN6x0bASyNYwkKU8Udm QJbvFThLUkpXzjkSpaeuzMPlEELx3jdsBauyCHBY6UWYPQI93KEljQD3jL6EGzN6x0bASyNYwkKU8Udm
gd6TMnIikDJyIqjVNz8T7FgKrAwFX6lVinM3aJ05lWDPRRcAAAAASUVORK5CYII= gd6TMnIikDJyIqjVNz8T7FgKrAwFX6lVinM3aJ05lWDPRRcAAAAASUVORK5CYII=
</value>
</data>
<data name="ToolbarTransformSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2
CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f
wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="ToolbarObjectSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ToolbarObjectSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -269,13 +261,12 @@ ufo
WBXYx9R1nV75RuyHKrrnzCcGjE1u9ZyD4BugoZigQ9xrngAAAABJRU5ErkJggg== WBXYx9R1nV75RuyHKrrnzCcGjE1u9ZyD4BugoZigQ9xrngAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="ToolbarSnapButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ToolbarTransformSpaceButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB0SURBVDhP7ZNBCoAgEEXnSJ3BqxmetNpaMLhVv5DNRJS2
ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert CxIeuvA9XSjtg5mHEILPxB6U7JyLxphmSkDK1o5x9dst87SUfTXwRsYsA+paT0BGDGsVOJ92hdz3Bz4f
em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5 wGPC48uu7w5IGd+gBlpRMgYCnRwyESUj3CsQkYNFDwAAAABJRU5ErkJggg==
2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="ToolbarSnapToGroundButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ToolbarSnapToGroundButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -304,6 +295,15 @@ ufo
EcMw2DzPDMEke9AsYBrHs10vN4I1QqImwwDcFyMjQGaBHr5Bo8nEoYCnCQTGzVeI4oj6fIi+KHgoPBhC EcMw2DzPDMEke9AsYBrHs10vN4I1QqImwwDcFyMjQGaBHr5Bo8nEoYCnCQTGzVeI4oj6fIi+KHgoPBhC
4knCjTww9vxfbIUQNDEyiGIZ8t6tW/k0vC/AOpuiueNOLwVkUeylvju9FJCg8E1vM/2PlTv5UoervVTJ 4knCjTww9vxfbIUQNDEyiGIZ8t6tW/k0vC/AOpuiueNOLwVkUeylvju9FJCg8E1vM/2PlTv5UoervVTJ
uQAAAABJRU5ErkJggg== uQAAAABJRU5ErkJggg==
</value>
</data>
<data name="ToolbarSnapButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACtSURBVDhPrZBBEsIgEAR5Gy/wFV55T/wHr+KgHuCKNsVY
ZI2JiU7VVIVlp7OL+1mllIr7cb8Ie++PQwQYITnnM24NWxoBgsQYm/l+gk699bMsRA4h1JTSPsg0Xert
em/mGwh3vW1Z7MvIABSWqXG3+iZHAEw1m4wD49oVANgVOL/VeSgeDAiX1mpWeKy9BIQiI+OxWQF77tG5
2Fc729BmeElf/3lNhORe+oecewDObEqX49RqCgAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="ToolbarUndoButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ToolbarUndoButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -389,17 +389,6 @@ ufo
4BJN+IjGo5O8ZJndGVhKxpjWWts551aih0fre+0BLaVchRAezPB2NXSSV/gVwXGYPJiVUt6ns1ghCDjn 4BJN+IjGo5O8ZJndGVhKxpjWWts551aih0fre+0BLaVchRAezPB2NXSSV/gVwXGYPJiVUt6ns1ghCDjn
UQG86w3FToVgDcWCWS9Fvi/Ao0RVAcwUjwpyhzmf4n8BFApS5HZRwRuONGMbrIJ1JIN8O2QAAAAASUVO UQG86w3FToVgDcWCWS9Fvi/Ao0RVAcwUjwpyhzmf4n8BFApS5HZRwRuONGMbrIJ1JIN8O2QAAAAASUVO
RK5CYII= RK5CYII=
</value>
</data>
<data name="ToolbarCameraModeButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG
WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM
TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G
UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC
ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2
5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="ToolbarCameraPerspectiveButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ToolbarCameraPerspectiveButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -435,6 +424,17 @@ ufo
rp3fhGJScIRLzKMLFTC9cMIu3nCDVUyjB6WkYA93mEWbAyH9cMImPuA+rWMA31YwBU82kF6BS32Er/aO rp3fhGJScIRLzKMLFTC9cMIu3nCDVUyjB6WkYA93mEWbAyH9cMImPuA+rWMA31YwBU82kF6BS32Er/aO
M8zAh+OEghpcwQ2bg3uwBW8ewFd7xQkm0IA4oaAS7bh2KHjBIZbhV/D6GJkFphrdcIP8lFrAGPwPOjCO M8zAh+OEghpcwQ2bg3uwBW8ewFd7xQkm0IA4oaAS7bh2KHjBIZbhV/D6GJkFphrdcIP8lFrAGPwPOjCO
QdQiTqrAWNICd7gPnUj+xBKaU9dxfhTkjwV/FxU+AbsiGnc46OYIAAAAAElFTkSuQmCC QdQiTqrAWNICd7gPnUj+xBKaU9dxfhTkjwV/FxU+AbsiGnc46OYIAAAAAElFTkSuQmCC
</value>
</data>
<data name="ToolbarCameraModeButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEvSURBVDhP3dK/K0dRGMfxKxRJopCSEkLya/guUhQRmQwG
WfwIkYySgYUSKUKJlOK/MBoMFMofYLUIsfJ+f3NuF3+A8tRree5zP/fcc070f6oHT/jAPTqQj6WvXvCM
TZQgG3H58gFGcYVLtGIN15jBNDbwiGNUIg4pQx8GsQuHhrCDW8yjHyns4Q0DcCXpykM5bFzgHGPYxw1G
UIVMtMHfWUUj4nIg/KurGIYrSAZYOXDGlbhXcZlegUO8Yxzb+BlQAwNW0G0jVAYK0AwHtnCEOyQDZvGC
ObTbKIIvLMA9WIYDizhFMsDjfsAZptCA9JcdfoVBvryOSbgCe4HPTuCz+BQMKEUvJmCy96ET1ehCuAf2
5ZF+uwdZKEYtmuBGFSIXhtejBe5PHX7dxL+qKPoEppRHcXOtiDsAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<metadata name="SubtitleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="SubtitleTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">