clang-format
parent
bbcefbd034
commit
a1e03e3481
|
@ -73,8 +73,7 @@ const char *TREE_STOP = TREE_STOP_UTF8;
|
|||
const char *TREE_CONTINUE = TREE_CONTINUE_UTF8;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int CountNodes(const aiNode* root)
|
||||
{
|
||||
unsigned int CountNodes(const aiNode *root) {
|
||||
unsigned int i = 0;
|
||||
for (unsigned int a = 0; a < root->mNumChildren; ++a) {
|
||||
i += CountNodes(root->mChildren[a]);
|
||||
|
@ -83,8 +82,7 @@ unsigned int CountNodes(const aiNode* root)
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int GetMaxDepth(const aiNode* root)
|
||||
{
|
||||
unsigned int GetMaxDepth(const aiNode *root) {
|
||||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
||||
cnt = std::max(cnt, GetMaxDepth(root->mChildren[i]));
|
||||
|
@ -93,8 +91,7 @@ unsigned int GetMaxDepth(const aiNode* root)
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int CountVertices(const aiScene* scene)
|
||||
{
|
||||
unsigned int CountVertices(const aiScene *scene) {
|
||||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||
cnt += scene->mMeshes[i]->mNumVertices;
|
||||
|
@ -103,8 +100,7 @@ unsigned int CountVertices(const aiScene* scene)
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int CountFaces(const aiScene* scene)
|
||||
{
|
||||
unsigned int CountFaces(const aiScene *scene) {
|
||||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||
cnt += scene->mMeshes[i]->mNumFaces;
|
||||
|
@ -113,8 +109,7 @@ unsigned int CountFaces(const aiScene* scene)
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int CountBones(const aiScene* scene)
|
||||
{
|
||||
unsigned int CountBones(const aiScene *scene) {
|
||||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||
cnt += scene->mMeshes[i]->mNumBones;
|
||||
|
@ -123,8 +118,7 @@ unsigned int CountBones(const aiScene* scene)
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
unsigned int CountAnimChannels(const aiScene* scene)
|
||||
{
|
||||
unsigned int CountAnimChannels(const aiScene *scene) {
|
||||
unsigned int cnt = 0;
|
||||
for (unsigned int i = 0; i < scene->mNumAnimations; ++i) {
|
||||
cnt += scene->mAnimations[i]->mNumChannels;
|
||||
|
@ -143,8 +137,7 @@ unsigned int GetAvgVertsPerMesh(const aiScene* scene) {
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D special_points[3],const aiMatrix4x4& mat=aiMatrix4x4())
|
||||
{
|
||||
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;
|
||||
|
@ -170,8 +163,7 @@ void FindSpecialPoints(const aiScene* scene,const aiNode* root,aiVector3D specia
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
|
||||
{
|
||||
void FindSpecialPoints(const aiScene *scene, aiVector3D special_points[3]) {
|
||||
special_points[0] = aiVector3D(1e10, 1e10, 1e10);
|
||||
special_points[1] = aiVector3D(-1e10, -1e10, -1e10);
|
||||
|
||||
|
@ -180,8 +172,7 @@ void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3])
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
std::string FindPTypes(const aiScene* scene)
|
||||
{
|
||||
std::string FindPTypes(const aiScene *scene) {
|
||||
bool haveit[4] = { 0 };
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i) {
|
||||
const unsigned int pt = scene->mMeshes[i]->mPrimitiveTypes;
|
||||
|
@ -209,13 +200,17 @@ void PrintHierarchy(
|
|||
const std::string &indent,
|
||||
bool verbose,
|
||||
bool last = false,
|
||||
bool first = true
|
||||
){
|
||||
bool first = true) {
|
||||
// tree visualization
|
||||
std::string branchchar;
|
||||
if (first) { branchchar = ""; }
|
||||
else if (last) { branchchar = TREE_STOP; } // "'-"
|
||||
else { branchchar = TREE_BRANCH; } // "|-"
|
||||
if (first) {
|
||||
branchchar = "";
|
||||
} else if (last) {
|
||||
branchchar = TREE_STOP;
|
||||
} // "'-"
|
||||
else {
|
||||
branchchar = TREE_BRANCH;
|
||||
} // "|-"
|
||||
|
||||
// print the indent and the branch character and the name
|
||||
std::cout << indent << branchchar << node->mName.C_Str();
|
||||
|
@ -226,7 +221,9 @@ void PrintHierarchy(
|
|||
bool sep = false;
|
||||
for (size_t i = 0; i < node->mNumMeshes; ++i) {
|
||||
unsigned int mesh_index = node->mMeshes[i];
|
||||
if (sep) { std::cout << ", "; }
|
||||
if (sep) {
|
||||
std::cout << ", ";
|
||||
}
|
||||
std::cout << mesh_index;
|
||||
sep = true;
|
||||
}
|
||||
|
@ -240,10 +237,16 @@ void PrintHierarchy(
|
|||
if (verbose) {
|
||||
// indent to use
|
||||
std::string indentadd;
|
||||
if (last) { indentadd += " "; }
|
||||
else { indentadd += TREE_CONTINUE; } // "| "..
|
||||
if (node->mNumChildren == 0) { indentadd += " "; }
|
||||
else { indentadd += TREE_CONTINUE; } // .."| "
|
||||
if (last) {
|
||||
indentadd += " ";
|
||||
} else {
|
||||
indentadd += TREE_CONTINUE;
|
||||
} // "| "..
|
||||
if (node->mNumChildren == 0) {
|
||||
indentadd += " ";
|
||||
} else {
|
||||
indentadd += TREE_CONTINUE;
|
||||
} // .."| "
|
||||
aiVector3D s, r, t;
|
||||
node->mTransformation.Decompose(s, r, t);
|
||||
if (s.x != 1.0 || s.y != 1.0 || s.z != 1.0) {
|
||||
|
@ -262,9 +265,13 @@ void PrintHierarchy(
|
|||
|
||||
// and recurse
|
||||
std::string nextIndent;
|
||||
if (first) { nextIndent = indent; }
|
||||
else if (last) { nextIndent = indent + " "; }
|
||||
else { nextIndent = indent + TREE_CONTINUE; } // "| "
|
||||
if (first) {
|
||||
nextIndent = indent;
|
||||
} else if (last) {
|
||||
nextIndent = indent + " ";
|
||||
} else {
|
||||
nextIndent = indent + TREE_CONTINUE;
|
||||
} // "| "
|
||||
for (size_t i = 0; i < node->mNumChildren; ++i) {
|
||||
bool lastone = (i == node->mNumChildren - 1);
|
||||
PrintHierarchy(
|
||||
|
@ -272,8 +279,7 @@ void PrintHierarchy(
|
|||
nextIndent,
|
||||
verbose,
|
||||
lastone,
|
||||
false
|
||||
);
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +345,6 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
|||
aiMemoryInfo mem;
|
||||
globalImporter->GetMemoryRequirements(mem);
|
||||
|
||||
|
||||
static const char *format_string =
|
||||
"Memory consumption: %i B\n"
|
||||
"Nodes: %i\n"
|
||||
|
@ -384,12 +389,9 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
|||
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]
|
||||
)
|
||||
;
|
||||
special_points[2][0], special_points[2][1], special_points[2][2]);
|
||||
|
||||
if (silent)
|
||||
{
|
||||
if (silent) {
|
||||
printf("\n");
|
||||
return AssimpCmdError::Success;
|
||||
}
|
||||
|
@ -405,13 +407,20 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
|||
": [%d / %d / %d |",
|
||||
mesh->mNumVertices,
|
||||
mesh->mNumBones,
|
||||
mesh->mNumFaces
|
||||
);
|
||||
mesh->mNumFaces);
|
||||
const unsigned int ptypes = mesh->mPrimitiveTypes;
|
||||
if (ptypes & aiPrimitiveType_POINT) { printf(" point"); }
|
||||
if (ptypes & aiPrimitiveType_LINE) { printf(" line"); }
|
||||
if (ptypes & aiPrimitiveType_TRIANGLE) { printf(" triangle"); }
|
||||
if (ptypes & aiPrimitiveType_POLYGON) { printf(" polygon"); }
|
||||
if (ptypes & aiPrimitiveType_POINT) {
|
||||
printf(" point");
|
||||
}
|
||||
if (ptypes & aiPrimitiveType_LINE) {
|
||||
printf(" line");
|
||||
}
|
||||
if (ptypes & aiPrimitiveType_TRIANGLE) {
|
||||
printf(" triangle");
|
||||
}
|
||||
if (ptypes & aiPrimitiveType_POLYGON) {
|
||||
printf(" polygon");
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
|
@ -454,7 +463,8 @@ int Assimp_Info (const char* const* params, unsigned int num) {
|
|||
};
|
||||
for (unsigned int type = 0; type < sizeof(types) / sizeof(types[0]); ++type) {
|
||||
for (unsigned int idx = 0; AI_SUCCESS == aiGetMaterialString(scene->mMaterials[i],
|
||||
AI_MATKEY_TEXTURE(types[type],idx),&name); ++idx) {
|
||||
AI_MATKEY_TEXTURE(types[type], idx), &name);
|
||||
++idx) {
|
||||
printf("%s\n \'%s\'", (total++ ? "" : "\nTexture Refs:"), name.data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue