Files
Sandbox/res/glsl/model_vertex.glsl
var 58289aa6b2 Import .glb model file with animation
- improve movement controls
- TODO: allow more than one model, instance, and animation
2026-04-19 21:31:31 -05:00

30 lines
810 B
GLSL

#version 450 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoord;
layout (location = 2) in ivec4 jointIndices;
layout (location = 3) in vec4 jointWeights;
out vec3 textureCoord;
uniform mat4 theModelMatrix;
uniform mat4 theViewMatrix;
uniform mat4 theProjMatrix;
uniform mat4 theJointMatrices[64];
uniform float texIndex;
void main()
{
mat4 skinMatrix =
jointWeights.x * theJointMatrices[jointIndices.x] +
jointWeights.y * theJointMatrices[jointIndices.y] +
jointWeights.z * theJointMatrices[jointIndices.z] +
jointWeights.w * theJointMatrices[jointIndices.w];
vec4 localPos = skinMatrix * vec4(position, 1.0);
mat4 mvp = theProjMatrix * theViewMatrix * theModelMatrix;
gl_Position = mvp * localPos;
textureCoord = vec3(texCoord.x, texCoord.y, texIndex);
}