Removed last traces of old skeletal animation sample
This commit is contained in:
parent
2589566364
commit
b0b299ee9c
18 changed files with 0 additions and 1313 deletions
|
|
@ -1,24 +0,0 @@
|
||||||
#version 450
|
|
||||||
|
|
||||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
|
||||||
|
|
||||||
layout (location = 0) in vec3 inNormal;
|
|
||||||
layout (location = 1) in vec3 inColor;
|
|
||||||
layout (location = 2) in vec2 inUV;
|
|
||||||
layout (location = 3) in vec3 inViewVec;
|
|
||||||
layout (location = 4) in vec3 inLightVec;
|
|
||||||
|
|
||||||
layout (location = 0) out vec4 outFragColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 color = texture(samplerColorMap, inUV) * vec4(inColor, 1.0);
|
|
||||||
|
|
||||||
vec3 N = normalize(inNormal);
|
|
||||||
vec3 L = normalize(inLightVec);
|
|
||||||
vec3 V = normalize(inViewVec);
|
|
||||||
vec3 R = reflect(-L, N);
|
|
||||||
vec3 diffuse = max(dot(N, L), 0.1) * vec3(1.0) * inColor;
|
|
||||||
vec3 specular = pow(max(dot(R, V), 0.0), 32.0) * vec3(0.5);
|
|
||||||
outFragColor = vec4(diffuse * color.rgb + specular, 1.0);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,49 +0,0 @@
|
||||||
#version 450
|
|
||||||
|
|
||||||
layout (location = 0) in vec3 inPos;
|
|
||||||
layout (location = 1) in vec3 inNormal;
|
|
||||||
layout (location = 2) in vec2 inUV;
|
|
||||||
layout (location = 3) in vec3 inColor;
|
|
||||||
layout (location = 4) in vec4 inBoneWeights;
|
|
||||||
layout (location = 5) in ivec4 inBoneIDs;
|
|
||||||
|
|
||||||
#define MAX_BONES 64
|
|
||||||
|
|
||||||
layout (binding = 0) uniform UBO
|
|
||||||
{
|
|
||||||
mat4 projection;
|
|
||||||
mat4 view;
|
|
||||||
mat4 model;
|
|
||||||
mat4 bones[MAX_BONES];
|
|
||||||
vec4 lightPos;
|
|
||||||
vec4 viewPos;
|
|
||||||
} ubo;
|
|
||||||
|
|
||||||
layout (location = 0) out vec3 outNormal;
|
|
||||||
layout (location = 1) out vec3 outColor;
|
|
||||||
layout (location = 2) out vec2 outUV;
|
|
||||||
layout (location = 3) out vec3 outViewVec;
|
|
||||||
layout (location = 4) out vec3 outLightVec;
|
|
||||||
|
|
||||||
out gl_PerVertex
|
|
||||||
{
|
|
||||||
vec4 gl_Position;
|
|
||||||
};
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
mat4 boneTransform = ubo.bones[inBoneIDs[0]] * inBoneWeights[0];
|
|
||||||
boneTransform += ubo.bones[inBoneIDs[1]] * inBoneWeights[1];
|
|
||||||
boneTransform += ubo.bones[inBoneIDs[2]] * inBoneWeights[2];
|
|
||||||
boneTransform += ubo.bones[inBoneIDs[3]] * inBoneWeights[3];
|
|
||||||
|
|
||||||
outColor = inColor;
|
|
||||||
outUV = inUV;
|
|
||||||
|
|
||||||
gl_Position = ubo.projection * ubo.view * ubo.model * boneTransform * vec4(inPos.xyz, 1.0);
|
|
||||||
|
|
||||||
vec4 pos = ubo.model * vec4(inPos, 1.0);
|
|
||||||
outNormal = mat3(boneTransform) * inNormal;
|
|
||||||
outLightVec = ubo.lightPos.xyz - pos.xyz;
|
|
||||||
outViewVec = ubo.viewPos.xyz - pos.xyz;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,28 +0,0 @@
|
||||||
#version 450
|
|
||||||
|
|
||||||
layout (binding = 1) uniform sampler2D samplerColorMap;
|
|
||||||
|
|
||||||
layout (location = 0) in vec2 inUV;
|
|
||||||
layout (location = 1) in vec3 inNormal;
|
|
||||||
layout (location = 2) in vec3 inViewVec;
|
|
||||||
layout (location = 3) in vec3 inLightVec;
|
|
||||||
|
|
||||||
layout (location = 0) out vec4 outFragColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 color = texture(samplerColorMap, inUV);
|
|
||||||
|
|
||||||
float distSqr = dot(inLightVec, inLightVec);
|
|
||||||
vec3 lVec = inLightVec * inversesqrt(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);
|
|
||||||
|
|
||||||
outFragColor = vec4(color.rgba * (1.0 - dropshadow));
|
|
||||||
outFragColor.rgb *= atten;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,36 +0,0 @@
|
||||||
#version 450
|
|
||||||
|
|
||||||
layout (location = 0) in vec3 inPos;
|
|
||||||
layout (location = 1) in vec3 inNormal;
|
|
||||||
layout (location = 2) in vec2 inUV;
|
|
||||||
|
|
||||||
layout (binding = 0) uniform UBO
|
|
||||||
{
|
|
||||||
mat4 projection;
|
|
||||||
mat4 view;
|
|
||||||
mat4 model;
|
|
||||||
vec4 lightPos;
|
|
||||||
vec4 viewPos;
|
|
||||||
vec2 uvOffset;
|
|
||||||
} ubo;
|
|
||||||
|
|
||||||
layout (location = 0) out vec2 outUV;
|
|
||||||
layout (location = 1) out vec3 outNormal;
|
|
||||||
layout (location = 2) out vec3 outViewVec;
|
|
||||||
layout (location = 3) out vec3 outLightVec;
|
|
||||||
|
|
||||||
out gl_PerVertex
|
|
||||||
{
|
|
||||||
vec4 gl_Position;
|
|
||||||
};
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
outUV = inUV + ubo.uvOffset;
|
|
||||||
vec4 pos = vec4(inPos, 1.0);
|
|
||||||
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(pos);
|
|
||||||
|
|
||||||
outNormal = inNormal;
|
|
||||||
outLightVec = ubo.lightPos.xyz - pos.xyz;
|
|
||||||
outViewVec = ubo.viewPos.xyz - pos.xyz;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -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);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -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;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -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;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -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;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -100,7 +100,6 @@ set(EXAMPLES
|
||||||
shadowmapping
|
shadowmapping
|
||||||
shadowmappingomni
|
shadowmappingomni
|
||||||
shadowmappingcascade
|
shadowmappingcascade
|
||||||
skeletalanimation
|
|
||||||
specializationconstants
|
specializationconstants
|
||||||
sphericalenvmapping
|
sphericalenvmapping
|
||||||
ssao
|
ssao
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue