From ce01b413b133d9cc3375442fafa0cc76e5b0e79b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 23 Dec 2014 18:36:39 +0100 Subject: [PATCH 01/40] add build matrix to support win32-build via cross compiler for windows platform. Signed-off-by: Kim Kulling --- .travis.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c6422058..4ec4c7697 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,15 @@ before_install: - sudo apt-get install cmake python3 env: - - TRAVIS_NO_EXPORT=YES - - TRAVIS_NO_EXPORT=NO - - TRAVIS_STATIC_BUILD=ON - - TRAVIS_STATIC_BUILD=OFF + matrix: + - LINUX=1 TRAVIS_NO_EXPORT=YES + - LINUX=1 TRAVIS_NO_EXPORT=NO + - LINUX=1 TRAVIS_STATIC_BUILD=ON + - LINUX=1 TRAVIS_STATIC_BUILD=OFF + - WINDOWS=1 TRAVIS_NO_EXPORT=YES + - WINDOWS=1 TRAVIS_NO_EXPORT=NO + - WINDOWS=1 TRAVIS_STATIC_BUILD=ON + - WINDOWS=1 TRAVIS_STATIC_BUILD=OFF language: cpp @@ -13,6 +18,9 @@ compiler: - gcc - clang +install: + - if [ $WINDOWS ]; then travis_retry sudo apt-get install -q -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64; fi + script: - cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD - make From e6988f62f6c57be9ea80d277460549f501d254bf Mon Sep 17 00:00:00 2001 From: Gustav Date: Mon, 29 Dec 2014 16:18:17 +0100 Subject: [PATCH 02/40] Fixed cmake 3x cmp0048 warning --- contrib/zlib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt index 5d7b58c43..c05509fdf 100644 --- a/contrib/zlib/CMakeLists.txt +++ b/contrib/zlib/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 2.4.4) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +# use the old project command http://www.cmake.org/cmake/help/v3.0/policy/CMP0048.html +cmake_policy(PUSH) +cmake_policy(SET CMP0048 OLD) project(zlib C) +cmake_policy(POP) set(VERSION "1.2.8") From 7c17c5f46b34f1318083894ee840927b47a26f4d Mon Sep 17 00:00:00 2001 From: Gustav Date: Mon, 29 Dec 2014 16:30:44 +0100 Subject: [PATCH 03/40] Also install zlibstatic --- contrib/zlib/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt index c05509fdf..dd9e742ea 100644 --- a/contrib/zlib/CMakeLists.txt +++ b/contrib/zlib/CMakeLists.txt @@ -189,3 +189,8 @@ if(MINGW) endif(MINGW) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +INSTALL( TARGETS zlibstatic + LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR} + COMPONENT ${LIBASSIMP_COMPONENT}) From 69dbf3713cbd8d7d06ac21c9590e0ff22de5d773 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 2 Jan 2015 12:38:06 +0100 Subject: [PATCH 04/40] fix typo Signed-off-by: Kim Kulling --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 401b4229a..9d8f8a64b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_ elseif(MSVC) # enable multi-core compilation with MSVC add_definitions(/MP) - endif() +endif() INCLUDE (FindPkgConfig) INCLUDE_DIRECTORIES( include ) From 797c89c896ef29d3ba6eb7f3948753c8f8d47aa9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 2 Jan 2015 15:33:47 +0100 Subject: [PATCH 05/40] fix check for minimum version of cmake. Signed-off-by: Kim Kulling --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d8f8a64b..4bd075cca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 3.1 ) PROJECT( Assimp ) # Define here the needed parameters From 6820f1a5c98d9d1f1b50195b6a9965bfe2a52b6f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 2 Jan 2015 15:34:23 +0100 Subject: [PATCH 06/40] workaround for compiler bug with mingw ( too many sections ). Signed-off-by: Kim Kulling --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bd075cca..6a55275cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,11 @@ set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names") option(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF) +# Workaround to be able to deal with compiler bug "Too many sections" with mingw. +if( CMAKE_COMPILER_IS_MINGW ) + ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER ) +endif() + if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW) add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... # hide all not-exported symbols From df4db6e6e299732adcbd5c78dc329b4ae41c790f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 2 Jan 2015 20:34:37 +0100 Subject: [PATCH 07/40] using cmake 3.0 Signed-off-by: Kim Kulling --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a55275cc..2e576522b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.1 ) +cmake_minimum_required( VERSION 3.0 ) PROJECT( Assimp ) # Define here the needed parameters From af48644e56e96222ffdb6e9bcb8f12873665b171 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 3 Jan 2015 01:09:33 +0100 Subject: [PATCH 08/40] fix build. Signed-off-by: Kim Kulling --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e576522b..2c8661f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.0 ) +cmake_minimum_required( VERSION 2.8 ) PROJECT( Assimp ) # Define here the needed parameters From 27f37715824e0b0ac68b356dea259f57c831745f Mon Sep 17 00:00:00 2001 From: Ricardo Ortiz Date: Tue, 20 Jan 2015 13:23:15 -0500 Subject: [PATCH 09/40] Set ASSIMP_LIBRARIES to the proper library name in assimp-config.cmake so that other programs can find it. --- assimp-config.cmake.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 1b68b4f18..d608a0fff 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -40,9 +40,9 @@ set( ASSIMP_LINK_FLAGS "" ) set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) -if (CMAKE_BUILD_TYPE EQUAL "DEBUG") - set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}D) -endif (CMAKE_BUILD_TYPE EQUAL "DEBUG") +if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@ASSIMP_DEBUG_POSTFIX@) +endif () # search for the boost version assimp was compiled with #set(Boost_USE_MULTITHREAD ON) From a09de30d83336bc0fa66bf75b39a9df88f223eee Mon Sep 17 00:00:00 2001 From: Tom Mettam Date: Wed, 21 Jan 2015 01:45:35 +0000 Subject: [PATCH 10/40] Add support for component controlled matrix transforms, i.e transform(0)(0) etc. --- code/ColladaLoader.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index aa4826fc9..5771bc7af 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -985,6 +985,47 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars entry.mTransformId = srcChannel.mTarget.substr( slashPos+1); } + std::string::size_type bracketPos = srcChannel.mTarget.find('('); + if (bracketPos != std::string::npos) + { + entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1); + std::string subElement = srcChannel.mTarget.substr(bracketPos); + + if (subElement == "(0)(0)") + entry.mSubElement = 0; + else if (subElement == "(1)(0)") + entry.mSubElement = 1; + else if (subElement == "(2)(0)") + entry.mSubElement = 2; + else if (subElement == "(3)(0)") + entry.mSubElement = 3; + else if (subElement == "(0)(1)") + entry.mSubElement = 4; + else if (subElement == "(1)(1)") + entry.mSubElement = 5; + else if (subElement == "(2)(1)") + entry.mSubElement = 6; + else if (subElement == "(3)(1)") + entry.mSubElement = 7; + else if (subElement == "(0)(2)") + entry.mSubElement = 8; + else if (subElement == "(1)(2)") + entry.mSubElement = 9; + else if (subElement == "(2)(2)") + entry.mSubElement = 10; + else if (subElement == "(3)(2)") + entry.mSubElement = 11; + else if (subElement == "(0)(3)") + entry.mSubElement = 12; + else if (subElement == "(1)(3)") + entry.mSubElement = 13; + else if (subElement == "(2)(3)") + entry.mSubElement = 14; + else if (subElement == "(3)(3)") + entry.mSubElement = 15; + + } + // determine which transform step is affected by this channel entry.mTransformIndex = SIZE_MAX; for( size_t a = 0; a < srcNode->mTransforms.size(); ++a) From e8d44793444c6275e866aaa7a9c3e0e03a1351f8 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Thu, 22 Jan 2015 20:03:13 +0000 Subject: [PATCH 11/40] Squash incorrect abs usage Replace calls to abs with a float to calls to std::abs. Before int abs(int) was being called. --- code/IFCCurve.cpp | 8 ++++---- code/IFCGeometry.cpp | 6 +++--- code/IFCOpenings.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/IFCCurve.cpp b/code/IFCCurve.cpp index c25ee68eb..ffe52dfd2 100644 --- a/code/IFCCurve.cpp +++ b/code/IFCCurve.cpp @@ -91,7 +91,7 @@ public: a = std::fmod(a,static_cast( AI_MATH_TWO_PI )); b = std::fmod(b,static_cast( AI_MATH_TWO_PI )); const IfcFloat setting = static_cast( AI_MATH_PI * conv.settings.conicSamplingAngle / 180.0 ); - return static_cast( std::ceil(abs( b-a)) / setting); + return static_cast( std::ceil(std::abs( b-a)) / setting); } // -------------------------------------------------- @@ -276,7 +276,7 @@ public: IfcFloat acc = 0; BOOST_FOREACH(const CurveEntry& entry, curves) { const ParamRange& range = entry.first->GetParametricRange(); - const IfcFloat delta = abs(range.second-range.first); + const IfcFloat delta = std::abs(range.second-range.first); if (u < acc+delta) { return entry.first->Eval( entry.second ? (u-acc) + range.first : range.second-(u-acc)); } @@ -295,7 +295,7 @@ public: IfcFloat acc = 0; BOOST_FOREACH(const CurveEntry& entry, curves) { const ParamRange& range = entry.first->GetParametricRange(); - const IfcFloat delta = abs(range.second-range.first); + const IfcFloat delta = std::abs(range.second-range.first); if (a <= acc+delta && b >= acc) { const IfcFloat at = std::max(static_cast( 0. ),a-acc), bt = std::min(delta,b-acc); cnt += entry.first->EstimateSampleCount( entry.second ? at + range.first : range.second - bt, entry.second ? bt + range.first : range.second - at ); @@ -569,7 +569,7 @@ bool Curve :: InRange(IfcFloat u) const IfcFloat Curve :: GetParametricRangeDelta() const { const ParamRange& range = GetParametricRange(); - return abs(range.second - range.first); + return std::abs(range.second - range.first); } // ------------------------------------------------------------------------------------------------ diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index cb918a47e..e991f8e57 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -375,21 +375,21 @@ void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, Conv bool take_any = false; for (unsigned int i = 0; i < 2; ++i, take_any = true) { - if ((last_dir == 0 || take_any) && abs(d.x) > 1e-6) { + if ((last_dir == 0 || take_any) && std::abs(d.x) > 1e-6) { q.y = startvec.y; q.z = startvec.z; q.x = -(d.y * q.y + d.z * q.z) / d.x; last_dir = 0; break; } - else if ((last_dir == 1 || take_any) && abs(d.y) > 1e-6) { + else if ((last_dir == 1 || take_any) && std::abs(d.y) > 1e-6) { q.x = startvec.x; q.z = startvec.z; q.y = -(d.x * q.x + d.z * q.z) / d.y; last_dir = 1; break; } - else if ((last_dir == 2 && abs(d.z) > 1e-6) || take_any) { + else if ((last_dir == 2 && std::abs(d.z) > 1e-6) || take_any) { q.y = startvec.y; q.x = startvec.x; q.z = -(d.y * q.y + d.x * q.x) / d.z; diff --git a/code/IFCOpenings.cpp b/code/IFCOpenings.cpp index 6b2f06d59..fb5d432fd 100644 --- a/code/IFCOpenings.cpp +++ b/code/IFCOpenings.cpp @@ -1244,7 +1244,7 @@ bool GenerateOpenings(std::vector& openings, const IfcVector3& face_nor = ((profile_verts[vi_total+2] - profile_verts[vi_total]) ^ (profile_verts[vi_total+1] - profile_verts[vi_total])).Normalize(); - const IfcFloat abs_dot_face_nor = abs(nor * face_nor); + const IfcFloat abs_dot_face_nor = std::abs(nor * face_nor); if (abs_dot_face_nor < 0.9) { vi_total += profile_vertcnts[f]; continue; From 7494cb6e4bf800b1cded52dc367a96e29e835042 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Thu, 22 Jan 2015 20:19:34 +0000 Subject: [PATCH 12/40] Use correct include file for INT_MAX INT_MAX is defined in limits.h, not stdint.h --- include/assimp/metadata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 16809a511..4e1f6732d 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if defined(_MSC_VER) && (_MSC_VER <= 1500) #include "Compiler/pstdint.h" #else -#include +#include #endif From 50dbb867ec56182ade7209f08b538ec662dc52d3 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Thu, 22 Jan 2015 21:27:43 +0000 Subject: [PATCH 13/40] Include stdint.h for uint64_t --- include/assimp/metadata.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 4e1f6732d..12670252e 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Compiler/pstdint.h" #else #include +#include #endif From e2a33e726d4c9c34c63b6a54bda1db8abd12da80 Mon Sep 17 00:00:00 2001 From: Ricardo Ortiz Date: Fri, 23 Jan 2015 10:10:51 -0500 Subject: [PATCH 14/40] Add quotes to build type variable. --- assimp-config.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index d608a0fff..acf6bd56d 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -40,7 +40,7 @@ set( ASSIMP_LINK_FLAGS "" ) set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) -if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@ASSIMP_DEBUG_POSTFIX@) endif () From a94e668486fd65bb2b16178a45ee72d14c93acf2 Mon Sep 17 00:00:00 2001 From: Ricardo Ortiz Date: Fri, 23 Jan 2015 13:10:36 -0500 Subject: [PATCH 15/40] Define CMAKE_DEBUG_POSTFIX and use it instead of ASSIMP_DEBUG_PREFIX to have a consistent library name accross platforms. --- CMakeLists.txt | 12 ++++---- assimp-config.cmake.in | 4 +-- code/CMakeLists.txt | 34 ++++++++++++++------- samples/SimpleOpenGL/CMakeLists.txt | 10 +++--- samples/SimpleTexturedOpenGL/CMakeLists.txt | 8 ++--- test/CMakeLists.txt | 2 +- tools/assimp_cmd/CMakeLists.txt | 4 +-- tools/assimp_view/CMakeLists.txt | 4 +-- 8 files changed, 44 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c8661f55..90cf503c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names") option(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF) # Workaround to be able to deal with compiler bug "Too many sections" with mingw. -if( CMAKE_COMPILER_IS_MINGW ) +if( CMAKE_COMPILER_IS_MINGW ) ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER ) endif() @@ -84,7 +84,7 @@ SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH "Path the tool executables are installed to." ) -SET(ASSIMP_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools") +SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools") # Allow the user to build a shared or static library option ( BUILD_SHARED_LIBS "Build a shared version of the library" ON ) @@ -108,7 +108,7 @@ IF ( ASSIMP_ENABLE_BOOST_WORKAROUND ) MESSAGE( STATUS "Building a non-boost version of Assimp." ) ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND ) SET( Boost_DETAILED_FAILURE_MSG ON ) - SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" ) + SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" ) FIND_PACKAGE( Boost ) IF ( NOT Boost_FOUND ) MESSAGE( FATAL_ERROR @@ -164,7 +164,7 @@ IF ( ASSIMP_NO_EXPORT ) MESSAGE( STATUS "Build an import-only version of Assimp." ) ENDIF( ASSIMP_NO_EXPORT ) -SET ( ASSIMP_BUILD_ARCHITECTURE "" CACHE STRING +SET ( ASSIMP_BUILD_ARCHITECTURE "" CACHE STRING "describe the current architecture." ) IF ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "") @@ -173,7 +173,7 @@ ELSE ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "") ENDIF ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "") # ${CMAKE_GENERATOR} -SET ( ASSIMP_BUILD_COMPILER "" CACHE STRING +SET ( ASSIMP_BUILD_COMPILER "" CACHE STRING "describe the current compiler." ) IF ( ASSIMP_BUILD_COMPILER STREQUAL "") @@ -211,7 +211,7 @@ option ( ASSIMP_BUILD_TESTS "If the test suite for Assimp is built in addition to the library." ON ) - + IF ( ASSIMP_BUILD_TESTS ) ADD_SUBDIRECTORY( test/ ) ENDIF ( ASSIMP_BUILD_TESTS ) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index acf6bd56d..4e5bb6dd7 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -40,9 +40,7 @@ set( ASSIMP_LINK_FLAGS "" ) set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) -if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@ASSIMP_DEBUG_POSTFIX@) -endif () +set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@CMAKE_DEBUG_POSTFIX@) # search for the boost version assimp was compiled with #set(Boost_USE_MULTITHREAD ON) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4f651c7c5..87821f98e 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -205,7 +205,7 @@ SET( Collada_SRCS ColladaParser.cpp ColladaParser.h ColladaExporter.h - ColladaExporter.cpp + ColladaExporter.cpp ) SOURCE_GROUP( Collada FILES ${Collada_SRCS}) @@ -332,7 +332,7 @@ SET( Obj_SRCS ObjFileParser.cpp ObjFileParser.h ObjTools.h - + ObjExporter.h ObjExporter.cpp ) @@ -596,14 +596,14 @@ SET( ConvertUTF_SRCS ) SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS}) -SET( Clipper_SRCS +SET( Clipper_SRCS ../contrib/clipper/clipper.hpp ../contrib/clipper/clipper.cpp ) SOURCE_GROUP( Clipper FILES ${Clipper_SRCS}) -SET( Poly2Tri_SRCS +SET( Poly2Tri_SRCS ../contrib/poly2tri/poly2tri/common/shapes.cc ../contrib/poly2tri/poly2tri/common/shapes.h ../contrib/poly2tri/poly2tri/common/utils.h @@ -699,7 +699,7 @@ SET( assimp_src ${IFC_SRCS} ${XGL_SRCS} ${FBX_SRCS} - + # Third-party libraries ${IrrXML_SRCS} ${ConvertUTF_SRCS} @@ -711,7 +711,7 @@ SET( assimp_src ${PUBLIC_HEADERS} ${COMPILER_HEADERS} - + # Old precompiled header # (removed because the precompiled header is not updated when visual studio switch configuration which leads to failed compilation. # Moreover it's a drag to recompile assimp entirely each time a modification is made to one of the included header, which is definitely counter-productive.) @@ -722,8 +722,6 @@ SET( assimp_src ADD_LIBRARY( assimp ${assimp_src} ) -SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) - TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) @@ -732,10 +730,24 @@ if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) target_link_libraries(assimp android_jniiosystem) endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) +if( MSVC ) + # in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix + if( MSVC70 OR MSVC71 ) + set(MSVC_PREFIX "vc70") + elseif( MSVC80 ) + set(MSVC_PREFIX "vc80") + elseif( MSVC90 ) + set(MSVC_PREFIX "vc90") + else() + set(MSVC_PREFIX "vc100") + endif() + set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) +endif() + SET_TARGET_PROPERTIES( assimp PROPERTIES VERSION ${ASSIMP_VERSION} - SOVERSION ${ASSIMP_SOVERSION} # use full version - OUTPUT_NAME assimp${ASSIMP_LIBRARY_SUFFIX} + SOVERSION ${ASSIMP_SOVERSION} # use full version + OUTPUT_NAME assimp${LIBRARY_SUFFIX} ) if (APPLE) @@ -765,7 +777,7 @@ if (ASSIMP_ANDROID_JNIIOSYSTEM) endif(ASSIMP_ANDROID_JNIIOSYSTEM) if(MSVC AND ASSIMP_INSTALL_PDB) - install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${ASSIMP_DEBUG_POSTFIX}.pdb + install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${ASSIMP_LIB_INSTALL_DIR} CONFIGURATIONS Debug ) diff --git a/samples/SimpleOpenGL/CMakeLists.txt b/samples/SimpleOpenGL/CMakeLists.txt index dea335ee1..cc83a7301 100644 --- a/samples/SimpleOpenGL/CMakeLists.txt +++ b/samples/SimpleOpenGL/CMakeLists.txt @@ -19,16 +19,16 @@ INCLUDE_DIRECTORIES( ${GLUT_INCLUDE_DIR} ) -LINK_DIRECTORIES( - ${Assimp_BINARY_DIR} - ${Assimp_BINARY_DIR}/lib +LINK_DIRECTORIES( + ${Assimp_BINARY_DIR} + ${Assimp_BINARY_DIR}/lib ) ADD_EXECUTABLE( assimp_simpleogl Sample_SimpleOpenGL.c ) -SET_PROPERTY(TARGET assimp_simpleogl PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_simpleogl PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES( assimp_simpleogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${M_LIB} ) SET_TARGET_PROPERTIES( assimp_simpleogl PROPERTIES @@ -37,4 +37,4 @@ SET_TARGET_PROPERTIES( assimp_simpleogl PROPERTIES INSTALL( TARGETS assimp_simpleogl DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev -) +) diff --git a/samples/SimpleTexturedOpenGL/CMakeLists.txt b/samples/SimpleTexturedOpenGL/CMakeLists.txt index cc1db1024..d26756bfb 100644 --- a/samples/SimpleTexturedOpenGL/CMakeLists.txt +++ b/samples/SimpleTexturedOpenGL/CMakeLists.txt @@ -19,8 +19,8 @@ INCLUDE_DIRECTORIES( ${Assimp_SOURCE_DIR}/samples/DevIL/include/ ) -LINK_DIRECTORIES( - ${Assimp_BINARY_DIR} +LINK_DIRECTORIES( + ${Assimp_BINARY_DIR} ${Assimp_BINARY_DIR}/lib/ ${Assimp_SOURCE_DIR}/samples/DevIL/lib/ ) @@ -30,7 +30,7 @@ ADD_EXECUTABLE( assimp_simpletexturedogl WIN32 SimpleTexturedOpenGL/src/model_loading.cpp ) -SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} DevIL.lib ) @@ -40,4 +40,4 @@ SET_TARGET_PROPERTIES( assimp_simpletexturedogl PROPERTIES INSTALL( TARGETS assimp_simpletexturedogl DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev -) +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5eb1f1b90..3a8bbe82d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -52,7 +52,7 @@ add_executable( unit ${TEST_SRCS} ) -SET_PROPERTY( TARGET assimp PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX} ) +SET_PROPERTY( TARGET assimp PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} ) add_dependencies( unit gtest ) target_link_libraries( unit assimp diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index 374758db8..b549f9b10 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -19,7 +19,7 @@ ADD_EXECUTABLE( assimp_cmd Export.cpp ) -SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) IF( WIN32 ) ADD_CUSTOM_COMMAND(TARGET assimp_cmd @@ -35,4 +35,4 @@ SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES INSTALL( TARGETS assimp_cmd DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-bin -) +) diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index ddc18686a..e65060c9d 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -42,7 +42,7 @@ ADD_EXECUTABLE( assimp_viewer WIN32 txi.bmp ) -SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) IF ( MSVC ) @@ -52,7 +52,7 @@ ENDIF ( MSVC ) # -ADD_CUSTOM_COMMAND(TARGET assimp_viewer +ADD_CUSTOM_COMMAND(TARGET assimp_viewer PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ MAIN_DEPENDENCY assimp) From 380021e7c4e6a9c69d0a380b539def637338ad82 Mon Sep 17 00:00:00 2001 From: Johnny Dickinson Date: Sat, 24 Jan 2015 00:00:35 -0500 Subject: [PATCH 16/40] Check that zlib initialized correctly in FBX parser Check the return code of inflateInit() indicates success to avoid crashing later when zstream contains invalid data. --- code/FBXParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index 7559a380d..bdeb40a09 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -549,7 +549,9 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha zstream.data_type = Z_BINARY; // http://hewgill.com/journal/entries/349-how-to-decompress-gzip-stream-with-zlib - inflateInit(&zstream); + if(Z_OK != inflateInit(&zstream)) { + ParseError("failure initializing zlib"); + } zstream.next_in = reinterpret_cast( const_cast(data) ); zstream.avail_in = comp_len; From b97c26b1d2abb53d00c0c251e4bd5e3f9a59f72c Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sun, 25 Jan 2015 22:27:57 +0200 Subject: [PATCH 17/40] Avoid division by zero in assimp_cmd info when scene loading succeeds but contains no meshes --- tools/assimp_cmd/Info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index a34129f31..055193f6e 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -112,12 +112,12 @@ unsigned int CountAnimChannels(const aiScene* scene) // ----------------------------------------------------------------------------------- unsigned int GetAvgFacePerMesh(const aiScene* scene) { - return static_cast(CountFaces(scene)/scene->mNumMeshes); + return (scene->mNumMeshes != 0) ? static_cast(CountFaces(scene)/scene->mNumMeshes) : 0; } // ----------------------------------------------------------------------------------- unsigned int GetAvgVertsPerMesh(const aiScene* scene) { - return static_cast(CountVertices(scene)/scene->mNumMeshes); + return (scene->mNumMeshes != 0) ? static_cast(CountVertices(scene)/scene->mNumMeshes) : 0; } // ----------------------------------------------------------------------------------- From 1bdb31f8aa33f182b8713986abf466e2fb952dfc Mon Sep 17 00:00:00 2001 From: yeonseok-yi <0108981@gmail.com> Date: Mon, 26 Jan 2015 21:09:54 +0900 Subject: [PATCH 18/40] Fixed error of aiQuaterniont::Rotate() The function rotates a point to opposite direction. Conjugate() should be applied to inverse of the quaternion. --- include/assimp/quaternion.inl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/assimp/quaternion.inl b/include/assimp/quaternion.inl index cf1223910..181b6ffcc 100644 --- a/include/assimp/quaternion.inl +++ b/include/assimp/quaternion.inl @@ -273,11 +273,10 @@ template inline aiVector3t aiQuaterniont::Rotate (const aiVector3t& v) { aiQuaterniont q2(0.f,v.x,v.y,v.z), q = *this, qinv = q; - q.Conjugate(); + qinv.Conjugate(); q = q*q2*qinv; return aiVector3t(q.x,q.y,q.z); - } #endif From 1cf81227c4cd96456101212e012faf6147186d47 Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Mon, 26 Jan 2015 15:35:38 +0000 Subject: [PATCH 19/40] Simplify behavior of SweepContext::InitEdges --- contrib/poly2tri/poly2tri/sweep/sweep_context.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index c9dd5a8c4..4fd1ac365 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -97,10 +97,10 @@ void SweepContext::InitTriangulation() void SweepContext::InitEdges(std::vector polyline) { int num_points = polyline.size(); - for (int i = 0; i < num_points; i++) { - int j = i < num_points - 1 ? i + 1 : 0; - edge_list.push_back(new Edge(*polyline[i], *polyline[j])); + for (int i = 0; i < num_points - 1; i++) { + edge_list.push_back(new Edge(*polyline[i], *polyline[i + 1])); } + edge_list.push_back(new Edge(*polyline.back(), *polyline.front())); } Point* SweepContext::GetPoint(const int& index) From 00d561982cdaea71395a000e8de15f96d11fa89d Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Mon, 26 Jan 2015 15:38:12 +0000 Subject: [PATCH 20/40] Use size_t instead of int for number of points This squashes warnings under Visual Studio 12 --- contrib/poly2tri/poly2tri/sweep/sweep_context.cc | 4 ++-- contrib/poly2tri/poly2tri/sweep/sweep_context.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index 4fd1ac365..672303c53 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -96,8 +96,8 @@ void SweepContext::InitTriangulation() void SweepContext::InitEdges(std::vector polyline) { - int num_points = polyline.size(); - for (int i = 0; i < num_points - 1; i++) { + std::size_t num_points = polyline.size(); + for (std::size_t i = 0; i < num_points - 1; i++) { edge_list.push_back(new Edge(*polyline[i], *polyline[i + 1])); } edge_list.push_back(new Edge(*polyline.back(), *polyline.front())); diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.h b/contrib/poly2tri/poly2tri/sweep/sweep_context.h index 266408dc2..4b098e860 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.h +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.h @@ -64,7 +64,7 @@ void set_tail(Point* p1); Point* tail(); -int point_count(); +std::size_t point_count(); Node& LocateNode(Point& point); @@ -156,7 +156,7 @@ inline AdvancingFront* SweepContext::front() return front_; } -inline int SweepContext::point_count() +inline std::size_t SweepContext::point_count() { return points_.size(); } From 8b55d276e9c636d54d2e54e938e2aff11eb2942d Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Mon, 26 Jan 2015 19:54:02 +0100 Subject: [PATCH 21/40] Revert "Fix warnings under Visual Studio 12" --- contrib/poly2tri/poly2tri/sweep/sweep_context.cc | 8 ++++---- contrib/poly2tri/poly2tri/sweep/sweep_context.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index 672303c53..c9dd5a8c4 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -96,11 +96,11 @@ void SweepContext::InitTriangulation() void SweepContext::InitEdges(std::vector polyline) { - std::size_t num_points = polyline.size(); - for (std::size_t i = 0; i < num_points - 1; i++) { - edge_list.push_back(new Edge(*polyline[i], *polyline[i + 1])); + int num_points = polyline.size(); + for (int i = 0; i < num_points; i++) { + int j = i < num_points - 1 ? i + 1 : 0; + edge_list.push_back(new Edge(*polyline[i], *polyline[j])); } - edge_list.push_back(new Edge(*polyline.back(), *polyline.front())); } Point* SweepContext::GetPoint(const int& index) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.h b/contrib/poly2tri/poly2tri/sweep/sweep_context.h index 4b098e860..266408dc2 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.h +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.h @@ -64,7 +64,7 @@ void set_tail(Point* p1); Point* tail(); -std::size_t point_count(); +int point_count(); Node& LocateNode(Point& point); @@ -156,7 +156,7 @@ inline AdvancingFront* SweepContext::front() return front_; } -inline std::size_t SweepContext::point_count() +inline int SweepContext::point_count() { return points_.size(); } From 704e57db4ee640262b8b20f4b687c15231d64354 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Tue, 27 Jan 2015 22:47:05 -0500 Subject: [PATCH 22/40] changed default postprocessing option to triangulate quad meshes --- port/PyAssimp/pyassimp/core.py | 61 ++++++++++++------------------- port/PyAssimp/pyassimp/structs.py | 10 +++++ 2 files changed, 33 insertions(+), 38 deletions(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index b5b0441ce..29550eb35 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -1,5 +1,3 @@ -#-*- coding: UTF-8 -*- - """ PyAssimp @@ -21,37 +19,31 @@ logger = logging.getLogger("pyassimp") logger.addHandler(logging.NullHandler()) from . import structs -from .errors import AssimpError from . import helper +from . import postprocess +from .errors import AssimpError +from .formats import available_formats -assimp_structs_as_tuple = ( - structs.Matrix4x4, - structs.Matrix3x3, - structs.Vector2D, - structs.Vector3D, - structs.Color3D, - structs.Color4D, - structs.Quaternion, - structs.Plane, - structs.Texel) +class AssimpLib(object): + """ + Assimp-Singleton + """ + load, load_mem, release, dll = helper.search_library() +_assimp_lib = AssimpLib() def make_tuple(ai_obj, type = None): res = None - if isinstance(ai_obj, structs.Matrix4x4): res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((4,4)) - #import pdb;pdb.set_trace() elif isinstance(ai_obj, structs.Matrix3x3): res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]).reshape((3,3)) else: res = numpy.array([getattr(ai_obj, e[0]) for e in ai_obj._fields_]) - return res # It is faster and more correct to have an init function for each assimp class def _init_face(aiFace): aiFace.indices = [aiFace.mIndices[i] for i in range(aiFace.mNumIndices)] - assimp_struct_inits = { structs.Face : _init_face } def call_init(obj, caller = None): @@ -112,7 +104,7 @@ def _init(self, target = None, parent = None): obj = getattr(self, m) # Create tuples - if isinstance(obj, assimp_structs_as_tuple): + if isinstance(obj, structs.assimp_structs_as_tuple): setattr(target, name, make_tuple(obj)) logger.debug(str(self) + ": Added array " + str(getattr(target, name)) + " as self." + name.lower()) continue @@ -142,7 +134,7 @@ def _init(self, target = None, parent = None): try: - if obj._type_ in assimp_structs_as_tuple: + if obj._type_ in structs.assimp_structs_as_tuple: setattr(target, name, numpy.array([make_tuple(obj[i]) for i in range(length)], dtype=numpy.float32)) logger.debug(str(self) + ": Added an array of numpy arrays (type "+ str(type(obj)) + ") as self." + name) @@ -178,19 +170,16 @@ def _init(self, target = None, parent = None): " a post-processing to triangulate your" " faces.") raise e + else: # starts with 'm' but not iterable - setattr(target, name, obj) logger.debug("Added " + name + " as self." + name + " (type: " + str(type(obj)) + ")") if _is_init_type(obj): call_init(obj, target) - - - if isinstance(self, structs.Mesh): _finalize_mesh(self, target) @@ -200,14 +189,6 @@ def _init(self, target = None, parent = None): return self -class AssimpLib(object): - """ - Assimp-Singleton - """ - load, load_mem, release, dll = helper.search_library() - -#the loader as singleton -_assimp_lib = AssimpLib() def pythonize_assimp(type, obj, scene): """ This method modify the Assimp data structures @@ -247,17 +228,16 @@ def recur_pythonize(node, scene): pythonize the assimp datastructures. ''' node.meshes = pythonize_assimp("MESH", node.meshes, scene) - for mesh in node.meshes: mesh.material = scene.materials[mesh.materialindex] - for cam in scene.cameras: pythonize_assimp("ADDTRANSFORMATION", cam, scene) - for c in node.children: recur_pythonize(c, scene) -def load(filename, processing=0, file_type=None): +def load(filename, + file_type = None, + processing = postprocess.aiProcess_Triangulate): ''' Load a model into a scene. On failure throws AssimpError. @@ -267,12 +247,17 @@ def load(filename, processing=0, file_type=None): If a file object is passed, file_type MUST be specified Otherwise Assimp has no idea which importer to use. This is named 'filename' so as to not break legacy code. - processing: assimp processing parameters - file_type: string, such as 'stl' + processing: assimp postprocessing parameters. Verbose keywords are imported + from postprocessing, and the parameters can be combined bitwise to + generate the final processing value. Note that the default value will + triangulate quad faces. Example of generating other possible values: + processing = (pyassimp.postprocess.aiProcess_Triangulate | + pyassimp.postprocess.aiProcess_OptimizeMeshes) + file_type: string of file extension, such as 'stl' Returns --------- - Scene object with model-data + Scene object with model data ''' if hasattr(filename, 'read'): diff --git a/port/PyAssimp/pyassimp/structs.py b/port/PyAssimp/pyassimp/structs.py index 9d8f5a5a1..39ed8267a 100644 --- a/port/PyAssimp/pyassimp/structs.py +++ b/port/PyAssimp/pyassimp/structs.py @@ -897,3 +897,13 @@ class Scene(Structure): # the scene. ("mCameras", POINTER(POINTER(Camera))), ] + +assimp_structs_as_tuple = (Matrix4x4, + Matrix3x3, + Vector2D, + Vector3D, + Color3D, + Color4D, + Quaternion, + Plane, + Texel) From 25012f7b8afb5f1f441958bd3f19b86528b94323 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Tue, 27 Jan 2015 22:53:31 -0500 Subject: [PATCH 23/40] added list of supported formats, pulled from webpage and test/models --- port/PyAssimp/pyassimp/formats.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 port/PyAssimp/pyassimp/formats.py diff --git a/port/PyAssimp/pyassimp/formats.py b/port/PyAssimp/pyassimp/formats.py new file mode 100644 index 000000000..baba1645c --- /dev/null +++ b/port/PyAssimp/pyassimp/formats.py @@ -0,0 +1,41 @@ +FORMATS = ["CSM", + "LWS", + "B3D", + "COB", + "PLY", + "IFC", + "OFF", + "SMD", + "IRRMESH", + "3D", + "DAE", + "MDL", + "HMP", + "TER", + "WRL", + "XML", + "NFF", + "AC", + "OBJ", + "3DS", + "STL", + "IRR", + "Q3O", + "Q3D" + "MS3D", + "Q3S", + "ZGL", + "MD2", + "X", + "BLEND", + "XGL", + "MD5MESH", + "MAX", + "LXO", + "DXF", + "BVH", + "LWO", + "NDO"] + +def available_formats(): + return FORMATS From f167fe1d4a3550e7c803db0105251595d879a518 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 13:31:04 +0200 Subject: [PATCH 24/40] Ignore unix editor backup files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 55995220d..0ec07fc21 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ test/gtest/src/gtest-stamp/Debug/gtest-build *.lib test/gtest/src/gtest-stamp/Debug/ tools/assimp_view/assimp_viewer.vcxproj.user + +# Unix editor backups +*~ From c5d048a98a750b68e2ddf488b0691cdc326e3fe8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 12:38:30 +0200 Subject: [PATCH 25/40] Fix crash when 3DS file contains faces but no vertices --- code/3DSLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 4f5614a00..1f2235229 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -175,6 +175,10 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile, // file. for (std::vector::iterator i = mScene->mMeshes.begin(), end = mScene->mMeshes.end(); i != end;++i) { + if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) { + delete mScene; + throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile); + } CheckIndices(*i); MakeUnique (*i); ComputeNormalsWithSmoothingsGroups(*i); From 2f0675ac53d9fef9d6b80be4a7189704fd9aeff8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 13:27:48 +0200 Subject: [PATCH 26/40] Fix memory corruption when 3DS file has more smoothing groups than faces --- code/3DSLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 1f2235229..6a51fb84f 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -948,6 +948,9 @@ void Discreet3DSImporter::ParseFaceChunk() // This is the list of smoothing groups - a bitfield for every face. // Up to 32 smoothing groups assigned to a single face. unsigned int num = chunkSize/4, m = 0; + if (num > mMesh.mFaces.size()) { + throw DeadlyImportError("3DS: More smoothing groups than faces"); + } for (std::vector::iterator i = mMesh.mFaces.begin(); m != num;++i, ++m) { // nth bit is set for nth smoothing group (*i).iSmoothGroup = stream->GetI4(); From af09e68654dc6a32fafe7e3192e5dea297031062 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 14:23:07 +0200 Subject: [PATCH 27/40] Fix memory corruption when LWO file contains bad-sized points chunk --- code/LWOLoader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index 14a9f261f..355e21298 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -730,6 +730,11 @@ void LWOImporter::LoadLWOPoints(unsigned int length) // --- this function is used for both LWO2 and LWOB but for // LWO2 we need to allocate 25% more storage - it could be we'll // need to duplicate some points later. + const size_t vertexLen = 12; + if ((length % vertexLen) != 0) + { + throw DeadlyImportError( "LWO2: Points chunk length is not multiple of vertexLen (12)"); + } register unsigned int regularSize = (unsigned int)mCurLayer->mTempPoints.size() + length / 12; if (mIsLWO2) { From 16f9ca35d2ee5e6817bae367e7fb264d0884532b Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 15:05:18 +0200 Subject: [PATCH 28/40] Fix out-of-bounds read when OFF file contains no vertices --- code/OFFLoader.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/OFFLoader.cpp b/code/OFFLoader.cpp index 23a1815c3..ca440a458 100644 --- a/code/OFFLoader.cpp +++ b/code/OFFLoader.cpp @@ -127,6 +127,13 @@ void OFFImporter::InternReadFile( const std::string& pFile, const unsigned int numVertices = strtoul10(sz,&sz);SkipSpaces(&sz); const unsigned int numFaces = strtoul10(sz,&sz); + if (!numVertices) { + throw DeadlyImportError("OFF: There are no valid vertices"); + } + if (!numFaces) { + throw DeadlyImportError("OFF: There are no valid faces"); + } + pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes = 1 ]; aiMesh* mesh = pScene->mMeshes[0] = new aiMesh(); aiFace* faces = mesh->mFaces = new aiFace [mesh->mNumFaces = numFaces]; From 0108d5b1f9deeabed41edf47ab67f9e9031f5d0f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 27 Jan 2015 23:47:22 +0200 Subject: [PATCH 29/40] Fix read past end of buffer on malformed LWOB files --- code/LWOBLoader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/LWOBLoader.cpp b/code/LWOBLoader.cpp index cdbd9695f..6c9b0560a 100644 --- a/code/LWOBLoader.cpp +++ b/code/LWOBLoader.cpp @@ -139,7 +139,15 @@ void LWOImporter::CountVertsAndFacesLWOB(unsigned int& verts, unsigned int& face while (cursor < end && max--) { uint16_t numIndices; + // must have 2 shorts left for numIndices and surface + if (end - cursor < 2) { + throw DeadlyImportError("LWOB: Unexpected end of file"); + } ::memcpy(&numIndices, cursor++, 2); + // must have enough left for indices and surface + if (end - cursor < (1 + numIndices)) { + throw DeadlyImportError("LWOB: Unexpected end of file"); + } verts += numIndices; faces++; cursor += numIndices; From 95ad8272772ef1555da29649cf0e5ce6bb6c8a43 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 28 Jan 2015 00:44:26 +0200 Subject: [PATCH 30/40] Remove bogus delete[] on error path mBuffer is a pointer inside a std::vector so don't try to delete[] it. --- code/PlyLoader.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index 104e194d9..d61c4e5a7 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -156,7 +156,6 @@ void PLYImporter::InternReadFile( const std::string& pFile, } else { - delete[] this->mBuffer; AI_DEBUG_INVALIDATE_PTR(this->mBuffer); throw DeadlyImportError( "Invalid .ply file: Missing format specification"); } From f971b66c477b128f617f14dd75ec3b85dfce28c8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 28 Jan 2015 14:29:14 +0200 Subject: [PATCH 31/40] Fix out-of-bounds read in invalid compressed X file --- code/XFileParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 36e70bc1c..a62aef414 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -214,6 +214,10 @@ XFileParser::XFileParser( const std::vector& pBuffer) AI_SWAP2(ofs); P += 4; + if (P + ofs > End + 2) { + throw DeadlyImportError("X: Unexpected EOF in compressed chunk"); + } + // push data to the stream stream.next_in = (Bytef*)P; stream.avail_in = ofs; From 792da49933195d1b0c4411e58ef041224acd45df Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 28 Jan 2015 16:06:01 +0200 Subject: [PATCH 32/40] Fix out-of-bounds write when STL file node name is too long --- code/STLLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 068008d9e..6fedcd34a 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -229,6 +229,9 @@ void STLImporter::LoadASCIIFile() size_t temp; // setup the name of the node if ((temp = (size_t)(sz-szMe))) { + if (temp >= MAXLEN) { + throw DeadlyImportError( "STL: Node name too long" ); + } pScene->mRootNode->mName.length = temp; memcpy(pScene->mRootNode->mName.data,szMe,temp); From 455d190fd0691698f3ad2c12e7087023c294a2e7 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Sat, 31 Jan 2015 20:51:36 +0100 Subject: [PATCH 33/40] CMakeLists: backwards compatibility with CMake < 3.0. --- contrib/zlib/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt index dd9e742ea..5a9546038 100644 --- a/contrib/zlib/CMakeLists.txt +++ b/contrib/zlib/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 2.4.4) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) -# use the old project command http://www.cmake.org/cmake/help/v3.0/policy/CMP0048.html +# CMake 3.0 changed the project command, setting policy CMP0048 reverts to the old behaviour. +# See http://www.cmake.org/cmake/help/v3.0/policy/CMP0048.html cmake_policy(PUSH) -cmake_policy(SET CMP0048 OLD) +if(CMAKE_MAJOR_VERSION GREATER 2) + cmake_policy(SET CMP0048 OLD) +endif() project(zlib C) cmake_policy(POP) From 6b9f9afd7abf47aabb847bd52324e60b8458416f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sun, 1 Feb 2015 00:02:12 +0200 Subject: [PATCH 34/40] Fix infinite loop in STL loader If next character was not part of valid token and not whitespace we would end up spinning in the loop indefinitely. Fix by using do..while loop which always skips at least one character. Fixes testcase hangs/73b42cd3b6d05e2ddb5c0fe5888459bc --- code/STLLoader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 6fedcd34a..a31df8a1e 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -326,8 +326,10 @@ void STLImporter::LoadASCIIFile() break; } // else skip the whole identifier - else while (!::IsSpaceOrNewLine(*sz)) { - ++sz; + else { + do { + ++sz; + } while (!::IsSpaceOrNewLine(*sz)); } } From fe89773c6fb10bd1a06f692ba9af473f2f625b31 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sun, 1 Feb 2015 00:22:32 +0200 Subject: [PATCH 35/40] Fix infinite loop in PLY parser Fixes testcase hangs/9ab979ab256c70aaec9b651f32f051e9 --- code/PlyParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 6687ca9ed..7c2165983 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -436,7 +436,7 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary) *pCurOut = pCur; // parse all elements - while (true) + while ((*pCur) != '\0') { // skip all comments PLY::DOM::SkipComments(pCur,&pCur); From b93bd167ed72e7a8d9ed6329579ac7755c0620e2 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sun, 1 Feb 2015 00:35:00 +0200 Subject: [PATCH 36/40] Fix infinite loop in STL loader error path It appears that this was never tested since hitting it caused an infinite loop. Fixes testcase hangs/c2eb1fa3e74c6ffe0cebcb1672b03140 --- code/STLLoader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index a31df8a1e..987de89d0 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -308,6 +308,7 @@ void STLImporter::LoadASCIIFile() { if (3 == curVertex) { DefaultLogger::get()->error("STL: a facet with more than 3 vertices has been found"); + ++sz; } else { From de66f15a0a29d3c4716347a126bc87f4105a2b09 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 2 Feb 2015 16:03:24 +0200 Subject: [PATCH 37/40] Fix division by zero --- code/IFCUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/IFCUtil.cpp b/code/IFCUtil.cpp index 97358257c..38fd400e0 100644 --- a/code/IFCUtil.cpp +++ b/code/IFCUtil.cpp @@ -122,7 +122,7 @@ void TempMesh::Transform(const IfcMatrix4& mat) // ------------------------------------------------------------------------------ IfcVector3 TempMesh::Center() const { - return std::accumulate(verts.begin(),verts.end(),IfcVector3()) / static_cast(verts.size()); + return (verts.size() == 0) ? IfcVector3(0.0f, 0.0f, 0.0f) : (std::accumulate(verts.begin(),verts.end(),IfcVector3()) / static_cast(verts.size())); } // ------------------------------------------------------------------------------------------------ From 99e280347449b85d8c0dfb5b908e84417b843259 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 5 Feb 2015 12:32:51 +0100 Subject: [PATCH 38/40] Regression suite: 2.7 compatibility, drop old logic to find assimp binary and require it to be explicitly specified. Process files in a stable order to make results diffable. --- test/regression/gen_db.py | 29 +++++++++++---- test/regression/run.py | 40 +++++++++++++++----- test/regression/utils.py | 77 ++++----------------------------------- 3 files changed, 60 insertions(+), 86 deletions(-) diff --git a/test/regression/gen_db.py b/test/regression/gen_db.py index ef10a298d..d405af9db 100644 --- a/test/regression/gen_db.py +++ b/test/regression/gen_db.py @@ -40,8 +40,15 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # --------------------------------------------------------------------------- -"""Generate the regression database db.zip from the files in the -/test/models directory. Older databases are overwritten with no prompt. +""" +Generate the regression database db.zip from the files in the /test/models +directory. Older databases are overwritten with no prompt but can be restored +using Git as needed. + +Use --help for usage. + +On Windows, use ``py run.py `` to make sure command line parameters +are forwarded to the script. """ import sys @@ -52,9 +59,14 @@ import zipfile import settings import utils -usage = """gen_db [-i=...] [-e=...] [-p] [-n] +usage = """gen_db [assimp_binary] [-i=...] [-e=...] [-p] [-n] + +The assimp_cmd (or assimp) binary to use is specified by the first +command line argument and defaults to ``assimp``. + +To build, set ``ASSIMP_BUILD_ASSIMP_TOOLS=ON`` in CMake. If generating +configs for an IDE, make sure to build the assimp_cmd project. -(lists of file extensions are comma delimited, i.e. `3ds,lwo,x`) -i,--include: List of file extensions to update dumps for. If omitted, all file extensions are updated except those in `exclude`. @@ -66,6 +78,8 @@ usage = """gen_db [-i=...] [-e=...] [-p] [-n] Dont' change anything. -n,--nozip: Don't pack to ZIP archive. Keep all dumps in individual files. + +(lists of file extensions are comma delimited, i.e. `3ds,lwo,x`) """ # ------------------------------------------------------------------------------- @@ -87,7 +101,7 @@ def process_dir(d, outfile, file_filter): outf = os.path.join(os.getcwd(), settings.database_name, utils.hashing(fullp, pp)) - cmd = [utils.assimp_bin_path,"dump",fullp,outf,"-b","-s","-l"] + pp.split() + cmd = [ assimp_bin_path, "dump", fullp, outf, "-b", "-s", "-l" ] + pp.split() outfile.write("assimp dump "+"-"*80+"\n") outfile.flush() if subprocess.call(cmd, stdout=outfile, stderr=outfile, shell=False): @@ -158,7 +172,8 @@ def gen_db(ext_list,outfile): # ------------------------------------------------------------------------------- if __name__ == "__main__": - utils.find_assimp_or_die() + assimp_bin_path = sys.argv[1] if len(sys.argv) > 1 else 'assimp' + def clean(f): f = f.strip("* \'") return "."+f if f[:1] != '.' else f @@ -184,7 +199,7 @@ if __name__ == "__main__": outfile = open(os.path.join("..", "results", "gen_regression_db_output.txt"), "w") if ext_list is None: - (ext_list, err) = subprocess.Popen([utils.assimp_bin_path, "listext"], + (ext_list, err) = subprocess.Popen([assimp_bin_path, "listext"], stdout=subprocess.PIPE).communicate() ext_list = str(ext_list).lower().split(";") diff --git a/test/regression/run.py b/test/regression/run.py index 6d776b362..73172cf04 100644 --- a/test/regression/run.py +++ b/test/regression/run.py @@ -41,8 +41,16 @@ # --------------------------------------------------------------------------- """ -Run the regression test suite using the settings from settings.py. +Run the regression test suite using settings from settings.py. +The assimp_cmd (or assimp) binary to use is specified by the first +command line argument and defaults to ``assimp``. + +To build, set ``ASSIMP_BUILD_ASSIMP_TOOLS=ON`` in CMake. If generating +configs for an IDE, make sure to build the assimp_cmd project. + +On Windows, use ``py run.py `` to make sure the command +line parameter is forwarded to the script. """ import sys @@ -124,8 +132,11 @@ class results: def report_results(self): """Write results to ../results/run_regression_suite_failures.txt""" + count_success = len(self.success) + count_fail = len(self.failures) + percent_good = float(count_success) / (count_success + count_fail) print("\n" + ('='*60) + "\n" + "SUCCESS: {0}\nFAILURE: {1}\nPercentage good: {2}".format( - len(self.success), len(self.failures), len(self.success)/(len(self.success)+len(self.failures)) ) + + count_success, count_fail, percent_good) + "\n" + ('='*60) + "\n") with open(os.path.join('..', 'results',outfilename_failur), "wt") as f: @@ -138,7 +149,7 @@ class results: + " for more details\n\n") # ------------------------------------------------------------------------------- -def mkoutputdir_andgetpath(fullpath, myhash, app): +def prepare_output_dir(fullpath, myhash, app): outfile = os.path.join(settings.results, "tmp", os.path.split(fullpath)[1] + "_" + myhash) try: os.mkdir(outfile) @@ -154,7 +165,7 @@ def process_dir(d, outfile_results, zipin, result): shellparams = {'stdout':outfile_results, 'stderr':outfile_results, 'shell':False} print("Processing directory " + d) - for f in os.listdir(d): + for f in sorted(os.listdir(d)): fullpath = os.path.join(d, f) if os.path.isdir(fullpath) and not f == ".svn": process_dir(fullpath, outfile_results, zipin, result) @@ -167,13 +178,16 @@ def process_dir(d, outfile_results, zipin, result): for pppreset in settings.pp_configs_to_test: filehash = utils.hashing(fullpath, pppreset) failure = False + try: input_expected = zipin.open(filehash, "r").read() # empty dump files indicate 'expected import failure' if not len(input_expected): failure = True except KeyError: - #print("Didn't find "+fullpath+" (Hash is "+filehash+") in database") + # TODO(acgessler): Keep track of this and report as error in the end. + print("Didn't find "+fullpath+" (Hash is "+filehash+") in database. Outdated "+\ + "regression database? Use gen_db.zip to re-generate.") continue # Ignore extensions via settings.py configured list @@ -184,13 +198,18 @@ def process_dir(d, outfile_results, zipin, result): print("-"*60 + "\n " + os.path.realpath(fullpath) + " pp: " + pppreset) - outfile_actual = mkoutputdir_andgetpath(fullpath, filehash, "ACTUAL") - outfile_expect = mkoutputdir_andgetpath(fullpath, filehash, "EXPECT") + outfile_actual = prepare_output_dir(fullpath, filehash, "ACTUAL") + outfile_expect = prepare_output_dir(fullpath, filehash, "EXPECT") outfile_results.write("assimp dump "+"-"*80+"\n") outfile_results.flush() - command = [utils.assimp_bin_path,"dump",fullpath,outfile_actual,"-b","-s","-l"]+pppreset.split() + command = [assimp_bin_path, + "dump", + fullpath, outfile_actual, "-b", "-s", "-l" ] +\ + pppreset.split() + r = subprocess.call(command, **shellparams) + print(r) if r and not failure: result.fail(fullpath, outfile_expect, pppreset, IMPORT_FAILURE, r) @@ -216,7 +235,7 @@ def process_dir(d, outfile_results, zipin, result): outfile_results.write("assimp cmpdump "+"-"*80+"\n") outfile_results.flush() - command = [utils.assimp_bin_path,'cmpdump',outfile_actual,outfile_expect] + command = [ assimp_bin_path, 'cmpdump', outfile_actual, outfile_expect ] if subprocess.call(command, **shellparams) != 0: result.fail(fullpath, outfile_expect, pppreset, DATABASE_VALUE_MISMATCH) continue @@ -235,7 +254,6 @@ def del_folder_with_contents(folder): # ------------------------------------------------------------------------------- def run_test(): - utils.find_assimp_or_die() tmp_target_path = os.path.join(settings.results, "tmp") try: os.mkdir(tmp_target_path) @@ -261,6 +279,8 @@ def run_test(): # ------------------------------------------------------------------------------- if __name__ == "__main__": + assimp_bin_path = sys.argv[1] if len(sys.argv) > 1 else 'assimp' + print('Using assimp binary: ' + assimp_bin_path) run_test() # vim: ai ts=4 sts=4 et sw=4 diff --git a/test/regression/utils.py b/test/regression/utils.py index 73c8336ca..8e358e9b0 100644 --- a/test/regression/utils.py +++ b/test/regression/utils.py @@ -40,7 +40,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # --------------------------------------------------------------------------- -"""Shared stuff for the gen_db and run scripts """ +"""Shared stuff for the gen_db and run scripts""" # ------------------------------------------------------------------------------- def hashing(file,pp): @@ -51,75 +51,14 @@ def hashing(file,pp): and platforms, so we implement the hashing manually. """ - def myhash(instring): - # sdbm hash - res = 0 - for t in instring: - res = (ord(t) + (res<<6) + (res<<16) - res) % 2**32 - return res + file = file.replace('\\','/')+":"+pp + # SDBM hash + res = 0 + for t in file: + res = (ord(t) + (res<<6) + (res<<16) - res) % 2**32 - return hex(myhash(file.replace('\\','/')+":"+pp)) + # Python 2.7 normalization: strip 'L' suffix. + return hex(res).rstrip('L') -assimp_bin_path = None -# ------------------------------------------------------------------------------- -def find_assimp_or_die(): - """Find assimp_cmd's binary for the current platform. - - The path to the binary is stored in assimp_bin_path, the process - is aborted if it can't be found. - - """ - - import os - import platform - import sys - - def locate_file(f_list): - for f in f_list: - try: - fl = open(f,"rb") - except IOError: - continue - fl.close() - return f - return None - - global assimp_bin_path - if os.name == "nt": - search_x86 = [ - os.path.join("assimp.exe"), - os.path.join("..","..","bin","assimpcmd_release-dll_Win32","assimp.exe"), - os.path.join("..","..","bin","x86","assimp"), - os.path.join("..","..","bin","Release","assimp.exe") - ] - if platform.machine() == "x86": - search = search_x86 - else: # amd64, hopefully - search = [ - os.path.join("..","..","bin","assimpcmd_release-dll_x64","assimp.exe"), - os.path.join("..","..","bin","x64","assimp") - ] - # x64 platform does not guarantee a x64 build. Also look for x86 as last paths. - search += search_x86 - - assimp_bin_path = locate_file(search) - if assimp_bin_path is None: - print("Can't locate assimp_cmd binary") - print("Looked in", search) - sys.exit(-5) - - print("Located assimp/assimp_cmd binary from", assimp_bin_path) - elif os.name == "posix": - #search = [os.path.join("..","..","bin","gcc","assimp"), - # os.path.join("/usr","local","bin",'assimp')] - assimp_bin_path = "assimp" - print("Taking system-wide assimp binary") - else: - print("Unsupported operating system") - sys.exit(-5) - -if __name__ == '__main__': - find_assimp_or_die() - # vim: ai ts=4 sts=4 et sw=4 From 4e8f7fb8027c177ca3dbc2213aba752ae927f260 Mon Sep 17 00:00:00 2001 From: OgreTransporter Date: Sun, 8 Feb 2015 12:26:29 +0100 Subject: [PATCH 39/40] Fix Visual Studio prefixes --- CMakeLists.txt | 2 +- assimp-config.cmake.in | 8 +++++++- code/CMakeLists.txt | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90cf503c1..be712c7fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ IF ( ASSIMP_ENABLE_BOOST_WORKAROUND ) MESSAGE( STATUS "Building a non-boost version of Assimp." ) ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND ) SET( Boost_DETAILED_FAILURE_MSG ON ) - SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" ) + SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0" "1.50" "1.50.0" "1.51" "1.51.0" "1.52.0" "1.53.0" "1.54.0" "1.55" "1.55.0" "1.56" "1.56.0" "1.57" "1.57.0" "1.58" "1.58.0" ) FIND_PACKAGE( Boost ) IF ( NOT Boost_FOUND ) MESSAGE( FATAL_ERROR diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 4e5bb6dd7..098eba85b 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -23,8 +23,14 @@ if( MSVC ) set(MSVC_PREFIX "vc80") elseif( MSVC90 ) set(MSVC_PREFIX "vc90") - else() + elseif( MSVC10 ) set(MSVC_PREFIX "vc100") + elseif( MSVC11 ) + set(MSVC_PREFIX "vc110") + elseif( MSVC12 ) + set(MSVC_PREFIX "vc120") + else() + set(MSVC_PREFIX "vc130") endif() set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) else() diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 87821f98e..5811bc103 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -738,8 +738,14 @@ if( MSVC ) set(MSVC_PREFIX "vc80") elseif( MSVC90 ) set(MSVC_PREFIX "vc90") - else() + elseif( MSVC10 ) set(MSVC_PREFIX "vc100") + elseif( MSVC11 ) + set(MSVC_PREFIX "vc110") + elseif( MSVC12 ) + set(MSVC_PREFIX "vc120") + else() + set(MSVC_PREFIX "vc130") endif() set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) endif() From 7bab42f55fdffb018feecddce7531b580b2a38e4 Mon Sep 17 00:00:00 2001 From: mbp566 Date: Wed, 18 Feb 2015 17:02:30 +0900 Subject: [PATCH 40/40] Fixed many doxygen errors --- include/assimp/DefaultLogger.hpp | 2 +- include/assimp/Exporter.hpp | 4 +-- include/assimp/IOStream.hpp | 2 +- include/assimp/IOSystem.hpp | 2 +- include/assimp/Importer.hpp | 2 +- include/assimp/LogStream.hpp | 2 +- include/assimp/NullLogger.hpp | 2 +- include/assimp/ProgressHandler.hpp | 2 +- include/assimp/ai_assert.h | 2 +- include/assimp/cexport.h | 7 ++-- include/assimp/cfileio.h | 2 +- include/assimp/cimport.h | 56 ++++++++++++++++++++++++------ include/assimp/color4.h | 2 +- include/assimp/color4.inl | 2 +- include/assimp/config.h | 25 ++++++------- include/assimp/defs.h | 2 +- include/assimp/importerdesc.h | 3 +- include/assimp/material.h | 46 +++++------------------- include/assimp/material.inl | 2 +- include/assimp/matrix3x3.inl | 2 +- include/assimp/matrix4x4.inl | 4 +-- include/assimp/mesh.h | 3 +- include/assimp/postprocess.h | 8 ++--- include/assimp/quaternion.inl | 2 +- include/assimp/scene.h | 14 ++++---- include/assimp/types.h | 10 ++++-- include/assimp/vector2.h | 6 ++-- include/assimp/vector2.inl | 2 +- include/assimp/vector3.h | 6 ++-- include/assimp/vector3.inl | 2 +- include/assimp/version.h | 2 +- 31 files changed, 115 insertions(+), 113 deletions(-) diff --git a/include/assimp/DefaultLogger.hpp b/include/assimp/DefaultLogger.hpp index 7efd11750..771ab9d59 100644 --- a/include/assimp/DefaultLogger.hpp +++ b/include/assimp/DefaultLogger.hpp @@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** @file DefaultLogger.h +/** @file DefaultLogger.hpp */ #ifndef INCLUDED_AI_DEFAULTLOGGER diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index fbf1ce1d6..8ed98b3a2 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file export.hpp +/** @file Exporter.hpp * @brief Defines the CPP-API for the Assimp export interface */ #ifndef AI_EXPORT_HPP_INC @@ -181,7 +181,7 @@ public: * about the output data flow of the export process. * @param pBlob A data blob obtained from a previous call to #aiExportScene. Must not be NULL. * @param pPath Full target file name. Target must be accessible. - * @param pPreprocessing Accepts any choice of the #aiPostProcessing enumerated + * @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated * flags, but in reality only a subset of them makes sense here. Specifying * 'preprocessing' flags is useful if the input scene does not conform to * Assimp's default conventions as specified in the @link data Data Structures Page @endlink. diff --git a/include/assimp/IOStream.hpp b/include/assimp/IOStream.hpp index 72f2e6611..4c1ba93a1 100644 --- a/include/assimp/IOStream.hpp +++ b/include/assimp/IOStream.hpp @@ -38,7 +38,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file IOStream.h +/** @file IOStream.hpp * @brief File I/O wrappers for C++. */ diff --git a/include/assimp/IOSystem.hpp b/include/assimp/IOSystem.hpp index 197988f72..c04514feb 100644 --- a/include/assimp/IOSystem.hpp +++ b/include/assimp/IOSystem.hpp @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file IOSystem.h +/** @file IOSystem.hpp * @brief File system wrapper for C++. Inherit this class to supply * custom file handling logic to the Import library. */ diff --git a/include/assimp/Importer.hpp b/include/assimp/Importer.hpp index 5e7797b99..0ee867ca6 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file assimp.hpp +/** @file Importer.hpp * @brief Defines the C++-API to the Open Asset Import Library. */ #ifndef INCLUDED_AI_ASSIMP_HPP diff --git a/include/assimp/LogStream.hpp b/include/assimp/LogStream.hpp index 25b1c65f5..a405e4b51 100644 --- a/include/assimp/LogStream.hpp +++ b/include/assimp/LogStream.hpp @@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** @file LogStream.h +/** @file LogStream.hpp * @brief Abstract base class 'LogStream', representing an output log stream. */ #ifndef INCLUDED_AI_LOGSTREAM_H diff --git a/include/assimp/NullLogger.hpp b/include/assimp/NullLogger.hpp index 38472b0c2..7b1895069 100644 --- a/include/assimp/NullLogger.hpp +++ b/include/assimp/NullLogger.hpp @@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** @file NullLogger.h +/** @file NullLogger.hpp * @brief Dummy logger */ diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index 3ab1e489b..edc210d22 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** @file ProgressHandler.h +/** @file ProgressHandler.hpp * @brief Abstract base class 'ProgressHandler'. */ #ifndef INCLUDED_AI_PROGRESSHANDLER_H diff --git a/include/assimp/ai_assert.h b/include/assimp/ai_assert.h index 1f946d6ec..202446009 100644 --- a/include/assimp/ai_assert.h +++ b/include/assimp/ai_assert.h @@ -1,4 +1,4 @@ -/** @file assert.h +/** @file ai_assert.h */ #ifndef AI_DEBUG_H_INC #define AI_DEBUG_H_INC diff --git a/include/assimp/cexport.h b/include/assimp/cexport.h index 9041621a1..d9cb12761 100644 --- a/include/assimp/cexport.h +++ b/include/assimp/cexport.h @@ -122,10 +122,7 @@ ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn); * @param pFormatId ID string to specify to which format you want to export to. Use * aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available. * @param pFileName Output file to write -* @param pIO custom IO implementation to be used. Use this if you use your own storage methods. -* If none is supplied, a default implementation using standard file IO is used. Note that -* #aiExportSceneToBlob is provided as convenience function to export to memory buffers. -* @param pPreprocessing Accepts any choice of the #aiPostProcessing enumerated +* @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated * flags, but in reality only a subset of them makes sense here. Specifying * 'preprocessing' flags is useful if the input scene does not conform to * Assimp's default conventions as specified in the @link data Data Structures Page @endlink. @@ -183,7 +180,7 @@ ASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene, // -------------------------------------------------------------------------------- /** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an -* exported scene. The memory referred by this structure is owned by Assimp. Use #aiReleaseExportedFile() +* exported scene. The memory referred by this structure is owned by Assimp. * to free its resources. Don't try to free the memory on your side - it will crash for most build configurations * due to conflicting heaps. * diff --git a/include/assimp/cfileio.h b/include/assimp/cfileio.h index 221198d1c..e3b71e9b2 100644 --- a/include/assimp/cfileio.h +++ b/include/assimp/cfileio.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiFileIO.h +/** @file cfileio.h * @brief Defines generic C routines to access memory-mapped files */ #ifndef AI_FILEIO_H_INC diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index 9080c16b6..6e85882d1 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file assimp.h +/** @file cimport.h * @brief Defines the C-API to the Open Asset Import Library. */ #ifndef AI_ASSIMP_H_INC @@ -139,7 +139,17 @@ ASSIMP_API const C_STRUCT aiScene* aiImportFileEx( // -------------------------------------------------------------------------------- /** Same as #aiImportFileEx, but adds an extra parameter containing importer settings. * + * @param pFile Path and filename of the file to be imported, + * expected to be a null-terminated c-string. NULL is not a valid value. + * @param pFlags Optional post processing steps to be executed after + * a successful import. Provide a bitwise combination of the + * #aiPostProcessSteps flags. + * @param pFS aiFileIO structure. Will be used to open the model file itself + * and any other files the loader needs to open. Pass NULL to use the default + * implementation. * @param pProps #aiPropertyStore instance containing import settings. + * @return Pointer to the imported data or NULL if the import failed. + * @note Include for the definition of #aiFileIO. * @see aiImportFileEx */ ASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties( @@ -188,7 +198,29 @@ ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory( // -------------------------------------------------------------------------------- /** Same as #aiImportFileFromMemory, but adds an extra parameter containing importer settings. * + * @param pBuffer Pointer to the file data + * @param pLength Length of pBuffer, in bytes + * @param pFlags Optional post processing steps to be executed after + * a successful import. Provide a bitwise combination of the + * #aiPostProcessSteps flags. If you wish to inspect the imported + * scene first in order to fine-tune your post-processing setup, + * consider to use #aiApplyPostProcessing(). + * @param pHint An additional hint to the library. If this is a non empty string, + * the library looks for a loader to support the file extension specified by pHint + * and passes the file to the first matching loader. If this loader is unable to + * completely the request, the library continues and tries to determine the file + * format on its own, a task that may or may not be successful. + * Check the return value, and you'll know ... * @param pProps #aiPropertyStore instance containing import settings. + * @return A pointer to the imported data, NULL if the import failed. + * + * @note This is a straightforward way to decode models from memory + * buffers, but it doesn't handle model formats that spread their + * data across multiple files or even directories. Examples include + * OBJ or MD3, which outsource parts of their material info into + * external scripts. If you need full functionality, provide + * a custom IOSystem to make Assimp find these files and use + * the regular aiImportFileEx()/aiImportFileExWithProperties() API. * @see aiImportFileFromMemory */ ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemoryWithProperties( @@ -210,7 +242,7 @@ ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemoryWithProperties( * meaning this is still the same #aiScene which you passed for pScene. However, * _if_ post-processing failed, the scene could now be NULL. That's quite a rare * case, post processing steps are not really designed to 'fail'. To be exact, - * the #aiProcess_ValidateDS flag is currently the only post processing step + * the #aiProcess_ValidateDataStructure flag is currently the only post processing step * which can actually cause the scene to be reset to NULL. */ ASSIMP_API const C_STRUCT aiScene* aiApplyPostProcessing( @@ -266,7 +298,7 @@ ASSIMP_API void aiEnableVerboseLogging(aiBool d); // -------------------------------------------------------------------------------- /** Detach a custom log stream from the libraries' logging system. * - * This is the counterpart of #aiAttachPredefinedLogStream. If you attached a stream, + * This is the counterpart of #aiAttachLogStream. If you attached a stream, * don't forget to detach it again. * @param stream The log stream to be detached. * @return AI_SUCCESS if the log stream has been detached successfully. @@ -356,8 +388,9 @@ ASSIMP_API void aiReleasePropertyStore(C_STRUCT aiPropertyStore* p); * interface, properties are always shared by all imports. It is not possible to * specify them per import. * + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. * @param szName Name of the configuration property to be set. All supported - * public properties are defined in the config.h header file (#AI_CONFIG_XXX). + * public properties are defined in the config.h header file (AI_CONFIG_XXX). * @param value New value for the property */ ASSIMP_API void aiSetImportPropertyInteger( @@ -372,8 +405,9 @@ ASSIMP_API void aiSetImportPropertyInteger( * interface, properties are always shared by all imports. It is not possible to * specify them per import. * + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. * @param szName Name of the configuration property to be set. All supported - * public properties are defined in the config.h header file (#AI_CONFIG_XXX). + * public properties are defined in the config.h header file (AI_CONFIG_XXX). * @param value New value for the property */ ASSIMP_API void aiSetImportPropertyFloat( @@ -388,10 +422,10 @@ ASSIMP_API void aiSetImportPropertyFloat( * interface, properties are always shared by all imports. It is not possible to * specify them per import. * - * @param property store to modify. Use #aiCreatePropertyStore to obtain a store. + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. * @param szName Name of the configuration property to be set. All supported - * public properties are defined in the config.h header file (#AI_CONFIG_XXX). - * @param value New value for the property + * public properties are defined in the config.h header file (AI_CONFIG_XXX). + * @param st New value for the property */ ASSIMP_API void aiSetImportPropertyString( C_STRUCT aiPropertyStore* store, @@ -405,10 +439,10 @@ ASSIMP_API void aiSetImportPropertyString( * interface, properties are always shared by all imports. It is not possible to * specify them per import. * - * @param property store to modify. Use #aiCreatePropertyStore to obtain a store. + * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. * @param szName Name of the configuration property to be set. All supported - * public properties are defined in the config.h header file (#AI_CONFIG_XXX). - * @param value New value for the property + * public properties are defined in the config.h header file (AI_CONFIG_XXX). + * @param mat New value for the property */ ASSIMP_API void aiSetImportPropertyMatrix( C_STRUCT aiPropertyStore* store, diff --git a/include/assimp/color4.h b/include/assimp/color4.h index bd8ff6fb4..4677858eb 100644 --- a/include/assimp/color4.h +++ b/include/assimp/color4.h @@ -38,7 +38,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiColor4D.h +/** @file color4.h * @brief RGBA color structure, including operators when compiling in C++ */ #ifndef AI_COLOR4D_H_INC diff --git a/include/assimp/color4.inl b/include/assimp/color4.inl index 2c83872d4..d47a60e23 100644 --- a/include/assimp/color4.inl +++ b/include/assimp/color4.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiColor4D.inl +/** @file color4.inl * @brief Inline implementation of aiColor4t operators */ #ifndef AI_COLOR4D_INL_INC diff --git a/include/assimp/config.h b/include/assimp/config.h index 56ef8f3b5..abe3f1102 100644 --- a/include/assimp/config.h +++ b/include/assimp/config.h @@ -209,7 +209,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "PP_RRM_EXCLUDE_LIST" // --------------------------------------------------------------------------- -/** @brief Configures the #aiProcess_PretransformVertices step to +/** @brief Configures the #aiProcess_PreTransformVertices step to * keep the scene hierarchy. Meshes are moved to worldspace, but * no optimization is performed (read: meshes with equal materials are not * joined. The total number of meshes won't change). @@ -224,7 +224,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "PP_PTV_KEEP_HIERARCHY" // --------------------------------------------------------------------------- -/** @brief Configures the #aiProcess_PretransformVertices step to normalize +/** @brief Configures the #aiProcess_PreTransformVertices step to normalize * all vertex components into the [-1,1] range. That is, a bounding box * for the whole scene is computed, the maximum component is taken and all * meshes are scaled appropriately (uniformly of course!). @@ -234,7 +234,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "PP_PTV_NORMALIZE" // --------------------------------------------------------------------------- -/** @brief Configures the #aiProcess_PretransformVertices step to use +/** @brief Configures the #aiProcess_PreTransformVertices step to use * a users defined matrix as the scene root node transformation before * transforming vertices. * Property type: bool. Default value: false. @@ -243,7 +243,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "PP_PTV_ADD_ROOT_TRANSFORMATION" // --------------------------------------------------------------------------- -/** @brief Configures the #aiProcess_PretransformVertices step to use +/** @brief Configures the #aiProcess_PreTransformVertices step to use * a users defined matrix as the scene root node transformation before * transforming vertices. This property correspond to the 'a1' component * of the transformation matrix. @@ -376,7 +376,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // --------------------------------------------------------------------------- /** @brief Enumerates components of the aiScene and aiMesh data structures - * that can be excluded from the import using the #aiPrpcess_RemoveComponent step. + * that can be excluded from the import using the #aiProcess_RemoveComponent step. * * See the documentation to #aiProcess_RemoveComponent for more details. */ @@ -715,7 +715,7 @@ enum aiComponent /** @brief Tells the MD3 loader which skin files to load. * * When loading MD3 files, Assimp checks whether a file - * _.skin is existing. These files are used by + * [md3_file_name]_[skin_name].skin is existing. These files are used by * Quake III to be able to assign different skins (e.g. red and blue team) * to models. 'default', 'red', 'blue' are typical skin names. * Property type: String. Default value: "default". @@ -728,14 +728,14 @@ enum aiComponent * MD3 file. This can also be a search path. * * By default Assimp's behaviour is as follows: If a MD3 file - * /models///.md3 is + * any_path/models/any_q3_subdir/model_name/file_name.md3 is * loaded, the library tries to locate the corresponding shader file in - * /scripts/.shader. This property overrides this + * any_path/scripts/model_name.shader. This property overrides this * behaviour. It can either specify a full path to the shader to be loaded * or alternatively the path (relative or absolute) to the directory where * the shaders for all MD3s to be loaded reside. Assimp attempts to open - * /.shader first, /.shader - * is the fallback file. Note that should have a terminal (back)slash. + * IMPORT_MD3_SHADER_SRC/model_name.shader first, IMPORT_MD3_SHADER_SRC/file_name.shader + * is the fallback file. Note that IMPORT_MD3_SHADER_SRC should have a terminal (back)slash. * Property type: String. Default value: n/a. */ #define AI_CONFIG_IMPORT_MD3_SHADER_SRC \ @@ -818,12 +818,13 @@ enum aiComponent /** @brief Ogre Importer detect the texture usage from its filename. * * Ogre material texture units do not define texture type, the textures usage - * depends on the used shader or Ogres fixed pipeline. If this config property + * depends on the used shader or Ogre's fixed pipeline. If this config property * is true Assimp will try to detect the type from the textures filename postfix: * _n, _nrm, _nrml, _normal, _normals and _normalmap for normal map, _s, _spec, * _specular and _specularmap for specular map, _l, _light, _lightmap, _occ * and _occlusion for light map, _disp and _displacement for displacement map. - * The matching is case insensitive. Post fix is taken between last "_" and last ".". + * The matching is case insensitive. Post fix is taken between the last + * underscore and the last period. * Default behavior is to detect type from lower cased texture unit name by * matching against: normalmap, specularmap, lightmap and displacementmap. * For both cases if no match is found aiTextureType_DIFFUSE is used. diff --git a/include/assimp/defs.h b/include/assimp/defs.h index e0019f893..7f9add37f 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiDefines.h +/** @file defs.h * @brief Assimp build configuration setup. See the notes in the comment * blocks to find out how to customize _your_ Assimp build. */ diff --git a/include/assimp/importerdesc.h b/include/assimp/importerdesc.h index 5cc9ef302..e61112a17 100644 --- a/include/assimp/importerdesc.h +++ b/include/assimp/importerdesc.h @@ -98,8 +98,7 @@ struct aiImporterDesc /** Implementation comments, i.e. unimplemented features*/ const char* mComments; - /** Any combination of the #aiLoaderFlags enumerated values. - These flags indicate some characteristics common to many + /** These flags indicate some characteristics common to many importers. */ unsigned int mFlags; diff --git a/include/assimp/material.h b/include/assimp/material.h index 2c8ad1d5c..03e46b0be 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -95,14 +95,9 @@ enum aiTextureOp aiTextureOp_SignedAdd = 0x5, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiTextureOp_Force32Bit = INT_MAX #endif - //! @endcond }; // --------------------------------------------------------------------------- @@ -131,14 +126,9 @@ enum aiTextureMapMode */ aiTextureMapMode_Mirror = 0x2, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiTextureMapMode_Force32Bit = INT_MAX #endif - //! @endcond }; // --------------------------------------------------------------------------- @@ -176,14 +166,9 @@ enum aiTextureMapping aiTextureMapping_OTHER = 0x5, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiTextureMapping_Force32Bit = INT_MAX #endif - //! @endcond }; // --------------------------------------------------------------------------- @@ -296,14 +281,9 @@ enum aiTextureType aiTextureType_UNKNOWN = 0xC, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiTextureType_Force32Bit = INT_MAX #endif - //! @endcond }; #define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN @@ -374,14 +354,9 @@ enum aiShadingMode aiShadingMode_Fresnel = 0xa, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiShadingMode_Force32Bit = INT_MAX #endif - //! @endcond }; @@ -420,14 +395,9 @@ enum aiTextureFlags */ aiTextureFlags_IgnoreAlpha = 0x4, - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiTextureFlags_Force32Bit = INT_MAX #endif - //! @endcond }; @@ -442,8 +412,8 @@ enum aiTextureFlags * @code * SourceColor * SourceBlend + DestColor * DestBlend * @endcode - * where is the previous color in the framebuffer at this - * position and is the material colro before the transparency + * where DestColor is the previous color in the framebuffer at this + * position and SourceColor is the material colro before the transparency * calculation.
* This corresponds to the #AI_MATKEY_BLEND_FUNC property. */ @@ -469,14 +439,9 @@ enum aiBlendMode // we don't need more for the moment, but we might need them // in future versions ... - /** @cond never - * This value is not used. It forces the compiler to use at least - * 32 Bit integers to represent this enum. - */ #ifndef SWIG _aiBlendMode_Force32Bit = INT_MAX #endif - //! @endcond }; @@ -862,7 +827,9 @@ public: /** @brief Remove a given key from the list. * * The function fails if the key isn't found - * @param pKey Key to be deleted */ + * @param pKey Key to be deleted + * @param type Set by the AI_MATKEY_XXX macro + * @param index Set by the AI_MATKEY_XXX macro */ aiReturn RemoveProperty (const char* pKey, unsigned int type = 0, unsigned int index = 0); @@ -1330,6 +1297,8 @@ extern "C" { #define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \ AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN,N) +//! @endcond +//! // --------------------------------------------------------------------------- /** @brief Retrieve a material property with a specific key from the material * @@ -1537,6 +1506,7 @@ ASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMa * Pass NULL if you're not interested in this information. Otherwise, * pass a pointer to an array of two aiTextureMapMode's (one for each * axis, UV order). + * @param[out] flags Receives the the texture flags. * @return AI_SUCCESS on success, otherwise something else. Have fun.*/ // --------------------------------------------------------------------------- #ifdef __cplusplus diff --git a/include/assimp/material.inl b/include/assimp/material.inl index 3c269cd1b..2658922bc 100644 --- a/include/assimp/material.inl +++ b/include/assimp/material.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiMaterial.inl +/** @file material.inl * @brief Defines the C++ getters for the material system */ diff --git a/include/assimp/matrix3x3.inl b/include/assimp/matrix3x3.inl index e8a34f9af..f10b45a83 100644 --- a/include/assimp/matrix3x3.inl +++ b/include/assimp/matrix3x3.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiMatrix3x3.inl +/** @file matrix3x3.inl * @brief Inline implementation of the 3x3 matrix operators */ #ifndef AI_MATRIX3x3_INL_INC diff --git a/include/assimp/matrix4x4.inl b/include/assimp/matrix4x4.inl index 4cae3afa7..5e4903e70 100644 --- a/include/assimp/matrix4x4.inl +++ b/include/assimp/matrix4x4.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiMatrix4x4t.inl +/** @file matrix4x4.inl * @brief Inline implementation of the 4x4 matrix operators */ #ifndef AI_MATRIX4x4_INL_INC @@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "quaternion.h" #include -#include +#include #include // ---------------------------------------------------------------------------------------- diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h index e283e4105..44f3ebf47 100644 --- a/include/assimp/mesh.h +++ b/include/assimp/mesh.h @@ -668,8 +668,7 @@ struct aiMesh } //! Check whether the mesh contains positions. Provided no special - //! scene flags are set (such as #AI_SCENE_FLAGS_ANIM_SKELETON_ONLY), - //! this will always be true + //! scene flags are set, this will always be true bool HasPositions() const { return mVertices != NULL && mNumVertices > 0; } diff --git a/include/assimp/postprocess.h b/include/assimp/postprocess.h index f078fd692..3904718a2 100644 --- a/include/assimp/postprocess.h +++ b/include/assimp/postprocess.h @@ -282,7 +282,7 @@ enum aiPostProcessSteps /**
Searches for redundant/unreferenced materials and removes them. * * This is especially useful in combination with the - * #aiProcess_PretransformVertices and #aiProcess_OptimizeMeshes flags. + * #aiProcess_PreTransformVertices and #aiProcess_OptimizeMeshes flags. * Both join small meshes with equal characteristics, but they can't do * their work if two meshes have different materials. Because several * material settings are lost during Assimp's import filters, @@ -335,7 +335,7 @@ enum aiPostProcessSteps * To have the degenerate stuff not only detected and collapsed but * removed, try one of the following procedures: *
1. (if you support lines and points for rendering but don't - * want the degenerates)
+ * want the degenerates)
*
    *
  • Specify the #aiProcess_FindDegenerates flag. *
  • @@ -345,7 +345,7 @@ enum aiPostProcessSteps * pipeline steps. * *
- *
2.(if you don't support lines and points at all)
+ *
2.(if you don't support lines and points at all)
*
    *
  • Specify the #aiProcess_FindDegenerates flag. *
  • @@ -550,7 +550,7 @@ enum aiPostProcessSteps // --------------------------------------------------------------------------------------- -/** @def aiProcessPreset_TargetRealtimeUse_Fast +/** @def aiProcessPreset_TargetRealtime_Fast * @brief Default postprocess configuration optimizing the data for real-time rendering. * * Applications would want to use this preset to load models on end-user PCs, diff --git a/include/assimp/quaternion.inl b/include/assimp/quaternion.inl index 181b6ffcc..6fae14017 100644 --- a/include/assimp/quaternion.inl +++ b/include/assimp/quaternion.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiQuaterniont.inl +/** @file quaternion.inl * @brief Inline implementation of aiQuaterniont operators */ #ifndef AI_QUATERNION_INL_INC diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 87f13152f..1096e18ac 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiScene.h +/** @file scene.h * @brief Defines the data structures in which the imported scene is returned. */ #ifndef __AI_SCENE_H_INC__ @@ -182,8 +182,6 @@ struct aiNode } - /** @override - */ inline const aiNode* FindNode(const char* name) const { if (!::strcmp( mName.data,name))return this; @@ -217,7 +215,7 @@ struct aiNode // ------------------------------------------------------------------------------- -/** @def AI_SCENE_FLAGS_INCOMPLETE +/** * Specifies that the scene data structure that was imported is not complete. * This flag bypasses some internal validations and allows the import * of animation skeletons, material libraries or camera animation paths @@ -225,14 +223,14 @@ struct aiNode */ #define AI_SCENE_FLAGS_INCOMPLETE 0x1 -/** @def AI_SCENE_FLAGS_VALIDATED +/** * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS) * if the validation is successful. In a validated scene you can be sure that * any cross references in the data structure (e.g. vertex indices) are valid. */ #define AI_SCENE_FLAGS_VALIDATED 0x2 -/** @def AI_SCENE_FLAGS_VALIDATION_WARNING +/** * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS) * if the validation is successful but some issues have been found. * This can for example mean that a texture that does not exist is referenced @@ -242,7 +240,7 @@ struct aiNode */ #define AI_SCENE_FLAGS_VALIDATION_WARNING 0x4 -/** @def AI_SCENE_FLAGS_NON_VERBOSE_FORMAT +/** * This flag is currently only set by the aiProcess_JoinIdenticalVertices step. * It indicates that the vertices of the output meshes aren't in the internal * verbose format anymore. In the verbose format all vertices are unique, @@ -250,7 +248,7 @@ struct aiNode */ #define AI_SCENE_FLAGS_NON_VERBOSE_FORMAT 0x8 - /** @def AI_SCENE_FLAGS_TERRAIN + /** * Denotes pure height-map terrain data. Pure terrains usually consist of quads, * sometimes triangles, in a regular grid. The x,y coordinates of all vertex * positions refer to the x,y coordinates on the terrain height map, the z-axis diff --git a/include/assimp/types.h b/include/assimp/types.h index 83767ad46..291e055cf 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -241,7 +241,7 @@ struct aiColor3D * For most applications, it will be absolutely sufficient to interpret the * aiString as ASCII data and work with it as one would work with a plain char*. * Windows users in need of proper support for i.e asian characters can use the - * #MultiByteToWideChar(), #WideCharToMultiByte() WinAPI functionality to convert the + * MultiByteToWideChar(), WideCharToMultiByte() WinAPI functionality to convert the * UTF-8 strings to their working character set (i.e. MBCS, WideChar). * * We use this representation instead of std::string to be C-compatible. The @@ -388,6 +388,8 @@ typedef enum aiReturn * Force 32-bit size enum */ _AI_ENFORCE_ENUM_SIZE = 0x7fffffff + + /// @endcond } aiReturn; // !enum aiReturn // just for backwards compatibility, don't use these constants anymore @@ -414,13 +416,14 @@ enum aiOrigin * Force 32-bit size enum */ _AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff + + /// @endcond }; // !enum aiOrigin // ---------------------------------------------------------------------------------- /** @brief Enumerates predefined log streaming destinations. * Logging to these streams can be enabled with a single call to - * #LogStream::createDefaultStream or #aiAttachPredefinedLogStream(), - * respectively. + * #LogStream::createDefaultStream. */ enum aiDefaultLogStream { @@ -442,6 +445,7 @@ enum aiDefaultLogStream * Force 32-bit size enum */ _AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff + /// @endcond }; // !enum aiDefaultLogStream // just for backwards compatibility, don't use these constants anymore diff --git a/include/assimp/vector2.h b/include/assimp/vector2.h index d033e5a15..e43606123 100644 --- a/include/assimp/vector2.h +++ b/include/assimp/vector2.h @@ -38,18 +38,18 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiVector2t.h +/** @file vector2.h * @brief 2D vector structure, including operators when compiling in C++ */ #ifndef AI_VECTOR2D_H_INC #define AI_VECTOR2D_H_INC - + #ifdef __cplusplus # include #else # include #endif - + #include "./Compiler/pushpack1.h" // ---------------------------------------------------------------------------------- diff --git a/include/assimp/vector2.inl b/include/assimp/vector2.inl index f6cedea1d..5ff03be17 100644 --- a/include/assimp/vector2.inl +++ b/include/assimp/vector2.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiVector2D.inl +/** @file vector2.inl * @brief Inline implementation of aiVector2t operators */ #ifndef AI_VECTOR2D_INL_INC diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index a4c33b194..38716db56 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -38,18 +38,18 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiVector3D.h +/** @file vector3.h * @brief 3D vector structure, including operators when compiling in C++ */ #ifndef AI_VECTOR3D_H_INC #define AI_VECTOR3D_H_INC - + #ifdef __cplusplus # include #else # include #endif - + #include "./Compiler/pushpack1.h" #ifdef __cplusplus diff --git a/include/assimp/vector3.inl b/include/assimp/vector3.inl index 7ba92f6d0..bae22f616 100644 --- a/include/assimp/vector3.inl +++ b/include/assimp/vector3.inl @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiVector3D.inl +/** @file vector3.inl * @brief Inline implementation of aiVector3t operators */ #ifndef AI_VECTOR3D_INL_INC diff --git a/include/assimp/version.h b/include/assimp/version.h index 44e797a11..7d2bbdb31 100644 --- a/include/assimp/version.h +++ b/include/assimp/version.h @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file aiVersion.h +/** @file version.h * @brief Functions to query the version of the Assimp runtime, check * compile flags, ... */