Merge branch 'SaschaWillems:master' into master
This commit is contained in:
commit
a867ca2809
109 changed files with 2298 additions and 642 deletions
|
|
@ -24,7 +24,7 @@ float4 main(VSOutput input) : SV_TARGET
|
|||
float3 N = normalize(input.Normal);
|
||||
float3 L = normalize(input.LightVec);
|
||||
float3 V = normalize(input.ViewVec);
|
||||
float3 R = reflect(-L, N);
|
||||
float3 R = reflect(L, N);
|
||||
float3 diffuse = max(dot(N, L), 0.0) * input.Color;
|
||||
float3 specular = pow(max(dot(R, V), 0.0), 16.0) * float3(0.75, 0.75, 0.75);
|
||||
return float4(diffuse * color.rgb + specular, 1.0);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -13,6 +13,7 @@ struct UBO
|
|||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4 lightPos;
|
||||
float4 viewPos;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
|
@ -42,8 +43,7 @@ VSOutput main(VSInput input)
|
|||
|
||||
float4 pos = mul(ubo.view, float4(input.Pos, 1.0));
|
||||
output.Normal = mul((float3x3)ubo.view, input.Normal);
|
||||
float3 lPos = mul((float3x3)ubo.view, ubo.lightPos.xyz);
|
||||
output.LightVec = lPos - pos.xyz;
|
||||
output.ViewVec = -pos.xyz;
|
||||
output.LightVec = ubo.lightPos.xyz - pos.xyz;
|
||||
output.ViewVec = ubo.viewPos.xyz - pos.xyz;
|
||||
return output;
|
||||
}
|
||||
Binary file not shown.
|
|
@ -5,8 +5,7 @@ SamplerState samplerColor : register(s1);
|
|||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float4 ProjCoord : POSITION0;
|
||||
[[vk::location(0)]] float4 ProjCoord : POSITION0;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input, bool FrontFacing : SV_IsFrontFace) : SV_TARGET
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -3,7 +3,6 @@
|
|||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float3 Pos : POSITION0;
|
||||
[[vk::location(1)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct UBO
|
||||
|
|
@ -18,14 +17,12 @@ cbuffer ubo : register(b0) { UBO ubo; }
|
|||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float4 ProjCoord : POSITION0;
|
||||
[[vk::location(0)]] float4 ProjCoord : POSITION0;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.UV = input.UV;
|
||||
output.ProjCoord = mul(ubo.projection, mul(ubo.view, mul(ubo.model, float4(input.Pos.xyz, 1.0))));
|
||||
output.Pos = output.ProjCoord;
|
||||
return output;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -3,19 +3,30 @@
|
|||
Texture2D textureColor : register(t1);
|
||||
SamplerState samplers[3] : register(s2);
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4x4 model;
|
||||
float4 viewPos;
|
||||
float lodBias;
|
||||
int samplerIndex;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float LodBias : TEXCOORD3;
|
||||
[[vk::location(2)]] int SamplerIndex : TEXCOORD4;
|
||||
[[vk::location(3)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(4)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(5)]] float3 LightVec : TEXCOORD2;
|
||||
[[vk::location(2)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
float4 color = textureColor.Sample(samplers[input.SamplerIndex], input.UV, int2(0, 0), input.LodBias);
|
||||
float4 color = textureColor.Sample(samplers[ubo.samplerIndex], input.UV, int2(0, 0), input.LodBias);
|
||||
|
||||
float3 N = normalize(input.Normal);
|
||||
float3 L = normalize(input.LightVec);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -24,10 +24,9 @@ struct VSOutput
|
|||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(1)]] float LodBias : TEXCOORD3;
|
||||
[[vk::location(2)]] int SamplerIndex : TEXCOORD4;
|
||||
[[vk::location(3)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(4)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(5)]] float3 LightVec : TEXCOORD2;
|
||||
[[vk::location(2)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
|
|
@ -35,7 +34,6 @@ VSOutput main(VSInput input)
|
|||
VSOutput output = (VSOutput)0;
|
||||
output.UV = input.UV * float2(2.0, 1.0);
|
||||
output.LodBias = ubo.lodBias;
|
||||
output.SamplerIndex = ubo.samplerIndex;
|
||||
|
||||
float3 worldPos = mul(ubo.model, float4(input.Pos, 1.0)).xyz;
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue