Import .glb model file with animation
- improve movement controls - TODO: allow more than one model, instance, and animation
This commit is contained in:
29
res/glsl/model_vertex.glsl
Normal file
29
res/glsl/model_vertex.glsl
Normal file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
}
|
||||
BIN
res/model/human.glb
Normal file
BIN
res/model/human.glb
Normal file
Binary file not shown.
Reference in New Issue
Block a user