diff --git a/CMakeLists.txt b/CMakeLists.txt index a79c0c371..ffbcf5b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${C configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) +FIND_PACKAGE( DirectX ) + option ( ASSIMP_NO_EXPORT "Disable Assimp's export functionality." OFF @@ -242,9 +244,9 @@ option ( ASSIMP_BUILD_ASSIMP_TOOLS ON ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) - IF ( WIN32 ) + IF ( WIN32 AND DirectX_FOUND ) ADD_SUBDIRECTORY( tools/assimp_view/ ) - ENDIF ( WIN32 ) + ENDIF ( WIN32 AND DirectX_FOUND ) ADD_SUBDIRECTORY( tools/assimp_cmd/ ) ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) diff --git a/code/ACLoader.cpp b/code/ACLoader.cpp index 637f51a77..5b7b6a61d 100644 --- a/code/ACLoader.cpp +++ b/code/ACLoader.cpp @@ -620,7 +620,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object, face.mIndices[i] = cur++; // copy vertex positions - if ((vertices - mesh->mVertices) >= mesh->mNumVertices) { + if (static_cast(vertices - mesh->mVertices) >= mesh->mNumVertices) { throw DeadlyImportError("AC3D: Invalid number of vertices"); } *vertices = object.vertices[entry.first] + object.translation; diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 1c8a39495..f11ce589a 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -333,8 +333,16 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll out->mAttenuationLinear = srcLight->mAttLinear; out->mAttenuationQuadratic = srcLight->mAttQuadratic; - // collada doesn't differenciate between these color types out->mColorDiffuse = out->mColorSpecular = out->mColorAmbient = srcLight->mColor*srcLight->mIntensity; + if (out->mType == aiLightSource_AMBIENT) { + out->mColorDiffuse = out->mColorSpecular = aiColor3D(0, 0, 0); + out->mColorAmbient = srcLight->mColor*srcLight->mIntensity; + } + else { + // collada doesn't differentiate between these color types + out->mColorDiffuse = out->mColorSpecular = srcLight->mColor*srcLight->mIntensity; + out->mColorAmbient = aiColor3D(0, 0, 0); + } // convert falloff angle and falloff exponent in our representation, if given if (out->mType == aiLightSource_SPOT) { diff --git a/code/FBXUtil.cpp b/code/FBXUtil.cpp index 1840e8074..7a7e6b993 100644 --- a/code/FBXUtil.cpp +++ b/code/FBXUtil.cpp @@ -84,29 +84,29 @@ const char* TokenTypeString(TokenType t) // ------------------------------------------------------------------------------------------------ std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset) { - return static_cast( (Formatter::format(),prefix," (offset 0x",std::hex,offset,") ",text) ); + return static_cast( (Formatter::format() << prefix << " (offset 0x" << std::hex << offset << ") " << text) ); } // ------------------------------------------------------------------------------------------------ std::string AddLineAndColumn(const std::string& prefix, const std::string& text, unsigned int line, unsigned int column) { - return static_cast( (Formatter::format(),prefix," (line ",line,", col ",column,") ",text) ); + return static_cast( (Formatter::format() << prefix << " (line " << line << " << col " << column << ") " << text) ); } // ------------------------------------------------------------------------------------------------ std::string AddTokenText(const std::string& prefix, const std::string& text, const Token* tok) { if(tok->IsBinary()) { - return static_cast( (Formatter::format(),prefix, - " (",TokenTypeString(tok->Type()), - ", offset 0x", std::hex, tok->Offset(),") ", + return static_cast( (Formatter::format() << prefix << + " (" << TokenTypeString(tok->Type()) << + ", offset 0x" << std::hex << tok->Offset() << ") " << text) ); } - return static_cast( (Formatter::format(),prefix, - " (",TokenTypeString(tok->Type()), - ", line ",tok->Line(), - ", col ",tok->Column(),") ", + return static_cast( (Formatter::format() << prefix << + " (" << TokenTypeString(tok->Type()) << + ", line " << tok->Line() << + ", col " << tok->Column() << ") " << text) ); } @@ -115,4 +115,3 @@ std::string AddTokenText(const std::string& prefix, const std::string& text, con } // !Assimp #endif - diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index bc85ec4ab..77a1c4a25 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -39,14 +39,14 @@ BEGIN_ODDLPARSER_NS static const char *Version = "0.1.0"; namespace Grammar { - static const char *OpenBracketToken = "{"; - static const char *CloseBracketToken = "}"; - static const char *OpenPropertyToken = "("; - static const char *ClosePropertyToken = ")"; - static const char *BoolTrue = "true"; - static const char *BoolFalse = "false"; - static const char *RefToken = "ref"; - static const char *CommaSeparator = ","; + static const char * const OpenBracketToken = "{"; + static const char * const CloseBracketToken = "}"; + static const char * const OpenPropertyToken = "("; + static const char * const ClosePropertyToken = ")"; + static const char * const BoolTrue = "true"; + static const char * const BoolFalse = "false"; + static const char * const RefToken = "ref"; + static const char * const CommaSeparator = ","; static const char* PrimitiveTypeToken[ Value::ddl_types_max ] = { "bool", diff --git a/contrib/poly2tri/poly2tri/sweep/sweep.cc b/contrib/poly2tri/poly2tri/sweep/sweep.cc index 130e06ed4..0f398ad2d 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep.cc @@ -652,13 +652,6 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Triangle& ot = t->NeighborAcross(p); Point& op = *ot.OppositePoint(*t, p); - if (&ot == NULL) { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - assert(0); - } - if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) { // Lets rotate shared edge one vertex CW RotateTrianglePair(*t, p, ot, op); @@ -728,13 +721,6 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& Triangle& ot = t.NeighborAcross(p); Point& op = *ot.OppositePoint(t, p); - if (&t.NeighborAcross(p) == NULL) { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - assert(0); - } - if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) { // flip with new edge op->eq FlipEdgeEvent(tcx, eq, op, &ot, op); diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index c9dd5a8c4..235e1eb05 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -164,7 +164,7 @@ void SweepContext::RemoveFromMap(Triangle* triangle) void SweepContext::MeshClean(Triangle& triangle) { - if (&triangle != NULL && !triangle.IsInterior()) { + if (!triangle.IsInterior()) { triangle.IsInterior(true); triangles_.push_back(&triangle); for (int i = 0; i < 3; i++) { diff --git a/samples/SimpleOpenGL/CMakeLists.txt b/samples/SimpleOpenGL/CMakeLists.txt index ac3b4da1c..52c994b63 100644 --- a/samples/SimpleOpenGL/CMakeLists.txt +++ b/samples/SimpleOpenGL/CMakeLists.txt @@ -1,6 +1,10 @@ FIND_PACKAGE(OpenGL) FIND_PACKAGE(GLUT) -find_library(M_LIB m) +IF ( MSVC ) + SET(M_LIB) +ELSE ( MSVC ) + find_library(M_LIB m) +ENDIF ( MSVC ) IF ( NOT GLUT_FOUND ) IF ( MSVC ) diff --git a/samples/SimpleOpenGL/Sample_SimpleOpenGL.c b/samples/SimpleOpenGL/Sample_SimpleOpenGL.c index 18cb43959..0b83fd487 100644 --- a/samples/SimpleOpenGL/Sample_SimpleOpenGL.c +++ b/samples/SimpleOpenGL/Sample_SimpleOpenGL.c @@ -14,7 +14,11 @@ #include #include +#ifdef __APPLE__ +#include +#else #include +#endif /* assimp include files. These three are usually needed. */ #include diff --git a/test/models/Collada/cube.dae b/test/models/Collada/cube.dae index ad351c77e..435ba2da7 100644 --- a/test/models/Collada/cube.dae +++ b/test/models/Collada/cube.dae @@ -69,6 +69,13 @@ limitations under the License. 1.000000 + + + + 0.1 0.1 0.2 + + + @@ -175,6 +182,7 @@ limitations under the License. 0 1 0 0 1 0 0 0 + 0 0 1 0 diff --git a/test/regression/db.zip b/test/regression/db.zip index ee68fc8cd..3808ded59 100644 Binary files a/test/regression/db.zip and b/test/regression/db.zip differ diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index de11150ff..b2a710284 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -191,7 +191,7 @@ void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxli for(unsigned int i = 0; i < cnest; ++i) { printf("-- "); } - printf("\'%s\', meshes: %i\n",root->mName.data,root->mNumMeshes); + printf("\'%s\', meshes: %u\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) { diff --git a/tools/assimp_cmd/WriteDumb.cpp b/tools/assimp_cmd/WriteDumb.cpp index efc27a935..bcdd64b3a 100644 --- a/tools/assimp_cmd/WriteDumb.cpp +++ b/tools/assimp_cmd/WriteDumb.cpp @@ -677,16 +677,26 @@ void WriteBinaryDump(const aiScene* scene, FILE* _out, const char* src, const ch Write(compressed); // == 20 bytes - char buff[256]; - strncpy(buff,src,256); - fwrite(buff,256,1,out); + { + char buff[256] = { 0 }; + strncpy(buff,src,256); + buff[255] = 0; + fwrite(buff,256,1,out); + } - strncpy(buff,cmd,128); - fwrite(buff,128,1,out); + { + char buff[128] = { 0 }; + strncpy(buff,cmd,128); + buff[127] = 0; + fwrite(buff,128,1,out); + } // leave 64 bytes free for future extensions - memset(buff,0xcd,64); - fwrite(buff,64,1,out); + { + char buff[64]; + memset(buff,0xcd,64); + fwrite(buff,64,1,out); + } // == 435 bytes // ==== total header size: 512 bytes @@ -748,17 +758,17 @@ void WriteNode(const aiNode* node, FILE* out, unsigned int depth) prefix,m.d1,m.d2,m.d3,m.d4,prefix); if (node->mNumMeshes) { - fprintf(out, "%s\t\n%s\t", + fprintf(out, "%s\t\n%s\t", prefix,node->mNumMeshes,prefix); for (unsigned int i = 0; i < node->mNumMeshes;++i) { - fprintf(out,"%i ",node->mMeshes[i]); + fprintf(out,"%u ",node->mMeshes[i]); } fprintf(out,"\n%s\t\n",prefix); } if (node->mNumChildren) { - fprintf(out,"%s\t\n", + fprintf(out,"%s\t\n", prefix,node->mNumChildren); for (unsigned int i = 0; i < node->mNumChildren;++i) { @@ -853,13 +863,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd "\n\n" "" " \n\n" - "\n", + "\n", aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),src,c.c_str(),asctime(p), scene->mFlags, @@ -936,7 +946,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write textures if (scene->mNumTextures) { - fprintf(out,"\n",scene->mNumTextures); + fprintf(out,"\n",scene->mNumTextures); for (unsigned int i = 0; i < scene->mNumTextures;++i) { aiTexture* tex = scene->mTextures[i]; bool compressed = (tex->mHeight == 0); @@ -947,7 +957,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd (compressed ? "true" : "false")); if (compressed) { - fprintf(out,"\t\t \n",tex->mWidth); + fprintf(out,"\t\t \n",tex->mWidth); if (!shortened) { for (unsigned int n = 0; n < tex->mWidth;++n) { @@ -981,12 +991,12 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write materials if (scene->mNumMaterials) { - fprintf(out,"\n",scene->mNumMaterials); + fprintf(out,"\n",scene->mNumMaterials); for (unsigned int i = 0; i< scene->mNumMaterials; ++i) { const aiMaterial* mat = scene->mMaterials[i]; fprintf(out,"\t\n"); - fprintf(out,"\t\t\n",mat->mNumProperties); + fprintf(out,"\t\t\n",mat->mNumProperties); for (unsigned int n = 0; n < mat->mNumProperties;++n) { const aiMaterialProperty* prop = mat->mProperties[n]; @@ -1004,7 +1014,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd sz = "binary_buffer"; } - fprintf(out,"\t\t\tmKey.data, sz, ::TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex); @@ -1048,7 +1058,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write animations if (scene->mNumAnimations) { - fprintf(out,"\n",scene->mNumAnimations); + fprintf(out,"\n",scene->mNumAnimations); for (unsigned int i = 0; i < scene->mNumAnimations;++i) { aiAnimation* anim = scene->mAnimations[i]; @@ -1059,7 +1069,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write bone animation channels if (anim->mNumChannels) { - fprintf(out,"\t\t\n",anim->mNumChannels); + fprintf(out,"\t\t\n",anim->mNumChannels); for (unsigned int n = 0; n < anim->mNumChannels;++n) { aiNodeAnim* nd = anim->mChannels[n]; @@ -1070,7 +1080,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd if (!shortened) { // write position keys if (nd->mNumPositionKeys) { - fprintf(out,"\t\t\t\t\n",nd->mNumPositionKeys); + fprintf(out,"\t\t\t\t\n",nd->mNumPositionKeys); for (unsigned int a = 0; a < nd->mNumPositionKeys;++a) { aiVectorKey* vc = nd->mPositionKeys+a; fprintf(out,"\t\t\t\t\t\n" @@ -1082,7 +1092,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write scaling keys if (nd->mNumScalingKeys) { - fprintf(out,"\t\t\t\t\n",nd->mNumScalingKeys); + fprintf(out,"\t\t\t\t\n",nd->mNumScalingKeys); for (unsigned int a = 0; a < nd->mNumScalingKeys;++a) { aiVectorKey* vc = nd->mScalingKeys+a; fprintf(out,"\t\t\t\t\t\n" @@ -1094,7 +1104,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write rotation keys if (nd->mNumRotationKeys) { - fprintf(out,"\t\t\t\t\n",nd->mNumRotationKeys); + fprintf(out,"\t\t\t\t\n",nd->mNumRotationKeys); for (unsigned int a = 0; a < nd->mNumRotationKeys;++a) { aiQuatKey* vc = nd->mRotationKeys+a; fprintf(out,"\t\t\t\t\t\n" @@ -1115,13 +1125,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // write meshes if (scene->mNumMeshes) { - fprintf(out,"\n",scene->mNumMeshes); + fprintf(out,"\n",scene->mNumMeshes); for (unsigned int i = 0; i < scene->mNumMeshes;++i) { aiMesh* mesh = scene->mMeshes[i]; // const unsigned int width = (unsigned int)log10((double)mesh->mNumVertices)+1; // mesh header - fprintf(out,"\t\n", + fprintf(out,"\t\n", (mesh->mPrimitiveTypes & aiPrimitiveType_POINT ? "points" : ""), (mesh->mPrimitiveTypes & aiPrimitiveType_LINE ? "lines" : ""), (mesh->mPrimitiveTypes & aiPrimitiveType_TRIANGLE ? "triangles" : ""), @@ -1130,7 +1140,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // bones if (mesh->mNumBones) { - fprintf(out,"\t\t\n",mesh->mNumBones); + fprintf(out,"\t\t\n",mesh->mNumBones); for (unsigned int n = 0; n < mesh->mNumBones;++n) { aiBone* bone = mesh->mBones[n]; @@ -1151,13 +1161,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd bone->mOffsetMatrix.d1,bone->mOffsetMatrix.d2,bone->mOffsetMatrix.d3,bone->mOffsetMatrix.d4); if (!shortened && bone->mNumWeights) { - fprintf(out,"\t\t\t\t\n",bone->mNumWeights); + fprintf(out,"\t\t\t\t\n",bone->mNumWeights); // bone weights for (unsigned int a = 0; a < bone->mNumWeights;++a) { aiVertexWeight* wght = bone->mWeights+a; - fprintf(out,"\t\t\t\t\t\n\t\t\t\t\t\t%f\n\t\t\t\t\t\n", + fprintf(out,"\t\t\t\t\t\n\t\t\t\t\t\t%f\n\t\t\t\t\t\n", wght->mVertexId,wght->mWeight); } fprintf(out,"\t\t\t\t\n"); @@ -1169,14 +1179,14 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // faces if (!shortened && mesh->mNumFaces) { - fprintf(out,"\t\t\n",mesh->mNumFaces); + fprintf(out,"\t\t\n",mesh->mNumFaces); for (unsigned int n = 0; n < mesh->mNumFaces; ++n) { aiFace& f = mesh->mFaces[n]; - fprintf(out,"\t\t\t\n" + fprintf(out,"\t\t\t\n" "\t\t\t\t",f.mNumIndices); for (unsigned int j = 0; j < f.mNumIndices;++j) - fprintf(out,"%i ",f.mIndices[j]); + fprintf(out,"%u ",f.mIndices[j]); fprintf(out,"\n\t\t\t\n"); } @@ -1185,7 +1195,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // vertex positions if (mesh->HasPositions()) { - fprintf(out,"\t\t \n",mesh->mNumVertices); + fprintf(out,"\t\t \n",mesh->mNumVertices); if (!shortened) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", @@ -1199,7 +1209,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // vertex normals if (mesh->HasNormals()) { - fprintf(out,"\t\t \n",mesh->mNumVertices); + fprintf(out,"\t\t \n",mesh->mNumVertices); if (!shortened) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", @@ -1215,7 +1225,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd // vertex tangents and bitangents if (mesh->HasTangentsAndBitangents()) { - fprintf(out,"\t\t \n",mesh->mNumVertices); + fprintf(out,"\t\t \n",mesh->mNumVertices); if (!shortened) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", @@ -1226,7 +1236,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd } fprintf(out,"\t\t\n"); - fprintf(out,"\t\t \n",mesh->mNumVertices); + fprintf(out,"\t\t \n",mesh->mNumVertices); if (!shortened) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", @@ -1243,7 +1253,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd if (!mesh->mTextureCoords[a]) break; - fprintf(out,"\t\t \n",mesh->mNumVertices, + fprintf(out,"\t\t \n",mesh->mNumVertices, a,mesh->mNumUVComponents[a]); if (!shortened) { @@ -1270,7 +1280,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a) { if (!mesh->mColors[a]) break; - fprintf(out,"\t\t \n",mesh->mNumVertices,a); + fprintf(out,"\t\t \n",mesh->mNumVertices,a); if (!shortened) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { fprintf(out,"\t\t%0 8f %0 8f %0 8f %0 8f\n", diff --git a/tools/assimp_view/Display.cpp b/tools/assimp_view/Display.cpp index a1d113aea..69bcdb7c1 100644 --- a/tools/assimp_view/Display.cpp +++ b/tools/assimp_view/Display.cpp @@ -169,7 +169,7 @@ int CDisplay::AddNodeToDisplayList( iIndex += iDepth * 100; } else iIndex += iDepth * 10; - sprintf(chTemp,"Node %i",iIndex); + sprintf(chTemp,"Node %u",iIndex); } else { sprintf(chTemp,"%s",pcNode->mName.data); @@ -222,7 +222,7 @@ int CDisplay::AddMeshToDisplayList(unsigned int iIndex, HTREEITEM hRoot) char chTemp[MAXLEN]; if(0 == pcMesh->mName.length) { - sprintf(chTemp,"Mesh %i",iIndex); + sprintf(chTemp,"Mesh %u",iIndex); } else { sprintf(chTemp,"%s",pcMesh->mName.data); @@ -1028,7 +1028,7 @@ int CDisplay::OnSetupTextureView(TextureInfo* pcNew) sprintf(szTemp,"%i",(*pcNew->piTexture)->GetLevelCount()); SetWindowText(GetDlgItem(g_hDlg,IDC_ESHADER),szTemp); - sprintf(szTemp,"%i",pcNew->iUV); + sprintf(szTemp,"%u",pcNew->iUV); SetWindowText(GetDlgItem(g_hDlg,IDC_EMAT),szTemp); sprintf(szTemp,"%f",pcNew->fBlend); @@ -1320,8 +1320,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam) { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), @@ -1353,8 +1355,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam) { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), diff --git a/tools/assimp_view/LogWindow.cpp b/tools/assimp_view/LogWindow.cpp index c8e725c34..c21c2802e 100644 --- a/tools/assimp_view/LogWindow.cpp +++ b/tools/assimp_view/LogWindow.cpp @@ -168,8 +168,10 @@ void CLogWindow::Save() { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 4fed990eb..74c94d7d6 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -474,8 +474,10 @@ void LoadBGTexture() { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), @@ -597,8 +599,10 @@ void LoadSkybox() { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), @@ -639,8 +643,10 @@ void SaveScreenshot() { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } OPENFILENAME sFilename1 = { sizeof(OPENFILENAME), @@ -938,8 +944,10 @@ void OpenAsset() { // need to remove the file name char* sz = strrchr(szFileName,'\\'); - if (!sz)sz = strrchr(szFileName,'/'); - if (!sz)*sz = 0; + if (!sz) + sz = strrchr(szFileName,'/'); + if (sz) + *sz = 0; } // get a list of all file extensions supported by ASSIMP