1

現在、ASSIMP を使用してアニメーションをテストするための MD5 モデルをロードしています (次のチュートリアルから: http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html )。これまでのところ、すべて問題なくロードされているように見えます (静的モデルは問題なくレンダリングされます) が、何らかの理由で Assimp のノードにボーン名が表示されません。各ノードの名前は<MD5_Root>or<MD5_Mesh>であり、表示すべきボーン名ではありません。

以下は、ASSIMP 内のすべてのボーン名をノード名でチェックするコードのスニペットです。文字列が になるポイントに到達することはありません"HOI"。nodeName は「pubis」や「upperarm.L」などのボーン名にする必要があります。

void MeshLoader::ReadNodeHeirarchy(float AnimationTime, const aiNode* pNode, const aiMatrix4x4 ParentTransform)
{
    string nodeName = pNode->mName.data;
    const aiAnimation* pAnimation = m_pScene->mAnimations[0]; // Update from here if you want different animations! :O
    aiMatrix4x4 nodeTransformation(pNode->mTransformation);
    const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnimation, nodeName);
    if(nodeName != "<MD5_Root>" && nodeName != "<MD5_Mesh>")
        nodeName = "HOI";
    ...
}

const aiNodeAnim* MeshLoader::FindNodeAnim(const aiAnimation* pAnimation, const string NodeName)
{
    for (unsigned int i = 0 ; i < pAnimation->mNumChannels ; i++) 
    {
        const aiNodeAnim* pNodeAnim = pAnimation->mChannels[i];

        if (string(pNodeAnim->mNodeName.data) == NodeName) 
            return pNodeAnim;
    }       
    return NULL;
}

また、.MD5 ファイルの一部で、何か役立つことがわかります。

MD5Version 10
commandline ""

numJoints 33
numMeshes 6

joints {
    "origin"    -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 )      // 
    "sheath"    0 ( 11.004813 -3.177138 31.702473 ) ( 0.307041 -0.578614 0.354181 )     // origin
    "sword" 1 ( 9.809593 -9.361549 40.753730 ) ( 0.305557 -0.578155 0.353505 )      // sheath
    "pubis" 0 ( 0.014076 2.064442 26.144581 ) ( -0.466932 -0.531013 -0.466932 )     // origin
    "pelvis"    3 ( 0.014076 2.592741 30.241238 ) ( -0.535591 -0.462288 -0.534983 )     // pubis
    "spine" 4 ( 0.023039 1.427001 38.133138 ) ( -0.499998 -0.500002 -0.499998 )     // pelvis
    "neck"  5 ( 0.023039 1.427122 51.620732 ) ( -0.643897 -0.292228 -0.643896 )     // spine
    "head"  6 ( 0.023047 -1.828043 55.341849 ) ( -0.707074 -0.007564 -0.707059 )        // neck
    "upperarm.L"    5 ( -7.999740 4.449851 48.597286 ) ( -0.000001 -0.000001 -0.716595 )        // spine
    "forearm.L" 8 ( -20.905890 4.101032 48.597330 ) ( -0.000001 -0.000001 -0.746270 )       // upperarm.L
    "wrist.L"   9 ( -32.023143 2.795714 48.607747 ) ( 0.009625 0.009713 -0.703812 )     // forearm.L
    ...
}

mesh {
    shader "....OpenGL/Resources/Objects/Bob/guard1_body.png"

    numverts 494
    vert 0 ( 0.394531 0.513672 ) 0 1
    vert 1 ( 0.447266 0.449219 ) 1 2
    vert 2 ( 0.453125 0.517578 ) 3 1
    ...
}

何らかの理由で名前が正しくロードされていないか、MD5 ファイル自体にエラーがあるのでしょうか?

4

1 に答える 1