Adjust irrlicht CSkinnedMesh class for .spm
The last frame in .spm is usable
This commit is contained in:
parent
2161efd9c4
commit
3607c7d520
@ -68,7 +68,7 @@ namespace scene
|
|||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CSkinnedMesh::CSkinnedMesh()
|
CSkinnedMesh::CSkinnedMesh()
|
||||||
: SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
|
: AnimationFrames(0.f), SkinningBuffers(0), FramesPerSecond(25.f),
|
||||||
LastAnimatedFrame(-1), SkinnedLastFrame(false),
|
LastAnimatedFrame(-1), SkinnedLastFrame(false),
|
||||||
InterpolationMode(EIM_LINEAR),
|
InterpolationMode(EIM_LINEAR),
|
||||||
HasAnimation(false), PreparedForSkinning(false),
|
HasAnimation(false), PreparedForSkinning(false),
|
||||||
|
@ -175,6 +175,8 @@ namespace scene
|
|||||||
|
|
||||||
u32 getTotalJoints() const { return m_total_joints; }
|
u32 getTotalJoints() const { return m_total_joints; }
|
||||||
|
|
||||||
|
f32 AnimationFrames;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void toStaticPose();
|
void toStaticPose();
|
||||||
|
|
||||||
@ -215,7 +217,6 @@ private:
|
|||||||
|
|
||||||
core::aabbox3d<f32> BoundingBox;
|
core::aabbox3d<f32> BoundingBox;
|
||||||
|
|
||||||
f32 AnimationFrames;
|
|
||||||
f32 FramesPerSecond;
|
f32 FramesPerSecond;
|
||||||
|
|
||||||
f32 LastAnimatedFrame;
|
f32 LastAnimatedFrame;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
#include "utils/mini_glm.hpp"
|
#include "utils/mini_glm.hpp"
|
||||||
|
|
||||||
|
#include "../../lib/irrlicht/source/Irrlicht/CSkinnedMesh.h"
|
||||||
const uint8_t VERSION_NOW = 1;
|
const uint8_t VERSION_NOW = 1;
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -47,7 +48,7 @@ scene::IAnimatedMesh* SPMeshLoader::createMesh(io::IReadFile* f)
|
|||||||
}
|
}
|
||||||
m_bind_frame = 0;
|
m_bind_frame = 0;
|
||||||
m_joint_count = 0;
|
m_joint_count = 0;
|
||||||
//m_frame_count = 0;
|
m_frame_count = 0;
|
||||||
m_mesh = NULL;
|
m_mesh = NULL;
|
||||||
m_mesh = m_scene_manager->createSkinnedMesh();
|
m_mesh = m_scene_manager->createSkinnedMesh();
|
||||||
io::IFileSystem* fs = m_scene_manager->getFileSystem();
|
io::IFileSystem* fs = m_scene_manager->getFileSystem();
|
||||||
@ -196,6 +197,9 @@ scene::IAnimatedMesh* SPMeshLoader::createMesh(io::IReadFile* f)
|
|||||||
f->read(&pre_computed_size, 2);
|
f->read(&pre_computed_size, 2);
|
||||||
}
|
}
|
||||||
m_mesh->finalize();
|
m_mesh->finalize();
|
||||||
|
// Because the last frame in spm is usable
|
||||||
|
static_cast<scene::CSkinnedMesh*>(m_mesh)->AnimationFrames =
|
||||||
|
(float)m_frame_count + 1.0f;
|
||||||
m_all_armatures.clear();
|
m_all_armatures.clear();
|
||||||
m_to_bind_pose_matrices.clear();
|
m_to_bind_pose_matrices.clear();
|
||||||
m_joints.clear();
|
m_joints.clear();
|
||||||
@ -366,8 +370,8 @@ void SPMeshLoader::createAnimationData(irr::io::IReadFile* spm)
|
|||||||
}
|
}
|
||||||
for (unsigned i = 0; i < armature_size; i++)
|
for (unsigned i = 0; i < armature_size; i++)
|
||||||
{
|
{
|
||||||
//m_frame_count = std::max(m_frame_count,
|
m_frame_count = std::max(m_frame_count,
|
||||||
// (unsigned)m_all_armatures[i].m_frame_pose_matrices.back().first);
|
(unsigned)m_all_armatures[i].m_frame_pose_matrices.back().first);
|
||||||
m_joint_count += m_all_armatures[i].m_joint_used;
|
m_joint_count += m_all_armatures[i].m_joint_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ private:
|
|||||||
unsigned id);
|
unsigned id);
|
||||||
};
|
};
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
unsigned m_bind_frame, m_joint_count;//, m_frame_count;
|
unsigned m_bind_frame, m_joint_count, m_frame_count;
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
std::vector<Armature> m_all_armatures;
|
std::vector<Armature> m_all_armatures;
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user