Removed last traces of old skeletal animation sample

This commit is contained in:
Sascha Willems 2020-06-06 14:32:28 +02:00
parent 2589566364
commit b0b299ee9c
18 changed files with 0 additions and 1313 deletions

View file

@ -1,26 +0,0 @@
// Copyright 2020 Google LLC
Texture2D textureColorMap : register(t1);
SamplerState samplerColorMap : register(s1);
struct VSOutput
{
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float3 Color : COLOR0;
[[vk::location(2)]] float2 UV : TEXCOORD0;
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
};
float4 main(VSOutput input) : SV_TARGET
{
float4 color = textureColorMap.Sample(samplerColorMap, input.UV) * float4(input.Color, 1.0);
float3 N = normalize(input.Normal);
float3 L = normalize(input.LightVec);
float3 V = normalize(input.ViewVec);
float3 R = reflect(-L, N);
float3 diffuse = max(dot(N, L), 0.1) * float3(1.0, 1.0, 1.0) * input.Color;
float3 specular = pow(max(dot(R, V), 0.0), 32.0) * float3(0.5, 0.5, 0.5);
return float4(diffuse * color.rgb + specular, 1.0);
}

View file

@ -1,55 +0,0 @@
// Copyright 2020 Google LLC
struct VSInput
{
[[vk::location(0)]] float3 Pos : POSITION0;
[[vk::location(1)]] float3 Normal : NORMAL0;
[[vk::location(2)]] float2 UV : TEXCOORD0;
[[vk::location(3)]] float3 Color : COLOR0;
[[vk::location(4)]] float4 BoneWeights : TEXCOORD1;
[[vk::location(5)]] int4 BoneIDs : TEXCOORD2;
};
#define MAX_BONES 64
struct UBO
{
float4x4 projection;
float4x4 view;
float4x4 model;
float4x4 bones[MAX_BONES];
float4 lightPos;
float4 viewPos;
};
cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float3 Color : COLOR0;
[[vk::location(2)]] float2 UV : TEXCOORD0;
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
};
VSOutput main(VSInput input)
{
VSOutput output = (VSOutput)0;
float4x4 boneTransform = ubo.bones[input.BoneIDs[0]] * input.BoneWeights[0];
boneTransform += ubo.bones[input.BoneIDs[1]] * input.BoneWeights[1];
boneTransform += ubo.bones[input.BoneIDs[2]] * input.BoneWeights[2];
boneTransform += ubo.bones[input.BoneIDs[3]] * input.BoneWeights[3];
output.Color = input.Color;
output.UV = input.UV;
output.Pos = mul(ubo.projection, mul(ubo.view, mul(ubo.model, mul(boneTransform, float4(input.Pos.xyz, 1.0)))));
float4 pos = mul(ubo.model, float4(input.Pos, 1.0));
output.Normal = mul((float3x3)(boneTransform), input.Normal);
output.LightVec = ubo.lightPos.xyz - pos.xyz;
output.ViewVec = ubo.viewPos.xyz - pos.xyz;
return output;
}

View file

@ -1,31 +0,0 @@
// Copyright 2020 Google LLC
Texture2D textureColorMap : register(t1);
SamplerState samplerColorMap : register(s1);
struct VSOutput
{
[[vk::location(0)]] float2 UV : TEXCOORD0;
[[vk::location(1)]] float3 Normal : NORMAL0;
[[vk::location(2)]] float3 ViewVec : TEXCOORD1;
[[vk::location(3)]] float3 LightVec : TEXCOORD2;
};
float4 main(VSOutput input) : SV_TARGET
{
float4 color = textureColorMap.Sample(samplerColorMap, input.UV);
float distSqr = dot(input.LightVec, input.LightVec);
float3 lVec = input.LightVec * rsqrt(distSqr);
const float attInvRadius = 1.0/5000.0;
float atten = max(clamp(1.0 - attInvRadius * sqrt(distSqr), 0.0, 1.0), 0.0);
// Fake drop shadow
const float shadowInvRadius = 1.0/2500.0;
float dropshadow = max(clamp(1.0 - shadowInvRadius * sqrt(distSqr), 0.0, 1.0), 0.0);
float4 outFragColor = float4(color.rgba * (1.0 - dropshadow));
outFragColor.rgb *= atten;
return outFragColor;
}

View file

@ -1,42 +0,0 @@
// Copyright 2020 Google LLC
struct VSInput
{
[[vk::location(0)]] float3 Pos : POSITION0;
[[vk::location(1)]] float3 Normal : NORMAL0;
[[vk::location(2)]] float2 UV : TEXCOORD0;
};
struct UBO
{
float4x4 projection;
float4x4 view;
float4x4 model;
float4 lightPos;
float4 viewPos;
float2 uvOffset;
};
cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float2 UV : TEXCOORD0;
[[vk::location(1)]] float3 Normal : NORMAL0;
[[vk::location(2)]] float3 ViewVec : TEXCOORD1;
[[vk::location(3)]] float3 LightVec : TEXCOORD2;
};
VSOutput main(VSInput input)
{
VSOutput output = (VSOutput)0;
output.UV = input.UV + ubo.uvOffset;
float4 pos = float4(input.Pos, 1.0);
output.Pos = mul(ubo.projection, mul(ubo.view, mul(ubo.model, pos)));
output.Normal = input.Normal;
output.LightVec = ubo.lightPos.xyz - pos.xyz;
output.ViewVec = ubo.viewPos.xyz - pos.xyz;
return output;
}