Move some things around to prepare for multiple pipelines
This commit is contained in:
1 parent
ea82627695
commit
c24d3f4f27
5 files changed
+180
-179
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
layout(location = 1) in vec3 normal;
|
||||
layout(location = 2) in uvec4 bone_indices;
|
||||
layout(location = 3) in vec4 weights;
|
||||
|
||||
layout(location = 0) out vec3 frag_normal;
|
||||
|
||||
layout(push_constant) uniform vp_t {
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
} vp;
|
||||
|
||||
layout(binding = 0) uniform transform_t {
|
||||
mat4 model;
|
||||
} transform;
|
||||
|
||||
layout(binding = 1) uniform skeleton_t {
|
||||
mat4 matrices[32];
|
||||
} bones;
|
||||
|
||||
void main() {
|
||||
const mat4 skinning_matrix
|
||||
= weights.x * bones.matrices[bone_indices.x]
|
||||
+ weights.y * bones.matrices[bone_indices.y]
|
||||
+ weights.z * bones.matrices[bone_indices.z]
|
||||
+ weights.w * bones.matrices[bone_indices.w];
|
||||
gl_Position = vp.proj * vp.view * transform.model * skinning_matrix
|
||||
* vec4(position, 1.0);
|
||||
frag_normal = transpose(
|
||||
inverse(mat3(transform.model * skinning_matrix))) * normal;
|
||||
}
|
||||
Reference in new issue
Block a user