PVR Model POD scaling animation problem

This topic contains 2 replies, has 2 voices, and was last updated by  mkandula 3 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31668

    mkandula
    Member

    Hi

    I was experiencing a crash when one of the .pod file was having scaling animation.

    The crash was happening here (in PVRTModelPOD.cpp in GetScalingMatrix() )

    if(node.nAnimFlags & ePODHasScaleAni)
    {
    if(node.pnAnimScaleIdx)
    {
    PVRTMatrixVec3Lerp(
    v,
    (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]],
    (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+1]], m_pImpl->fBlend);

    }

    I fixed the crash using the following fix


    if(node.pnAnimScaleIdx)
    {
    if(m_pImpl->nFrame + 1 >= this->nNumFrame) {
    v = (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]];
    }
    else {
    PVRTMatrixVec3Lerp(
    v,
    (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]],
    (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+1]], m_pImpl->fBlend);
    }
    }

    Please suggest a proper fix. The condition m_pImpl->nFrame + 1 >= this->nNumFrame, was needed to be dealt with 🙂

    #38611

    Joe Davis
    Member

    Hi Madan,

    As mentioned in the SetFrame() comment, the tools expect the user to check that the input frame value value is valid for animation. For looping animation, frame 0 and the last frame should be identical, so there is no need to wrap between the last and the first frame animations.

    We chose not to add an array bounds test to the function, as its an additional operaiton that would only be required for looping animations.

    Regards,
    Joe

    #38612

    mkandula
    Member

    Hi Joe,

    Thanks for the insight into the problem ! Really helps.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.