diff --git a/0001-Apply-mechanism-to-decide-use-for-IrrXML-external-or.patch b/0001-Apply-mechanism-to-decide-use-for-IrrXML-external-or.patch new file mode 100644 index 0000000000000000000000000000000000000000..c3d7a9b47732b6dd936d7d6f68f313307a43f47a --- /dev/null +++ b/0001-Apply-mechanism-to-decide-use-for-IrrXML-external-or.patch @@ -0,0 +1,286 @@ +From a52bb1d9b030ee888ab44b8ad9a2a2b8ebb909a3 Mon Sep 17 00:00:00 2001 +From: Helio Chissini de Castro +Date: Thu, 27 Apr 2017 17:19:51 +0200 +Subject: [PATCH] - Apply mechanism to decide use for IrrXML external or + internal + +Several distributions usually decide for shared external libraries +instead of an usual embedded, for security reasons, duplicatiion issues. +This change enable the possibility to set SYSTEM_IRRXML=ON for detect +and build against a system installed irrxml. +By default, the internal copy is compiled. + +Changes on build: +- Added a FindIrrXML cmake module. +- Moved the source recipe for proper CMakeLists inside contrib directory +- Includes aren't path based anymore, using the provided INCLUDE_DIR +- Compiler option are grouped in a singled entry on main CMakeLists +--- + CMakeLists.txt | 88 +++++++++++++++++++++++++++++++++++------- + cmake-modules/FindIrrXML.cmake | 17 ++++++++ + code/CMakeLists.txt | 20 +++------- + code/irrXMLWrapper.h | 6 +-- + contrib/CMakeLists.txt | 4 ++ + contrib/irrXML/CMakeLists.txt | 13 +++++++ + 6 files changed, 116 insertions(+), 32 deletions(-) + create mode 100644 cmake-modules/FindIrrXML.cmake + create mode 100644 contrib/CMakeLists.txt + create mode 100644 contrib/irrXML/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6989510..c2b3faa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,65 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required + cmake_minimum_required( VERSION 2.8 ) + PROJECT( Assimp ) + +-OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON) ++# All supported options ############################################### ++OPTION( BUILD_SHARED_LIBS ++ "Build package with shared libraries." ++ ON ++) ++OPTION( ASSIMP_DOUBLE_PRECISION ++ "Set to ON to enable double precision processing" ++ OFF ++) ++OPTION( ASSIMP_OPT_BUILD_PACKAGES ++ "Set to ON to generate CPack configuration files and packaging targets" ++ OFF ++) ++OPTION( ASSIMP_ANDROID_JNIIOSYSTEM ++ "Android JNI IOSystem support is active" ++ OFF ++) ++OPTION( ASSIMP_NO_EXPORT ++ "Disable Assimp's export functionality." ++ OFF ++) ++OPTION( ASSIMP_BUILD_ZLIB ++ "Build your own zlib" ++ OFF ++) ++option( ASSIMP_BUILD_ASSIMP_TOOLS ++ "If the supplementary tools for Assimp are built in addition to the library." ++ ON ++) ++option ( ASSIMP_BUILD_SAMPLES ++ "If the official samples are built as well (needs Glut)." ++ OFF ++) ++OPTION ( ASSIMP_BUILD_TESTS ++ "If the test suite for Assimp is built in addition to the library." ++ ON ++) ++OPTION ( ASSIMP_COVERALLS ++ "EaƄable this to measure test coverage." ++ OFF ++) ++ ++option ( SYSTEM_IRRXML ++ "Use system installed Irrlicht/IrrXML library." ++ OFF ++) ++ ++#OPTION ( BUILD_DOCS ++# "Build documentation using Doxygen." ++# OFF ++#) ++ ++IF(MSVC) ++ set (CMAKE_PREFIX_PATH "D:\\libs\\devil") ++ OPTION( ASSIMP_INSTALL_PDB ++ "Install MSVC debug files." ++ ON ++ ) ++ENDIF(MSVC) + + IF(NOT BUILD_SHARED_LIBS) + SET(LINK_SEARCH_START_STATIC TRUE) +@@ -116,17 +174,17 @@ IF( UNIX ) + include(GNUInstallDirs) + ENDIF( UNIX ) + +-IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW) +- IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit +- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +- ENDIF() ++# Grouped compiler settings ++IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) + # hide all not-exported symbols +- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" ) ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -std=c++0x" ) ++ SET(LIBSTDC++_LIBRARIES -lstdc++) ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) + ELSEIF(MSVC) + # enable multi-core compilation with MSVC + add_compile_options(/MP) +-ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) ++ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fvisibility=hidden -fPIC -Wall -Wno-long-long -pedantic -std=c++11" ) + ELSEIF( CMAKE_COMPILER_IS_MINGW ) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) + ENDIF() +@@ -176,14 +233,14 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C + + FIND_PACKAGE( DirectX ) + +-OPTION ( ASSIMP_NO_EXPORT +- "Disable Assimp's export functionality." +- OFF +-) ++#IF( BUILD_DOCS ) ++# add_subdirectory(doc) ++#ENDIF( BUILD_DOCS ) + +-IF( CMAKE_COMPILER_IS_GNUCXX ) +- SET(LIBSTDC++_LIBRARIES -lstdc++) +-ENDIF( CMAKE_COMPILER_IS_GNUCXX ) ++# Look for system installed irrXML ++IF ( SYSTEM_IRRXML ) ++ find_package( IrrXML REQUIRED ) ++ENDIF( SYSTEM_IRRXML ) + + # Search for external dependencies, and build them from source if not found + # Search for zlib +@@ -287,6 +344,7 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) + ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER ) + ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) + ++ADD_SUBDIRECTORY(contrib) + + ADD_SUBDIRECTORY( code/ ) + option ( ASSIMP_BUILD_ASSIMP_TOOLS +diff --git a/cmake-modules/FindIrrXML.cmake b/cmake-modules/FindIrrXML.cmake +new file mode 100644 +index 0000000..5434e0b +--- /dev/null ++++ b/cmake-modules/FindIrrXML.cmake +@@ -0,0 +1,17 @@ ++# Find IrrXMl from irrlicht project ++# ++# Find LibIrrXML headers and library ++# ++# IRRXML_FOUND - IrrXML found ++# IRRXML_INCLUDE_DIR - Headers location ++# IRRXML_LIBRARY - IrrXML main library ++ ++find_path(IRRXML_INCLUDE_DIR irrXML.h ++ PATH_SUFFIXES include/irrlicht include/irrxml) ++find_library(IRRXML_LIBRARY IrrXML) ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args(IrrXML REQUIRED_VARS IRRXML_INCLUDE_DIR IRRXML_LIBRARY) ++ ++ ++mark_as_advanced(IRRXML_INCLUDE_DIR IRRXML_LIBRARY) +diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt +index 35ecf50..52073d1 100644 +--- a/code/CMakeLists.txt ++++ b/code/CMakeLists.txt +@@ -542,6 +542,9 @@ SET( PostProcessing_SRCS + ) + SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS}) + ++SET( IrrXML_SRCS irrXMLWrapper.h ) ++SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS}) ++ + ADD_ASSIMP_IMPORTER( Q3D + Q3DLoader.cpp + Q3DLoader.h +@@ -637,18 +640,6 @@ SET( Extra_SRCS + ) + SOURCE_GROUP( Extra FILES ${Extra_SRCS}) + +-SET( IrrXML_SRCS +- irrXMLWrapper.h +- ../contrib/irrXML/CXMLReaderImpl.h +- ../contrib/irrXML/heapsort.h +- ../contrib/irrXML/irrArray.h +- ../contrib/irrXML/irrString.h +- ../contrib/irrXML/irrTypes.h +- ../contrib/irrXML/irrXML.cpp +- ../contrib/irrXML/irrXML.h +-) +-SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS}) +- + SET( ConvertUTF_SRCS + ../contrib/ConvertUTF/ConvertUTF.h + ../contrib/ConvertUTF/ConvertUTF.c +@@ -756,7 +747,8 @@ SET( assimp_src + ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) + + INCLUDE_DIRECTORIES( +- ../contrib/openddlparser/include ++ ${IRRXML_INCLUDE_DIR} ++ ../contrib/openddlparser/include + ) + + IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) +@@ -766,7 +758,7 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) + + ADD_LIBRARY( assimp ${assimp_src} ) + +-TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ) ++TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} ) + + if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) + set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI) +diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h +index 41e4188..9d96456 100644 +--- a/code/irrXMLWrapper.h ++++ b/code/irrXMLWrapper.h +@@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #define INCLUDED_AI_IRRXML_WRAPPER + + // some long includes .... +-#include "./../contrib/irrXML/irrXML.h" ++#include + #include "./../include/assimp/IOStream.hpp" + #include "BaseImporter.h" + #include +@@ -128,8 +128,8 @@ public: + + // ---------------------------------------------------------------------------------- + //! Returns size of file in bytes +- virtual int getSize() { +- return (int)data.size(); ++ virtual long getSize() const { ++ return (long)data.size(); + } + + private: +diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt +new file mode 100644 +index 0000000..362f165 +--- /dev/null ++++ b/contrib/CMakeLists.txt +@@ -0,0 +1,4 @@ ++# Compile internal irrXML only if system is not requested ++if( NOT SYSTEM_IRRXML ) ++ add_subdirectory(irrXML) ++endif( NOT SYSTEM_IRRXML ) +diff --git a/contrib/irrXML/CMakeLists.txt b/contrib/irrXML/CMakeLists.txt +new file mode 100644 +index 0000000..82ede3a +--- /dev/null ++++ b/contrib/irrXML/CMakeLists.txt +@@ -0,0 +1,13 @@ ++set( IrrXML_SRCS ++ CXMLReaderImpl.h ++ heapsort.h ++ irrArray.h ++ irrString.h ++ irrTypes.h ++ irrXML.cpp ++ irrXML.h ++) ++ ++add_library(IrrXML STATIC ${IrrXML_SRCS}) ++set(IRRXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "IrrXML_Include" ) ++set(IRRXML_LIBRARY "IrrXML" CACHE INTERNAL "IrrXML" ) +-- +2.9.3 + diff --git a/0001-Assimp-cmake-provider-fix.patch b/0001-Assimp-cmake-provider-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..e3567a1726841662f75079f49b6f44f720d914af --- /dev/null +++ b/0001-Assimp-cmake-provider-fix.patch @@ -0,0 +1,39 @@ +From 584a0923a3c78304974eb05930fbb908edbc8c8c Mon Sep 17 00:00:00 2001 +From: Helio Chissini de Castro +Date: Tue, 18 Apr 2017 19:21:30 +0200 +Subject: [PATCH] Assimp cmake provider fix + +--- + assimp-config.cmake.in | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in +index e06cc10..9224b9b 100644 +--- a/assimp-config.cmake.in ++++ b/assimp-config.cmake.in +@@ -10,10 +10,7 @@ + # ASSIMP_LIBRARY_DIRS - link directories + # ASSIMP_LIBRARIES - libraries to link plugins with + # ASSIMP_Boost_VERSION - the boost version assimp was compiled with +-get_filename_component(_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +-get_filename_component(_PREFIX "${_PREFIX}" PATH) +-get_filename_component(_PREFIX "${_PREFIX}" PATH) +-get_filename_component(ASSIMP_ROOT_DIR "${_PREFIX}" PATH) ++set(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@") + + if( MSVC ) + # in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix +@@ -45,8 +42,8 @@ if( WIN32 ) + set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB") + endif() + 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_LIBRARY_DIRS "@ASSIMP_LIB_INSTALL_DIR@") ++set( ASSIMP_INCLUDE_DIRS "@ASSIMP_INCLUDE_INSTALL_DIR@") + set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) + set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@CMAKE_DEBUG_POSTFIX@) + +-- +2.9.3 + diff --git a/0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch b/0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..dd009bf5d9b56be224a640f5920f448aa1a1a998 --- /dev/null +++ b/0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch @@ -0,0 +1,221 @@ +From c63f886c9d12b88fc65afcd379bb086984dd44c2 Mon Sep 17 00:00:00 2001 +From: Helio Chissini de Castro +Date: Tue, 18 Apr 2017 14:51:17 +0200 +Subject: [PATCH] Enable doxygen been properly used from cmake build and + install. + +Current documentation lacks a proper directory handling and switch for +Unix like systems. +The option BUILD_DOCS are added as disable by default, even so the +Doxyfile file is generated for a manual build. + +Option HTML_OUTPUT are made cached to be properly replaced, as usually +done by some Linux distributions + +Microsoft CHM option is enabled if MSVC is detected. +--- + CMakeLists.txt | 11 ++++++++++ + doc/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++ + doc/{Doxyfile => Doxyfile.in} | 46 ++++++++++-------------------------------- + 3 files changed, 69 insertions(+), 35 deletions(-) + create mode 100644 doc/CMakeLists.txt + rename doc/{Doxyfile => Doxyfile.in} (98%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8455bb8..6989510 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,6 +40,7 @@ cmake_minimum_required( VERSION 2.8 ) + PROJECT( Assimp ) + + OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON) ++ + IF(NOT BUILD_SHARED_LIBS) + SET(LINK_SEARCH_START_STATIC TRUE) + ENDIF(NOT BUILD_SHARED_LIBS) +@@ -58,6 +59,12 @@ SET(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used f + add_definitions( -DOPENDDL_NO_USE_CPP11 ) + set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) + ++OPTION ( BUILD_DOCS ++ "Build documentation using Doxygen." ++ OFF ++) ++add_subdirectory(doc) ++ + # Get the current working branch + EXECUTE_PROCESS( + COMMAND git rev-parse --abbrev-ref HEAD +@@ -105,6 +112,10 @@ IF( CMAKE_COMPILER_IS_MINGW ) + ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER ) + ENDIF() + ++IF( UNIX ) ++ include(GNUInstallDirs) ++ENDIF( UNIX ) ++ + IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW) + IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt +new file mode 100644 +index 0000000..0ad04cf +--- /dev/null ++++ b/doc/CMakeLists.txt +@@ -0,0 +1,51 @@ ++# Only test for Doxygent if BUILD_DOCS are ON ++# We will configure Doxygen output anyway in case ++# of manual generation ++if( BUILD_DOCS ) ++ find_package( Doxygen REQUIRED ) ++endif( BUILD_DOCS ) ++ ++set( HTML_OUTPUT "AssimpDoc_Html" CACHE STRING "Output directory for generated HTML documentation. Defaults to AssimpDoc_Html." ) ++ ++# Enable Microsoft CHM help style only on Windows ++set( MICROSOFT_HELP_WORKSHOP "NO") ++if( MSVC ) ++ set( MICROSOFT_HELP_WORKSHOP "YES" ) ++endif( MSVC ) ++ ++configure_file( ++ ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ++ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ++ @ONLY ++) ++ ++add_custom_target( ++ docs ALL ++ DEPENDS docs.done ++) ++ ++add_custom_command( ++ OUTPUT docs.done ++ COMMAND ${DOXYGEN_EXECUTABLE} ++ COMMAND ${CMAKE_COMMAND} -E touch docs.done ++ COMMENT "Generating assimp documentation" ++ VERBATIM ++ ) ++ ++IF( UNIX ) ++ include(GNUInstallDirs) ++ENDIF( UNIX ) ++ ++if( DEFINED CMAKE_INSTALL_DOCDIR ) ++ install( ++ DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${HTML_OUTPUT} ++ DESTINATION ${CMAKE_INSTALL_DOCDIR} ++ ) ++ install(FILES ++ ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/AnimationOverview.png ++ ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/AnimationOverview.svg ++ ${CMAKE_CURRENT_SOURCE_DIR}/AssimpDoc_Html/dragonsplash.png ++ DESTINATION ${CMAKE_INSTALL_DOCDIR}/${HTML_OUTPUT} ++ ) ++endif( DEFINED CMAKE_INSTALL_DOCDIR ) ++ +diff --git a/doc/Doxyfile b/doc/Doxyfile.in +similarity index 98% +rename from doc/Doxyfile +rename to doc/Doxyfile.in +index 64dd5d2..ebb6b72 100644 +--- a/doc/Doxyfile ++++ b/doc/Doxyfile.in +@@ -140,7 +140,8 @@ FULL_PATH_NAMES = NO + # relative paths, which will be relative from the directory where doxygen is + # started. + +-STRIP_FROM_PATH = ++STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ \ ++ @PROJECT_BINARY_DIR@ + + # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of + # the path mentioned in the documentation of a class, which tells +@@ -339,22 +340,6 @@ INLINE_SIMPLE_STRUCTS = NO + + TYPEDEF_HIDES_STRUCT = YES + +-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +-# determine which symbols to keep in memory and which to flush to disk. +-# When the cache is full, less often used symbols will be written to disk. +-# For small to medium size projects (<1000 input files) the default value is +-# probably good enough. For larger projects a too small cache size can cause +-# doxygen to be busy swapping symbols to and from disk most of the time +-# causing a significant performance penalty. +-# If the system has enough physical memory increasing the cache will improve the +-# performance by keeping more symbols in memory. Note that the value works on +-# a logarithmic scale so increasing the size by one will roughly double the +-# memory usage. The cache size is given by this formula: +-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +-# corresponding to a cache size of 2^16 = 65536 symbols. +- +-SYMBOL_CACHE_SIZE = 0 +- + # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be + # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given + # their name and scope. Since this can be an expensive process and often the +@@ -677,9 +662,12 @@ WARN_LOGFILE = + # directories like "/usr/src/myproject". Separate the files or directories + # with spaces. + +-INPUT = ../include/ \ +- ../doc/dox.h \ +- ../code/BaseImporter.h ++INPUT = @doxy_main_page@ \ ++ @PROJECT_SOURCE_DIR@ \ ++ @PROJECT_BINARY_DIR@ \ ++ @PROJECT_SOURCE_DIR@/include/ \ ++ @PROJECT_SOURCE_DIR@/doc/dox.h \ ++ @PROJECT_SOURCE_DIR@/code/BaseImporter.h + + # This tag can be used to specify the character encoding of the source files + # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +@@ -919,7 +907,7 @@ GENERATE_HTML = YES + # If a relative path is entered the value of OUTPUT_DIRECTORY will be + # put in front of it. If left blank `html' will be used as the default path. + +-HTML_OUTPUT = AssimpDoc_Html ++HTML_OUTPUT = @HTML_OUTPUT@ + + # The HTML_FILE_EXTENSION tag can be used to specify the file extension for + # each generated HTML page (for example: .htm,.php,.asp). If it is left blank +@@ -953,7 +941,7 @@ HTML_FOOTER = + # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this + # tag will in the future become obsolete. + +-HTML_STYLESHEET = style.css ++# HTML_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/style.css + + # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional + # user-defined cascading style sheet that is included after the standard +@@ -1064,7 +1052,7 @@ DOCSET_PUBLISHER_NAME = Publisher + # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) + # of the generated HTML documentation. + +-GENERATE_HTMLHELP = YES ++GENERATE_HTMLHELP = @MICROSOFT_HELP_WORKSHOP@ + + # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can + # be used to specify the file name of the resulting .chm file. You +@@ -1504,18 +1492,6 @@ GENERATE_XML = NO + + XML_OUTPUT = xml + +-# The XML_SCHEMA tag can be used to specify an XML schema, +-# which can be used by a validating XML parser to check the +-# syntax of the XML files. +- +-XML_SCHEMA = +- +-# The XML_DTD tag can be used to specify an XML DTD, +-# which can be used by a validating XML parser to check the +-# syntax of the XML files. +- +-XML_DTD = +- + # If the XML_PROGRAMLISTING tag is set to YES Doxygen will + # dump the program listings (including syntax highlighting + # and cross-referencing information) to the XML output. Note that +-- +2.9.3 + diff --git a/0001-Morph-animation-support-for-collada.patch b/0001-Morph-animation-support-for-collada.patch new file mode 100644 index 0000000000000000000000000000000000000000..c955d5c2becccde3304d5b1536480e9a5591f55f --- /dev/null +++ b/0001-Morph-animation-support-for-collada.patch @@ -0,0 +1,966 @@ +From 42e353f2a672baed485c03acf30529c77092ece9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= +Date: Thu, 12 Jan 2017 13:41:32 +0200 +Subject: [PATCH] Morph animation support for collada + +--- + code/CMakeLists.txt | 2 + + code/ColladaHelper.h | 31 +++++ + code/ColladaLoader.cpp | 310 ++++++++++++++++++++++++++++++++++++++++++------ + code/ColladaLoader.h | 5 + + code/ColladaParser.cpp | 48 +++++++- + code/CreateAnimMesh.cpp | 92 ++++++++++++++ + code/CreateAnimMesh.h | 56 +++++++++ + include/assimp/anim.h | 95 +++++++++++++-- + include/assimp/mesh.h | 36 +++++- + 9 files changed, 623 insertions(+), 52 deletions(-) + create mode 100644 code/CreateAnimMesh.cpp + create mode 100644 code/CreateAnimMesh.h + +diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt +index 35ecf50..e0747d6 100644 +--- a/code/CMakeLists.txt ++++ b/code/CMakeLists.txt +@@ -171,6 +171,8 @@ SET( Common_SRCS + Bitmap.h + XMLTools.h + Version.cpp ++ CreateAnimMesh.h ++ CreateAnimMesh.cpp + ) + SOURCE_GROUP(Common FILES ${Common_SRCS}) + +diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h +index 5a51642..5ff4904 100644 +--- a/code/ColladaHelper.h ++++ b/code/ColladaHelper.h +@@ -89,6 +89,21 @@ enum InputType + IT_Bitangent + }; + ++/** Supported controller types */ ++enum ControllerType ++{ ++ Skin, ++ Morph ++}; ++ ++/** Supported morph methods */ ++enum MorphMethod ++{ ++ Normalized, ++ Relative ++}; ++ ++ + /** Contains all data for one of the different transformation types */ + struct Transform + { +@@ -380,6 +395,12 @@ enum PrimitiveType + /** A skeleton controller to deform a mesh with the use of joints */ + struct Controller + { ++ // controller type ++ ControllerType mType; ++ ++ // Morphing method if type is Morph ++ MorphMethod mMethod; ++ + // the URL of the mesh deformed by the controller. + std::string mMeshId; + +@@ -402,6 +423,9 @@ struct Controller + + // JointIndex-WeightIndex pairs for all vertices + std::vector< std::pair > mWeights; ++ ++ std::string mMorphTarget; ++ std::string mMorphWeight; + }; + + /** A collada material. Pretty much the only member is a reference to an effect. */ +@@ -577,6 +601,12 @@ struct AnimationChannel + std::string mSourceTimes; + /** Source URL of the value values. Collada calls them "output". */ + std::string mSourceValues; ++ /** Source URL of the IN_TANGENT semantic values. */ ++ std::string mInTanValues; ++ /** Source URL of the OUT_TANGENT semantic values. */ ++ std::string mOutTanValues; ++ /** Source URL of the INTERPOLATION semantic values. */ ++ std::string mInterpolationValues; + }; + + /** An animation. Container for 0-x animation channels or 0-x animations */ +@@ -645,6 +675,7 @@ struct Animation + struct ChannelEntry + { + const Collada::AnimationChannel* mChannel; ///> the source channel ++ std::string mTargetId; + std::string mTransformId; // the ID of the transformation step of the node which is influenced + size_t mTransformIndex; // Index into the node's transform chain to apply the channel to + size_t mSubElement; // starting index inside the transform data +diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp +index 6cc0f85..a3b6d6e 100644 +--- a/code/ColladaLoader.cpp ++++ b/code/ColladaLoader.cpp +@@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "ParsingUtils.h" + #include "SkeletonMeshBuilder.h" + #include "Defines.h" ++#include "CreateAnimMesh.h" + + #include "time.h" + #include "math.h" +@@ -148,6 +149,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I + mMeshIndexByID.clear(); + mMaterialIndexByName.clear(); + mMeshes.clear(); ++ mTargetMeshes.clear(); + newMats.clear(); + mLights.clear(); + mCameras.clear(); +@@ -562,6 +564,21 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll + } + + // ------------------------------------------------------------------------------------------------ ++// Find mesh from either meshes or morph target meshes ++aiMesh *ColladaLoader::findMesh(std::string meshid) ++{ ++ for (unsigned int i = 0; i < mMeshes.size(); i++) ++ if (std::string(mMeshes[i]->mName.data) == meshid) ++ return mMeshes[i]; ++ ++ for (unsigned int i = 0; i < mTargetMeshes.size(); i++) ++ if (std::string(mTargetMeshes[i]->mName.data) == meshid) ++ return mTargetMeshes[i]; ++ ++ return NULL; ++} ++ ++// ------------------------------------------------------------------------------------------------ + // Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh + aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, + const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace) +@@ -646,8 +663,70 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: + face.mIndices[b] = vertex++; + } + ++ // create morph target meshes if any ++ std::vector targetMeshes; ++ std::vector targetWeights; ++ Collada::MorphMethod method; ++ ++ for(std::map::const_iterator it = pParser.mControllerLibrary.begin(); ++ it != pParser.mControllerLibrary.end(); it++) ++ { ++ const Collada::Controller &c = it->second; ++ const Collada::Mesh* baseMesh = pParser.ResolveLibraryReference( pParser.mMeshLibrary, c.mMeshId); ++ ++ if (c.mType == Collada::Morph && baseMesh->mName == pSrcMesh->mName) ++ { ++ const Collada::Accessor& targetAccessor = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, c.mMorphTarget); ++ const Collada::Accessor& weightAccessor = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, c.mMorphWeight); ++ const Collada::Data& targetData = pParser.ResolveLibraryReference( pParser.mDataLibrary, targetAccessor.mSource); ++ const Collada::Data& weightData = pParser.ResolveLibraryReference( pParser.mDataLibrary, weightAccessor.mSource); ++ ++ // take method ++ method = c.mMethod; ++ ++ if (!targetData.mIsStringArray) ++ throw DeadlyImportError( "target data must contain id. "); ++ if (weightData.mIsStringArray) ++ throw DeadlyImportError( "target weight data must not be textual "); ++ ++ for (unsigned int i = 0; i < targetData.mStrings.size(); ++i) ++ { ++ const Collada::Mesh* targetMesh = pParser.ResolveLibraryReference(pParser.mMeshLibrary, targetData.mStrings.at(i)); ++ ++ aiMesh *aimesh = findMesh(targetMesh->mName); ++ if (!aimesh) ++ { ++ if (targetMesh->mSubMeshes.size() > 1) ++ throw DeadlyImportError( "Morhing target mesh must be a single"); ++ aimesh = CreateMesh(pParser, targetMesh, targetMesh->mSubMeshes.at(0), NULL, 0, 0); ++ mTargetMeshes.push_back(aimesh); ++ } ++ targetMeshes.push_back(aimesh); ++ } ++ for (unsigned int i = 0; i < weightData.mValues.size(); ++i) ++ targetWeights.push_back(weightData.mValues.at(i)); ++ } ++ } ++ if (targetMeshes.size() > 0 && targetWeights.size() == targetMeshes.size()) ++ { ++ std::vector animMeshes; ++ for (unsigned int i = 0; i < targetMeshes.size(); i++) ++ { ++ aiAnimMesh *animMesh = aiCreateAnimMesh(targetMeshes.at(i)); ++ animMesh->mWeight = targetWeights[i]; ++ animMeshes.push_back(animMesh); ++ } ++ dstMesh->mMethod = (method == Collada::Relative) ++ ? aiMorphingMethod_MORPH_RELATIVE ++ : aiMorphingMethod_MORPH_NORMALIZED; ++ dstMesh->mAnimMeshes = new aiAnimMesh*[animMeshes.size()]; ++ dstMesh->mNumAnimMeshes = animMeshes.size(); ++ for (unsigned int i = 0; i < animMeshes.size(); i++) ++ dstMesh->mAnimMeshes[i] = animMeshes.at(i); ++ } ++ + // create bones if given +- if( pSrcController) ++ if( pSrcController && pSrcController->mType == Collada::Skin) + { + // refuse if the vertex count does not match + // if( pSrcController->mWeightCounts.size() != dstMesh->mNumVertices) +@@ -946,6 +1025,68 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars + CreateAnimation( pScene, pParser, pSrcAnim, animName); + } + ++struct MorphTimeValues ++{ ++ float mTime; ++ struct key ++ { ++ float mWeight; ++ unsigned int mValue; ++ }; ++ std::vector mKeys; ++}; ++ ++void insertMorphTimeValue(std::vector &values, float time, float weight, unsigned int value) ++{ ++ MorphTimeValues::key k; ++ k.mValue = value; ++ k.mWeight = weight; ++ if (values.size() == 0 || time < values[0].mTime) ++ { ++ MorphTimeValues val; ++ val.mTime = time; ++ val.mKeys.push_back(k); ++ values.insert(values.begin(), val); ++ return; ++ } ++ if (time > values.back().mTime) ++ { ++ MorphTimeValues val; ++ val.mTime = time; ++ val.mKeys.push_back(k); ++ values.insert(values.end(), val); ++ return; ++ } ++ for (unsigned int i = 0; i < values.size(); i++) ++ { ++ if (std::abs(time - values[i].mTime) < 1e-6f) ++ { ++ values[i].mKeys.push_back(k); ++ return; ++ } else if (time > values[i].mTime && time < values[i+1].mTime) ++ { ++ MorphTimeValues val; ++ val.mTime = time; ++ val.mKeys.push_back(k); ++ values.insert(values.begin() + i, val); ++ return; ++ } ++ } ++ // should not get here ++} ++ ++float getWeightAtKey(const std::vector &values, int key, unsigned int value) ++{ ++ for (unsigned int i = 0; i < values[key].mKeys.size(); i++) ++ { ++ if (values[key].mKeys[i].mValue == value) ++ return values[key].mKeys[i].mWeight; ++ } ++ // no value at key found, try to interpolate if present at other keys. if not, return zero ++ // TODO: interpolation ++ return 0.0f; ++} ++ + // ------------------------------------------------------------------------------------------------ + // Constructs the animation for the given source anim + void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName) +@@ -955,6 +1096,8 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars + CollectNodes( pScene->mRootNode, nodes); + + std::vector anims; ++ std::vector morphAnims; ++ + for( std::vector::const_iterator nit = nodes.begin(); nit != nodes.end(); ++nit) + { + // find all the collada anim channels which refer to the current node +@@ -978,7 +1121,20 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars + // find the slash that separates the node name - there should be only one + std::string::size_type slashPos = srcChannel.mTarget.find( '/'); + if( slashPos == std::string::npos) ++ { ++ std::string::size_type targetPos = srcChannel.mTarget.find(srcNode->mID); ++ if (targetPos == std::string::npos) ++ continue; ++ ++ // not node transform, but something else. store as unknown animation channel for now ++ entry.mChannel = &(*cit); ++ entry.mTargetId = srcChannel.mTarget.substr(targetPos + pSrcAnim->mName.length(), ++ srcChannel.mTarget.length() - targetPos - pSrcAnim->mName.length()); ++ if (entry.mTargetId.front() == '-') ++ entry.mTargetId = entry.mTargetId.substr(1); ++ entries.push_back(entry); + continue; ++ } + if( srcChannel.mTarget.find( '/', slashPos+1) != std::string::npos) + continue; + std::string targetID = srcChannel.mTarget.substr( 0, slashPos); +@@ -1058,8 +1214,14 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars + if( srcNode->mTransforms[a].mID == entry.mTransformId) + entry.mTransformIndex = a; + +- if( entry.mTransformIndex == SIZE_MAX) { +- continue; ++ if( entry.mTransformIndex == SIZE_MAX) ++ { ++ if (entry.mTransformId.find("morph-weights") != std::string::npos) ++ { ++ entry.mTargetId = entry.mTransformId; ++ entry.mTransformId = ""; ++ } else ++ continue; + } + + entry.mChannel = &(*cit); +@@ -1203,49 +1365,125 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars + // ai_assert( resultTrafos.size() > 0); + + // build an animation channel for the given node out of these trafo keys +- if( !resultTrafos.empty() ) +- { +- aiNodeAnim* dstAnim = new aiNodeAnim; +- dstAnim->mNodeName = nodeName; +- dstAnim->mNumPositionKeys = resultTrafos.size(); +- dstAnim->mNumRotationKeys= resultTrafos.size(); +- dstAnim->mNumScalingKeys = resultTrafos.size(); +- dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()]; +- dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()]; +- dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()]; +- +- for( size_t a = 0; a < resultTrafos.size(); ++a) +- { +- aiMatrix4x4 mat = resultTrafos[a]; +- double time = double( mat.d4); // remember? time is stored in mat.d4 +- mat.d4 = 1.0f; +- +- dstAnim->mPositionKeys[a].mTime = time; +- dstAnim->mRotationKeys[a].mTime = time; +- dstAnim->mScalingKeys[a].mTime = time; +- mat.Decompose( dstAnim->mScalingKeys[a].mValue, dstAnim->mRotationKeys[a].mValue, dstAnim->mPositionKeys[a].mValue); +- } ++ if( !resultTrafos.empty() ) ++ { ++ aiNodeAnim* dstAnim = new aiNodeAnim; ++ dstAnim->mNodeName = nodeName; ++ dstAnim->mNumPositionKeys = resultTrafos.size(); ++ dstAnim->mNumRotationKeys= resultTrafos.size(); ++ dstAnim->mNumScalingKeys = resultTrafos.size(); ++ dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()]; ++ dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()]; ++ dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()]; ++ ++ for( size_t a = 0; a < resultTrafos.size(); ++a) ++ { ++ aiMatrix4x4 mat = resultTrafos[a]; ++ double time = double( mat.d4); // remember? time is stored in mat.d4 ++ mat.d4 = 1.0f; ++ ++ dstAnim->mPositionKeys[a].mTime = time; ++ dstAnim->mRotationKeys[a].mTime = time; ++ dstAnim->mScalingKeys[a].mTime = time; ++ mat.Decompose( dstAnim->mScalingKeys[a].mValue, dstAnim->mRotationKeys[a].mValue, dstAnim->mPositionKeys[a].mValue); ++ } + +- anims.push_back( dstAnim); +- } else +- { +- DefaultLogger::get()->warn( "Collada loader: found empty animation channel, ignored. Please check your exporter."); +- } ++ anims.push_back( dstAnim); ++ } else ++ { ++ DefaultLogger::get()->warn( "Collada loader: found empty animation channel, ignored. Please check your exporter."); ++ } ++ ++ if( !entries.empty() && entries.front().mTimeAccessor->mCount > 0 ) ++ { ++ std::vector morphChannels; ++ for( std::vector::iterator it = entries.begin(); it != entries.end(); ++it) ++ { ++ Collada::ChannelEntry& e = *it; ++ ++ // skip non-transform types ++ if (e.mTargetId.empty()) ++ continue; ++ ++ if (e.mTargetId.find("morph-weights") != std::string::npos) ++ morphChannels.push_back(e); ++ } ++ if (morphChannels.size() > 0) ++ { ++ // either 1) morph weight animation count should contain morph target count channels ++ // or 2) one channel with morph target count arrays ++ // assume first ++ ++ aiMeshMorphAnim *morphAnim = new aiMeshMorphAnim; ++ morphAnim->mName.Set(nodeName); ++ ++ std::vector morphTimeValues; ++ ++ int morphAnimChannelIndex = 0; ++ for( std::vector::iterator it = morphChannels.begin(); it != morphChannels.end(); ++it) ++ { ++ Collada::ChannelEntry& e = *it; ++ std::string::size_type apos = e.mTargetId.find('('); ++ std::string::size_type bpos = e.mTargetId.find(')'); ++ if (apos == std::string::npos || bpos == std::string::npos) ++ // unknown way to specify weight -> ignore this animation ++ continue; ++ ++ // weight target can be in format Weight_M_N, Weight_N, WeightN, or some other way ++ // we ignore the name and just assume the channels are in the right order ++ for (unsigned int i = 0; i < e.mTimeData->mValues.size(); i++) ++ insertMorphTimeValue(morphTimeValues, e.mTimeData->mValues.at(i), e.mValueData->mValues.at(i), morphAnimChannelIndex); ++ ++ ++morphAnimChannelIndex; ++ } ++ ++ morphAnim->mNumKeys = morphTimeValues.size(); ++ morphAnim->mKeys = new aiMeshMorphKey[morphAnim->mNumKeys]; ++ for (unsigned int key = 0; key < morphAnim->mNumKeys; key++) ++ { ++ morphAnim->mKeys[key].mNumValuesAndWeights = morphChannels.size(); ++ morphAnim->mKeys[key].mValues = new unsigned int [morphChannels.size()]; ++ morphAnim->mKeys[key].mWeights = new double [morphChannels.size()]; ++ ++ morphAnim->mKeys[key].mTime = morphTimeValues[key].mTime; ++ for (unsigned int valueIndex = 0; valueIndex < morphChannels.size(); valueIndex++) ++ { ++ morphAnim->mKeys[key].mValues[valueIndex] = valueIndex; ++ morphAnim->mKeys[key].mWeights[valueIndex] = getWeightAtKey(morphTimeValues, key, valueIndex); ++ } ++ } ++ ++ morphAnims.push_back(morphAnim); ++ } ++ } + } + +- if( !anims.empty()) ++ if( !anims.empty() || !morphAnims.empty()) + { + aiAnimation* anim = new aiAnimation; + anim->mName.Set( pName); + anim->mNumChannels = anims.size(); +- anim->mChannels = new aiNodeAnim*[anims.size()]; +- std::copy( anims.begin(), anims.end(), anim->mChannels); ++ if (anim->mNumChannels > 0) ++ { ++ anim->mChannels = new aiNodeAnim*[anims.size()]; ++ std::copy( anims.begin(), anims.end(), anim->mChannels); ++ } ++ anim->mNumMorphMeshChannels = morphAnims.size(); ++ if (anim->mNumMorphMeshChannels > 0) ++ { ++ anim->mMorphMeshChannels = new aiMeshMorphAnim*[anim->mNumMorphMeshChannels]; ++ std::copy( morphAnims.begin(), morphAnims.end(), anim->mMorphMeshChannels); ++ } + anim->mDuration = 0.0f; + for( size_t a = 0; a < anims.size(); ++a) + { +- anim->mDuration = std::max( anim->mDuration, anims[a]->mPositionKeys[anims[a]->mNumPositionKeys-1].mTime); +- anim->mDuration = std::max( anim->mDuration, anims[a]->mRotationKeys[anims[a]->mNumRotationKeys-1].mTime); +- anim->mDuration = std::max( anim->mDuration, anims[a]->mScalingKeys[anims[a]->mNumScalingKeys-1].mTime); ++ anim->mDuration = std::max( anim->mDuration, anims[a]->mPositionKeys[anims[a]->mNumPositionKeys-1].mTime); ++ anim->mDuration = std::max( anim->mDuration, anims[a]->mRotationKeys[anims[a]->mNumRotationKeys-1].mTime); ++ anim->mDuration = std::max( anim->mDuration, anims[a]->mScalingKeys[anims[a]->mNumScalingKeys-1].mTime); ++ } ++ for (size_t a = 0; a < morphAnims.size(); ++a) ++ { ++ anim->mDuration = std::max(anim->mDuration, morphAnims[a]->mKeys[morphAnims[a]->mNumKeys-1].mTime); + } + anim->mTicksPerSecond = 1; + mAnims.push_back( anim); +diff --git a/code/ColladaLoader.h b/code/ColladaLoader.h +index 313608c..fc26532 100644 +--- a/code/ColladaLoader.h ++++ b/code/ColladaLoader.h +@@ -117,6 +117,8 @@ protected: + /** Builds meshes for the given node and references them */ + void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode, + aiNode* pTarget); ++ ++ aiMesh *findMesh(std::string meshid); + + /** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */ + aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, +@@ -223,6 +225,9 @@ protected: + + /** Accumulated meshes for the target scene */ + std::vector mMeshes; ++ ++ /** Accumulated morph target meshes */ ++ std::vector mTargetMeshes; + + /** Temporary material list */ + std::vector > newMats; +diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp +index 527e2ed..ce87476 100644 +--- a/code/ColladaParser.cpp ++++ b/code/ColladaParser.cpp +@@ -586,6 +586,12 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel) + pChannel.mSourceTimes = source; + else if( strcmp( semantic, "OUTPUT") == 0) + pChannel.mSourceValues = source; ++ else if( strcmp( semantic, "IN_TANGENT") == 0) ++ pChannel.mInTanValues = source; ++ else if( strcmp( semantic, "OUT_TANGENT") == 0) ++ pChannel.mOutTanValues = source; ++ else if( strcmp( semantic, "INTERPOLATION") == 0) ++ pChannel.mInterpolationValues = source; + + if( !mReader->isEmptyElement()) + SkipElement(); +@@ -648,6 +654,9 @@ void ColladaParser::ReadControllerLibrary() + // Reads a controller into the given mesh structure + void ColladaParser::ReadController( Collada::Controller& pController) + { ++ // initial values ++ pController.mType = Skin; ++ pController.mMethod = Normalized; + while( mReader->read()) + { + if( mReader->getNodeType() == irr::io::EXN_ELEMENT) +@@ -655,8 +664,15 @@ void ColladaParser::ReadController( Collada::Controller& pController) + // two types of controllers: "skin" and "morph". Only the first one is relevant, we skip the other + if( IsElement( "morph")) + { +- // should skip everything inside, so there's no danger of catching elements inbetween +- SkipElement(); ++ pController.mType = Morph; ++ int baseIndex = GetAttribute("source"); ++ pController.mMeshId = mReader->getAttributeValue(baseIndex) + 1; ++ int methodIndex = GetAttribute("method"); ++ if (methodIndex > 0) { ++ const char *method = mReader->getAttributeValue(methodIndex); ++ if (strcmp(method, "RELATIVE") == 0) ++ pController.mMethod = Relative; ++ } + } + else if( IsElement( "skin")) + { +@@ -694,6 +710,32 @@ void ColladaParser::ReadController( Collada::Controller& pController) + { + ReadControllerWeights( pController); + } ++ else if ( IsElement( "targets" )) ++ { ++ while (mReader->read()) { ++ if( mReader->getNodeType() == irr::io::EXN_ELEMENT) { ++ if ( IsElement( "input")) { ++ int semanticsIndex = GetAttribute("semantic"); ++ int sourceIndex = GetAttribute("source"); ++ ++ const char *semantics = mReader->getAttributeValue(semanticsIndex); ++ const char *source = mReader->getAttributeValue(sourceIndex); ++ if (strcmp(semantics, "MORPH_TARGET") == 0) { ++ pController.mMorphTarget = source + 1; ++ } ++ else if (strcmp(semantics, "MORPH_WEIGHT") == 0) ++ { ++ pController.mMorphWeight = source + 1; ++ } ++ } ++ } else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) { ++ if( strcmp( mReader->getNodeName(), "targets") == 0) ++ break; ++ else ++ ThrowException( "Expected end of element."); ++ } ++ } ++ } + else + { + // ignore the rest +@@ -704,7 +746,7 @@ void ColladaParser::ReadController( Collada::Controller& pController) + { + if( strcmp( mReader->getNodeName(), "controller") == 0) + break; +- else if( strcmp( mReader->getNodeName(), "skin") != 0) ++ else if( strcmp( mReader->getNodeName(), "skin") != 0 && strcmp( mReader->getNodeName(), "morph") != 0) + ThrowException( "Expected end of element."); + } + } +diff --git a/code/CreateAnimMesh.cpp b/code/CreateAnimMesh.cpp +new file mode 100644 +index 0000000..094a414 +--- /dev/null ++++ b/code/CreateAnimMesh.cpp +@@ -0,0 +1,92 @@ ++/* ++--------------------------------------------------------------------------- ++Open Asset Import Library (assimp) ++--------------------------------------------------------------------------- ++ ++Copyright (C) 2016 The Qt Company Ltd. ++Copyright (c) 2006-2012, assimp team ++ ++All rights reserved. ++ ++Redistribution and use of this software in source and binary forms, ++with or without modification, are permitted provided that the following ++conditions are met: ++ ++* Redistributions of source code must retain the above ++copyright notice, this list of conditions and the ++following disclaimer. ++ ++* Redistributions in binary form must reproduce the above ++copyright notice, this list of conditions and the ++following disclaimer in the documentation and/or other ++materials provided with the distribution. ++ ++* Neither the name of the assimp team, nor the names of its ++contributors may be used to endorse or promote products ++derived from this software without specific prior ++written permission of the assimp team. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++--------------------------------------------------------------------------- ++*/ ++ ++#include "CreateAnimMesh.h" ++ ++namespace Assimp { ++ ++aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh) ++{ ++ aiAnimMesh *animesh = new aiAnimMesh; ++ animesh->mVertices = NULL; ++ animesh->mNormals = NULL; ++ animesh->mTangents = NULL; ++ animesh->mBitangents = NULL; ++ animesh->mNumVertices = mesh->mNumVertices; ++ if (mesh->mVertices) { ++ animesh->mVertices = new aiVector3D[animesh->mNumVertices]; ++ std::memcpy(animesh->mVertices, mesh->mVertices, mesh->mNumVertices * sizeof(aiVector3D)); ++ } ++ if (mesh->mNormals) { ++ animesh->mNormals = new aiVector3D[animesh->mNumVertices]; ++ std::memcpy(animesh->mNormals, mesh->mNormals, mesh->mNumVertices * sizeof(aiVector3D)); ++ } ++ if (mesh->mTangents) { ++ animesh->mTangents = new aiVector3D[animesh->mNumVertices]; ++ std::memcpy(animesh->mTangents, mesh->mTangents, mesh->mNumVertices * sizeof(aiVector3D)); ++ } ++ if (mesh->mBitangents) { ++ animesh->mBitangents = new aiVector3D[animesh->mNumVertices]; ++ std::memcpy(animesh->mBitangents, mesh->mBitangents, mesh->mNumVertices * sizeof(aiVector3D)); ++ } ++ ++ for (int i = 0; i < AI_MAX_NUMBER_OF_COLOR_SETS; ++i) { ++ if (mesh->mColors[i]) { ++ animesh->mColors[i] = new aiColor4D[animesh->mNumVertices]; ++ std::memcpy(animesh->mColors[i], mesh->mColors[i], mesh->mNumVertices * sizeof(aiColor4D)); ++ } else { ++ animesh->mColors[i] = NULL; ++ } ++ } ++ ++ for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) { ++ if (mesh->mTextureCoords[i]) { ++ animesh->mTextureCoords[i] = new aiVector3D[animesh->mNumVertices]; ++ std::memcpy(animesh->mTextureCoords[i], mesh->mTextureCoords[i], mesh->mNumVertices * sizeof(aiVector3D)); ++ } else { ++ animesh->mTextureCoords[i] = NULL; ++ } ++ } ++ return animesh; ++} ++ ++} // end of namespace Assimp +diff --git a/code/CreateAnimMesh.h b/code/CreateAnimMesh.h +new file mode 100644 +index 0000000..c5ceb40 +--- /dev/null ++++ b/code/CreateAnimMesh.h +@@ -0,0 +1,56 @@ ++/* ++Open Asset Import Library (assimp) ++---------------------------------------------------------------------- ++ ++Copyright (c) 2006-2016, assimp team ++All rights reserved. ++ ++Redistribution and use of this software in source and binary forms, ++with or without modification, are permitted provided that the ++following conditions are met: ++ ++* Redistributions of source code must retain the above ++ copyright notice, this list of conditions and the ++ following disclaimer. ++ ++* Redistributions in binary form must reproduce the above ++ copyright notice, this list of conditions and the ++ following disclaimer in the documentation and/or other ++ materials provided with the distribution. ++ ++* Neither the name of the assimp team, nor the names of its ++ contributors may be used to endorse or promote products ++ derived from this software without specific prior ++ written permission of the assimp team. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++---------------------------------------------------------------------- ++*/ ++ ++/** @file CreateAnimMesh.h ++ * Create AnimMesh from Mesh ++ */ ++#ifndef INCLUDED_AI_CREATE_ANIM_MESH_H ++#define INCLUDED_AI_CREATE_ANIM_MESH_H ++ ++#include ++ ++namespace Assimp { ++ ++/** Create aiAnimMesh from aiMesh. */ ++aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh); ++ ++} // end of namespace Assimp ++#endif // INCLUDED_AI_CREATE_ANIM_MESH_H ++ +diff --git a/include/assimp/anim.h b/include/assimp/anim.h +index af59417..7b4dff8 100644 +--- a/include/assimp/anim.h ++++ b/include/assimp/anim.h +@@ -182,6 +182,39 @@ struct aiMeshKey + }; + + // --------------------------------------------------------------------------- ++/** Binds a morph anim mesh to a specific point in time. */ ++struct aiMeshMorphKey ++{ ++ /** The time of this key */ ++ double mTime; ++ ++ /** The values and weights at the time of this key */ ++ unsigned int *mValues; ++ double *mWeights; ++ ++ /** The number of values and weights */ ++ unsigned int mNumValuesAndWeights; ++#ifdef __cplusplus ++ aiMeshMorphKey() ++ : mTime(0.0) ++ , mValues(NULL) ++ , mWeights(NULL) ++ , mNumValuesAndWeights(0) ++ { ++ ++ } ++ ++ ~aiMeshMorphKey() ++ { ++ if (mNumValuesAndWeights && mValues && mWeights) { ++ delete [] mValues; ++ delete [] mWeights; ++ } ++ } ++#endif ++}; ++ ++// --------------------------------------------------------------------------- + /** Defines how an animation channel behaves outside the defined time + * range. This corresponds to aiNodeAnim::mPreState and + * aiNodeAnim::mPostState.*/ +@@ -335,7 +368,38 @@ struct aiMeshAnim + }; + + // --------------------------------------------------------------------------- +-/** An animation consists of keyframe data for a number of nodes. For ++/** Describes a morphing animation of a given mesh. */ ++struct aiMeshMorphAnim ++{ ++ /** Name of the mesh to be animated. An empty string is not allowed, ++ * animated meshes need to be named (not necessarily uniquely, ++ * the name can basically serve as wildcard to select a group ++ * of meshes with similar animation setup)*/ ++ C_STRUCT aiString mName; ++ ++ /** Size of the #mKeys array. Must be 1, at least. */ ++ unsigned int mNumKeys; ++ ++ /** Key frames of the animation. May not be NULL. */ ++ C_STRUCT aiMeshMorphKey* mKeys; ++ ++#ifdef __cplusplus ++ ++ aiMeshMorphAnim() ++ : mNumKeys() ++ , mKeys() ++ {} ++ ++ ~aiMeshMorphAnim() ++ { ++ delete[] mKeys; ++ } ++ ++#endif ++}; ++ ++// --------------------------------------------------------------------------- ++/** An animation consists of key-frame data for a number of nodes. For + * each node affected by the animation a separate series of data is given.*/ + struct aiAnimation + { +@@ -367,15 +431,25 @@ struct aiAnimation + * The array is mNumMeshChannels in size. */ + C_STRUCT aiMeshAnim** mMeshChannels; + ++ /** The number of mesh animation channels. Each channel affects ++ * a single mesh and defines morphing animation. */ ++ unsigned int mNumMorphMeshChannels; ++ ++ /** The morph mesh animation channels. Each channel affects a single mesh. ++ * The array is mNumMorphMeshChannels in size. */ ++ C_STRUCT aiMeshMorphAnim **mMorphMeshChannels; ++ + #ifdef __cplusplus + aiAnimation() +- : mDuration(-1.) +- , mTicksPerSecond() +- , mNumChannels() +- , mChannels() +- , mNumMeshChannels() +- , mMeshChannels() +- { ++ : mDuration(-1.) ++ , mTicksPerSecond(0.) ++ , mNumChannels(0) ++ , mChannels(NULL) ++ , mNumMeshChannels(0) ++ , mMeshChannels(NULL) ++ , mNumMorphMeshChannels(0) ++ , mMorphMeshChannels(NULL) { ++ // empty + } + + ~aiAnimation() +@@ -395,6 +469,11 @@ struct aiAnimation + + delete [] mMeshChannels; + } ++ if (mNumMorphMeshChannels && mMorphMeshChannels) { ++ for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) { ++ delete mMorphMeshChannels[a]; ++ } ++ } + } + #endif // __cplusplus + }; +diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h +index a76a2d7..2ebc14d 100644 +--- a/include/assimp/mesh.h ++++ b/include/assimp/mesh.h +@@ -377,6 +377,9 @@ struct aiAnimMesh + */ + unsigned int mNumVertices; + ++/** Weight of the AnimMesh. */ ++ float mWeight; ++ + #ifdef __cplusplus + + aiAnimMesh() +@@ -445,6 +448,27 @@ struct aiAnimMesh + #endif + }; + ++// --------------------------------------------------------------------------- ++/** @brief Enumerates the methods of mesh morphing supported by Assimp. ++ */ ++enum aiMorphingMethod ++{ ++ /** Interpolation between morph targets */ ++ aiMorphingMethod_VERTEX_BLEND = 0x1, ++ ++ /** Normalized morphing between morph targets */ ++ aiMorphingMethod_MORPH_NORMALIZED = 0x2, ++ ++ /** Relative morphing between morph targets */ ++ aiMorphingMethod_MORPH_RELATIVE = 0x3, ++ ++ /** This value is not used. It is just here to force the ++ * compiler to map this enum to a 32 Bit integer. ++ */ ++#ifndef SWIG ++ _aiMorphingMethod_Force32Bit = INT_MAX ++#endif ++}; //! enum aiMorphingMethod + + // --------------------------------------------------------------------------- + /** @brief A mesh represents a geometry or model with a single material. +@@ -599,15 +623,18 @@ struct aiMesh + C_STRUCT aiString mName; + + +- /** NOT CURRENTLY IN USE. The number of attachment meshes */ ++ /** The number of attachment meshes. Note! Currently only works with Collada loader. */ + unsigned int mNumAnimMeshes; + +- /** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation. ++ /** Attachment meshes for this mesh, for vertex-based animation. + * Attachment meshes carry replacement data for some of the +- * mesh'es vertex components (usually positions, normals). */ ++ * mesh'es vertex components (usually positions, normals). ++ * Note! Currently only works with Collada loader.*/ + C_STRUCT aiAnimMesh** mAnimMeshes; + +- ++ /** Method of morphing when animeshes are specified. */ ++ unsigned int mMethod; ++ + #ifdef __cplusplus + + //! Default constructor. Initializes all members to 0 +@@ -732,7 +759,6 @@ struct aiMesh + #endif // __cplusplus + }; + +- + #ifdef __cplusplus + } + #endif //! extern "C" +-- +2.9.3 + diff --git a/assimp-3.2.0-pythonpath.patch b/assimp-3.2.0-pythonpath.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ef9d95538db66163451cf450fdf7f3585407528 --- /dev/null +++ b/assimp-3.2.0-pythonpath.patch @@ -0,0 +1,19 @@ +diff -up ./port/PyAssimp/pyassimp/helper.py.pythonpath ./port/PyAssimp/pyassimp/helper.py +--- ./port/PyAssimp/pyassimp/helper.py.pythonpath 2016-05-21 19:54:37.152745935 -0400 ++++ ./port/PyAssimp/pyassimp/helper.py 2016-05-21 19:57:28.578516453 -0400 +@@ -22,6 +22,7 @@ additional_dirs, ext_whitelist = [],[] + # depending on the platform we're running on. + if os.name=='posix': + additional_dirs.append('./') ++ additional_dirs.append('/usr/lib64/') + additional_dirs.append('/usr/lib/') + additional_dirs.append('/usr/local/lib/') + +@@ -29,6 +30,7 @@ if os.name=='posix': + # currently there's always a symlink called + # libassimp.so in /usr/local/lib. + ext_whitelist.append('.so') ++ ext_whitelist.append('.3') + # libassimp.dylib in /usr/local/lib + ext_whitelist.append('.dylib') + diff --git a/assimp-3.3.1-free.tar.xz b/assimp-3.3.1-free.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..c6eca65d916ac6ce0a9f55181c2f5a98b83297c9 Binary files /dev/null and b/assimp-3.3.1-free.tar.xz differ diff --git a/assimp-3.3.1-install-pkgconfig.patch b/assimp-3.3.1-install-pkgconfig.patch new file mode 100644 index 0000000000000000000000000000000000000000..6a45f68cf25fd07404d5e2060c80e2d944fd2514 --- /dev/null +++ b/assimp-3.3.1-install-pkgconfig.patch @@ -0,0 +1,13 @@ +--- assimp-3.3.1/assimp.pc.in.fedora 2017-05-18 07:19:36.251314963 +0200 ++++ assimp-3.3.1/assimp.pc.in 2017-05-18 07:20:26.038525493 +0200 +@@ -1,7 +1,7 @@ + prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=@CMAKE_INSTALL_PREFIX@/@ASSIMP_BIN_INSTALL_DIR@ +-libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@ +-includedir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_INCLUDE_INSTALL_DIR@/assimp ++exec_prefix=@ASSIMP_BIN_INSTALL_DIR@ ++libdir=@ASSIMP_LIB_INSTALL_DIR@ ++includedir=@ASSIMP_INCLUDE_INSTALL_DIR@/assimp + + Name: @CMAKE_PROJECT_NAME@ + Description: Import various well-known 3D model formats in an uniform manner. diff --git a/assimp-3.3.1-namespace-bigendian.patch b/assimp-3.3.1-namespace-bigendian.patch new file mode 100644 index 0000000000000000000000000000000000000000..28b5d898309ac8eb4d1fd106a2cec2b29f5b08b4 --- /dev/null +++ b/assimp-3.3.1-namespace-bigendian.patch @@ -0,0 +1,12 @@ +diff -up assimp-3.3.1/code/ByteSwapper.h.than assimp-3.3.1/code/ByteSwapper.h +diff -up assimp-3.3.1/code/glTFAsset.inl.than assimp-3.3.1/code/glTFAsset.inl +--- assimp-3.3.1/code/glTFAsset.inl.than 2017-05-05 17:28:29.754976483 -0400 ++++ assimp-3.3.1/code/glTFAsset.inl 2017-05-05 17:28:52.995404721 -0400 +@@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE + + #include "StringUtils.h" + ++using namespace Assimp; + namespace glTF { + + namespace { diff --git a/assimp-3.3.1-unbundle.patch b/assimp-3.3.1-unbundle.patch new file mode 100644 index 0000000000000000000000000000000000000000..c28474b6581686eb7f2d90cce2ae9c742fe4503d --- /dev/null +++ b/assimp-3.3.1-unbundle.patch @@ -0,0 +1,201 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8455bb8..c8e0d88 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -211,6 +211,26 @@ IF ( ASSIMP_NO_EXPORT ) + MESSAGE( STATUS "Build an import-only version of Assimp." ) + ENDIF( ASSIMP_NO_EXPORT ) + ++# Search for poly2tri ++FIND_LIBRARY(POLY2TRI_LIB poly2tri HINTS ${POLY2TRI_LIB_PATH}) ++FIND_FILE(POLY2TRI_H poly2tri.h PATHS ${POLY2TRI_INCLUDE_PATH}) ++IF (POLY2TRI_LIB AND POLY2TRI_H) ++ message(status "Found External poly2tri") ++ SET(HAVE_POLY2TRI true) ++ELSE(POLY2TRI_LIB AND POLY2TRI_H) ++ SET(HAVE_POLY2TRI false) ++ENDIF(POLY2TRI_LIB AND POLY2TRI_H) ++ ++# Search for clipper ++FIND_LIBRARY(CLIPPER_LIB polyclipping HINTS ${CLIPPER_LIB_PATH}) ++FIND_FILE(CLIPPER_H clipper.hpp PATHS ${CLIPPER_INCLUDE_PATH}) ++IF (CLIPPER_LIB AND CLIPPER_H) ++ message(status "Found External clipper") ++ SET(HAVE_CLIPPER true) ++ELSE(CLIPPER_LIB AND CLIPPER_H) ++ SET(HAVE_CLIPPER false) ++ENDIF(CLIPPER_LIB AND CLIPPER_H) ++ + SET ( ASSIMP_BUILD_ARCHITECTURE "" CACHE STRING + "describe the current architecture." + ) +diff --git a/code/BlenderTessellator.h b/code/BlenderTessellator.h +index 530bd2c..a6c9d9e 100644 +--- a/code/BlenderTessellator.h ++++ b/code/BlenderTessellator.h +@@ -142,7 +142,7 @@ namespace Assimp + + #if ASSIMP_BLEND_WITH_POLY_2_TRI + +-#include "../contrib/poly2tri/poly2tri/poly2tri.h" ++#include "poly2tri/poly2tri.h" + + namespace Assimp + { +diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt +index 35ecf50..d549c89 100644 +--- a/code/CMakeLists.txt ++++ b/code/CMakeLists.txt +@@ -655,12 +655,15 @@ SET( ConvertUTF_SRCS + ) + SOURCE_GROUP( ConvertUTF FILES ${ConvertUTF_SRCS}) + ++if (NOT HAVE_CLIPPER) + SET( Clipper_SRCS + ../contrib/clipper/clipper.hpp + ../contrib/clipper/clipper.cpp + ) + SOURCE_GROUP( Clipper FILES ${Clipper_SRCS}) +- ++else (NOT HAVE_CLIPPER) ++SET( Clipper_SRCS "") ++endif(NOT HAVE_CLIPPER) + + SET( Poly2Tri_SRCS + ../contrib/poly2tri/poly2tri/common/shapes.cc +@@ -743,8 +746,6 @@ SET( assimp_src + # Third-party libraries + ${IrrXML_SRCS} + ${ConvertUTF_SRCS} +- ${unzip_compile_SRCS} +- ${Poly2Tri_SRCS} + ${Clipper_SRCS} + ${openddl_parser_SRCS} + # Necessary to show the headers in the project when using the VC++ generator: +@@ -753,6 +754,8 @@ SET( assimp_src + ${COMPILER_HEADERS} + + ) ++ ++ + ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) + + INCLUDE_DIRECTORIES( +@@ -821,6 +824,19 @@ else (UNZIP_FOUND) + INCLUDE_DIRECTORIES("../") + endif (UNZIP_FOUND) + ++if (HAVE_POLY2TRI) ++ INCLUDE_DIRECTORIES(${POLY2TRI_INCLUDE_PATH}) ++ TARGET_LINK_LIBRARIES(assimp ${POLY2TRI_LIB}) ++endif(HAVE_POLY2TRI) ++ ++if (HAVE_CLIPPER) ++ INCLUDE_DIRECTORIES(${CLIPPER_INCLUDE_PATH}) ++ TARGET_LINK_LIBRARIES(assimp ${CLIPPER_LIB}) ++else (HAVE_CLIPPER) ++ INCLUDE_DIRECTORIES(../contrib/clipper) ++endif(HAVE_CLIPPER) ++ ++ + INSTALL( TARGETS assimp + LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} +diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp +index 1a97168..7377eb4 100644 +--- a/code/D3MFImporter.cpp ++++ b/code/D3MFImporter.cpp +@@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include +-#include ++#include + #include "irrXMLWrapper.h" + #include "StringComparison.h" + #include "StringUtils.h" +diff --git a/code/D3MFOpcPackage.cpp b/code/D3MFOpcPackage.cpp +index 7cc1dd5..2b007db 100644 +--- a/code/D3MFOpcPackage.cpp ++++ b/code/D3MFOpcPackage.cpp +@@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "D3MFOpcPackage.h" + #include "Exceptional.h" + +-#include ++#include + #include + #include + #include +diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp +index 5a2e4a0..0926498 100644 +--- a/code/IFCGeometry.cpp ++++ b/code/IFCGeometry.cpp +@@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "PolyTools.h" + #include "ProcessHelper.h" + +-#include "../contrib/poly2tri/poly2tri/poly2tri.h" +-#include "../contrib/clipper/clipper.hpp" ++#include "poly2tri/poly2tri.h" ++#include "clipper.hpp" + #include + + #include +diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp +index 34977f5..bc655c0 100644 +--- a/code/IFCLoader.cpp ++++ b/code/IFCLoader.cpp +@@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + + #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC +-# include ++# include + #endif + + #include "IFCLoader.h" +diff --git a/code/IFCOpenings.cpp b/code/IFCOpenings.cpp +index 51ea143..f0915fb 100644 +--- a/code/IFCOpenings.cpp ++++ b/code/IFCOpenings.cpp +@@ -49,8 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include "PolyTools.h" + #include "ProcessHelper.h" + +-#include "../contrib/poly2tri/poly2tri/poly2tri.h" +-#include "../contrib/clipper/clipper.hpp" ++#include "poly2tri/poly2tri.h" ++#include "clipper.hpp" + + #include + +diff --git a/code/Q3BSPZipArchive.h b/code/Q3BSPZipArchive.h +index e46a11b..da93e5c 100644 +--- a/code/Q3BSPZipArchive.h ++++ b/code/Q3BSPZipArchive.h +@@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #ifndef AI_Q3BSP_ZIPARCHIVE_H_INC + #define AI_Q3BSP_ZIPARCHIVE_H_INC + +-#include ++#include + #include + #include + #include +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index df0139d..8b26f22 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -37,7 +37,8 @@ + #---------------------------------------------------------------------- + cmake_minimum_required( VERSION 2.6 ) + +-INCLUDE( AddGTest ) ++# Search for Google Test ++FIND_PACKAGE(GTest) + + INCLUDE_DIRECTORIES( + ${Assimp_SOURCE_DIR}/include +diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt +index f8af93a..3f9a902 100644 diff --git a/assimp.spec b/assimp.spec new file mode 100644 index 0000000000000000000000000000000000000000..357f3686ac46c5a5a9385287b0b0673010356f0f --- /dev/null +++ b/assimp.spec @@ -0,0 +1,120 @@ +Name: assimp +Version: 3.3.1 +Release: 18 +Summary: Library to load and process various 3D model formats into applications. +License: BSD and MIT +URL: http://assimp.sourceforge.net +Source0: assimp-%{version}-free.tar.xz +Patch0001: assimp-3.3.1-unbundle.patch +Patch0002: assimp-3.2.0-pythonpath.patch +Patch0003: 0001-Assimp-cmake-provider-fix.patch +Patch0004: assimp-3.3.1-namespace-bigendian.patch +Patch0005: assimp-3.3.1-install-pkgconfig.patch +Patch0006: 0001-Morph-animation-support-for-collada.patch +Patch0007: 0001-Enable-doxygen-been-properly-used-from-cmake-build-a.patch +Patch0008: 0001-Apply-mechanism-to-decide-use-for-IrrXML-external-or.patch +BuildRequires: gcc-c++ boost-devel cmake dos2unix irrlicht-devel irrXML-devel +BuildRequires: doxygen poly2tri-devel gtest-devel pkgconfig(zzip-zlib-config) +BuildRequires: pkgconfig(zlib) pkgconfig(minizip) pkgconfig(python2) python2-rpm-macros +BuildRequires: pkgconfig(ILUT) pkgconfig(python3) python3-rpm-macros +Provides: bundled(polyclipping) = 4.8.8 bundled(openddl-parser) + +%description +Assimp is a library to load and process geometric scenes from various data formats. +Assimp aims to provide a full asset conversion pipeline for use in game +engines and real-time rendering systems of any kind, but is not limited +to this purpose. + +%package devel +Summary: Headers and libraries for assimp +Requires: assimp = %{version}-%{release} + +%description devel +This package provides the header files and libraries +for assimp. Developers use it to develop programs. + +%package -n python2-assimp +Summary: Python2 bindings for assimp +BuildArch: noarch +Requires: assimp = %{version}-%{release} python2 +Provides: assimp-python = %{version}-%{release} +Obsoletes: assimp-python < 3.1.1 + +%description -n python2-assimp +This package provides the PyAssimp python bindings + +%package -n python3-assimp +Summary: Python3 bindings for assimp +BuildArch: noarch +Requires: assimp = %{version}-%{release} python3 +Provides: assimp-python3 = %{version}-%{release} +Obsoletes: assimp-python3 < 3.1.1 + +%description -n python3-assimp +This package provides the PyAssimp3 python bindings + +%package help +Summary: Assimp help doc +BuildArch: noarch +Provides: assimp-doc = %{version}-%{release} +Obsoletes: assimp-doc < %{version}-%{release} + +%description help +Assimp help doc. + +%prep +%autosetup -n assimp-%{version} -p1 +rm -r contrib/irrXML;rm -r contrib/zlib;rm -r contrib/unzip;rm -r contrib/poly2tri + +%build +mkdir build +pushd build +%cmake .. -DASSIMP_LIB_INSTALL_DIR=%{_libdir} -DASSIMP_BIN_INSTALL_DIR=%{_bindir} \ + -DASSIMP_INCLUDE_INSTALL_DIR=%{_includedir} -DBUILD_DOCS=ON \ + -DHTML_OUTPUT=%{name}-%{version} -DCMAKE_INSTALL_DOCDIR=%{_docdir} \ + -DPOLY2TRI_INCLUDE_PATH=%{_includedir}/poly2tri -DSYSTEM_IRRXML=ON +popd + +%make_build -C build + +dos2unix LICENSE README port/PyAssimp/README.md CREDITS +iconv -f iso8859-1 -t utf-8 CREDITS > CREDITS.conv && mv -f CREDITS.conv CREDITS + +%install +%make_install -C build +install -d %{buildroot}%{python2_sitelib}/pyassimp/ +install -m 0644 port/PyAssimp/pyassimp/*.py %{buildroot}%{python2_sitelib}/pyassimp/ +install -d %{buildroot}%{python3_sitelib}/pyassimp/ +install -m 0644 port/PyAssimp/pyassimp/*.py %{buildroot}%{python3_sitelib}/pyassimp/ + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%doc README CREDITS LICENSE +%{_bindir}/assimp +%{_libdir}/*.so.* + +%files devel +%{_includedir}/assimp +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%{_libdir}/cmake/* + +%files help +%{_docdir}/* + +%files -n python2-assimp +%doc port/PyAssimp/README.md +%{python2_sitelib}/pyassimp + +%files -n python3-assimp +%doc port/PyAssimp/README.md +%{python3_sitelib}/pyassimp + +%changelog +* Fri Feb 14 likexin - 3.3.1-18 +- Package init