Force re-skin when getMesh with hardware skinning on

Actually spm has a built in way to use mesh without bothering bind
pose
This commit is contained in:
Benau 2017-09-20 01:27:52 +08:00
parent 71334bac5b
commit 3cd2f403e0
2 changed files with 13 additions and 3 deletions
lib/irrlicht/source/Irrlicht
src/karts

@ -77,7 +77,10 @@ IMesh* CSkinnedMesh::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32
{
const bool is_hw_skinning_before = HardwareSkinning;
if (is_hw_skinning_before)
{
HardwareSkinning = false;
LastAnimatedFrame = -1;
}
//animate(frame,startFrameLoop, endFrameLoop);
if (frame==-1)
return this;

@ -520,8 +520,9 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool human_playe
}
else
{
swo = irr_driver->addMesh(obj.m_model, "speedweighted",
parent, getRenderInfo(), true/*all_parts_colorized*/);
swo = irr_driver->addMesh(obj.m_model->getMesh(0),
"speedweighted", parent, getRenderInfo(),
true/*all_parts_colorized*/);
}
#ifdef DEBUG
std::string debug_name = obj.m_name + " (speed-weighted)";
@ -1211,7 +1212,13 @@ void KartModel::initInverseBoneMatrices()
// All bone matrices are configured in straight frame (as in exporting)
scene::IAnimatedMeshSceneNode* node = irr_driver->getSceneManager()
->addAnimatedMeshSceneNode(m_mesh);
node->setCurrentFrame((float)m_animation_frame[AF_STRAIGHT]);
float striaght_frame = (float)m_animation_frame[AF_STRAIGHT];
if (m_animation_frame[AF_STRAIGHT] == -1)
{
Log::warn("KartModel", "%s has no striaght frame defined.");
striaght_frame = 0.0f;
}
node->setCurrentFrame(striaght_frame);
const unsigned total_joint = node->getJointCount();
for (unsigned i = 0; i < total_joint; i++)
{