diff --git a/.travis.sh b/.travis.sh index 7534c3f79..c3624a593 100755 --- a/.travis.sh +++ b/.travis.sh @@ -11,6 +11,6 @@ else && sudo make install \ && sudo ldconfig \ && (cd test/unit; ../../bin/unit) \ - #&& (cd test/regression; chmod 755 run.py; ./run.py; \ - #chmod 755 result_checker.py; ./result_checker.py) + && (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \ + chmod 755 result_checker.py; ./result_checker.py) fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 8434e4628..f0736da74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,65 @@ -set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required +# 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. +# +#---------------------------------------------------------------------- +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) -if(NOT BUILD_SHARED_LIBS) - #set(CMAKE_EXE_LINKER_FLAGS "-static") - set(LINK_SEARCH_START_STATIC TRUE) -endif(NOT BUILD_SHARED_LIBS) +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) # Define here the needed parameters -set (ASSIMP_VERSION_MAJOR 3) -set (ASSIMP_VERSION_MINOR 2) -set (ASSIMP_VERSION_PATCH 0) # subversion revision? -set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) -set (ASSIMP_SOVERSION 3) -set (PROJECT_VERSION "${ASSIMP_VERSION}") +SET (ASSIMP_VERSION_MAJOR 3) +SET (ASSIMP_VERSION_MINOR 2) +SET (ASSIMP_VERSION_PATCH 0) # subversion revision? +SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) +SET (ASSIMP_SOVERSION 3) +SET (PROJECT_VERSION "${ASSIMP_VERSION}") -set(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources") +SET(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources") # Needed for openddl_parser config, no use of c++11 at this moment add_definitions( -DOPENDDL_NO_USE_CPP11 ) +set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) # Get the current working branch -execute_process( +EXECUTE_PROCESS( COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH @@ -31,7 +68,7 @@ execute_process( ) # Get the latest abbreviated commit hash of the working branch -execute_process( +EXECUTE_PROCESS( COMMAND git log -1 --format=%h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH @@ -39,9 +76,9 @@ execute_process( ERROR_QUIET ) -if(NOT GIT_COMMIT_HASH) - set(GIT_COMMIT_HASH 0) -endif(NOT GIT_COMMIT_HASH) +IF(NOT GIT_COMMIT_HASH) + SET(GIT_COMMIT_HASH 0) +ENDIF(NOT GIT_COMMIT_HASH) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in @@ -50,30 +87,34 @@ configure_file( include_directories(${CMAKE_CURRENT_BINARY_DIR}) -option(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" ) -set(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" ) -set(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev" ) -set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev) -set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names") +OPTION(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) +SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" ) +SET(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" ) +SET(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev" ) +SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev) +SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names") -option(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF) +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() +ENDIF() -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() +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() # hide all not-exported symbols - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall" ) -elseif(MSVC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" ) +ELSEIF(MSVC) # enable multi-core compilation with MSVC - add_definitions(/MP) -endif() + 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_COMPILER_IS_MINGW ) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" ) +ENDIF() INCLUDE (FindPkgConfig) INCLUDE_DIRECTORIES( include ) @@ -111,32 +152,7 @@ IF (NOT TARGET uninstall) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") ENDIF() -# Globally enable Boost resp. the Boost workaround – it is also needed by the -# tools which include the Assimp headers. -option ( ASSIMP_ENABLE_BOOST_WORKAROUND - "If a simple implementation of the used Boost functions is used. Slightly reduces functionality, but enables builds without Boost available." - ON -) -IF ( ASSIMP_ENABLE_BOOST_WORKAROUND ) - INCLUDE_DIRECTORIES( code/BoostWorkaround ) - ADD_DEFINITIONS( -DASSIMP_BUILD_BOOST_WORKAROUND ) - MESSAGE( STATUS "Building a non-boost version of Assimp." ) -ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND ) - SET( Boost_DETAILED_FAILURE_MSG ON ) - IF ( NOT Boost_ADDITIONAL_VERSIONS ) - 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" "1.59" "1.59.0") - ENDIF ( NOT Boost_ADDITIONAL_VERSIONS ) - FIND_PACKAGE( Boost ) - IF ( NOT Boost_FOUND ) - MESSAGE( FATAL_ERROR - "Boost libraries (http://www.boost.org/) not found. " - "You can build a non-boost version of Assimp with slightly reduced " - "functionality by specifying -DASSIMP_ENABLE_BOOST_WORKAROUND=ON." - ) - ENDIF ( NOT Boost_FOUND ) - INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) -ENDIF ( ASSIMP_ENABLE_BOOST_WORKAROUND ) # cmake configuration files configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE) @@ -145,38 +161,38 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C FIND_PACKAGE( DirectX ) -option ( ASSIMP_NO_EXPORT +OPTION ( ASSIMP_NO_EXPORT "Disable Assimp's export functionality." OFF ) -if( CMAKE_COMPILER_IS_GNUCXX ) - set(LIBSTDC++_LIBRARIES -lstdc++) -endif( CMAKE_COMPILER_IS_GNUCXX ) +IF( CMAKE_COMPILER_IS_GNUCXX ) + SET(LIBSTDC++_LIBRARIES -lstdc++) +ENDIF( CMAKE_COMPILER_IS_GNUCXX ) # Search for external dependencies, and build them from source if not found # Search for zlib find_package(ZLIB) -if( NOT ZLIB_FOUND ) +IF( NOT ZLIB_FOUND ) message(STATUS "compiling zlib from souces") include(CheckIncludeFile) include(CheckTypeSize) include(CheckFunctionExists) # compile from sources add_subdirectory(contrib/zlib) - set(ZLIB_FOUND 1) - set(ZLIB_LIBRARIES zlibstatic) - set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib) + SET(ZLIB_FOUND 1) + SET(ZLIB_LIBRARIES zlibstatic) + SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib) else(NOT ZLIB_FOUND) ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB) - set(ZLIB_LIBRARIES_LINKED -lz) -endif(NOT ZLIB_FOUND) + SET(ZLIB_LIBRARIES_LINKED -lz) +ENDIF(NOT ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) # Search for unzip -if (PKG_CONFIG_FOUND) +IF (PKG_CONFIG_FOUND) PKG_CHECK_MODULES(UNZIP minizip) -endif (PKG_CONFIG_FOUND) +ENDIF (PKG_CONFIG_FOUND) IF ( ASSIMP_NO_EXPORT ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT) @@ -204,7 +220,7 @@ MARK_AS_ADVANCED ( ASSIMP_BUILD_ARCHITECTURE ASSIMP_BUILD_COMPILER ) SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL - "Build the C4D importer, which relies on the non-free Melange SDK." + "Build the C4D importer, which relies on the non-free Melange SDK." ) IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) @@ -219,44 +235,47 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) ELSEIF(MSVC90) SET(C4D_LIB_POSTFIX "_2008md") ELSE() - MESSAGE( FATAL_ERROR + MESSAGE( FATAL_ERROR "C4D is currently only supported with MSVC 9, 10, 11" ) ENDIF() - + IF(CMAKE_CL_64) SET(C4D_LIB_ARCH_POSTFIX "_x64") ELSE() SET(C4D_LIB_ARCH_POSTFIX "") ENDIF() - + SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/lib/WIN") - + SET(C4D_DEBUG_LIBRARY "${C4D_LIB_BASE_PATH}/debug/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib") SET(C4D_RELEASE_LIBRARY "${C4D_LIB_BASE_PATH}/release/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib") - + # winsock and winmm are necessary dependencies of melange (this is undocumented, but true.) SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib) ELSE () - MESSAGE( FATAL_ERROR + MESSAGE( FATAL_ERROR "C4D is currently only available on Windows with melange SDK installed in contrib/Melange" ) ENDIF ( MSVC ) -else (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) +ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER ) ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) - ADD_SUBDIRECTORY( code/ ) option ( ASSIMP_BUILD_ASSIMP_TOOLS "If the supplementary tools for Assimp are built in addition to the library." ON ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) - IF ( WIN32 AND DirectX_FOUND ) - ADD_SUBDIRECTORY( tools/assimp_view/ ) - ENDIF ( WIN32 AND DirectX_FOUND ) + IF ( WIN32 ) + option ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} ) + IF ( ASSIMP_BUILD_ASSIMP_VIEW ) + ADD_SUBDIRECTORY( tools/assimp_view/ ) + ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW ) + ENDIF ( WIN32 ) + ADD_SUBDIRECTORY( tools/assimp_cmd/ ) ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) @@ -272,7 +291,7 @@ IF ( ASSIMP_BUILD_SAMPLES) ADD_SUBDIRECTORY( samples/SimpleOpenGL/ ) ENDIF ( ASSIMP_BUILD_SAMPLES ) -option ( ASSIMP_BUILD_TESTS +OPTION ( ASSIMP_BUILD_TESTS "If the test suite for Assimp is built in addition to the library." ON ) @@ -282,7 +301,7 @@ IF ( ASSIMP_BUILD_TESTS ) ENDIF ( ASSIMP_BUILD_TESTS ) IF(MSVC) - option ( ASSIMP_INSTALL_PDB + OPTION ( ASSIMP_INSTALL_PDB "Install MSVC debug files." ON ) @@ -292,72 +311,72 @@ ENDIF(MSVC) CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT}) -if(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES) +IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES) # Packing information - set(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}") - set(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.") - set(CPACK_PACKAGE_VENDOR "http://assimp.sourceforge.net/") - set(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library ${ASSIMP_VERSION}") - set(CPACK_PACKAGE_VERSION "${ASSIMP_VERSION}.${ASSIMP_PACKAGE_VERSION}" ) - set(CPACK_PACKAGE_VERSION_MAJOR "${ASSIMP_VERSION_MAJOR}") - set(CPACK_PACKAGE_VERSION_MINOR "${ASSIMP_VERSION_MINOR}") - set(CPACK_PACKAGE_VERSION_PATCH "${ASSIMP_VERSION_PATCH}") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "assimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + SET(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}") + SET(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.") + SET(CPACK_PACKAGE_VENDOR "https://github.com/assimp") + SET(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library ${ASSIMP_VERSION}") + SET(CPACK_PACKAGE_VERSION "${ASSIMP_VERSION}.${ASSIMP_PACKAGE_VERSION}" ) + SET(CPACK_PACKAGE_VERSION_MAJOR "${ASSIMP_VERSION_MAJOR}") + SET(CPACK_PACKAGE_VERSION_MINOR "${ASSIMP_VERSION_MINOR}") + SET(CPACK_PACKAGE_VERSION_PATCH "${ASSIMP_VERSION_PATCH}") + SET(CPACK_PACKAGE_INSTALL_DIRECTORY "assimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}") + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") string(TOUPPER ${LIBASSIMP_COMPONENT} "LIBASSIMP_COMPONENT_UPPER") string(TOUPPER ${LIBASSIMP-DEV_COMPONENT} "LIBASSIMP-DEV_COMPONENT_UPPER") - set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools") - set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS "${LIBASSIMP_COMPONENT}" ) - set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT_UPPER}_DISPLAY_NAME "libraries") - set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs") - set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" ) - set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" ) - set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" ) - set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake libboost-dev libboost-thread-dev libboost-math-dev zlib1g-dev pkg-config) + SET(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools") + SET(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS "${LIBASSIMP_COMPONENT}" ) + SET(CPACK_COMPONENT_${LIBASSIMP_COMPONENT_UPPER}_DISPLAY_NAME "libraries") + SET(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs") + SET(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" ) + SET(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" ) + SET(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" ) + SET(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config) # debian - set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") - set(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_ASSIMP_SAMPLES:BOOL=${ASSIMP_BUILD_SAMPLES}") - set(CPACK_DEBIAN_PACKAGE_SECTION "libs" ) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}") - set(CPACK_DEBIAN_PACKAGE_SUGGESTS) - set(CPACK_DEBIAN_PACKAGE_NAME "assimp") - set(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/cppunit-1.12.1 contrib/cppunit_note.txt contrib/zlib workspaces test doc obj samples packaging) - set(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force) - set(CPACK_DEBIAN_CHANGELOG) + SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + SET(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_ASSIMP_SAMPLES:BOOL=${ASSIMP_BUILD_SAMPLES}") + SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" ) + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}") + SET(CPACK_DEBIAN_PACKAGE_SUGGESTS) + SET(CPACK_DEBIAN_PACKAGE_NAME "assimp") + SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/cppunit-1.12.1 contrib/cppunit_note.txt contrib/zlib workspaces test doc obj samples packaging) + SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force) + SET(CPACK_DEBIAN_CHANGELOG) execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE _lsb_distribution OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _lsb_release_failed) - set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton") - string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME) - if( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" ) - set(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release") - endif() - set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources") + SET(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton") + STRING(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME) + IF( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" ) + SET(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release") + ENDIF() + SET(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources") include(CPack) include(DebSourcePPA) -endif() +ENDIF() if(WIN32) if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/") - set(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/") + SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/") + SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/") elseif() - set(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/") - set(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/") - endif() - + SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/") + SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/") + ENDIF() + if(MSVC12) - set(ASSIMP_MSVC_VERSION "vc120") - elseif(MSVC14) - set(ASSIMP_MSVC_VERSION "vc140") - endif(MSVC12) + SET(ASSIMP_MSVC_VERSION "vc120") + elseif(MSVC14) + SET(ASSIMP_MSVC_VERSION "vc140") + ENDIF(MSVC12) if(MSVC12 OR MSVC14) - add_custom_target(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM) + add_custom_target(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM) @@ -366,5 +385,5 @@ if(WIN32) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM) add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM) - endif(MSVC12 OR MSVC14) -endif (WIN32) \ No newline at end of file + ENDIF(MSVC12 OR MSVC14) +ENDIF (WIN32) diff --git a/CREDITS b/CREDITS index 774bed5f8..9186c092e 100644 --- a/CREDITS +++ b/CREDITS @@ -30,7 +30,7 @@ Ogre Loader, VC2010 fixes and CMake fixes. - Sebastian Hempel, PyAssimp (first version) -Compile-Bugfixes for mingw, add enviroment for static library support in make. +Compile-Bugfixes for mingw, add environment for static library support in make. - Jonathan Pokrass Supplied a bugfix concerning the scaling in the md3 loader. @@ -114,7 +114,7 @@ Contributes a fix for the configure script environment. Contributed AssimpDelphi (/port/AssimpDelphi). - rdb -Contributes a bundle of fixes and improvments for the bsp-importer. +Contributes a bundle of fixes and improvements for the bsp-importer. - Mick P For contributing the De-bone postprocessing step and filing various bug reports. diff --git a/Readme.md b/Readme.md index 0564e4eda..ddb38f410 100644 --- a/Readme.md +++ b/Readme.md @@ -60,7 +60,8 @@ __Importers__: - Ogre XML - Q3D - ASSBIN (Assimp custom format) -- glTF +- glTF (partial) +- 3MF Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default): @@ -76,7 +77,8 @@ __Exporters__: - 3DS - JSON (for WebGl, via https://github.com/acgessler/assimp2json) - ASSBIN -- glTF +- STEP +- glTF (partial) ### Building ### Take a look into the `INSTALL` file. Our build system is CMake, if you used CMake before there is a good chance you know what to do. @@ -100,7 +102,7 @@ Open Asset Import Library is implemented in C++. The directory structure is: /tools Tools (old assimp viewer, command line `assimp`) /samples A small number of samples to illustrate possible use cases for Assimp - /workspaces Build enviroments for vc,xcode,... (deprecated, + /workspaces Build environments for vc,xcode,... (deprecated, CMake has superseeded all legacy build options!) @@ -120,6 +122,10 @@ And we also have an IRC-channel at freenode: #assetimporterlib . You can easily Contributions to assimp are highly appreciated. The easiest way to get involved is to submit a pull request with your changes against the main repository's `master` branch. +### Donate ### +If you like assimp, consider buying us a beer (or two): +[Donate](http://sourceforge.net/donate/index.php?group_id=226462) + ### License ### Our license is based on the modified, __3-clause BSD__-License. diff --git a/appveyor.yml b/appveyor.yml index 41e483d80..d732c72e7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,7 +18,7 @@ configuration: - 14 2015 - 12 2013 #- MinGW - - 10 2010 # only works for x86 + #- 10 2010 # only works for x86 init: - if "%platform%" EQU "x64" ( for %%a in (2008 2010 MinGW) do ( if "%Configuration%"=="%%a" (echo "Skipping unsupported configuration" && exit /b 1 ) ) ) diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 7e57d79d3..e06cc10ee 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -64,7 +64,7 @@ set( ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES}@CMAKE_DEBUG_POSTFIX@) # the boost version assimp was compiled with set( ASSIMP_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@") -# for compatibility wiht pkg-config +# for compatibility with pkg-config set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}") set(ASSIMP_LDFLAGS_OTHER "${ASSIMP_LINK_FLAGS}") diff --git a/code/3DSConverter.cpp b/code/3DSConverter.cpp index cea255380..419b71b29 100644 --- a/code/3DSConverter.cpp +++ b/code/3DSConverter.cpp @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/assimp/scene.h" #include "../include/assimp/DefaultLogger.hpp" #include "StringComparison.h" -#include +#include #include using namespace Assimp; @@ -359,7 +359,7 @@ void Discreet3DSImporter::ConvertMeshes(aiScene* pcOut) // we need to split all meshes by their materials for (std::vector::iterator i = mScene->mMeshes.begin(); i != mScene->mMeshes.end();++i) { - boost::scoped_array< std::vector > aiSplit(new std::vector[mScene->mMaterials.size()]); + std::unique_ptr< std::vector[] > aiSplit(new std::vector[mScene->mMaterials.size()]); name.length = ASSIMP_itoa10(name.data,num++); diff --git a/code/3DSExporter.cpp b/code/3DSExporter.cpp index f33799fef..5450c1baf 100644 --- a/code/3DSExporter.cpp +++ b/code/3DSExporter.cpp @@ -150,7 +150,7 @@ namespace { // Worker function for exporting a scene to 3DS. Prototyped and registered in Exporter.cpp void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) { - boost::shared_ptr outfile (pIOSystem->Open(pFile, "wb")); + std::shared_ptr outfile (pIOSystem->Open(pFile, "wb")); if(!outfile) { throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile)); } @@ -164,7 +164,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen // in |Exporter::ExportFormatEntry|. aiScene* scenecopy_tmp; SceneCombiner::CopyScene(&scenecopy_tmp,pScene); - std::auto_ptr scenecopy(scenecopy_tmp); + std::unique_ptr scenecopy(scenecopy_tmp); SplitLargeMeshesProcess_Triangle tri_splitter; tri_splitter.SetLimit(0xffff); @@ -181,7 +181,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen } // end of namespace Assimp // ------------------------------------------------------------------------------------------------ -Discreet3DSExporter:: Discreet3DSExporter(boost::shared_ptr outfile, const aiScene* scene) +Discreet3DSExporter:: Discreet3DSExporter(std::shared_ptr outfile, const aiScene* scene) : scene(scene) , writer(outfile) { diff --git a/code/3DSExporter.h b/code/3DSExporter.h index ce9a02f78..321539cff 100644 --- a/code/3DSExporter.h +++ b/code/3DSExporter.h @@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_3DSEXPORTER_H_INC #include -#include +#include #include "StreamWriter.h" #include "./../include/assimp/material.h" @@ -64,7 +64,7 @@ namespace Assimp class Discreet3DSExporter { public: - Discreet3DSExporter(boost::shared_ptr outfile, const aiScene* pScene); + Discreet3DSExporter(std::shared_ptr outfile, const aiScene* pScene); private: diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 2c55ba977..f6ade56a3 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -197,7 +197,7 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile, ComputeNormalsWithSmoothingsGroups(*i); } - // Replace all occurences of the default material with a + // Replace all occurrences of the default material with a // valid material. Generate it if no material containing // DEFAULT in its name has been found in the file ReplaceDefaultMaterial(); diff --git a/code/ACLoader.cpp b/code/ACLoader.cpp index f84027501..fbe8cb009 100644 --- a/code/ACLoader.cpp +++ b/code/ACLoader.cpp @@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/assimp/scene.h" #include "../include/assimp/config.h" #include "../include/assimp/IOSystem.hpp" -#include +#include using namespace Assimp; @@ -708,7 +708,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object, // collect all meshes using the same material group. if (object.subDiv) { if (configEvalSubdivision) { - boost::scoped_ptr div(Subdivider::Create(Subdivider::CATMULL_CLARKE)); + std::unique_ptr div(Subdivider::Create(Subdivider::CATMULL_CLARKE)); DefaultLogger::get()->info("AC3D: Evaluating subdivision surface: "+object.name); std::vector cpy(meshes.size()-oldm,NULL); @@ -787,7 +787,7 @@ void AC3DImporter::SetupProperties(const Importer* pImp) void AC3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) { - boost::scoped_ptr file( pIOHandler->Open( pFile, "rb")); + std::unique_ptr file( pIOHandler->Open( pFile, "rb")); // Check whether we can read from the file if( file.get() == NULL) @@ -884,7 +884,7 @@ void AC3DImporter::InternReadFile( const std::string& pFile, // copy meshes if (meshes.empty()) { - throw DeadlyImportError("An unknown error occured during converting"); + throw DeadlyImportError("An unknown error occurred during converting"); } pScene->mNumMeshes = (unsigned int)meshes.size(); pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; diff --git a/code/ASELoader.cpp b/code/ASELoader.cpp index 514b6b66c..6f6610786 100644 --- a/code/ASELoader.cpp +++ b/code/ASELoader.cpp @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "SkeletonMeshBuilder.h" #include "TargetAnimation.h" #include "../include/assimp/Importer.hpp" -#include +#include #include "../include/assimp/IOSystem.hpp" #include "../include/assimp/DefaultLogger.hpp" #include "../include/assimp/scene.h" @@ -130,7 +130,7 @@ void ASEImporter::SetupProperties(const Importer* pImp) void ASEImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) { - boost::scoped_ptr file( pIOHandler->Open( pFile, "rb")); + std::unique_ptr file( pIOHandler->Open( pFile, "rb")); // Check whether we can read from the file if( file.get() == NULL) { diff --git a/code/ASEParser.h b/code/ASEParser.h index 6a3e56e71..0a8931472 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -43,11 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_ASEFILEHELPER_H_INC #define AI_ASEFILEHELPER_H_INC -// STL/CRT headers -#include -#include -#include - // public ASSIMP headers #include "../include/assimp/types.h" #include "../include/assimp/mesh.h" @@ -609,7 +604,7 @@ private: //! \param out Output string //! \param szName Name of the enclosing element -> used in error //! messages. - //! \return false if an error occured + //! \return false if an error occurred bool ParseString(std::string& out,const char* szName); public: diff --git a/code/AssbinExporter.cpp b/code/AssbinExporter.cpp index 9a70d7166..7df58cd2d 100644 --- a/code/AssbinExporter.cpp +++ b/code/AssbinExporter.cpp @@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/assimp/Exporter.hpp" #include "ProcessHelper.h" #include "Exceptional.h" -#include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include @@ -103,7 +102,7 @@ inline size_t Write(IOStream * stream, const unsigned int& w) template <> inline size_t Write(IOStream * stream, const uint16_t& w) { - BOOST_STATIC_ASSERT(sizeof(uint16_t)==2); + static_assert(sizeof(uint16_t)==2, "sizeof(uint16_t)==2"); stream->Write(&w,2,1); return 2; } @@ -113,7 +112,7 @@ inline size_t Write(IOStream * stream, const uint16_t& w) template <> inline size_t Write(IOStream * stream, const float& f) { - BOOST_STATIC_ASSERT(sizeof(float)==4); + static_assert(sizeof(float)==4, "sizeof(float)==4"); stream->Write(&f,4,1); return 4; } @@ -123,7 +122,7 @@ inline size_t Write(IOStream * stream, const float& f) template <> inline size_t Write(IOStream * stream, const double& f) { - BOOST_STATIC_ASSERT(sizeof(double)==8); + static_assert(sizeof(double)==8, "sizeof(double)==8"); stream->Write(&f,8,1); return 8; } @@ -472,7 +471,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) uint32_t tmp = f.mNumIndices; hash = SuperFastHash(reinterpret_cast(&tmp),sizeof tmp,hash); for (unsigned int i = 0; i < f.mNumIndices; ++i) { - BOOST_STATIC_ASSERT(AI_MAX_VERTICES <= 0xffffffff); + static_assert(AI_MAX_VERTICES <= 0xffffffff, "AI_MAX_VERTICES <= 0xffffffff"); tmp = static_cast( f.mIndices[i] ); hash = SuperFastHash(reinterpret_cast(&tmp),sizeof tmp,hash); } @@ -486,7 +485,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) for (unsigned int i = 0; i < mesh->mNumFaces;++i) { const aiFace& f = mesh->mFaces[i]; - BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff); + static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff"); Write(&chunk,f.mNumIndices); for (unsigned int a = 0; a < f.mNumIndices;++a) { diff --git a/code/AssbinLoader.cpp b/code/AssbinLoader.cpp index 509741277..2e8e06f8a 100644 --- a/code/AssbinLoader.cpp +++ b/code/AssbinLoader.cpp @@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/assimp/mesh.h" #include "../include/assimp/anim.h" #include "../include/assimp/scene.h" -#include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB # include @@ -351,7 +350,7 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) for (unsigned int i = 0; i < mesh->mNumFaces;++i) { aiFace& f = mesh->mFaces[i]; - BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff); + static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff"); f.mNumIndices = Read(stream); f.mIndices = new unsigned int[f.mNumIndices]; diff --git a/code/Assimp.cpp b/code/Assimp.cpp index d46ebe537..8507c8641 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -59,8 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ------------------------------------------------------------------------------------------------ #ifndef ASSIMP_BUILD_SINGLETHREADED -# include -# include +# include +# include #endif // ------------------------------------------------------------------------------------------------ using namespace Assimp; @@ -103,7 +103,7 @@ namespace Assimp #ifndef ASSIMP_BUILD_SINGLETHREADED /** Global mutex to manage the access to the log-stream map */ -static boost::mutex gLogStreamMutex; +static std::mutex gLogStreamMutex; #endif @@ -119,7 +119,7 @@ public: ~LogToCallbackRedirector() { #ifndef ASSIMP_BUILD_SINGLETHREADED - boost::mutex::scoped_lock lock(gLogStreamMutex); + std::lock_guard lock(gLogStreamMutex); #endif // (HACK) Check whether the 'stream.user' pointer points to a // custom LogStream allocated by #aiGetPredefinedLogStream. @@ -321,8 +321,8 @@ ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene, } // ------------------------------------------------------------------------------------------------ -ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene, - BaseProcess* process, +ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene, + BaseProcess* process, bool requestValidation ) { const aiScene* sc( NULL ); @@ -343,7 +343,7 @@ ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene, } ASSIMP_END_EXCEPTION_REGION( const aiScene* ); - + return sc; } @@ -383,7 +383,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream ) ASSIMP_BEGIN_EXCEPTION_REGION(); #ifndef ASSIMP_BUILD_SINGLETHREADED - boost::mutex::scoped_lock lock(gLogStreamMutex); + std::lock_guard lock(gLogStreamMutex); #endif LogStream* lg = new LogToCallbackRedirector(*stream); @@ -402,7 +402,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream) ASSIMP_BEGIN_EXCEPTION_REGION(); #ifndef ASSIMP_BUILD_SINGLETHREADED - boost::mutex::scoped_lock lock(gLogStreamMutex); + std::lock_guard lock(gLogStreamMutex); #endif // find the log-stream associated with this data LogStreamMap::iterator it = gActiveLogStreams.find( *stream); @@ -427,7 +427,7 @@ ASSIMP_API void aiDetachAllLogStreams(void) { ASSIMP_BEGIN_EXCEPTION_REGION(); #ifndef ASSIMP_BUILD_SINGLETHREADED - boost::mutex::scoped_lock lock(gLogStreamMutex); + std::lock_guard lock(gLogStreamMutex); #endif Logger *logger( DefaultLogger::get() ); if ( NULL == logger ) { @@ -440,7 +440,7 @@ ASSIMP_API void aiDetachAllLogStreams(void) } gActiveLogStreams.clear(); DefaultLogger::kill(); - + ASSIMP_END_EXCEPTION_REGION(void); } diff --git a/code/AssxmlExporter.cpp b/code/AssxmlExporter.cpp index 669ff64ca..bcf805501 100644 --- a/code/AssxmlExporter.cpp +++ b/code/AssxmlExporter.cpp @@ -65,13 +65,21 @@ namespace Assimp { namespace AssxmlExport { -int ioprintf( IOStream * io, const char * format, ... ) -{ - char sz[4096]; +// ----------------------------------------------------------------------------------- +static int ioprintf( IOStream * io, const char *format, ... ) { + using namespace std; + if ( nullptr == io ) { + return -1; + } + + static const size_t Size = 4096; + char sz[ Size ]; + size_t len( strlen( format ) ); + ::memset( sz, '\0', Size ); va_list va; va_start( va, format ); - int nSize = ai_snprintf( sz, 4096, format, va ); - ai_assert( nSize < 4096 ); + int nSize = vsnprintf( sz, Size-1, format, va ); + ai_assert( nSize < Size ); va_end( va ); io->Write( sz, sizeof(char), nSize ); @@ -81,8 +89,7 @@ int ioprintf( IOStream * io, const char * format, ... ) // ----------------------------------------------------------------------------------- // Convert a name to standard XML format -void ConvertName(aiString& out, const aiString& in) -{ +static void ConvertName(aiString& out, const aiString& in) { out.length = 0; for (unsigned int i = 0; i < in.length; ++i) { switch (in.data[i]) { @@ -105,8 +112,7 @@ void ConvertName(aiString& out, const aiString& in) // ----------------------------------------------------------------------------------- // Write a single node as text dump -void WriteNode(const aiNode* node, IOStream * io, unsigned int depth) -{ +static void WriteNode(const aiNode* node, IOStream * io, unsigned int depth) { char prefix[512]; for (unsigned int i = 0; i < depth;++i) prefix[i] = '\t'; @@ -156,47 +162,46 @@ void WriteNode(const aiNode* node, IOStream * io, unsigned int depth) // Some chuncks of text will need to be encoded for XML // http://stackoverflow.com/questions/5665231/most-efficient-way-to-escape-xml-html-in-c-string#5665377 static std::string encodeXML(const std::string& data) { - std::string buffer; - buffer.reserve(data.size()); - for(size_t pos = 0; pos != data.size(); ++pos) { - switch(data[pos]) { - case '&': buffer.append("&"); break; - case '\"': buffer.append("""); break; - case '\'': buffer.append("'"); break; - case '<': buffer.append("<"); break; - case '>': buffer.append(">"); break; - default: buffer.append(&data[pos], 1); break; - } - } - return buffer; + std::string buffer; + buffer.reserve(data.size()); + for(size_t pos = 0; pos != data.size(); ++pos) { + switch(data[pos]) { + case '&': buffer.append("&"); break; + case '\"': buffer.append("""); break; + case '\'': buffer.append("'"); break; + case '<': buffer.append("<"); break; + case '>': buffer.append(">"); break; + default: buffer.append(&data[pos], 1); break; + } + } + return buffer; } - - // ----------------------------------------------------------------------------------- // Write a text model dump -void WriteDump(const aiScene* scene, IOStream* io, bool shortened) -{ - time_t tt = ::time(NULL); - tm* p = ::gmtime(&tt); - - aiString name; +static +void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { + time_t tt = ::time( NULL ); + tm* p = ::gmtime( &tt ); + ai_assert( nullptr != p ); // write header - ioprintf(io, + std::string header( "\n" "\n\n" - "" " \n\n" - "\n", + "\n" + ); - aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),asctime(p), - scene->mFlags, - 0 /*globalImporter->GetEffectivePostProcessing()*/); + const unsigned int majorVersion( aiGetVersionMajor() ); + const unsigned int minorVersion( aiGetVersionMinor() ); + const unsigned int rev( aiGetVersionRevision() ); + const char *curtime( asctime( p ) ); + ioprintf( io, header.c_str(), majorVersion, minorVersion, rev, curtime, scene->mFlags, 0 ); // write the node graph WriteNode(scene->mRootNode, io, 0); @@ -266,6 +271,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) ioprintf(io,"\t\n"); } #endif + aiString name; // write textures if (scene->mNumTextures) { @@ -301,9 +307,10 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened) unsigned int r = tx->r,g=tx->g,b=tx->b,a=tx->a; ioprintf(io,"\t\t\t%2x %2x %2x %2x",r,g,b,a); - // group by four for readibility - if (0 == (x+y*tex->mWidth) % 4) - ioprintf(io,"\n"); + // group by four for readability + if ( 0 == ( x + y*tex->mWidth ) % 4 ) { + ioprintf( io, "\n" ); + } } } } diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index 05109cacb..a8214814d 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -7,8 +7,8 @@ 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 +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 @@ -25,16 +25,16 @@ conditions are met: 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 +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 +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 +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 +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. --------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "TextureTransform.h" #include "ConvertToLHProcess.h" #include "StringUtils.h" -#include +#include #include "../include/assimp/IOSystem.hpp" #include "../include/assimp/anim.h" #include "../include/assimp/scene.h" @@ -71,11 +71,11 @@ static const aiImporterDesc desc = { 0, 0, 0, - "b3d" + "b3d" }; // (fixme, Aramis) quick workaround to get rid of all those signed to unsigned warnings -#ifdef _MSC_VER +#ifdef _MSC_VER # pragma warning (disable: 4018) #endif @@ -114,7 +114,7 @@ void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS cout<<"Hello world from the B3DImporter!"< file( pIOHandler->Open( pFile)); + std::unique_ptr file( pIOHandler->Open( pFile)); // Check whether we can read from the file if( file.get() == NULL) @@ -280,12 +280,12 @@ void B3DImporter::ReadBRUS(){ aiMaterial *mat=new aiMaterial; _materials.push_back( mat ); - + // Name aiString ainame( name ); mat->AddProperty( &ainame,AI_MATKEY_NAME ); - - // Diffuse color + + // Diffuse color mat->AddProperty( &color,1,AI_MATKEY_COLOR_DIFFUSE ); // Opacity @@ -294,16 +294,16 @@ void B3DImporter::ReadBRUS(){ // Specular color aiColor3D speccolor( shiny,shiny,shiny ); mat->AddProperty( &speccolor,1,AI_MATKEY_COLOR_SPECULAR ); - + // Specular power float specpow=shiny*128; mat->AddProperty( &specpow,1,AI_MATKEY_SHININESS ); - + // Double sided if( fx & 0x10 ){ - int i=1; + int i=1; mat->AddProperty( &i,1,AI_MATKEY_TWOSIDED ); - } + } //Textures for( int i=0;imNumMaterials=_materials.size(); scene->mMaterials=to_array( _materials ); - + //meshes scene->mNumMeshes=_meshes.size(); scene->mMeshes=to_array( _meshes ); diff --git a/code/BVHLoader.cpp b/code/BVHLoader.cpp index 1f4bc2e71..6cca1f04a 100644 --- a/code/BVHLoader.cpp +++ b/code/BVHLoader.cpp @@ -47,12 +47,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "SkeletonMeshBuilder.h" #include "../include/assimp/Importer.hpp" -#include -#include +#include +#include "TinyFormatter.h" #include "../include/assimp/IOSystem.hpp" #include "../include/assimp/scene.h" using namespace Assimp; +using namespace Assimp::Formatter; static const aiImporterDesc desc = { "BVH Importer (MoCap)", @@ -118,7 +119,7 @@ void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSys mFileName = pFile; // read file into memory - boost::scoped_ptr file( pIOHandler->Open( pFile)); + std::unique_ptr file( pIOHandler->Open( pFile)); if( file.get() == NULL) throw DeadlyImportError( "Failed to open file " + pFile + "."); @@ -179,12 +180,12 @@ aiNode* BVHLoader::ReadNode() // first token is name std::string nodeName = GetNextToken(); if( nodeName.empty() || nodeName == "{") - ThrowException( boost::str( boost::format( "Expected node name, but found \"%s\".") % nodeName)); + ThrowException( format() << "Expected node name, but found \"" << nodeName << "\"." ); // then an opening brace should follow std::string openBrace = GetNextToken(); if( openBrace != "{") - ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace)); + ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\"." ); // Create a node aiNode* node = new aiNode( nodeName); @@ -216,7 +217,7 @@ aiNode* BVHLoader::ReadNode() // The real symbol is "End Site". Second part comes in a separate token std::string siteToken = GetNextToken(); if( siteToken != "Site") - ThrowException( boost::str( boost::format( "Expected \"End Site\" keyword, but found \"%s %s\".") % token % siteToken)); + ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." ); aiNode* child = ReadEndSite( nodeName); child->mParent = node; @@ -229,7 +230,7 @@ aiNode* BVHLoader::ReadNode() } else { // everything else is a parse error - ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token)); + ThrowException( format() << "Unknown keyword \"" << token << "\"." ); } } @@ -252,7 +253,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName) // check opening brace std::string openBrace = GetNextToken(); if( openBrace != "{") - ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace)); + ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\"."); // Create a node aiNode* node = new aiNode( "EndSite_" + pParentName); @@ -274,7 +275,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName) } else { // everything else is a parse error - ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token)); + ThrowException( format() << "Unknown keyword \"" << token << "\"." ); } } @@ -321,7 +322,7 @@ void BVHLoader::ReadNodeChannels( BVHLoader::Node& pNode) else if( channelToken == "Zrotation") pNode.mChannels.push_back( Channel_RotationZ); else - ThrowException( boost::str( boost::format( "Invalid channel specifier \"%s\".") % channelToken)); + ThrowException( format() << "Invalid channel specifier \"" << channelToken << "\"." ); } } @@ -332,7 +333,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/) // Read number of frames std::string tokenFrames = GetNextToken(); if( tokenFrames != "Frames:") - ThrowException( boost::str( boost::format( "Expected frame count \"Frames:\", but found \"%s\".") % tokenFrames)); + ThrowException( format() << "Expected frame count \"Frames:\", but found \"" << tokenFrames << "\"."); float numFramesFloat = GetNextTokenAsFloat(); mAnimNumFrames = (unsigned int) numFramesFloat; @@ -341,7 +342,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/) std::string tokenDuration1 = GetNextToken(); std::string tokenDuration2 = GetNextToken(); if( tokenDuration1 != "Frame" || tokenDuration2 != "Time:") - ThrowException( boost::str( boost::format( "Expected frame duration \"Frame Time:\", but found \"%s %s\".") % tokenDuration1 % tokenDuration2)); + ThrowException( format() << "Expected frame duration \"Frame Time:\", but found \"" << tokenDuration1 << " " << tokenDuration2 << "\"." ); mAnimTickDuration = GetNextTokenAsFloat(); @@ -368,7 +369,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/) // Retrieves the next token std::string BVHLoader::GetNextToken() { - // skip any preceeding whitespace + // skip any preceding whitespace while( mReader != mBuffer.end()) { if( !isspace( *mReader)) @@ -414,7 +415,7 @@ float BVHLoader::GetNextTokenAsFloat() ctoken = fast_atoreal_move( ctoken, result); if( ctoken != token.c_str() + token.length()) - ThrowException( boost::str( boost::format( "Expected a floating point number, but found \"%s\".") % token)); + ThrowException( format() << "Expected a floating point number, but found \"" << token << "\"." ); return result; } @@ -423,7 +424,7 @@ float BVHLoader::GetNextTokenAsFloat() // Aborts the file reading with an exception AI_WONT_RETURN void BVHLoader::ThrowException( const std::string& pError) { - throw DeadlyImportError( boost::str( boost::format( "%s:%d - %s") % mFileName % mLine % pError)); + throw DeadlyImportError( format() << mFileName << ":" << mLine << " - " << pError); } // ------------------------------------------------------------------------------------------------ diff --git a/code/BaseImporter.cpp b/code/BaseImporter.cpp index d58c30b2f..a7e134c54 100644 --- a/code/BaseImporter.cpp +++ b/code/BaseImporter.cpp @@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/assimp/postprocess.h" #include #include -#include -#include +#include #include #include @@ -149,10 +148,10 @@ void BaseImporter::GetExtensionList(std::set& extensions) if (!pIOHandler) return false; - boost::scoped_ptr pStream (pIOHandler->Open(pFile)); + std::unique_ptr pStream (pIOHandler->Open(pFile)); if (pStream.get() ) { // read 200 characters from the file - boost::scoped_array _buffer (new char[searchBytes+1 /* for the '\0' */]); + std::unique_ptr _buffer (new char[searchBytes+1 /* for the '\0' */]); char* buffer = _buffer.get(); if( NULL == buffer ) { return false; @@ -256,7 +255,7 @@ void BaseImporter::GetExtensionList(std::set& extensions) const uint32_t* magic_u32; }; magic = reinterpret_cast(_magic); - boost::scoped_ptr pStream (pIOHandler->Open(pFile)); + std::unique_ptr pStream (pIOHandler->Open(pFile)); if (pStream.get() ) { // skip to offset @@ -336,7 +335,7 @@ void BaseImporter::ConvertToUTF8(std::vector& data) // UTF 32 BE with BOM if(*((uint32_t*)&data.front()) == 0xFFFE0000) { - // swap the endianess .. + // swap the endianness .. for(uint32_t* p = (uint32_t*)&data.front(), *end = (uint32_t*)&data.back(); p <= end; ++p) { AI_SWAP4P(p); } @@ -367,7 +366,7 @@ void BaseImporter::ConvertToUTF8(std::vector& data) // UTF 16 BE with BOM if(*((uint16_t*)&data.front()) == 0xFFFE) { - // swap the endianess .. + // swap the endianness .. for(uint16_t* p = (uint16_t*)&data.front(), *end = (uint16_t*)&data.back(); p <= end; ++p) { ByteSwap::Swap2(p); } @@ -534,7 +533,7 @@ BatchLoader::~BatchLoader() delete (*it).scene; } - data->pImporter->SetIOHandler(NULL); /* get pointer back into our posession */ + data->pImporter->SetIOHandler(NULL); /* get pointer back into our possession */ delete data->pImporter; delete data; } diff --git a/code/BaseImporter.h b/code/BaseImporter.h index 75e1fdb00..167a03610 100644 --- a/code/BaseImporter.h +++ b/code/BaseImporter.h @@ -176,8 +176,8 @@ public: ); // ------------------------------------------------------------------- - /** Returns the error description of the last error that occured. - * @return A description of the last error that occured. An empty + /** Returns the error description of the last error that occurred. + * @return A description of the last error that occurred. An empty * string if there was no error. */ const std::string& GetErrorText() const { @@ -347,7 +347,7 @@ public: // static utilities static void ConvertUTF8toISO8859_1( std::string& data); - enum TextFileMode { ALLOW_EMPTY, FORBID_EMPTY }; + enum TextFileMode { ALLOW_EMPTY, FORBID_EMPTY }; // ------------------------------------------------------------------- /** Utility for text file loaders which copies the contents of the @@ -375,7 +375,7 @@ public: // static utilities T*& out, unsigned int& outLength) { - outLength = vec.size(); + outLength = unsigned(vec.size()); if (outLength) { out = new T[outLength]; std::swap_ranges(vec.begin(), vec.end(), out); diff --git a/code/BlenderDNA.cpp b/code/BlenderDNA.cpp index 5fb14c052..18ec9f2b4 100644 --- a/code/BlenderDNA.cpp +++ b/code/BlenderDNA.cpp @@ -48,13 +48,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "BlenderDNA.h" #include "StreamReader.h" #include "fast_atof.h" -#include using namespace Assimp; using namespace Assimp::Blender; using namespace Assimp::Formatter; -#define for_each BOOST_FOREACH bool match4(StreamReaderAny& stream, const char* string) { char tmp[] = { (stream).GetI1(), @@ -86,7 +84,7 @@ void DNAParser :: Parse () } std::vector names (stream.GetI4()); - for_each(std::string& s, names) { + for(std::string& s : names) { while (char c = stream.GetI1()) { s += c; } @@ -99,7 +97,7 @@ void DNAParser :: Parse () } std::vector types (stream.GetI4()); - for_each(Type& s, types) { + for(Type& s : types) { while (char c = stream.GetI1()) { s.name += c; } @@ -111,7 +109,7 @@ void DNAParser :: Parse () throw DeadlyImportError("BlenderDNA: Expected TLEN field"); } - for_each(Type& s, types) { + for(Type& s : types) { s.size = stream.GetI2(); } @@ -238,13 +236,15 @@ void DNA :: DumpToFile() f << "Field format: type name offset size" << "\n"; f << "Structure format: name size" << "\n"; - for_each(const Structure& s, structures) { + for(const Structure& s : structures) { f << s.name << " " << s.size << "\n\n"; - for_each(const Field& ff, s.fields) { - f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl; + for(const Field& ff : s.fields) { + f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << "\n"; } - f << std::endl; + f << "\n"; } + f << std::flush; + DefaultLogger::get()->info("BlenderDNA: Dumped dna to dna.txt"); } #endif @@ -270,17 +270,17 @@ void DNA :: DumpToFile() } // ------------------------------------------------------------------------------------------------ -boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure( +std::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure( const Structure& structure, const FileDatabase& db ) const { std::map::const_iterator it = converters.find(structure.name); if (it == converters.end()) { - return boost::shared_ptr< ElemBase >(); + return std::shared_ptr< ElemBase >(); } - boost::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))(); + std::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))(); (structure.*((*it).second.second))(ret,db); return ret; diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index 98095391b..4257d9ca5 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "../include/assimp/DefaultLogger.hpp" #include -#include +#include // enable verbose log output. really verbose, so be careful. @@ -97,7 +97,7 @@ struct ElemBase * string points is the `c_str` of the `name` attribute of the * corresponding `Structure`, that is, it is only valid as long * as the DNA is not modified. The dna_type is only set if the - * data type is not static, i.e. a boost::shared_ptr + * data type is not static, i.e. a std::shared_ptr * in the scene description would have its type resolved * at runtime, so this member is always set. */ const char* dna_type; @@ -127,7 +127,7 @@ struct FileOffset // ------------------------------------------------------------------------------- /** Dummy derivate of std::vector to be able to use it in templates simultaenously - * with boost::shared_ptr, which takes only one template argument + * with std::shared_ptr, which takes only one template argument * while std::vector takes three. Also we need to provide some special member * functions of shared_ptr */ // ------------------------------------------------------------------------------- @@ -209,7 +209,7 @@ class Structure public: Structure() - : cache_idx(-1) + : cache_idx(static_cast(-1) ) {} public: @@ -260,11 +260,11 @@ public: // -------------------------------------------------------- // generic converter template - void Convert(boost::shared_ptr in,const FileDatabase& db) const; + void Convert(std::shared_ptr in,const FileDatabase& db) const; // -------------------------------------------------------- // generic allocator - template boost::shared_ptr Allocate() const; + template std::shared_ptr Allocate() const; @@ -282,7 +282,7 @@ public: // -------------------------------------------------------- // field parsing for pointer or dynamic array types - // (boost::shared_ptr or boost::shared_array) + // (std::shared_ptr) // The return value indicates whether the data was already cached. template class TOUT, typename T> bool ReadFieldPtr(TOUT& out, const char* name, @@ -291,7 +291,7 @@ public: // -------------------------------------------------------- // field parsing for static arrays of pointer or dynamic - // array types (boost::shared_ptr[] or boost::shared_array[]) + // array types (std::shared_ptr[]) // The return value indicates whether the data was already cached. template class TOUT, typename T, size_t N> bool ReadFieldPtr(TOUT (&out)[N], const char* name, @@ -318,7 +318,7 @@ private: const FileDatabase& db, const Field& f, bool) const; // -------------------------------------------------------- - bool ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval, + bool ResolvePointer( std::shared_ptr< FileOffset >& out, const Pointer & ptrval, const FileDatabase& db, const Field& f, bool) const; // -------------------------------------------------------- @@ -329,8 +329,8 @@ private: private: // ------------------------------------------------------------------------------ - template T* _allocate(boost::shared_ptr& out, size_t& s) const { - out = boost::shared_ptr(new T()); + template T* _allocate(std::shared_ptr& out, size_t& s) const { + out = std::shared_ptr(new T()); s = 1; return out.get(); } @@ -394,7 +394,7 @@ template <> struct Structure :: _defaultInitializer { }; // ------------------------------------------------------------------------------------------------------- -template <> inline bool Structure :: ResolvePointer(boost::shared_ptr& out, +template <> inline bool Structure :: ResolvePointer(std::shared_ptr& out, const Pointer & ptrval, const FileDatabase& db, const Field& f, @@ -413,11 +413,11 @@ class DNA public: typedef void (Structure::*ConvertProcPtr) ( - boost::shared_ptr in, + std::shared_ptr in, const FileDatabase& ) const; - typedef boost::shared_ptr ( + typedef std::shared_ptr ( Structure::*AllocProcPtr) () const; typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair; @@ -464,7 +464,7 @@ public: * @param structure Destination structure definition * @param db File database. * @return A null pointer if no appropriate converter is available.*/ - boost::shared_ptr< ElemBase > ConvertBlobToStructure( + std::shared_ptr< ElemBase > ConvertBlobToStructure( const Structure& structure, const FileDatabase& db ) const; @@ -724,7 +724,7 @@ public: bool little; DNA dna; - boost::shared_ptr< StreamReaderAny > reader; + std::shared_ptr< StreamReaderAny > reader; vector< FileBlockHead > entries; public: @@ -738,7 +738,7 @@ public: // arrays of objects are never cached because we can't easily // ensure their proper destruction. template - ObjectCache& cache(boost::shared_ptr& /*in*/) const { + ObjectCache& cache(std::shared_ptr& /*in*/) const { return _cache; } @@ -755,7 +755,7 @@ private: #endif mutable ObjectCache _cacheArrays; - mutable ObjectCache _cache; + mutable ObjectCache _cache; mutable size_t next_cache_idx; }; diff --git a/code/BlenderDNA.inl b/code/BlenderDNA.inl index f23d723ee..0b3f2fd02 100644 --- a/code/BlenderDNA.inl +++ b/code/BlenderDNA.inl @@ -5,8 +5,8 @@ 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 +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 @@ -23,29 +23,29 @@ following conditions are met: 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 +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 +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 +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 +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 BlenderDNA.inl - * @brief Blender `DNA` (file format specification embedded in + * @brief Blender `DNA` (file format specification embedded in * blend file itself) loader. */ #ifndef INCLUDED_AI_BLEND_DNA_INL #define INCLUDED_AI_BLEND_DNA_INL -#include +#include namespace Assimp { namespace Blender { @@ -71,7 +71,7 @@ const Field* Structure :: Get (const std::string& ss) const } //-------------------------------------------------------------------------------- -const Field& Structure :: operator [] (const size_t i) const +const Field& Structure :: operator [] (const size_t i) const { if (i >= fields.size()) { throw Error((Formatter::format(), @@ -83,15 +83,15 @@ const Field& Structure :: operator [] (const size_t i) const } //-------------------------------------------------------------------------------- -template boost::shared_ptr Structure :: Allocate() const +template std::shared_ptr Structure :: Allocate() const { - return boost::shared_ptr(new T()); + return std::shared_ptr(new T()); } //-------------------------------------------------------------------------------- template void Structure :: Convert( - boost::shared_ptr in, - const FileDatabase& db) const + std::shared_ptr in, + const FileDatabase& db) const { Convert (*static_cast ( in.get() ),db); } @@ -226,7 +226,7 @@ bool Structure :: ReadFieldPtr(TOUT& out, const char* name, const FileDatabas //-------------------------------------------------------------------------------- template class TOUT, typename T, size_t N> -bool Structure :: ReadFieldPtr(TOUT (&out)[N], const char* name, +bool Structure :: ReadFieldPtr(TOUT (&out)[N], const char* name, const FileDatabase& db) const { // XXX see if we can reduce this to call to the 'normal' ReadFieldPtr @@ -306,12 +306,12 @@ void Structure :: ReadField(T& out, const char* name, const FileDatabase& db) co //-------------------------------------------------------------------------------- template