game_kernel 0.1.0

A 3D game engine written entirely in rust
Documentation
#version 450

#include<skeletal.h>

layout(push_constant) uniform ProjectionData
{
    mat4 model;
    mat3x4 normal_matrix;
};

layout(location = 0) in vec3 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 uv;
layout(location = 3) in ivec4 affecting_bones_indices;
layout(location = 4) in vec4 weights;

layout(location = 0) out vec3 o_norm;
layout(location = 1) out vec2 o_uv;
layout(location = 2) out vec3 o_v;
layout(location = 3) out vec3 o_mpos;

layout(set = 1, binding = 0) buffer Projection
{
    mat4 view, 
         projection;
    uvec2 res;
}projection;

layout(set = 1, binding = 1) buffer PrevMvps 
{
    mat4 mvp;
}prev;

layout(set = 2, binding = 0) buffer Bones {
    Bone bones[];
} bones;

void main() {
    vec4 new_vertex = weights.x * transform_by_bone(vec4(position, 1.0), (bones.bones[affecting_bones_indices.x])) + 
                      weights.y * transform_by_bone(vec4(position, 1.0), (bones.bones[affecting_bones_indices.y])) +
                      weights.z * transform_by_bone(vec4(position, 1.0), (bones.bones[affecting_bones_indices.z])) +
                      weights.w * transform_by_bone(vec4(position, 1.0), (bones.bones[affecting_bones_indices.w]));

    o_norm = mat3(normal_matrix) * normal;
    o_norm =         (weights.x * transform_normal_by_bone(vec4(o_norm, 0.0), (bones.bones[affecting_bones_indices.x])) + 
                      weights.y * transform_normal_by_bone(vec4(o_norm, 0.0), (bones.bones[affecting_bones_indices.y])) +
                      weights.z * transform_normal_by_bone(vec4(o_norm, 0.0), (bones.bones[affecting_bones_indices.z])) +
                      weights.w * transform_normal_by_bone(vec4(o_norm, 0.0), (bones.bones[affecting_bones_indices.w]))).xyz;

    o_uv = uv;

    mat4 mvp = projection.projection * projection.view * model;
    gl_Position = mvp * vec4(new_vertex.xyz, 1.0);

    o_mpos = new_vertex.xyz;

    vec4 camera = inverse(mvp)*vec4(0.0, 0.0, 0.0, 1.0);
    camera.xyz /= camera.w; //not necessary
    o_v = camera.xyz - new_vertex.xyz;

}