assimp info now prints min,max and center points of a model.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@586 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
a7f298e6c3
commit
b26cee19a0
|
@ -120,13 +120,42 @@ unsigned int GetAvgVertsPerMesh(const aiScene* scene) {
|
|||
return static_cast<unsigned int>(CountVertices(scene)/scene->mNumMeshes);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// -----------------------------------------------------------------------------------
|
||||
void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D special_points[3],const aiMatrix4x4& mat=aiMatrix4x4())
|
||||
{
|
||||
// XXX that could be greatly simplified by using code from code/ProcessHelper.h
|
||||
// XXX I just don't want to include it here.
|
||||
const aiMatrix4x4 trafo = root->mTransformation*mat;
|
||||
for(unsigned int i = 0; i < root->mNumMeshes; ++i) {
|
||||
const aiMesh* mesh = scene->mMeshes[root->mMeshes[i]];
|
||||
|
||||
for(unsigned int a = 0; a < mesh->mNumVertices; ++a) {
|
||||
aiVector3D v = trafo*mesh->mVertices[a];
|
||||
|
||||
special_points[0].x = std::min(special_points[0].x,v.x);
|
||||
special_points[0].y = std::min(special_points[0].y,v.y);
|
||||
special_points[0].z = std::min(special_points[0].z,v.z);
|
||||
|
||||
special_points[1].x = std::max(special_points[1].x,v.x);
|
||||
special_points[1].y = std::max(special_points[1].y,v.y);
|
||||
special_points[1].z = std::max(special_points[1].z,v.z);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < root->mNumChildren; ++i) {
|
||||
FindSpecialPoints(scene,root->mChildren[i],special_points,trafo);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
|
||||
{
|
||||
// XXX include code/ProcessHelper.h from here or rewrite everything from scratch?
|
||||
special_points[0] = aiVector3D(1e10f,1e10f,1e10f);
|
||||
special_points[1] = aiVector3D(-1e10f,-1e10f,-1e10f);
|
||||
|
||||
FindSpecialPoints(scene,scene->mRootNode,special_points);
|
||||
special_points[2] = 0.5f*(special_points[0]+special_points[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
std::string FindPTypes(const aiScene* scene)
|
||||
|
@ -233,18 +262,14 @@ int Assimp_Info (const char** params, unsigned int num)
|
|||
"Primitive Types: %s\n"
|
||||
"Average faces/mesh %i\n"
|
||||
"Average verts/mesh %i\n"
|
||||
#if 0
|
||||
"Center point (%f %f %f)\n"
|
||||
"Minimum point (%f %f %f)\n"
|
||||
"Maximum point (%f %f %f)\n"
|
||||
#endif
|
||||
"Center point (%f %f %f)\n"
|
||||
|
||||
;
|
||||
|
||||
#if 0
|
||||
aiVector3D special_points[3];
|
||||
FindSpecialPoints(scene,special_points);
|
||||
#endif
|
||||
|
||||
printf(format_string,
|
||||
mem.total,
|
||||
CountNodes(scene->mRootNode),
|
||||
|
@ -261,13 +286,10 @@ int Assimp_Info (const char** params, unsigned int num)
|
|||
CountAnimChannels(scene),
|
||||
FindPTypes(scene).c_str(),
|
||||
GetAvgFacePerMesh(scene),
|
||||
GetAvgVertsPerMesh(scene)
|
||||
#if 0
|
||||
,
|
||||
special_points[0],
|
||||
special_points[1],
|
||||
special_points[2]
|
||||
#endif
|
||||
GetAvgVertsPerMesh(scene),
|
||||
special_points[0][0],special_points[0][1],special_points[0][2],
|
||||
special_points[1][0],special_points[1][1],special_points[1][2],
|
||||
special_points[2][0],special_points[2][1],special_points[2][2]
|
||||
)
|
||||
;
|
||||
unsigned int total=0;
|
||||
|
|
|
@ -54,10 +54,10 @@ const char* AICMD_MSG_ABOUT =
|
|||
|
||||
"Version %i.%i-%s%s%s%s%s (SVNREV %i)\n\n";
|
||||
|
||||
|
||||
const char* AICMD_MSG_HELP =
|
||||
"assimp <verb> <arguments>\n\n"
|
||||
"\tverbs:\n"
|
||||
"\t\tinfo - Display statistics and structure of a 3D model\n"
|
||||
"\t\tversion - Display Assimp version\n"
|
||||
"\t\tlistext - List all known file extension\n"
|
||||
"\t\tknowext - Check whether a file extension is recognized by Assimp\n"
|
||||
|
|
Loading…
Reference in New Issue