diff options
author | Sergey Dubitskiy <sergey.dubitskiy@nokia.com> | 2012-01-27 16:49:16 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-29 23:56:55 +0100 |
commit | 9b86d4f10610e4226e61bb1d266ae45a6ff5a269 (patch) | |
tree | 4368c27b9583306a5e4fa8c48881ec629159bbc6 /src/plugins | |
parent | f0f7e8249d71d22cab2155efbd3b2d3adcb336e1 (diff) |
Upgrade to AssImp library v2.0.863.
Also includes a new example.
Task-number: QTBUG-22194.
Change-Id: I9b8cb61f805b9011b6478532be83aa6d9a45111e
Reviewed-by: Danny Pope <daniel.pope@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/sceneformats/assimp/qaiscenehandler.cpp | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/src/plugins/sceneformats/assimp/qaiscenehandler.cpp b/src/plugins/sceneformats/assimp/qaiscenehandler.cpp index f14567f2b..562c87610 100644 --- a/src/plugins/sceneformats/assimp/qaiscenehandler.cpp +++ b/src/plugins/sceneformats/assimp/qaiscenehandler.cpp @@ -67,6 +67,10 @@ QT_BEGIN_NAMESPACE +#ifdef _DEBUG +void DumpScene(const aiScene* pScene); +#endif + QAiSceneHandler::QAiSceneHandler() : m_options(qAiPostProcessPreset) , m_showWarnings(false) @@ -211,6 +215,9 @@ void QAiSceneHandler::decodeOptions(const QString &options) QGLAbstractScene *QAiSceneHandler::read() { + qDebug() << "QAiSceneHandler::read()"; + + AiLoaderIOSystem *ios = new AiLoaderIOSystem(device(), url()); m_importer.SetIOHandler(ios); @@ -245,8 +252,8 @@ QGLAbstractScene *QAiSceneHandler::read() m_importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS, m_removeComponentFlags); m_importer.SetPropertyInteger(AI_CONFIG_PP_SBP_REMOVE, m_removeSortFlags); - m_importer.SetPropertyInteger(AI_CONFIG_PP_SLM_VERTEX_LIMIT, m_meshSplitVertexLimit); - m_importer.SetPropertyInteger(AI_CONFIG_PP_SLM_TRIANGLE_LIMIT, m_meshSplitTriangleLimit); + //m_importer.SetPropertyInteger(AI_CONFIG_PP_SLM_VERTEX_LIMIT, m_meshSplitVertexLimit); + //m_importer.SetPropertyInteger(AI_CONFIG_PP_SLM_TRIANGLE_LIMIT, m_meshSplitTriangleLimit); // force this on, and provide no way to turn it off. Its set by the // aiProcessPreset_TargetRealtime_Quality option in the constructor. @@ -274,7 +281,11 @@ QGLAbstractScene *QAiSceneHandler::read() qWarning("For details check log: %s/AssimpLog.txt\n", qPrintable(c)); return 0; } - +#ifdef _DEBUG + else { + DumpScene(scene); + } +#endif QAiScene *qscene = new QAiScene(scene, this); @@ -283,4 +294,65 @@ QGLAbstractScene *QAiSceneHandler::read() return qscene; } +#ifdef _DEBUG +void LogPrint(const char* pFormat, ...) +{ + static char buff[1024]; + buff[0] = '\0'; + va_list args; + va_start(args, pFormat); + vsnprintf( buff, sizeof(buff) - 1, pFormat, args); + qDebug() << buff; +} + +void DumpAnimation(int i, const aiAnimation* pAnimation, const aiScene* pScene) +{ + Q_UNUSED(pScene); + LogPrint(" Animation %d",i); + LogPrint(" name = '%s'",pAnimation->mName.data); + LogPrint(" ticks = %f",pAnimation->mDuration); + LogPrint(" ticks per sec = %f",pAnimation->mTicksPerSecond); + for (unsigned int i=0; i<pAnimation->mNumChannels; ++i) { + const aiNodeAnim* pNodeAnim = pAnimation->mChannels[i]; + LogPrint(" channel %d affects: '%s'", i, pNodeAnim->mNodeName.data); + } +} + +void DumpMesh(int i, const aiMesh* pMesh, const aiScene* pScene) +{ + Q_UNUSED(pScene); + LogPrint(" Mesh %d",i); + LogPrint(" name = '%s'",pMesh->mName.data); + LogPrint(" has bones: %s (%d)",pMesh->HasBones()?"YES":"no ",pMesh->mNumBones); +} +void DumpNodeRecursive(int level, const aiNode* pNode, const aiScene* pScene) +{ + if (level > 100) + level = 100; + char Prefix[256]; + memset(Prefix,' ',level*2); + Prefix[level*2] = '\0'; + LogPrint(" %sNode, name='%s', nMeshes=%d",Prefix,pNode->mName.data,pNode->mNumMeshes); + for (unsigned int i=0; i<pNode->mNumChildren; ++i) { + DumpNodeRecursive(level+1, pNode->mChildren[i], pScene); + } +} + +void DumpScene(const aiScene* pScene) +{ + LogPrint("DumpScene(%p)",pScene); + if (pScene) { + LogPrint(" has animations: %s (%d)",pScene->HasAnimations()?"YES":"no ",pScene->mNumAnimations); + LogPrint(" has meshes: %s (%d)",pScene->HasMeshes()?"YES":"no ",pScene->mNumMeshes); + for (unsigned int i=0; i<pScene->mNumAnimations; ++i) { + DumpAnimation(i,pScene->mAnimations[i],pScene); + } + for (unsigned int i=0; i<pScene->mNumMeshes; ++i) { + DumpMesh(i,pScene->mMeshes[i],pScene); + } + DumpNodeRecursive(0,pScene->mRootNode,pScene); + } +} +#endif + QT_END_NAMESPACE |