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

Uses assimp for loading bvh animations #425

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
16 changes: 14 additions & 2 deletions graphics/src/Skeleton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*
*/
#include <list>
#include "gz/common/AssimpLoader.hh"
#include <gz/common/Console.hh>
#include "gz/common/Mesh.hh"
#include <gz/common/SkeletonAnimation.hh>
#include <gz/common/Skeleton.hh>
#include <gz/common/BVHLoader.hh>
Expand Down Expand Up @@ -62,6 +64,10 @@ class gz::common::Skeleton::Implementation
/// * Skeleton node names from animation
/// * Transformations to rotate
public: std::vector<std::map<std::string, math::Matrix4d>> alignRotate;

/// \brief 3D mesh loader for Assimp assets (others)
public: AssimpLoader assimpLoader;

};

//////////////////////////////////////////////////
Expand Down Expand Up @@ -339,8 +345,14 @@ void Skeleton::AddAnimation(SkeletonAnimation *_anim)
//////////////////////////////////////////////////
bool Skeleton::AddBvhAnimation(const std::string &_bvhFile, double _scale)
{
BVHLoader loader;
auto skel = loader.Load(_bvhFile, _scale);

Mesh *mesh = this->dataPtr->assimpLoader.Load(_bvhFile);

if (mesh == nullptr)
return false;

auto skel = mesh->MeshSkeleton();

if (nullptr == skel)
return false;

Expand Down