From 26a96340ffa745c1c4e42129d3c441735cfbd582 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Thu, 4 Mar 2010 17:47:39 +0000 Subject: [PATCH] - Add 'info' utility to assimp_cmd. It displays quick file statistics, texture dependencies, file structure. - Clean up assimp_cmd source code, a bit of doc work as well. - Remove unused workspaces pertaining to old jAssimp and Assimp.net. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@582 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- tools/assimp_cmd/CMakeLists.txt | 91 +- tools/assimp_cmd/Info.cpp | 330 +++++ tools/assimp_cmd/Main.cpp | 133 +- tools/assimp_cmd/Main.h | 12 +- tools/assimp_cmd/WriteDumb.cpp | 18 +- tools/assimp_cmd/makefile.mingw | 78 -- workspaces/vc8/assimp_cmd.vcproj | 4 + workspaces/vc8/assimp_jbridge.vcproj | 494 -------- workspaces/vc9/assimp.sln | 31 +- workspaces/vc9/assimp_cmd.vcproj | 4 + workspaces/vc9/jAssimp.vcproj | 1696 -------------------------- 11 files changed, 474 insertions(+), 2417 deletions(-) create mode 100644 tools/assimp_cmd/Info.cpp delete mode 100644 tools/assimp_cmd/makefile.mingw delete mode 100644 workspaces/vc8/assimp_jbridge.vcproj delete mode 100644 workspaces/vc9/jAssimp.vcproj diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index 72d8172a2..2758fcbc6 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -1,45 +1,46 @@ -INCLUDE_DIRECTORIES( - ${Assimp_SOURCE_DIR}/include - ${Assimp_SOURCE_DIR}/code -) - -LINK_DIRECTORIES( ${Assimp_BINARY_DIR} ${Assimp_BINARY_DIR}/lib ) - -ADD_EXECUTABLE( assimp_cmd - ../../contrib/zlib/adler32.c - ../../contrib/zlib/compress.c - ../../contrib/zlib/crc32.c - ../../contrib/zlib/crc32.h - ../../contrib/zlib/deflate.c - ../../contrib/zlib/deflate.h - ../../contrib/zlib/inffast.c - ../../contrib/zlib/inffast.h - ../../contrib/zlib/inffixed.h - ../../contrib/zlib/inflate.c - ../../contrib/zlib/inflate.h - ../../contrib/zlib/inftrees.c - ../../contrib/zlib/inftrees.h - ../../contrib/zlib/trees.c - ../../contrib/zlib/trees.h - ../../contrib/zlib/zconf.h - ../../contrib/zlib/zconf.in.h - ../../contrib/zlib/zlib.h - ../../contrib/zlib/zutil.c - ../../contrib/zlib/zutil.h - assimp_cmd.rc - CompareDump.cpp - ImageExtractor.cpp - Main.cpp - Main.h - resource.h - WriteDumb.cpp -) - -TARGET_LINK_LIBRARIES( assimp_cmd assimp ) -SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES - OUTPUT_NAME assimp -) - -INSTALL( TARGETS assimp_cmd - DESTINATION "${BIN_INSTALL_DIR}" -) +INCLUDE_DIRECTORIES( + ${Assimp_SOURCE_DIR}/include + ${Assimp_SOURCE_DIR}/code +) + +LINK_DIRECTORIES( ${Assimp_BINARY_DIR} ${Assimp_BINARY_DIR}/lib ) + +ADD_EXECUTABLE( assimp_cmd + ../../contrib/zlib/adler32.c + ../../contrib/zlib/compress.c + ../../contrib/zlib/crc32.c + ../../contrib/zlib/crc32.h + ../../contrib/zlib/deflate.c + ../../contrib/zlib/deflate.h + ../../contrib/zlib/inffast.c + ../../contrib/zlib/inffast.h + ../../contrib/zlib/inffixed.h + ../../contrib/zlib/inflate.c + ../../contrib/zlib/inflate.h + ../../contrib/zlib/inftrees.c + ../../contrib/zlib/inftrees.h + ../../contrib/zlib/trees.c + ../../contrib/zlib/trees.h + ../../contrib/zlib/zconf.h + ../../contrib/zlib/zconf.in.h + ../../contrib/zlib/zlib.h + ../../contrib/zlib/zutil.c + ../../contrib/zlib/zutil.h + assimp_cmd.rc + CompareDump.cpp + ImageExtractor.cpp + Main.cpp + Main.h + resource.h + WriteDumb.cpp + Info.cpp +) + +TARGET_LINK_LIBRARIES( assimp_cmd assimp ) +SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES + OUTPUT_NAME assimp +) + +INSTALL( TARGETS assimp_cmd + DESTINATION "${BIN_INSTALL_DIR}" +) diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp new file mode 100644 index 000000000..ecf18a339 --- /dev/null +++ b/tools/assimp_cmd/Info.cpp @@ -0,0 +1,330 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (ASSIMP) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2008, ASSIMP Development Team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the ASSIMP team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the ASSIMP Development Team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +*/ + +/** @file Info.cpp + * @brief Implementation of the 'assimp info' utility */ + +#include "Main.h" + +const char* AICMD_MSG_INFO_HELP_E = +"assimp info [-r]\n" +"\tPrint basic structure of a 3D model\n" +"\t-r,--raw: No postprocessing, do a raw import\n"; + + +// ----------------------------------------------------------------------------------- +unsigned int CountNodes(const aiNode* root) +{ + unsigned int i = 0; + for (unsigned int a = 0; a < root->mNumChildren; ++a ) { + i += CountNodes(root->mChildren[a]); + } + return 1+i; +} + +// ----------------------------------------------------------------------------------- +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])); + } + return cnt+1; +} + +// ----------------------------------------------------------------------------------- +unsigned int CountVertices(const aiScene* scene) +{ + unsigned int cnt = 0; + for(unsigned int i = 0; i < scene->mNumMeshes; ++i) { + cnt += scene->mMeshes[i]->mNumVertices; + } + return cnt; +} + +// ----------------------------------------------------------------------------------- +unsigned int CountFaces(const aiScene* scene) +{ + unsigned int cnt = 0; + for(unsigned int i = 0; i < scene->mNumMeshes; ++i) { + cnt += scene->mMeshes[i]->mNumFaces; + } + return cnt; +} + +// ----------------------------------------------------------------------------------- +unsigned int CountBones(const aiScene* scene) +{ + unsigned int cnt = 0; + for(unsigned int i = 0; i < scene->mNumMeshes; ++i) { + cnt += scene->mMeshes[i]->mNumBones; + } + return cnt; +} + +// ----------------------------------------------------------------------------------- +unsigned int CountAnimChannels(const aiScene* scene) +{ + unsigned int cnt = 0; + for(unsigned int i = 0; i < scene->mNumAnimations; ++i) { + cnt += scene->mAnimations[i]->mNumChannels; + } + return cnt; +} + +// ----------------------------------------------------------------------------------- +unsigned int GetAvgFacePerMesh(const aiScene* scene) { + return static_cast(CountFaces(scene)/scene->mNumMeshes); +} + +// ----------------------------------------------------------------------------------- +unsigned int GetAvgVertsPerMesh(const aiScene* scene) { + return static_cast(CountVertices(scene)/scene->mNumMeshes); +} + +#if 0 +// ----------------------------------------------------------------------------------- +void FindSpecialPoints(const aiScene* scene,aiVector3D special_points[3]) +{ + // XXX include code/ProcessHelper.h from here or rewrite everything from scratch? +} +#endif + +// ----------------------------------------------------------------------------------- +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; + if (pt & aiPrimitiveType_POINT) { + haveit[0]=true; + } + if (pt & aiPrimitiveType_LINE) { + haveit[1]=true; + } + if (pt & aiPrimitiveType_TRIANGLE) { + haveit[2]=true; + } + if (pt & aiPrimitiveType_POLYGON) { + haveit[3]=true; + } + } + return (haveit[0]?std::string("points"):"")+(haveit[1]?"lines":"")+ + (haveit[2]?"triangles":"")+(haveit[3]?"n-polygons":""); +} + +// ----------------------------------------------------------------------------------- +void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxline, + unsigned int cline, unsigned int cnest=0) +{ + if (cline++ >= maxline || cnest >= maxnest) { + return; + } + + for(unsigned int i = 0; i < cnest; ++i) { + printf("-- "); + } + printf("\'%s\', meshes: %i\n",root->mName.data,root->mNumMeshes); + for (unsigned int i = 0; i < root->mNumChildren; ++i ) { + PrintHierarchy(root->mChildren[i],maxnest,maxline,cline,cnest+1); + if(i == root->mNumChildren-1) { + for(unsigned int i = 0; i < cnest; ++i) { + printf(" "); + } + printf("<--\n"); + } + } +} + +// ----------------------------------------------------------------------------------- +// Implementation of the assimp info utility to print basic file info +int Assimp_Info (const char** params, unsigned int num) +{ + if (num < 1) { + printf("assimp info: Invalid number of arguments. " + "See \'assimp info --help\'\n"); + return 1; + } + + // --help + if (!strcmp( params[0],"-h")||!strcmp( params[0],"--help")||!strcmp( params[0],"-?") ) { + printf("%s",AICMD_MSG_INFO_HELP_E); + return 0; + } + + // asssimp info [-r] + if (num < 1) { + printf("assimp info: Invalid number of arguments. " + "See \'assimp info --help\'\n"); + return 1; + } + + const std::string in = std::string(params[0]); + + // do maximum post-processing unless -r was specified + ImportData import; + import.ppFlags = num>1&&(!strcmp(params[1],"--raw")||!strcmp(params[1],"-r")) ? 0 + : aiProcessPreset_TargetRealtime_MaxQuality; + + // import the main model + const aiScene* scene = ImportModel(import,in); + if (!scene) { + printf("assimp info: Unable to load input file %s\n", + in.c_str()); + return 5; + } + + aiMemoryInfo mem; + globalImporter->GetMemoryRequirements(mem); + + + static const char* format_string = + "Memory consumption: %i B\n" + "Nodes: %i\n" + "Maximum depth %i\n" + "Meshes: %i\n" + "Animations: %i\n" + "Textures (embed.): %i\n" + "Materials: %i\n" + "Cameras: %i\n" + "Lights: %i\n" + "Vertices: %i\n" + "Faces: %i\n" + "Bones: %i\n" + "Animation Channels: %i\n" + "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 + ; + +#if 0 + aiVector3D special_points[3]; + FindSpecialPoints(scene,special_points); +#endif + + printf(format_string, + mem.total, + CountNodes(scene->mRootNode), + GetMaxDepth(scene->mRootNode), + scene->mNumMeshes, + scene->mNumAnimations, + scene->mNumTextures, + scene->mNumMaterials, + scene->mNumCameras, + scene->mNumLights, + CountVertices(scene), + CountFaces(scene), + CountBones(scene), + CountAnimChannels(scene), + FindPTypes(scene).c_str(), + GetAvgFacePerMesh(scene), + GetAvgVertsPerMesh(scene) +#if 0 + , + special_points[0], + special_points[1], + special_points[2] +#endif + ) + ; + unsigned int total=0; + for(unsigned int i = 0;i < scene->mNumMaterials; ++i) { + aiString name; + if (AI_SUCCESS==aiGetMaterialString(scene->mMaterials[i],AI_MATKEY_NAME,&name)) { + printf("%s\n \'%s\'",(total++?"":"\nNamed Materials:" ),name.data); + } + } + if(total) { + printf("\n"); + } + + total=0; + for(unsigned int i = 0;i < scene->mNumMaterials; ++i) { + aiString name; + static const aiTextureType types[] = { + aiTextureType_NONE, + aiTextureType_DIFFUSE, + aiTextureType_SPECULAR, + aiTextureType_AMBIENT, + aiTextureType_EMISSIVE, + aiTextureType_HEIGHT, + aiTextureType_NORMALS, + aiTextureType_SHININESS, + aiTextureType_OPACITY, + aiTextureType_DISPLACEMENT, + aiTextureType_LIGHTMAP, + aiTextureType_REFLECTION, + aiTextureType_UNKNOWN + }; + 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) { + printf("%s\n \'%s\'",(total++?"":"\nTexture Refs:" ),name.data); + } + } + } + if(total) { + printf("\n"); + } + + total=0; + for(unsigned int i = 0;i < scene->mNumAnimations; ++i) { + if (scene->mAnimations[i]->mName.length) { + printf("%s\n \'%s\'",(total++?"":"\nNamed Animations:" ),scene->mAnimations[i]->mName.data); + } + } + if(total) { + printf("\n"); + } + + printf("\nNode hierarchy:\n"); + unsigned int cline=0; + PrintHierarchy(scene->mRootNode,20,1000,cline); + + printf("\n"); + return 0; +} + diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index ae020d6ec..820c67b05 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -47,15 +47,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. const char* AICMD_MSG_ABOUT = "------------------------------------------------------ \n" -"Open Asset Import Library (Assimp) \n" +"Open Asset Import Library - Assimp \n" "http://assimp.sourceforge.net \n" "Command-line tools \n" "------------------------------------------------------ \n\n" -"Major version: %i\n" -"Minor version: %i\n" -"SVN revision : %i\n" -"Build flags : %s %s %s %s %s\n\n"; +"Version %i.%i-%s%s%s%s%s (SVNREV %i)\n\n"; const char* AICMD_MSG_HELP = @@ -82,27 +79,26 @@ int main (int argc, char* argv[]) } // assimp version - // Display a version string + // Display version information if (! ::strcmp(argv[1], "version")) { - const unsigned int flags = aiGetCompileFlags(); printf(AICMD_MSG_ABOUT, aiGetVersionMajor(), aiGetVersionMinor(), - aiGetVersionRevision(), - (flags & ASSIMP_CFLAGS_DEBUG ? "-debug" : ""), - (flags & ASSIMP_CFLAGS_NOBOOST ? "-noboost" : ""), - (flags & ASSIMP_CFLAGS_SHARED ? "-shared" : ""), - (flags & ASSIMP_CFLAGS_SINGLETHREADED ? "-st" : ""), - (flags & ASSIMP_CFLAGS_STLPORT ? "-stlport" : "")); + (flags & ASSIMP_CFLAGS_DEBUG ? "-debug " : ""), + (flags & ASSIMP_CFLAGS_NOBOOST ? "-noboost " : ""), + (flags & ASSIMP_CFLAGS_SHARED ? "-shared " : ""), + (flags & ASSIMP_CFLAGS_SINGLETHREADED ? "-st " : ""), + (flags & ASSIMP_CFLAGS_STLPORT ? "-stlport " : ""), + aiGetVersionRevision()); return 0; } // assimp help - // Display some basic help - if (! ::strcmp(argv[1], "help")) { - + // Display some basic help (--help and -h work as well + // because people could try them intuitively) + if (!strcmp(argv[1], "help") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) { printf("%s",AICMD_MSG_HELP); return 0; } @@ -113,7 +109,7 @@ int main (int argc, char* argv[]) // assimp listext // List all file extensions supported by Assimp - if (! ::strcmp(argv[1], "listext")) { + if (! strcmp(argv[1], "listext")) { aiString s; imp.GetExtensionList(s); @@ -123,7 +119,7 @@ int main (int argc, char* argv[]) // assimp knowext // Check whether a particular file extension is known by us, return 0 on success - if (! ::strcmp(argv[1], "knowext")) { + if (! strcmp(argv[1], "knowext")) { if (argc<3) { printf("Expected a file extension to check for!"); return -10; @@ -133,19 +129,25 @@ int main (int argc, char* argv[]) return b?0:-1; } + // assimp info + // Print basic model statistics + if (! strcmp(argv[1], "info")) { + return Assimp_Info ((const char**)&argv[2],argc-2); + } + // assimp dump // Dump a model to a file - if (! ::strcmp(argv[1], "dump")) { + if (! strcmp(argv[1], "dump")) { return Assimp_Dump ((const char**)&argv[2],argc-2); } // assimp extract // Extract an embedded texture from a file - if (! ::strcmp(argv[1], "extract")) { + if (! strcmp(argv[1], "extract")) { return Assimp_Extract ((const char**)&argv[2],argc-2); } - ::printf("Unrecognized command. Use \'assimp help\' for a detailed command list\n"); + printf("Unrecognized command. Use \'assimp help\' for a detailed command list\n"); return 1; } @@ -155,34 +157,35 @@ const aiScene* ImportModel(const ImportData& imp, const std::string& path) { // Attach log streams if (imp.log) { - ::printf("\nAttaching log stream ... OK\n"); + printf("\nAttaching log stream ... OK\n"); unsigned int flags = 0; - if (imp.logFile.length()) + if (imp.logFile.length()) { flags |= aiDefaultLogStream_FILE; - if (imp.showLog) + } + if (imp.showLog) { flags |= aiDefaultLogStream_STDERR; - + } DefaultLogger::create(imp.logFile.c_str(),imp.verbose ? Logger::VERBOSE : Logger::NORMAL,flags); } - ::printf("Launching model import ... OK\n"); + printf("Launching model import ... OK\n"); // Now validate this flag combination if(!globalImporter->ValidateFlags(imp.ppFlags)) { ::printf("ERROR: Unsupported post-processing flags \n"); return NULL; } - ::printf("Validating postprocessing flags ... OK\n"); + printf("Validating postprocessing flags ... OK\n"); if (imp.showLog) ::printf("-----------------------------------------------------------------\n"); // do the actual import, measure time - const clock_t first = ::clock(); + const clock_t first = clock(); const aiScene* scene = globalImporter->ReadFile(path,imp.ppFlags); - if (imp.showLog) - ::printf("-----------------------------------------------------------------\n"); - + if (imp.showLog) { + printf("-----------------------------------------------------------------\n"); + } if (!scene) { printf("ERROR: Failed to load file\n"); return NULL; @@ -191,7 +194,7 @@ const aiScene* ImportModel(const ImportData& imp, const std::string& path) const clock_t second = ::clock(); const float seconds = (float)(second-first) / CLOCKS_PER_SEC; - ::printf("Importing file ... OK \n import took approx. %.5f seconds\n" + printf("Importing file ... OK \n import took approx. %.5f seconds\n" "\n",seconds); if (imp.log) { @@ -239,109 +242,109 @@ int ProcessStandardArguments(ImportData& fill, const char** params, } bool has = true; - if (! ::strcmp(params[i], "-ptv") || ! ::strcmp(params[i], "--pretransform-vertices")) { + if (! strcmp(params[i], "-ptv") || ! strcmp(params[i], "--pretransform-vertices")) { fill.ppFlags |= aiProcess_PreTransformVertices; } - else if (! ::strcmp(params[i], "-gsn") || ! ::strcmp(params[i], "--gen-smooth-normals")) { + else if (! strcmp(params[i], "-gsn") || ! strcmp(params[i], "--gen-smooth-normals")) { fill.ppFlags |= aiProcess_GenSmoothNormals; } - else if (! ::strcmp(params[i], "-gn") || ! ::strcmp(params[i], "--gen-normals")) { + else if (! strcmp(params[i], "-gn") || ! strcmp(params[i], "--gen-normals")) { fill.ppFlags |= aiProcess_GenNormals; } - else if (! ::strcmp(params[i], "-jiv") || ! ::strcmp(params[i], "--join-identical-vertices")) { + else if (! strcmp(params[i], "-jiv") || ! strcmp(params[i], "--join-identical-vertices")) { fill.ppFlags |= aiProcess_JoinIdenticalVertices; } - else if (! ::strcmp(params[i], "-rrm") || ! ::strcmp(params[i], "--remove-redundant-materials")) { + else if (! strcmp(params[i], "-rrm") || ! strcmp(params[i], "--remove-redundant-materials")) { fill.ppFlags |= aiProcess_RemoveRedundantMaterials; } - else if (! ::strcmp(params[i], "-fd") || ! ::strcmp(params[i], "--find-degenerates")) { + else if (! strcmp(params[i], "-fd") || ! strcmp(params[i], "--find-degenerates")) { fill.ppFlags |= aiProcess_FindDegenerates; } - else if (! ::strcmp(params[i], "-slm") || ! ::strcmp(params[i], "--split-large-meshes")) { + else if (! strcmp(params[i], "-slm") || ! strcmp(params[i], "--split-large-meshes")) { fill.ppFlags |= aiProcess_SplitLargeMeshes; } - else if (! ::strcmp(params[i], "-lbw") || ! ::strcmp(params[i], "--limit-bone-weights")) { + else if (! strcmp(params[i], "-lbw") || ! strcmp(params[i], "--limit-bone-weights")) { fill.ppFlags |= aiProcess_LimitBoneWeights; } - else if (! ::strcmp(params[i], "-vds") || ! ::strcmp(params[i], "--validate-data-structure")) { + else if (! strcmp(params[i], "-vds") || ! strcmp(params[i], "--validate-data-structure")) { fill.ppFlags |= aiProcess_ValidateDataStructure; } - else if (! ::strcmp(params[i], "-icl") || ! ::strcmp(params[i], "--improve-cache-locality")) { + else if (! strcmp(params[i], "-icl") || ! strcmp(params[i], "--improve-cache-locality")) { fill.ppFlags |= aiProcess_ImproveCacheLocality; } - else if (! ::strcmp(params[i], "-sbpt") || ! ::strcmp(params[i], "--sort-by-ptype")) { + else if (! strcmp(params[i], "-sbpt") || ! strcmp(params[i], "--sort-by-ptype")) { fill.ppFlags |= aiProcess_SortByPType; } - else if (! ::strcmp(params[i], "-lh") || ! ::strcmp(params[i], "--left-handed")) { + else if (! strcmp(params[i], "-lh") || ! strcmp(params[i], "--left-handed")) { fill.ppFlags |= aiProcess_ConvertToLeftHanded; } - else if (! ::strcmp(params[i], "-fuv") || ! ::strcmp(params[i], "--flip-uv")) { + else if (! strcmp(params[i], "-fuv") || ! strcmp(params[i], "--flip-uv")) { fill.ppFlags |= aiProcess_FlipUVs; } - else if (! ::strcmp(params[i], "-fwo") || ! ::strcmp(params[i], "--flip-winding-order")) { + else if (! strcmp(params[i], "-fwo") || ! strcmp(params[i], "--flip-winding-order")) { fill.ppFlags |= aiProcess_FlipWindingOrder; } - else if (! ::strcmp(params[i], "-tuv") || ! ::strcmp(params[i], "--transform-uv-coords")) { + else if (! strcmp(params[i], "-tuv") || ! strcmp(params[i], "--transform-uv-coords")) { fill.ppFlags |= aiProcess_TransformUVCoords; } - else if (! ::strcmp(params[i], "-guv") || ! ::strcmp(params[i], "--gen-uvcoords")) { + else if (! strcmp(params[i], "-guv") || ! strcmp(params[i], "--gen-uvcoords")) { fill.ppFlags |= aiProcess_GenUVCoords; } - else if (! ::strcmp(params[i], "-fid") || ! ::strcmp(params[i], "--find-invalid-data")) { + else if (! strcmp(params[i], "-fid") || ! strcmp(params[i], "--find-invalid-data")) { fill.ppFlags |= aiProcess_FindInvalidData; } - else if (! ::strcmp(params[i], "-fixn") || ! ::strcmp(params[i], "--fix-normals")) { + else if (! strcmp(params[i], "-fixn") || ! strcmp(params[i], "--fix-normals")) { fill.ppFlags |= aiProcess_FixInfacingNormals; } - else if (! ::strcmp(params[i], "-tri") || ! ::strcmp(params[i], "--triangulate")) { + else if (! strcmp(params[i], "-tri") || ! strcmp(params[i], "--triangulate")) { fill.ppFlags |= aiProcess_Triangulate; } - else if (! ::strcmp(params[i], "-cts") || ! ::strcmp(params[i], "--calc-tangent-space")) { + else if (! strcmp(params[i], "-cts") || ! strcmp(params[i], "--calc-tangent-space")) { fill.ppFlags |= aiProcess_CalcTangentSpace; } - else if (! ::strcmp(params[i], "-fi") || ! ::strcmp(params[i], "--find-instances")) { + else if (! strcmp(params[i], "-fi") || ! strcmp(params[i], "--find-instances")) { fill.ppFlags |= aiProcess_FindInstances; } - else if (! ::strcmp(params[i], "-og") || ! ::strcmp(params[i], "--optimize-graph")) { + else if (! strcmp(params[i], "-og") || ! strcmp(params[i], "--optimize-graph")) { fill.ppFlags |= aiProcess_OptimizeGraph; } - else if (! ::strcmp(params[i], "-om") || ! ::strcmp(params[i], "--optimize-meshes")) { + else if (! strcmp(params[i], "-om") || ! strcmp(params[i], "--optimize-meshes")) { fill.ppFlags |= aiProcess_OptimizeMeshes; } #if 0 - else if (! ::strcmp(params[i], "-oa") || ! ::strcmp(params[i], "--optimize-anims")) { + else if (! strcmp(params[i], "-oa") || ! strcmp(params[i], "--optimize-anims")) { fill.ppFlags |= aiProcess_OptimizeAnims; } - else if (! ::strcmp(params[i], "-gem") || ! ::strcmp(params[i], "--gen-entity-meshes")) { + else if (! strcmp(params[i], "-gem") || ! strcmp(params[i], "--gen-entity-meshes")) { fill.ppFlags |= aiProcess_GenEntityMeshes; } - else if (! ::strcmp(params[i], "-ftp") || ! ::strcmp(params[i], "--fix-texture-paths")) { + else if (! strcmp(params[i], "-ftp") || ! strcmp(params[i], "--fix-texture-paths")) { fill.ppFlags |= aiProcess_FixTexturePaths; } #endif - else if (! ::strncmp(params[i], "-c",2) || ! ::strncmp(params[i], "--config=",9)) { + else if (! strncmp(params[i], "-c",2) || ! strncmp(params[i], "--config=",9)) { const unsigned int ofs = (params[i][1] == '-' ? 9 : 2); // use default configurations - if (! ::strncmp(params[i]+ofs,"full",4)) + if (! strncmp(params[i]+ofs,"full",4)) fill.ppFlags |= aiProcessPreset_TargetRealtime_MaxQuality; - else if (! ::strncmp(params[i]+ofs,"default",7)) + else if (! strncmp(params[i]+ofs,"default",7)) fill.ppFlags |= aiProcessPreset_TargetRealtime_Quality; - else if (! ::strncmp(params[i]+ofs,"fast",4)) + else if (! strncmp(params[i]+ofs,"fast",4)) fill.ppFlags |= aiProcessPreset_TargetRealtime_Fast; } - else if (! ::strcmp(params[i], "-l") || ! ::strcmp(params[i], "--show-log")) { + else if (! strcmp(params[i], "-l") || ! strcmp(params[i], "--show-log")) { fill.showLog = true; } - else if (! ::strcmp(params[i], "-v") || ! ::strcmp(params[i], "--verbose")) { + else if (! strcmp(params[i], "-v") || ! strcmp(params[i], "--verbose")) { fill.verbose = true; } - else if (! ::strncmp(params[i], "--log-out=",10) || ! ::strncmp(params[i], "-lo",3)) { + else if (! strncmp(params[i], "--log-out=",10) || ! strncmp(params[i], "-lo",3)) { fill.logFile = std::string(params[i]+(params[i][1] == '-' ? 10 : 3)); if (!fill.logFile.length()) fill.logFile = "assimp-log.txt"; diff --git a/tools/assimp_cmd/Main.h b/tools/assimp_cmd/Main.h index 669784546..cd44d7e39 100644 --- a/tools/assimp_cmd/Main.h +++ b/tools/assimp_cmd/Main.h @@ -120,7 +120,7 @@ const aiScene* ImportModel(const ImportData& imp, const std::string& path); // ------------------------------------------------------------------------------ -/** @brief assimp_dump utility +/** @brief assimp dump utility * @param params Command line parameters to 'assimp dumb' * @param Number of params * @return 0 for success @@ -128,11 +128,19 @@ const aiScene* ImportModel(const ImportData& imp, const std::string& path); int Assimp_Dump (const char** params, unsigned int num); // ------------------------------------------------------------------------------ -/** @brief assimp_extract utility +/** @brief assimp extract utility * @param params Command line parameters to 'assimp extract' * @param Number of params * @return 0 for success */ int Assimp_Extract (const char** params, unsigned int num); +// ------------------------------------------------------------------------------ +/** @brief assimp info utility + * @param params Command line parameters to 'assimp info' + * @param Number of params + * @return 0 for success + */ +int Assimp_Info (const char** params, unsigned int num); + #endif // !! AICMD_MAIN_INCLUDED \ No newline at end of file diff --git a/tools/assimp_cmd/WriteDumb.cpp b/tools/assimp_cmd/WriteDumb.cpp index cd447b599..0b1e14512 100644 --- a/tools/assimp_cmd/WriteDumb.cpp +++ b/tools/assimp_cmd/WriteDumb.cpp @@ -938,7 +938,8 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd int Assimp_Dump (const char** params, unsigned int num) { if (num < 1) { - ::printf("assimp dump: Invalid number of arguments. See \'assimp dump --help\'\r\n"); + ::printf("assimp dump: Invalid number of arguments. " + "See \'assimp dump --help\'\r\n"); return 1; } @@ -950,7 +951,8 @@ int Assimp_Dump (const char** params, unsigned int num) // asssimp dump in out [options] if (num < 1) { - ::printf("assimp dump: Invalid number of arguments. See \'assimp dump --help\'\r\n"); + ::printf("assimp dump: Invalid number of arguments. " + "See \'assimp dump --help\'\r\n"); return 1; } @@ -974,13 +976,13 @@ int Assimp_Dump (const char** params, unsigned int num) // process other flags for (unsigned int i = 1; i < num;++i) { if (!params[i])continue; - if (!::strcmp( params[i], "-b") || !::strcmp( params[i], "--binary")) { + if (!::strcmp( params[i],"-b") || !::strcmp( params[i],"--binary")) { binary = true; } - else if (!::strcmp( params[i], "-s") || !::strcmp( params[i], "--short")) { + else if (!::strcmp( params[i],"-s") || !::strcmp( params[i],"--short")) { shortened = true; } - else if (!::strcmp( params[i], "-z") || !::strcmp( params[i], "--compressed")) { + else if (!::strcmp( params[i],"-z") || !::strcmp( params[i],"--compressed")) { compressed = true; } else if (i > 2 || params[i][0] == '-') { @@ -1005,14 +1007,16 @@ int Assimp_Dump (const char** params, unsigned int num) // import the main model const aiScene* scene = ImportModel(import,in); if (!scene) { - ::printf("assimp dump: Unable to load input file %s\n",in.c_str()); + ::printf("assimp dump: Unable to load input file %s\n", + in.c_str()); return 5; } // open the output file and build the dump FILE* o = ::fopen(out.c_str(),(binary ? "wb" : "wt")); if (!o) { - ::printf("assimp dump: Unable to open output file %s\n",out.c_str()); + ::printf("assimp dump: Unable to open output file %s\n", + out.c_str()); return 12; } diff --git a/tools/assimp_cmd/makefile.mingw b/tools/assimp_cmd/makefile.mingw deleted file mode 100644 index fb07713c1..000000000 --- a/tools/assimp_cmd/makefile.mingw +++ /dev/null @@ -1,78 +0,0 @@ - -# --------------------------------------------------------------------------- -# Makefile for assimp_cmd (mingw32-make) -# aramis_acg@users.sourceforge.net -# -# Usage: mingw32-make -f makefile.mingw - -# TARGETS: -# all Build assimp_cmd tool and assimp if necessary -# clean Cleanup all object files, including those from core -# cleanme Cleanup only my object files - -# MACROS: (make clean before you change one) -# NOBOOST=1 Build Assimp against boost workaround -# SINGLETHREADED=1 Build Assimp single-threaded library -# DEBUG=1 Build debug build of Assimp library -# --------------------------------------------------------------------------- - -# C++ object files -OBJECTS = $(patsubst %.cpp,%.o, $(wildcard *.cpp)) - -# Windows resource files -RCFILES = $(patsubst %.rc,%.res, $(wildcard *.rc)) - -# Specify additional include paths here -INCLUDEFLAGS = -I../../include - -# Specify additional library paths here -LIBRARYFLAGS = -L../../bin/mingw/ - -# Specify additional cpp definitions here -DEFINEFLAGS = -DASSIMP_BUILD_BOOST_WORKAROUND - -# Specify additional gcc compiler flags here -CPPFLAGS=-Wall - -# Specify the output executable name here -OUTPUT = ../../bin/mingw/assimp - -# --------------------------------------------------------------------------- -# Setup environment for debug/release builds -# --------------------------------------------------------------------------- -ifeq ($(DEBUG),1) - DEFINEFLAGS += -D_DEBUG -DDEBUG -else - CPPFLAGS += -o3 - DEFINEFLAGS += -DNDEBUG -D_NDEBUG -endif - -# --------------------------------------------------------------------------- -# all: Build assimp and assimp_cmd -# --------------------------------------------------------------------------- -all: $(OBJECTS) $(RCFILES) - cd ../../code/ && $(MAKE) -fmakefile.mingw static - gcc -s -o$(OUTPUT) $(OBJECTS) $(RCFILES) $(LIBRARYFLAGS) -lassimp -lstdc++ - - -# --------------------------------------------------------------------------- -# clean: Clean assimp and assimp_cmd -# --------------------------------------------------------------------------- -.PHONY: clean -clean: - -del *.o *.res - cd ../../code/ && $(MAKE) -fmakefile.mingw clean - -# --------------------------------------------------------------------------- -# cleanme: Clean assimp_cmd only -# --------------------------------------------------------------------------- -.PHONY: cleanme -cleanme: - -del *.o *.res - -%.o:%.cpp - $(CXX) -g -c $(CPPFLAGS) $? -o $@ $(INCLUDEFLAGS) $(DEFINEFLAGS) - -%.res:%.rc - windres $? -O coff -o $@ - diff --git a/workspaces/vc8/assimp_cmd.vcproj b/workspaces/vc8/assimp_cmd.vcproj index 5b449ae6b..2d207e981 100644 --- a/workspaces/vc8/assimp_cmd.vcproj +++ b/workspaces/vc8/assimp_cmd.vcproj @@ -1461,6 +1461,10 @@ RelativePath="..\..\tools\assimp_cmd\ImageExtractor.cpp" > + + diff --git a/workspaces/vc8/assimp_jbridge.vcproj b/workspaces/vc8/assimp_jbridge.vcproj deleted file mode 100644 index 490c3fdf7..000000000 --- a/workspaces/vc8/assimp_jbridge.vcproj +++ /dev/null @@ -1,494 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/workspaces/vc9/assimp.sln b/workspaces/vc9/assimp.sln index fb53f1ceb..99ef7abfb 100644 --- a/workspaces/vc9/assimp.sln +++ b/workspaces/vc9/assimp.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +# Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpview", "assimp_view.vcproj", "{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}" ProjectSection(ProjectDependencies) = postProject {5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524} @@ -18,11 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assimpcmd", "assimp_cmd.vcp {5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Assimp.NET", "..\..\port\Assimp.NET\Assimp.NET\Assimp.NET.vcproj", "{4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}" - ProjectSection(ProjectDependencies) = postProject - {5691E159-2D9B-407F-971F-EA5C592DC524} = {5691E159-2D9B-407F-971F-EA5C592DC524} - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug|Win32 = debug|Win32 @@ -161,30 +156,6 @@ Global {7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}.release-st|Win32.ActiveCfg = release-st|Win32 {7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}.release-st|Win32.Build.0 = release-st|Win32 {7C8F7B44-C990-4EA8-A2A5-9028472E0AD3}.release-st|x64.ActiveCfg = release-st|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug|Win32.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug|Win32.Build.0 = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug|x64.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-dll|Win32.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-dll|Win32.Build.0 = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-dll|x64.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-noboost-st|Win32.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-noboost-st|Win32.Build.0 = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-noboost-st|x64.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-st|Win32.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-st|Win32.Build.0 = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.debug-st|x64.ActiveCfg = Debug|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release|Win32.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release|Win32.Build.0 = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release|x64.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-dll|Win32.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-dll|Win32.Build.0 = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-dll|x64.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-noboost-st|Win32.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-noboost-st|Win32.Build.0 = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-noboost-st|x64.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-st|Win32.ActiveCfg = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-st|Win32.Build.0 = Release|Win32 - {4922D7BD-5E7A-44DD-BC1D-7F6F0BD82894}.release-st|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/workspaces/vc9/assimp_cmd.vcproj b/workspaces/vc9/assimp_cmd.vcproj index 175e4846b..e8ed6beab 100644 --- a/workspaces/vc9/assimp_cmd.vcproj +++ b/workspaces/vc9/assimp_cmd.vcproj @@ -1454,6 +1454,10 @@ RelativePath="..\..\tools\assimp_cmd\ImageExtractor.cpp" > + + diff --git a/workspaces/vc9/jAssimp.vcproj b/workspaces/vc9/jAssimp.vcproj deleted file mode 100644 index 33c58e969..000000000 --- a/workspaces/vc9/jAssimp.vcproj +++ /dev/null @@ -1,1696 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -