40 lines
901 B
GLSL
40 lines
901 B
GLSL
#version 430 core
|
|
|
|
layout (location = 0) in vec3 Position;
|
|
layout (location = 1) in vec3 Normal;
|
|
layout (location = 2) in vec2 Texture;
|
|
layout (location = 3) in ivec4 BlendIndices;
|
|
layout (location = 4) in vec4 BlendWeight;
|
|
|
|
layout (location = 0) uniform mat4 Transform;
|
|
layout (location = 1) uniform mat4 WorldTransform;
|
|
|
|
layout (std140, binding = 0) uniform JointsLayout
|
|
{
|
|
mat4 Joints[64];
|
|
};
|
|
|
|
out VS_OUT {
|
|
vec3 Position;
|
|
vec3 Normal;
|
|
vec2 Texture;
|
|
} vs_out;
|
|
|
|
void main()
|
|
{
|
|
mat4 skin
|
|
= BlendWeight.x * Joints[BlendIndices.x]
|
|
+ BlendWeight.y * Joints[BlendIndices.y]
|
|
+ BlendWeight.z * Joints[BlendIndices.z]
|
|
+ BlendWeight.w * Joints[BlendIndices.w]
|
|
;
|
|
|
|
vec4 position = skin * vec4(Position, 1);
|
|
|
|
vs_out.Position = (WorldTransform * position).xyz;
|
|
vs_out.Normal = Normal;
|
|
vs_out.Texture = vec2(Texture.x, 1.0 - Texture.y);
|
|
|
|
gl_Position = Transform * position;
|
|
}
|