Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in article 2020/Skeletal-Animation #404

Open
elmarsan opened this issue Oct 24, 2024 · 8 comments
Open

Errors in article 2020/Skeletal-Animation #404

elmarsan opened this issue Oct 24, 2024 · 8 comments

Comments

@elmarsan
Copy link
Contributor

elmarsan commented Oct 24, 2024

Couple of things I've notice:

  • This method signature is wrong: void ExtractBoneWeightForVertices(std::vector& vertices, aiMesh* mesh, const aiScene* scene) The first parameter should be: std::vector<Vertex>&
  • The snippet of code to be added in setupMesh contains couple of minor errors:
class Mesh
{
    ...
    
    void setupMesh()
    {
        ....

        // FIX
        // The last vertex attribute at this point if the number 4. (Bitangent)
        // So next attributes should be 5 and 6 respectively.
        
        //  ids
        glEnableVertexAttribArray(3);
        glVertexAttribIPointer(3, 4, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, m_BoneIDs));

        // weights
        glEnableVertexAttribArray(4);
        glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), 
            (void*)offsetof(Vertex, m_Weights));   
  
        ...
    }    
    ...
}
@elmarsan
Copy link
Contributor Author

Another one:

  • In the article and code snippets you can find heirarchy rather than Hierarchy

@elmarsan
Copy link
Contributor Author

elmarsan commented Oct 24, 2024

Wrong method name (Related with previous one):

  • ReadHeirarchyData -> ReadHierarchyData

@elmarsan
Copy link
Contributor Author

Qualified name is not allowed in method declaration:

  • Bone class is header based, hence this method is wrong: glm::mat4 Bone::InterpolateScaling(float animationTime), the correct version is: glm::mat4 InterpolateScaling(float animationTime)

@elmarsan
Copy link
Contributor Author

Qualified name is not allowed in method declaration:

  • Bone class is header based, hence this method is wrong: glm::mat4 Bone::InterpolateScaling(float animationTime), the correct version is: glm::mat4 InterpolateScaling(float animationTime)

Same is happening in Animator header class, all methods are using the qualified name.

@elmarsan
Copy link
Contributor Author

  • Vertex shader snippet uses 430 core version

@elmarsan
Copy link
Contributor Author

  • Animation class doesn't need default constructor

@elmarsan
Copy link
Contributor Author

  • Animation empty destructor

@elmarsan
Copy link
Contributor Author

  • Extra code in Animation constructor
Animation(const std::string& animationPath, Model* model)
	{
		Assimp::Importer importer;
		const aiScene* scene = importer.ReadFile(animationPath, aiProcess_Triangulate);
		assert(scene && scene->mRootNode);
		auto animation = scene->mAnimations[0];
		m_Duration = animation->mDuration;
		m_TicksPerSecond = animation->mTicksPerSecond;
                // Redundant line
		aiMatrix4x4 globalTransformation = scene->mRootNode->mTransformation;
                // Redundant line
		globalTransformation = globalTransformation.Inverse();
		ReadHierarchyData(m_RootNode, scene->mRootNode);
		ReadMissingBones(animation, *model);
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant