Fix how loading works before clenaup.

This commit is contained in:
Zed A. Shaw 2026-10-08 14:34:08 -04:00
parent 6d21b7f163
commit a629e16fe2
7 changed files with 19 additions and 15 deletions

View file

@ -2,7 +2,8 @@
#include "model.hpp"
#include "assimp_glm_helpers.hpp"
Animation::Animation(const std::string& animationPath, Model *model) {
Animation::Animation(Model *model) {
std::string animationPath = model->directory + "/" + model->model_path;
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(animationPath, aiProcess_Triangulate);

View file

@ -26,7 +26,7 @@ struct Animation {
Animation() = default;
Animation(const std::string& animationPath, Model *model);
Animation(Model *model);
~Animation() {}

View file

@ -70,4 +70,7 @@ void Mesh::setup_mesh() {
// bone weights
glEnableVertexAttribArray(6);
glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, weights));
glEnableVertexAttribArray(7);
glVertexAttribIPointer(7, 1, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, bone_count));
}

View file

@ -132,7 +132,6 @@ void Model::SetVertexBoneData(Vertex& vertex, int boneID, float weight)
}
void Model::ExtractBoneWeightForVertices(std::vector<Vertex>& vertices, aiMesh *mesh, const aiScene* scene) {
for(size_t boneIndex = 0; boneIndex < mesh->mNumBones; ++boneIndex) {
int boneID = -1;
std::string bone_name = mesh->mBones[boneIndex]->mName.C_Str();

View file

@ -88,7 +88,7 @@ struct Scene {
if(thing.animate) {
// LEAK! Just temporary until I can clean up the original code
anim = new Animation(model.model_path, &model);
anim = new Animation(&model);
// WARNING! Only works with one right now
animator.PlayAnimation(anim);
}