【发布时间】:2017-01-11 00:21:11
【问题描述】:
我正在尝试使用 assimp 加载动画网格(骨架),但遇到了一些问题。
当我尝试访问(根节点)aiNode* 的名称时,程序崩溃了。在 Visual Studio 的输出中,它说它无法读取字符串字符。
(我关注this tutorial。)
void Mesh::ReadNodeHierarchy(float AnimationTime, aiScene* scene, aiNode* pNode, const aiMatrix4x4& ParentTransform) {
if (pNode == NULL) {
std::cerr << "NODE NULL\n";
return;
}
std::cerr << pNode->mName.length; // I tried to check the length of the string but it caused the same error
std::string NodeName(pNode->mName.data); // Throws error
(...)
}
【问题讨论】:
-
检查 NULL 很好,但
pNode变量是否正确初始化? -
是的,pNode 是场景中的根节点,assimp 表示它始终处于初始化状态,除非文件加载失败。 (文件正在加载,如果我停用动画,我可以完美地看到模型)
标签: c++ animation assimp skeletal-animation