Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
40edfca
Add animation system with skeleton and bone support
AhmedAmrNabil Apr 19, 2026
b40260a
fix(animation): fix inlcudes
AhmedAmrNabil Apr 19, 2026
bb9b437
feat(animation): implement skinned animation support in vertex shader
AhmedAmrNabil Apr 19, 2026
3ab4f38
refactor(animation): update animation system and remove skeleton.cpp
AhmedAmrNabil Apr 19, 2026
bdb5761
feat(animation): enhance animation system with node animation support…
AhmedAmrNabil Apr 19, 2026
ecd4212
refactor(animation): update processNode to use pointer for skeleton n…
AhmedAmrNabil Apr 20, 2026
517875f
fix(animation): correct isFinished logic to account for looping anima…
AhmedAmrNabil Apr 20, 2026
4b8b7fe
feat(animation): enhance animation system with clip management and sp…
AhmedAmrNabil Apr 20, 2026
f267da5
refactor(animation): clean up bones uniform buffer management and rem…
AhmedAmrNabil Apr 23, 2026
6e8a90a
fix(animation): optimize bone transformation calculation by reusing g…
AhmedAmrNabil Apr 23, 2026
7d1ad58
perf(model): add optimize graph flag
AhmedAmrNabil Apr 23, 2026
d6bd17b
fix(animation): handle left-handed axis Y up models
AhmedAmrNabil Apr 23, 2026
3be5776
fix(c_cpp_properties): add include paths for animator.hpp bug
AhmedAmrNabil Apr 23, 2026
4269243
feat(animation): add new enemy model and animations for 'mundo'
AhmedAmrNabil Apr 23, 2026
54d9411
feat(animation): add new enemy models and animations for 'shaco' and …
AhmedAmrNabil Apr 23, 2026
40d113a
refactor(animation): simplify BoneAnimation constructor by removing B…
AhmedAmrNabil Apr 23, 2026
8a1d792
feat(animation): enhance model loading to support animations and upda…
AhmedAmrNabil Apr 23, 2026
5921e33
chore: fix compilation error
AhmedAmrNabil Apr 23, 2026
8da8596
feat(animation): add playDuration method to AnimationComponent for ti…
AhmedAmrNabil Apr 23, 2026
33d1ffc
refactor(animation): remove unused includes from animation-system.hpp
AhmedAmrNabil Apr 23, 2026
7c6127b
refactor(model): remove unused scene parameter from processVertexBone…
AhmedAmrNabil Apr 23, 2026
8c1f1bb
refactor(uniform-buffer): disable copying of UniformBuffer class
AhmedAmrNabil Apr 23, 2026
2b95d9c
refactor(uniform-buffer): add assertions for input validation in Unif…
AhmedAmrNabil Apr 23, 2026
bd377a3
refactor(animation): clear ununsed enemy definitions in playground co…
AhmedAmrNabil Apr 23, 2026
c233089
fix(model): set global inverse transform for skeleton when animations…
AhmedAmrNabil Apr 23, 2026
1a7e1c6
fix(animator): include cmath for std::fmod usage
AhmedAmrNabil Apr 23, 2026
07cc3e5
fix(animator): update MAX_BONES definition to modern c++ and change t…
AhmedAmrNabil Apr 23, 2026
ceb6521
fix(animation): enhance key interpolation to handle empty vectors and…
AhmedAmrNabil Apr 23, 2026
b4eda4f
feat(shader): add getUniformBlockBinding caching
AhmedAmrNabil Apr 23, 2026
50fc0ca
fix(animation): initialize model and defaultClip to avoid uninitializ…
AhmedAmrNabil Apr 23, 2026
1b723bf
feat(renderer): optimize bone matrix updates by caching last uploaded…
AhmedAmrNabil Apr 23, 2026
b5ceebb
feat(animation): enhance play method to support force restart and imp…
AhmedAmrNabil Apr 24, 2026
d43f80b
fix(animation): ensure animator updates before checking if animation …
AhmedAmrNabil Apr 24, 2026
9fc45d6
fix(animation): correct isFinished logic to account for looping anima…
AhmedAmrNabil Apr 24, 2026
62ca883
fix(animation): use findBone instead of manual reading from animation…
AhmedAmrNabil Apr 24, 2026
c540d7c
fix(model): fix cache key for model texture
AhmedAmrNabil Apr 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
"browse": {
"path": ["${workspaceFolder}/src", "${workspaceFolder}/vendor"]
},
"defines": ["COLLISION_DEBUG_DRAW"]
"defines": ["COLLISION_DEBUG_DRAW"],
"includePath": [
"src/common",
"src/game",
"src/states",
"vendor/bullet3/src",
"vendor/imgui",
"vendor/imgui/imgui_impl",
"vendor/glad/include",
"vendor/glm",
"vendor/utils"
]
}
],
"version": 4
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ add_executable(${PROJECT_NAME}
src/common/components/free-camera-controller.cpp
src/common/components/movement.cpp
src/common/components/light.cpp
src/common/components/animation.cpp

src/game/components/collider.cpp
src/game/components/enemy.cpp
Expand All @@ -272,6 +273,7 @@ add_executable(${PROJECT_NAME}

src/common/systems/forward-renderer.cpp
src/common/systems/audio-system.cpp
src/common/systems/animation-system.cpp

src/common/audio/audio-utils.cpp
src/common/components/audio-source.cpp
Expand Down
Binary file added assets/gltf/enemies/mundo.glb
Binary file not shown.
Binary file added assets/gltf/enemies/shaco.glb
Binary file not shown.
Binary file added assets/gltf/enemies/yummi.glb
Binary file not shown.
46 changes: 38 additions & 8 deletions assets/shaders/lit.vert
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,54 @@ out Varyings {
mat3 TBN;
} vs_out;

#define MAX_BONES 128
uniform mat4 transform;
uniform mat4 model;
layout(std140) uniform Bones {
mat4 bones[MAX_BONES];
};
uniform bool hasBones;

void main() {
gl_Position = transform * vec4(position, 1.0);
vec4 skinnedPosition = vec4(0.0);
vec3 skinnedNormal = vec3(0.0);
vec3 skinnedTangent = vec3(0.0);
float totalWeight = 0.0;

if(hasBones) {
for(int i = 0; i < 4; i++) {
if (bone_ids[i] < 0 || bone_ids[i] >= MAX_BONES)
continue;
mat4 boneMatrix = bones[bone_ids[i]];
float weight = weights[i];
totalWeight += weight;

skinnedPosition += weight * (boneMatrix * vec4(position, 1.0));
skinnedNormal += weight * (mat3(boneMatrix) * normal);
skinnedTangent += weight * (mat3(boneMatrix) * tangent.xyz);
}
if (totalWeight <= 0.0) {
skinnedPosition = vec4(position, 1.0);
skinnedNormal = normal;
skinnedTangent = tangent.xyz;
}
} else {
skinnedPosition = vec4(position, 1.0);
skinnedNormal = normal;
skinnedTangent = tangent.xyz;
}

gl_Position = transform * skinnedPosition;
vs_out.worldPos = vec3(model * skinnedPosition);
vs_out.color = color;
vs_out.tex_coord = tex_coord;
vs_out.worldPos = vec3(model * vec4(position, 1.0));

// normal matrix — handles non-uniform scaling correctly
mat3 normalMatrix = transpose(inverse(mat3(model)));
vec3 N = normalize(normalMatrix * normal);
vec3 N = normalize(normalMatrix * skinnedNormal);
vs_out.worldNormal = N;

// TBN matrix for normal mapping
vec3 T = normalize(normalMatrix * tangent.xyz);
T = normalize(T - dot(T, N) * N); // re-orthogonalize
vec3 B = cross(N, T) * tangent.w; // bitangent with handedness
vec3 T = normalize(normalMatrix * skinnedTangent);
T = normalize(T - dot(T, N) * N);
vec3 B = cross(N, T) * tangent.w;
vs_out.TBN = mat3(T, B, N);
}
Loading
Loading