diff --git a/AssimpConfigVersion.cmake.in b/AssimpConfigVersion.cmake.in index 7ffe759d5..701fa6158 100644 --- a/AssimpConfigVersion.cmake.in +++ b/AssimpConfigVersion.cmake.in @@ -1,11 +1,11 @@ -set(PACKAGE_VERSION "@ASSIMP_SOVERSION@") +set(ASSIMP_PACKAGE_VERSION "@ASSIMP_SOVERSION@") # Check whether the requested PACKAGE_FIND_VERSION is compatible -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_COMPATIBLE FALSE) +if("${ASSIMP_PACKAGE_VERSION}" VERSION_LESS "${ASSIMP_PACKAGE_FIND_VERSION}") + set(ASSIMP_PACKAGE_VERSION_COMPATIBLE FALSE) else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) + set(ASSIMP_PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${ASSIMP_PACKAGE_VERSION}" VERSION_EQUAL "${ASSIMP_PACKAGE_FIND_VERSION}") + set(ASSIMP_PACKAGE_VERSION_EXACT TRUE) endif() endif() diff --git a/CHANGES b/CHANGES index f64053dd8..da5f36e37 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,36 @@ CHANGELOG ---------------------------------------------------------------------- +3.0 (2012-07-07) + +FEATURES: + - new export interface similar to the import API. + - Supported export formats: Collada, OBJ, PLY and STL + - added new import formats: XGL/ZGL, M3 (experimental) + - new postprocessing steps: Debone + - vastly improved IFC (Industry Foundation Classes) support + - introduced API to query importer meta information (such as supported + format versions, full name, maintainer info). + - reworked Ogre XML import + - C-API now supports per-import properties + +FIXES/HOUSEKEEPING: + + - hundreds of bugfixes in all parts of the library + - unified naming and cleanup of public headers + - improved CMake build system + - templatized math library + - reduce dependency on boost.thread, only remaining spot + is synchronization for the C logging API + +API COMPATIBILITY: + - renamed headers, export interface, C API properties and meta data + prevent compatibility with code written for 2.0, but in + most cases these can be easily resolved + - Note: 3.0 is not binary compatible with 2.0 + + + 2.0 (2010-11-21) @@ -44,8 +74,6 @@ API CHANGES: - - 1.1 (2010-04-17) This is the list of relevant changes from the 1.0 (r412) release to 1.1 (r700). @@ -85,4 +113,4 @@ BREAKING API CHANGES: MINOR API BEHAVIOUR CHANGES: - Change quaternion orientation to suit to the more common convention (-w). - - aiString is utf8 now. Not yet consistent, however. \ No newline at end of file + - aiString is utf8 now. Not yet consistent, however. diff --git a/CMakeLists.txt b/CMakeLists.txt index d42b0191b..0539a4717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,20 +2,21 @@ cmake_minimum_required( VERSION 2.6 ) PROJECT( Assimp ) # Define here the needed parameters -set (ASSIMP_SV_REVISION 1260) -set (ASSIMP_VERSION_MAJOR 2) +set (ASSIMP_SV_REVISION 1264) +set (ASSIMP_VERSION_MAJOR 3) set (ASSIMP_VERSION_MINOR 0) set (ASSIMP_VERSION_PATCH ${ASSIMP_SV_REVISION}) # subversion revision? set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) -set (ASSIMP_SOVERSION 1251) +set (ASSIMP_SOVERSION 3) SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) -set(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") -option(OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) +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_MAJOR}-r${ASSIMP_SV_REVISION}) -set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} assimp-dev) +set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}-r${ASSIMP_SV_REVISION}) +set(LIBASSIMP-DEV_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}-r${ASSIMP_SV_REVISION}-dev) +set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... @@ -37,45 +38,45 @@ IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) # Cache these to allow the user to override them manually. -SET( LIB_INSTALL_DIR "lib" CACHE PATH +SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE PATH "Path the built library files are installed to." ) -SET( INCLUDE_INSTALL_DIR "include" CACHE PATH +SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH "Path the header files are installed to." ) -SET( BIN_INSTALL_DIR "bin" CACHE PATH +SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH "Path the tool executables are installed to." ) -SET(DEBUG_POSTFIX "D" CACHE STRING "Debug Postfitx for lib, samples and tools") +SET(ASSIMP_DEBUG_POSTFIX "D" CACHE STRING "Debug Postfitx for lib, samples and tools") + +# Allow the user to build a static library +SET ( ASSIMP_BUILD_STATIC_LIB OFF CACHE BOOL + "Build a static (.a) version of the library" +) # Generate a pkg-config .pc for the Assimp library. CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) -INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ COMPONENT assimp-dev) +INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT}) # cmake configuration files configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT assimp-dev) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) # add make uninstall capability configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -# Allow the user to build a static library -SET ( BUILD_STATIC_LIB OFF CACHE BOOL - "Build a static (.a) version of the library" -) - # Globally enbale Boost resp. the Boost workaround – it is also needed by the # tools which include the Assimp headers. -SET ( ENABLE_BOOST_WORKAROUND OFF CACHE BOOL +SET ( ASSIMP_ENABLE_BOOST_WORKAROUND OFF CACHE BOOL "If a simple implementation of the used Boost functions is used. Slightly reduces functionality, but enables builds without Boost available." ) -IF ( ENABLE_BOOST_WORKAROUND ) +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 ( ENABLE_BOOST_WORKAROUND ) +ELSE ( ASSIMP_ENABLE_BOOST_WORKAROUND ) SET( Boost_DETAILED_FAILURE_MSG ON ) - SET( Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48.0" "1.48" "1.49" "1.49.0") + 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") FIND_PACKAGE( Boost ) IF ( NOT Boost_FOUND ) MESSAGE( FATAL_ERROR @@ -86,10 +87,10 @@ ELSE ( ENABLE_BOOST_WORKAROUND ) ENDIF ( NOT Boost_FOUND ) INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) -ENDIF ( ENABLE_BOOST_WORKAROUND ) +ENDIF ( ASSIMP_ENABLE_BOOST_WORKAROUND ) -SET ( NO_EXPORT OFF CACHE BOOL +SET ( ASSIMP_NO_EXPORT OFF CACHE BOOL "Disable Assimp's export functionality." ) @@ -116,12 +117,16 @@ if (PKG_CONFIG_FOUND) PKG_CHECK_MODULES(UNZIP minizip) endif (PKG_CONFIG_FOUND) -IF ( NO_EXPORT ) +IF ( ASSIMP_NO_EXPORT ) ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT) MESSAGE( STATUS "Build an import-only version of Assimp." ) -ENDIF( NO_EXPORT ) - +ENDIF( ASSIMP_NO_EXPORT ) +# if(CMAKE_CL_64) +# set(ASSIMP_BUILD_ARCHITECTURE "amd64") +# else(CMAKE_CL_64) +# set(ASSIMP_BUILD_ARCHITECTURE "x86") +# endif(CMAKE_CL_64) SET ( ASSIMP_BUILD_ARCHITECTURE "" CACHE STRING "describe the current architecture." ) @@ -130,6 +135,7 @@ ELSE ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "") ADD_DEFINITIONS ( -D'ASSIMP_BUILD_ARCHITECTURE="${ASSIMP_BUILD_ARCHITECTURE}"' ) ENDIF ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "") +# ${CMAKE_GENERATOR} SET ( ASSIMP_BUILD_COMPILER "" CACHE STRING "describe the current compiler." ) @@ -142,46 +148,51 @@ MARK_AS_ADVANCED ( ASSIMP_BUILD_ARCHITECTURE ASSIMP_BUILD_COMPILER ) ADD_SUBDIRECTORY( code/ ) -SET ( BUILD_ASSIMP_TOOLS ON CACHE BOOL +SET ( ASSIMP_BUILD_ASSIMP_TOOLS ON CACHE BOOL "If the supplementary tools for Assimp are built in addition to the library." ) -IF ( BUILD_ASSIMP_TOOLS ) +IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) IF ( WIN32 ) ADD_SUBDIRECTORY( tools/assimp_view/ ) ENDIF ( WIN32 ) ADD_SUBDIRECTORY( tools/assimp_cmd/ ) -ENDIF ( BUILD_ASSIMP_TOOLS ) +ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) -SET ( BUILD_ASSIMP_SAMPLES ON CACHE BOOL +SET ( ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "If the official samples are built as well (needs Glut)." ) -IF ( BUILD_ASSIMP_SAMPLES) +IF ( ASSIMP_BUILD_SAMPLES) IF ( WIN32 ) ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ ) ENDIF ( WIN32 ) ADD_SUBDIRECTORY( samples/SimpleOpenGL/ ) -ENDIF ( BUILD_ASSIMP_SAMPLES ) +ENDIF ( ASSIMP_BUILD_SAMPLES ) -SET ( BUILD_TESTS OFF CACHE BOOL - "If the test suite for Assimp is built in addition to the library." -) -IF ( BUILD_TESTS ) - IF ( WIN32 ) +IF ( WIN32 ) + SET ( ASSIMP_BUILD_TESTS OFF CACHE BOOL + "If the test suite for Assimp is built in addition to the library." + ) + + IF ( ASSIMP_BUILD_TESTS ) ADD_SUBDIRECTORY( test/ ) - ELSE ( WIN32 ) - MESSAGE( WARNING "The Assimp test suite is currently Windows-only." ) - ENDIF ( WIN32 ) -ENDIF ( BUILD_TESTS ) + ENDIF ( ASSIMP_BUILD_TESTS ) +ENDIF ( WIN32 ) -if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES) +IF(MSVC) + SET ( ASSIMP_INSTALL_PDB ON CACHE BOOL + "Install MSVC debug files." + ) +ENDIF(MSVC) + +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}.${ASSIMP_VERSION_MINOR}") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library r1252") - set(CPACK_PACKAGE_VERSION ${ASSIMP_VERSION}.${PACKAGE_VERSION}) + 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}) @@ -189,20 +200,26 @@ if(CMAKE_CPACK_COMMAND AND UNIX AND OPT_BUILD_PACKAGES) #set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/description) 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-DEV_DISPLAY_NAME "common headers and installs") - set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT}_DISPLAY_NAME "libraries") set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS ${LIBASSIMP_COMPONENT}) - set(CPACK_COMPONENT_ASSIMP-DEV_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) # 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 ) + 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 diff --git a/INSTALL b/INSTALL index 97cdf181f..563fda397 100644 --- a/INSTALL +++ b/INSTALL @@ -3,7 +3,6 @@ Open Asset Import Library (assimp) INSTALL ======================================================================== - ------------------------------ Getting the documentation ------------------------------ diff --git a/LICENSE b/LICENSE index f52504f7d..3fc3272bd 100644 --- a/LICENSE +++ b/LICENSE @@ -35,6 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +****************************************************************************** + AN EXCEPTION applies to all files in the ./test/models-nonbsd folder. These are 3d models for testing purposes, from various free sources on the internet. They are - unless otherwise stated - copyright of @@ -44,3 +46,39 @@ on the use of their work. For any of these models, see are a copyright holder and believe that we credited you inproperly or if you don't want your files to appear in the repository. + +****************************************************************************** + +Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors +http://code.google.com/p/poly2tri/ + +All rights reserved. +Redistribution and use 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 Poly2Tri nor the names of its contributors may be + used to endorse or promote products derived from this software without specific + prior written permission. + +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. + + + + + + diff --git a/assimp-config-version.cmake.in b/assimp-config-version.cmake.in index 9a8789f34..2698a53ac 100644 --- a/assimp-config-version.cmake.in +++ b/assimp-config-version.cmake.in @@ -1,12 +1,13 @@ -set( PACKAGE_VERSION "@ASSIMP_VERSION@" ) -if( "${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") - set(PACKAGE_VERSION_EXACT 1) +set( ASSIMP_PACKAGE_VERSION "@ASSIMP_VERSION@" ) +if( "${ASSIMP_PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") + set(ASSIMP_PACKAGE_VERSION_EXACT 1) endif() -if( "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) - set(PACKAGE_VERSION_COMPATIBLE 1) -elseif( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) +if( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}.${ASSIMP_PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) + set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) +elseif( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) # for now backward compatible if minor version is less - if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) - set(PACKAGE_VERSION_COMPATIBLE 1) + if( ${ASSIMP_PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) + set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) endif() endif() +set( ASSIMP_STATIC_LIB "@ASSIMP_BUILD_STATIC_LIB@") diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 853cc06fd..1d581b20a 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -26,9 +26,9 @@ if( MSVC ) else() set(MSVC_PREFIX "vc100") endif() - set(ASSIMP_LIBRARY_SUFFIX "-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" FORCE) else() - set(ASSIMP_LIBRARY_SUFFIX ) + set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the openrave libraries" FORCE) endif() set( ASSIMP_CXX_FLAGS ) # dynamically linked library @@ -39,7 +39,7 @@ endif() set( ASSIMP_LINK_FLAGS "" ) set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@LIB_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@INCLUDE_INSTALL_DIR@") -set( ASSIMP_LIBRARIES assimp) +set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) # the boost version assimp was compiled with set( ASSIMP_Boost_VERSION "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@") diff --git a/assimp.pc.in b/assimp.pc.in index ac6c5a6ae..07cd4d3fe 100644 --- a/assimp.pc.in +++ b/assimp.pc.in @@ -6,5 +6,5 @@ includedir=@CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@/assimp Name: @CMAKE_PROJECT_NAME@ Description: Import various well-known 3D model formats in an uniform manner. Version: @PROJECT_VERSION@ -Libs: -L${libdir} -lassimp +Libs: -L${libdir} -lassimp@ASSIMP_LIBRARY_SUFFIX@ Cflags: -I${includedir} diff --git a/cmake-modules/FindDirectX.cmake b/cmake-modules/FindDirectX.cmake new file mode 100644 index 000000000..c8eac1a7d --- /dev/null +++ b/cmake-modules/FindDirectX.cmake @@ -0,0 +1,100 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# Find DirectX SDK +# Define: +# DirectX_FOUND +# DirectX_INCLUDE_DIR +# DirectX_LIBRARY +# DirectX_ROOT_DIR + +if(WIN32) # The only platform it makes sense to check for DirectX SDK + include(FindPkgMacros) + findpkg_begin(DirectX) + + # Get path, convert backslashes as ${ENV_DXSDK_DIR} + getenv_path(DXSDK_DIR) + getenv_path(DIRECTX_HOME) + getenv_path(DIRECTX_ROOT) + getenv_path(DIRECTX_BASE) + + # construct search paths + set(DirectX_PREFIX_PATH + "${DXSDK_DIR}" "${ENV_DXSDK_DIR}" + "${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}" + "${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}" + "${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}" + "C:/apps_x86/Microsoft DirectX SDK*" + "C:/Program Files (x86)/Microsoft DirectX SDK*" + "C:/apps/Microsoft DirectX SDK*" + "C:/Program Files/Microsoft DirectX SDK*" + "$ENV{ProgramFiles}/Microsoft DirectX SDK*" + ) + create_search_paths(DirectX) + # redo search if prefix path changed + clear_if_changed(DirectX_PREFIX_PATH + DirectX_LIBRARY + DirectX_INCLUDE_DIR + ) + + find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH}) + # dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86 + # lib files are in DirectX_ROOT_DIR/Lib/x64|x86 + if(CMAKE_CL_64) + set(DirectX_LIBPATH_SUFFIX "x64") + else(CMAKE_CL_64) + set(DirectX_LIBPATH_SUFFIX "x86") + endif(CMAKE_CL_64) + find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + + + # look for dxgi (needed by both 10 and 11) + find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + + # look for d3dcompiler (needed by 11) + find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + + findpkg_finish(DirectX) + set(DirectX_LIBRARIES ${DirectX_LIBRARIES} + ${DirectX_D3DX9_LIBRARY} + ${DirectX_DXERR_LIBRARY} + ${DirectX_DXGUID_LIBRARY} + ) + + mark_as_advanced(DirectX_D3DX9_LIBRARY DirectX_DXERR_LIBRARY DirectX_DXGUID_LIBRARY + DirectX_DXGI_LIBRARY DirectX_D3DCOMPILER_LIBRARY) + + + # look for D3D11 components + if (DirectX_FOUND) + find_path(DirectX_D3D11_INCLUDE_DIR NAMES D3D11Shader.h HINTS ${DirectX_INC_SEARCH_PATH}) + get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH) + message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}") + find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY) + set(DirectX_D3D11_FOUND TRUE) + set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR}) + set(DirectX_D3D11_LIBRARIES ${DirectX_D3D11_LIBRARIES} + ${DirectX_D3D11_LIBRARY} + ${DirectX_D3DX11_LIBRARY} + ${DirectX_DXGI_LIBRARY} + ${DirectX_DXERR_LIBRARY} + ${DirectX_DXGUID_LIBRARY} + ${DirectX_D3DCOMPILER_LIBRARY} + ) + endif () + mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY) + endif () + +endif(WIN32) diff --git a/cmake-modules/FindPkgMacros.cmake b/cmake-modules/FindPkgMacros.cmake new file mode 100644 index 000000000..bc3b145ba --- /dev/null +++ b/cmake-modules/FindPkgMacros.cmake @@ -0,0 +1,142 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +################################################################## +# Provides some common functionality for the FindPackage modules +################################################################## + +# Begin processing of package +macro(findpkg_begin PREFIX) + if (NOT ${PREFIX}_FIND_QUIETLY) + message(STATUS "Looking for ${PREFIX}...") + endif () +endmacro(findpkg_begin) + +# Display a status message unless FIND_QUIETLY is set +macro(pkg_message PREFIX) + if (NOT ${PREFIX}_FIND_QUIETLY) + message(STATUS ${ARGN}) + endif () +endmacro(pkg_message) + +# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes +macro(getenv_path VAR) + set(ENV_${VAR} $ENV{${VAR}}) + # replace won't work if var is blank + if (ENV_${VAR}) + string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) + endif () +endmacro(getenv_path) + +# Construct search paths for includes and libraries from a PREFIX_PATH +macro(create_search_paths PREFIX) + foreach(dir ${${PREFIX}_PREFIX_PATH}) + set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH} + ${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers) + set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} + ${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs) + endforeach(dir) + set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH}) +endmacro(create_search_paths) + +# clear cache variables if a certain variable changed +macro(clear_if_changed TESTVAR) + # test against internal check variable + if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}") + message(STATUS "${TESTVAR} changed.") + foreach(var ${ARGN}) + set(${var} "NOTFOUND" CACHE STRING "x" FORCE) + endforeach(var) + endif () + set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE) +endmacro(clear_if_changed) + +# Try to get some hints from pkg-config, if available +macro(use_pkgconfig PREFIX PKGNAME) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${PREFIX} ${PKGNAME}) + endif () +endmacro (use_pkgconfig) + +# Couple a set of release AND debug libraries (or frameworks) +macro(make_library_set PREFIX) + if (${PREFIX}_FWK) + set(${PREFIX} ${${PREFIX}_FWK}) + elseif (${PREFIX}_REL AND ${PREFIX}_DBG) + set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG}) + elseif (${PREFIX}_REL) + set(${PREFIX} ${${PREFIX}_REL}) + elseif (${PREFIX}_DBG) + set(${PREFIX} ${${PREFIX}_DBG}) + endif () +endmacro(make_library_set) + +# Generate debug names from given release names +macro(get_debug_names PREFIX) + foreach(i ${${PREFIX}}) + set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i}) + endforeach(i) +endmacro(get_debug_names) + +# Add the parent dir from DIR to VAR +macro(add_parent_dir VAR DIR) + get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE) + set(${VAR} ${${VAR}} ${${DIR}_TEMP}) +endmacro(add_parent_dir) + +# Do the final processing for the package find. +macro(findpkg_finish PREFIX) + # skip if already processed during this run + if (NOT ${PREFIX}_FOUND) + if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + if (NOT ${PREFIX}_FIND_QUIETLY) + message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}") + endif () + else () + if (NOT ${PREFIX}_FIND_QUIETLY) + message(STATUS "Could not locate ${PREFIX}") + endif () + if (${PREFIX}_FIND_REQUIRED) + message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.") + endif () + endif () + + mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK) + endif () +endmacro(findpkg_finish) + + +# Slightly customised framework finder +MACRO(findpkg_framework fwk) + IF(APPLE) + SET(${fwk}_FRAMEWORK_PATH + ${${fwk}_FRAMEWORK_SEARCH_PATH} + ${CMAKE_FRAMEWORK_PATH} + ~/Library/Frameworks + /Library/Frameworks + /System/Library/Frameworks + /Network/Library/Frameworks + /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/ + ) + FOREACH(dir ${${fwk}_FRAMEWORK_PATH}) + SET(fwkpath ${dir}/${fwk}.framework) + IF(EXISTS ${fwkpath}) + SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES} + ${fwkpath}/Headers ${fwkpath}/PrivateHeaders) + if (NOT ${fwk}_LIBRARY_FWK) + SET(${fwk}_LIBRARY_FWK "-framework ${fwk}") + endif () + ENDIF(EXISTS ${fwkpath}) + ENDFOREACH(dir) + ENDIF(APPLE) +ENDMACRO(findpkg_framework) diff --git a/cmake-modules/FindZLIB.cmake b/cmake-modules/FindZLIB.cmake new file mode 100644 index 000000000..c1e20016b --- /dev/null +++ b/cmake-modules/FindZLIB.cmake @@ -0,0 +1,48 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +# - Try to find ZLIB +# Once done, this will define +# +# ZLIB_FOUND - system has ZLIB +# ZLIB_INCLUDE_DIRS - the ZLIB include directories +# ZLIB_LIBRARIES - link these to use ZLIB + +include(FindPkgMacros) +findpkg_begin(ZLIB) + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(ZLIB_HOME) + +# construct search paths +set(ZLIB_PREFIX_PATH ${ZLIB_HOME} ${ENV_ZLIB_HOME}) +create_search_paths(ZLIB) +# redo search if prefix path changed +clear_if_changed(ZLIB_PREFIX_PATH + ZLIB_LIBRARY_FWK + ZLIB_LIBRARY_REL + ZLIB_LIBRARY_DBG + ZLIB_INCLUDE_DIR +) + +set(ZLIB_LIBRARY_NAMES z zlib zdll) +get_debug_names(ZLIB_LIBRARY_NAMES) + +use_pkgconfig(ZLIB_PKGC zzip-zlib-config) + +findpkg_framework(ZLIB) + +find_path(ZLIB_INCLUDE_DIR NAMES zlib.h HINTS ${ZLIB_INC_SEARCH_PATH} ${ZLIB_PKGC_INCLUDE_DIRS}) +find_library(ZLIB_LIBRARY_REL NAMES ${ZLIB_LIBRARY_NAMES} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) +find_library(ZLIB_LIBRARY_DBG NAMES ${ZLIB_LIBRARY_NAMES_DBG} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) + +make_library_set(ZLIB_LIBRARY) + +findpkg_finish(ZLIB) + diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index 4e15727bc..c175c719f 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -360,7 +360,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD root->mNumChildren = static_cast(no_parents.size()); root->mChildren = new aiNode*[root->mNumChildren](); for (unsigned int i = 0; i < root->mNumChildren; ++i) { - root->mChildren[i] = ConvertNode(in, no_parents[i], conv); + root->mChildren[i] = ConvertNode(in, no_parents[i], conv, aiMatrix4x4()); root->mChildren[i]->mParent = root; } @@ -568,6 +568,11 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) // Usually, zero diffuse color means no diffuse color at all in the equation. // So we omit this member to express this intent. mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE); + + if (mat->emit) { + aiColor3D emit_col(mat->emit * mat->r, mat->emit * mat->g, mat->emit * mat->b) ; + mout->AddProperty(&emit_col, 1, AI_MATKEY_COLOR_EMISSIVE) ; + } } col = aiColor3D(mat->specr,mat->specg,mat->specb); @@ -877,7 +882,7 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* /*obj* } // ------------------------------------------------------------------------------------------------ -aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data) +aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data, const aiMatrix4x4& parentTransform) { std::deque children; for(std::set::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) { @@ -961,16 +966,12 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers for(unsigned int x = 0; x < 4; ++x) { for(unsigned int y = 0; y < 4; ++y) { - node->mTransformation[y][x] = obj->parentinv[x][y]; + node->mTransformation[y][x] = obj->obmat[x][y]; } } - aiMatrix4x4 m; - for(unsigned int x = 0; x < 4; ++x) { - for(unsigned int y = 0; y < 4; ++y) { - m[y][x] = obj->obmat[x][y]; - } - } + aiMatrix4x4 m = parentTransform; + m = m.Inverse(); node->mTransformation = m*node->mTransformation; @@ -978,7 +979,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers node->mNumChildren = static_cast(children.size()); aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren](); for_each (const Object* nobj,children) { - *nd = ConvertNode(in,nobj,conv_data); + *nd = ConvertNode(in,nobj,conv_data,node->mTransformation * parentTransform); (*nd++)->mParent = node; } } diff --git a/code/BlenderLoader.h b/code/BlenderLoader.h index f2109f663..4b44d2c7d 100644 --- a/code/BlenderLoader.h +++ b/code/BlenderLoader.h @@ -145,7 +145,8 @@ private: // -------------------- aiNode* ConvertNode(const Blender::Scene& in, const Blender::Object* obj, - Blender::ConversionData& conv_info + Blender::ConversionData& conv_info, + const aiMatrix4x4& parentTransform ); // -------------------- diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 9f5847c01..0278b8e6e 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -591,17 +591,19 @@ SOURCE_GROUP( unzip FILES ${unzip_SRCS}) # VC2010 fixes -OPTION( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF ) -if( VC10_STDINT_FIX ) - ADD_DEFINITIONS( -D_STDINT ) -endif( VC10_STDINT_FIX ) +if(MSVC10) + OPTION( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF ) + if( VC10_STDINT_FIX ) + ADD_DEFINITIONS( -D_STDINT ) + endif( VC10_STDINT_FIX ) +endif(MSVC10) ADD_DEFINITIONS( -DASSIMP_BUILD_DLL_EXPORT ) -if ( MSVC80 OR MSVC90 OR MSVC10 ) +if ( MSVC ) ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) -endif ( MSVC80 OR MSVC90 OR MSVC10 ) +endif ( MSVC ) if (UNZIP_FOUND) SET (unzip_compile_SRCS "") @@ -670,17 +672,17 @@ SET( assim_src ${PUBLIC_HEADERS} ${COMPILER_HEADERS} ) -IF ( BUILD_STATIC_LIB ) +IF ( ASSIMP_BUILD_STATIC_LIB ) ADD_LIBRARY( assimp STATIC ${assim_src} ) -ELSE ( BUILD_STATIC_LIB ) +ELSE ( ASSIMP_BUILD_STATIC_LIB ) ADD_LIBRARY( assimp SHARED ${assim_src} ) -ENDIF ( BUILD_STATIC_LIB ) +ENDIF ( ASSIMP_BUILD_STATIC_LIB ) -SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp PROPERTIES @@ -696,6 +698,17 @@ else (UNZIP_FOUND) INCLUDE_DIRECTORIES("../contrib/unzip") endif (UNZIP_FOUND) -INSTALL( TARGETS assimp DESTINATION ${LIB_INSTALL_DIR} COMPONENT ${LIBASSIMP_COMPONENT}) -INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev) -INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) +INSTALL( TARGETS assimp DESTINATION ${ASSIMP_LIB_INSTALL_DIR} COMPONENT ${LIBASSIMP_COMPONENT}) +INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev) +INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) + +if(MSVC AND ASSIMP_INSTALL_PDB) + install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${ASSIMP_DEBUG_POSTFIX}.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS Debug + ) + install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS RelWithDebInfo + ) +endif () diff --git a/code/IFCCurve.cpp b/code/IFCCurve.cpp index ba6df6ac4..fab256f6a 100644 --- a/code/IFCCurve.cpp +++ b/code/IFCCurve.cpp @@ -85,14 +85,18 @@ public: size_t EstimateSampleCount(IfcFloat a, IfcFloat b) const { ai_assert(InRange(a) && InRange(b)); - a = fmod(a,static_cast( 360. )); - b = fmod(b,static_cast( 360. )); - return static_cast( abs(ceil(( b-a)) / conv.settings.conicSamplingAngle) ); + a *= conv.angle_scale; + b *= conv.angle_scale; + + a = fmod(a,static_cast( AI_MATH_TWO_PI )); + b = fmod(b,static_cast( AI_MATH_TWO_PI )); + const IfcFloat setting = static_cast( AI_MATH_PI * conv.settings.conicSamplingAngle / 180.0 ); + return static_cast( ceil(abs( b-a)) / setting); } // -------------------------------------------------- ParamRange GetParametricRange() const { - return std::make_pair(static_cast( 0. ), static_cast( 360. )); + return std::make_pair(static_cast( 0. ), static_cast( AI_MATH_TWO_PI / conv.angle_scale )); } protected: @@ -272,7 +276,7 @@ public: IfcFloat acc = 0; BOOST_FOREACH(const CurveEntry& entry, curves) { const ParamRange& range = entry.first->GetParametricRange(); - const IfcFloat delta = range.second-range.first; + const IfcFloat delta = abs(range.second-range.first); if (u < acc+delta) { return entry.first->Eval( entry.second ? (u-acc) + range.first : range.second-(u-acc)); } @@ -291,7 +295,7 @@ public: IfcFloat acc = 0; BOOST_FOREACH(const CurveEntry& entry, curves) { const ParamRange& range = entry.first->GetParametricRange(); - const IfcFloat delta = range.second-range.first; + const IfcFloat delta = abs(range.second-range.first); if (a <= acc+delta && b >= acc) { const IfcFloat at = std::max(static_cast( 0. ),a-acc), bt = std::min(delta,b-acc); cnt += entry.first->EstimateSampleCount( entry.second ? at + range.first : range.second - bt, entry.second ? bt + range.first : range.second - at ); @@ -424,6 +428,12 @@ public: return base->EstimateSampleCount(TrimParam(a),TrimParam(b)); } + // -------------------------------------------------- + void SampleDiscrete(TempMesh& out,IfcFloat a,IfcFloat b) const { + ai_assert(InRange(a) && InRange(b)); + return base->SampleDiscrete(out,TrimParam(a),TrimParam(b)); + } + // -------------------------------------------------- ParamRange GetParametricRange() const { return std::make_pair(static_cast( 0. ),maxval); @@ -546,10 +556,12 @@ bool Curve :: InRange(IfcFloat u) const { const ParamRange range = GetParametricRange(); if (IsClosed()) { - ai_assert(range.first != std::numeric_limits::infinity() && range.second != std::numeric_limits::infinity()); - u = range.first + fmod(u-range.first,range.second-range.first); + return true; + //ai_assert(range.first != std::numeric_limits::infinity() && range.second != std::numeric_limits::infinity()); + //u = range.first + fmod(u-range.first,range.second-range.first); } - return u >= range.first && u <= range.second; + const IfcFloat epsilon = 1e-5; + return u - range.first > -epsilon && range.second - u > -epsilon; } #endif @@ -557,7 +569,7 @@ bool Curve :: InRange(IfcFloat u) const IfcFloat Curve :: GetParametricRangeDelta() const { const ParamRange& range = GetParametricRange(); - return range.second - range.first; + return abs(range.second - range.first); } // ------------------------------------------------------------------------------------------------ diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 9f8610ecc..525208abc 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -451,7 +451,6 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, - // ------------------------------------------------------------------------------------------------ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& result, ConversionData& conv) { @@ -539,6 +538,112 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul IFCImporter::LogDebug("generate mesh procedurally by radial extrusion (IfcRevolvedAreaSolid)"); } + + +// ------------------------------------------------------------------------------------------------ +void ProcessSweptDiskSolid(const IfcSweptDiskSolid solid, TempMesh& result, ConversionData& conv) +{ + const Curve* const curve = Curve::Convert(*solid.Directrix, conv); + if(!curve) { + IFCImporter::LogError("failed to convert Directrix curve (IfcSweptDiskSolid)"); + return; + } + + const std::vector& in = result.verts; + const size_t size=in.size(); + + const unsigned int cnt_segments = 16; + const IfcFloat deltaAngle = AI_MATH_TWO_PI/cnt_segments; + + const size_t samples = curve->EstimateSampleCount(solid.StartParam,solid.EndParam); + + result.verts.reserve(cnt_segments * samples * 4); + result.vertcnt.reserve((cnt_segments - 1) * samples); + + std::vector points; + points.reserve(cnt_segments * samples); + + TempMesh temp; + curve->SampleDiscrete(temp,solid.StartParam,solid.EndParam); + const std::vector& curve_points = temp.verts; + + if(curve_points.empty()) { + IFCImporter::LogWarn("curve evaluation yielded no points (IfcSweptDiskSolid)"); + return; + } + + IfcVector3 current = curve_points[0]; + IfcVector3 previous = current; + IfcVector3 next; + + IfcVector3 startvec; + startvec.x = 1.0f; + startvec.y = 1.0f; + startvec.z = 1.0f; + + // generate circles at the sweep positions + for(size_t i = 0; i < samples; ++i) { + + if(i != samples - 1) { + next = curve_points[i + 1]; + } + + // get a direction vector reflecting the approximate curvature (i.e. tangent) + IfcVector3 d = (current-previous) + (next-previous); + + d.Normalize(); + + // figure out an arbitrary point q so that (p-q) * d = 0, + // try to maximize ||(p-q)|| * ||(p_last-q_last)|| + IfcVector3 q; + if (abs(d.x) > 1e-6) { + q.y = startvec.y; + q.z = startvec.z; + q.x = -(d.y * q.y + d.z * q.z) / d.x; + } + else if (abs(d.y) > 1e-6) { + q.x = startvec.x; + q.z = startvec.z; + q.y = -(d.x * q.x + d.z * q.z) / d.y; + } + else { // if (abs(d.z) > 1e-6) + q.y = startvec.y; + q.x = startvec.x; + q.z = -(d.y * q.y + d.x * q.x) / d.z; + } + + startvec = q; + q *= solid.Radius / q.Length(); + + // generate a rotation matrix to rotate q around d + IfcMatrix4 rot; + IfcMatrix4::Rotation(deltaAngle,d,rot); + + for (unsigned int seg = 0; seg < cnt_segments; ++seg, q *= rot ) { + points.push_back(q + current); + } + + previous = current; + current = next; + } + + // make quads + for(size_t i = 0; i < samples - 1; ++i) { + + for (unsigned int seg = 0; seg < cnt_segments - 1; ++seg) { + + result.verts.push_back(points[ i * cnt_segments + seg]); + result.verts.push_back(points[ i * cnt_segments + seg + 1]); + result.verts.push_back(points[ (i+1) * cnt_segments + seg + 1]); + result.verts.push_back(points[ (i+1) * cnt_segments + seg]); + + result.vertcnt.push_back(4); + } + } + + IFCImporter::LogDebug("generate mesh procedurally by sweeping a disk along a curve (IfcSweptDiskSolid)"); +} + // ------------------------------------------------------------------------------------------------ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh) { @@ -1723,6 +1828,9 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vector()) { ProcessSweptAreaSolid(*swept,meshtmp,conv); } + else if(const IfcSweptDiskSolid* disk = geo.ToPtr()) { + ProcessSweptDiskSolid(*disk,meshtmp,conv); + } else if(const IfcManifoldSolidBrep* brep = geo.ToPtr()) { ProcessConnectedFaceSet(brep->Outer,meshtmp,conv); } diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 6b8789be0..add16565a 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include "../contrib/unzip/unzip.h" #include "IFCLoader.h" #include "STEPFileReader.h" @@ -103,7 +104,7 @@ static const aiImporterDesc desc = { 0, 0, 0, - "ifc" + "ifc ifczip" }; @@ -123,7 +124,7 @@ IFCImporter::~IFCImporter() bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const { const std::string& extension = GetExtension(pFile); - if (extension == "ifc") { + if (extension == "ifc" || extension == "ifczip") { return true; } @@ -168,6 +169,53 @@ void IFCImporter::InternReadFile( const std::string& pFile, ThrowException("Could not open file for reading"); } + // if this is a ifczip file, decompress its contents first + if(GetExtension(pFile) == "ifczip") { + unzFile zip = unzOpen( pFile.c_str() ); + if(zip == NULL) { + ThrowException("Could not open ifczip file for reading, unzip failed"); + } + + // chop 'zip' postfix + std::string fileName = pFile.substr(0,pFile.length() - 3); + + std::string::size_type s = pFile.find_last_of('\\'); + if(s == std::string::npos) { + s = pFile.find_last_of('/'); + } + if(s != std::string::npos) { + fileName = fileName.substr(s+1); + } + + // search file (same name as the IFCZIP except for the file extension) and place file pointer there + if ( unzLocateFile( zip, fileName.c_str(), 0 ) == UNZ_OK ) + { + // get file size, etc. + unz_file_info fileInfo; + unzGetCurrentFileInfo( zip , &fileInfo, 0, 0, 0, 0, 0, 0 ); + + uint8_t* buff = new uint8_t[fileInfo.uncompressed_size]; + + LogInfo("Decompressing IFCZIP file"); + + unzOpenCurrentFile( zip ); + const int ret = unzReadCurrentFile( zip, buff, fileInfo.uncompressed_size); + size_t filesize = fileInfo.uncompressed_size; + if ( ret < 0 || size_t(ret) != filesize ) + { + delete[] buff; + ThrowException("Failed to decompress IFC ZIP file"); + } + unzCloseCurrentFile( zip ); + stream.reset(new MemoryIOStream(buff,fileInfo.uncompressed_size,true)); + } + else { + ThrowException("Found no IFC file member in IFCZIP file"); + } + + unzClose(zip); + } + boost::scoped_ptr db(STEP::ReadFileHeader(stream)); const STEP::HeaderInfo& head = static_cast(*db).GetHeader(); diff --git a/code/IFCReaderGen.cpp b/code/IFCReaderGen.cpp index 4f9f4903b..fd3181331 100644 --- a/code/IFCReaderGen.cpp +++ b/code/IFCReaderGen.cpp @@ -1,8 +1,8 @@ /* -Open Asset Import Library (assimp) +Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------- -Copyright (c) 2006-2012, assimp team +Copyright (c) 2006-2010, ASSIMP Development Team All rights reserved. Redistribution and use of this software in source and binary forms, @@ -18,10 +18,10 @@ following conditions are met: 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 +* 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. + written permission of the ASSIMP Development Team. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -96,7 +96,6 @@ namespace { , SchemaEntry("ifcobjecttypeenum",NULL ) , SchemaEntry("ifcthermalloadtypeenum",NULL ) , SchemaEntry("ifcionconcentrationmeasure",NULL ) -, SchemaEntry("ifcobjectreferenceselect",NULL ) , SchemaEntry("ifcclassificationnotationselect",NULL ) , SchemaEntry("ifcbsplinecurveform",NULL ) , SchemaEntry("ifcelementcompositionenum",NULL ) @@ -158,6 +157,7 @@ namespace { , SchemaEntry("ifcidentifier",NULL ) , SchemaEntry("ifcradioactivitymeasure",NULL ) , SchemaEntry("ifcsymbolstyleselect",NULL ) +, SchemaEntry("ifcobjectreferenceselect",NULL ) , SchemaEntry("ifcrooftypeenum",NULL ) , SchemaEntry("ifcreal",NULL ) , SchemaEntry("ifcroleenum",NULL ) @@ -168,6 +168,7 @@ namespace { , SchemaEntry("ifcfiltertypeenum",NULL ) , SchemaEntry("ifctransformertypeenum",NULL ) , SchemaEntry("ifcsurfaceside",NULL ) +, SchemaEntry("ifcspaceheatertypeenum",NULL ) , SchemaEntry("ifcthermaltransmittancemeasure",NULL ) , SchemaEntry("ifctubebundletypeenum",NULL ) , SchemaEntry("ifclightfixturetypeenum",NULL ) @@ -239,7 +240,6 @@ namespace { , SchemaEntry("ifcvolumemeasure",NULL ) , SchemaEntry("ifcbeamtypeenum",NULL ) , SchemaEntry("ifcstateenum",NULL ) -, SchemaEntry("ifcspaceheatertypeenum",NULL ) , SchemaEntry("ifcsectiontypeenum",NULL ) , SchemaEntry("ifcfootingtypeenum",NULL ) , SchemaEntry("ifcmonetarymeasure",NULL ) @@ -379,6 +379,9 @@ namespace { , SchemaEntry("ifcpermeablecoveringoperationenum",NULL ) , SchemaEntry("ifcmagneticfluxdensitymeasure",NULL ) , SchemaEntry("ifcmoisturediffusivitymeasure",NULL ) +, SchemaEntry("ifcprofiledef",&STEP::ObjectHelper::Construct ) +, SchemaEntry("ifcparameterizedprofiledef",&STEP::ObjectHelper::Construct ) +, SchemaEntry("ifczshapeprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcroot",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcobjectdefinition",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifctypeobject",&STEP::ObjectHelper::Construct ) @@ -463,7 +466,6 @@ namespace { , SchemaEntry("ifcpredefineditem",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcpredefinedcolour",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcdraughtingpredefinedcolour",&STEP::ObjectHelper::Construct ) -, SchemaEntry("ifcprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcarbitraryclosedprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifccurve",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcconic",&STEP::ObjectHelper::Construct ) @@ -550,6 +552,7 @@ namespace { , SchemaEntry("ifcaxis1placement",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifclightintensitydistribution",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcpredefinedsymbol",&STEP::ObjectHelper::Construct ) +, SchemaEntry("ifccolourspecification",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcstructuralpointaction",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcspatialstructureelement",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcspace",&STEP::ObjectHelper::Construct ) @@ -583,7 +586,6 @@ namespace { , SchemaEntry("ifcvertex",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcvertexpoint",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcflowinstrumenttype",&STEP::ObjectHelper::Construct ) -, SchemaEntry("ifcparameterizedprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcushapeprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcramp",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcfillareastyle",&STEP::ObjectHelper::Construct ) @@ -869,7 +871,6 @@ namespace { , SchemaEntry("ifcrelaggregates",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcboilertype",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcrelprojectselement",&STEP::ObjectHelper::Construct ) -, SchemaEntry("ifccolourspecification",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifccolourrgb",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcrelconnectsstructuralactivity",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcdoorstyle",&STEP::ObjectHelper::Construct ) @@ -881,7 +882,6 @@ namespace { , SchemaEntry("ifcsensortype",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcairterminalboxtype",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcannotationsurfaceoccurrence",&STEP::ObjectHelper::Construct ) -, SchemaEntry("ifczshapeprofiledef",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcclassificationnotation",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifcrationalbeziercurve",&STEP::ObjectHelper::Construct ) , SchemaEntry("ifccartesiantransformationoperator2d",&STEP::ObjectHelper::Construct ) @@ -1052,6 +1052,44 @@ template <> size_t GenericFill(const STEP::DB& db, const LIST& p +// ----------------------------------------------------------------------------------------------------------- +template <> size_t GenericFill(const DB& db, const LIST& params, IfcProfileDef* in) +{ + size_t base = 0; + if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcProfileDef"); } do { // convert the 'ProfileType' argument + boost::shared_ptr arg = params[base++]; + if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } + try { GenericConvert( in->ProfileType, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProfileDef to be a `IfcProfileTypeEnum`")); } + } while(0); + do { // convert the 'ProfileName' argument + boost::shared_ptr arg = params[base++]; + if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } + if (dynamic_cast(&*arg)) break; + try { GenericConvert( in->ProfileName, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProfileDef to be a `IfcLabel`")); } + } while(0); + return base; +} +// ----------------------------------------------------------------------------------------------------------- +template <> size_t GenericFill(const DB& db, const LIST& params, IfcParameterizedProfileDef* in) +{ + size_t base = GenericFill(db,params,static_cast(in)); + if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcParameterizedProfileDef"); } do { // convert the 'Position' argument + boost::shared_ptr arg = params[base++]; + if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } + try { GenericConvert( in->Position, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcParameterizedProfileDef to be a `IfcAxis2Placement2D`")); } + } while(0); + return base; +} +// ----------------------------------------------------------------------------------------------------------- +template <> size_t GenericFill(const DB& db, const LIST& params, IfcZShapeProfileDef* in) +{ + size_t base = GenericFill(db,params,static_cast(in)); +// this data structure is not used yet, so there is no code generated to fill its members + return base; +} // ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcRoot* in) { @@ -1519,25 +1557,6 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I return base; } // ----------------------------------------------------------------------------------------------------------- -template <> size_t GenericFill(const DB& db, const LIST& params, IfcProfileDef* in) -{ - size_t base = 0; - if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcProfileDef"); } do { // convert the 'ProfileType' argument - boost::shared_ptr arg = params[base++]; - if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->ProfileType, arg, db ); break; } - catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProfileDef to be a `IfcProfileTypeEnum`")); } - } while(0); - do { // convert the 'ProfileName' argument - boost::shared_ptr arg = params[base++]; - if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ProfileName, arg, db ); break; } - catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProfileDef to be a `IfcLabel`")); } - } while(0); - return base; -} -// ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcArbitraryClosedProfileDef* in) { size_t base = GenericFill(db,params,static_cast(in)); @@ -2068,6 +2087,19 @@ template <> size_t GenericFill(const DB& db, const LIST& para return base; } // ----------------------------------------------------------------------------------------------------------- +template <> size_t GenericFill(const DB& db, const LIST& params, IfcColourSpecification* in) +{ + size_t base = 0; + if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcColourSpecification"); } do { // convert the 'Name' argument + boost::shared_ptr arg = params[base++]; + if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } + if (dynamic_cast(&*arg)) break; + try { GenericConvert( in->Name, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcColourSpecification to be a `IfcLabel`")); } + } while(0); + return base; +} +// ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcStructuralPointAction* in) { size_t base = GenericFill(db,params,static_cast(in)); @@ -2236,18 +2268,6 @@ template <> size_t GenericFill(const DB& db, const LIST& return base; } // ----------------------------------------------------------------------------------------------------------- -template <> size_t GenericFill(const DB& db, const LIST& params, IfcParameterizedProfileDef* in) -{ - size_t base = GenericFill(db,params,static_cast(in)); - if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcParameterizedProfileDef"); } do { // convert the 'Position' argument - boost::shared_ptr arg = params[base++]; - if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Position, arg, db ); break; } - catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcParameterizedProfileDef to be a `IfcAxis2Placement2D`")); } - } while(0); - return base; -} -// ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcUShapeProfileDef* in) { size_t base = GenericFill(db,params,static_cast(in)); @@ -3375,7 +3395,32 @@ template <> size_t GenericFill(const DB& db, const LIST& template <> size_t GenericFill(const DB& db, const LIST& params, IfcSweptDiskSolid* in) { size_t base = GenericFill(db,params,static_cast(in)); -// this data structure is not used yet, so there is no code generated to fill its members + if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcSweptDiskSolid"); } do { // convert the 'Directrix' argument + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Directrix, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSweptDiskSolid to be a `IfcCurve`")); } + } while(0); + do { // convert the 'Radius' argument + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Radius, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcSweptDiskSolid to be a `IfcPositiveLengthMeasure`")); } + } while(0); + do { // convert the 'InnerRadius' argument + boost::shared_ptr arg = params[base++]; + if (dynamic_cast(&*arg)) break; + try { GenericConvert( in->InnerRadius, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcSweptDiskSolid to be a `IfcPositiveLengthMeasure`")); } + } while(0); + do { // convert the 'StartParam' argument + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->StartParam, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcSweptDiskSolid to be a `IfcParameterValue`")); } + } while(0); + do { // convert the 'EndParam' argument + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->EndParam, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcSweptDiskSolid to be a `IfcParameterValue`")); } + } while(0); return base; } // ----------------------------------------------------------------------------------------------------------- @@ -3980,19 +4025,6 @@ template <> size_t GenericFill(const DB& db, const LIST& params, return base; } // ----------------------------------------------------------------------------------------------------------- -template <> size_t GenericFill(const DB& db, const LIST& params, IfcColourSpecification* in) -{ - size_t base = 0; - if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcColourSpecification"); } do { // convert the 'Name' argument - boost::shared_ptr arg = params[base++]; - if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, arg, db ); break; } - catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcColourSpecification to be a `IfcLabel`")); } - } while(0); - return base; -} -// ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcColourRgb* in) { size_t base = GenericFill(db,params,static_cast(in)); @@ -4063,13 +4095,6 @@ template <> size_t GenericFill(const DB& db, con return base; } // ----------------------------------------------------------------------------------------------------------- -template <> size_t GenericFill(const DB& db, const LIST& params, IfcZShapeProfileDef* in) -{ - size_t base = GenericFill(db,params,static_cast(in)); -// this data structure is not used yet, so there is no code generated to fill its members - return base; -} -// ----------------------------------------------------------------------------------------------------------- template <> size_t GenericFill(const DB& db, const LIST& params, IfcRationalBezierCurve* in) { size_t base = GenericFill(db,params,static_cast(in)); diff --git a/code/IFCReaderGen.h b/code/IFCReaderGen.h index 07dd183f7..93ccc27c9 100644 --- a/code/IFCReaderGen.h +++ b/code/IFCReaderGen.h @@ -1,8 +1,8 @@ /* -Open Asset Import Library (assimp) +Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------- -Copyright (c) 2006-2012, assimp team +Copyright (c) 2006-2010, ASSIMP Development Team All rights reserved. Redistribution and use of this software in source and binary forms, @@ -18,10 +18,10 @@ following conditions are met: 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 +* 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. + written permission of the ASSIMP Development Team. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -149,8 +149,6 @@ namespace IFC { typedef ENUMERATION IfcThermalLoadTypeEnum; // C++ wrapper type for IfcIonConcentrationMeasure typedef REAL IfcIonConcentrationMeasure; - // C++ wrapper type for IfcObjectReferenceSelect - typedef SELECT IfcObjectReferenceSelect; // C++ wrapper type for IfcClassificationNotationSelect typedef SELECT IfcClassificationNotationSelect; // C++ wrapper type for IfcBSplineCurveForm @@ -273,6 +271,8 @@ namespace IFC { typedef REAL IfcRadioActivityMeasure; // C++ wrapper type for IfcSymbolStyleSelect typedef SELECT IfcSymbolStyleSelect; + // C++ wrapper type for IfcObjectReferenceSelect + typedef SELECT IfcObjectReferenceSelect; // C++ wrapper type for IfcRoofTypeEnum typedef ENUMERATION IfcRoofTypeEnum; // C++ wrapper type for IfcReal @@ -293,6 +293,8 @@ namespace IFC { typedef ENUMERATION IfcTransformerTypeEnum; // C++ wrapper type for IfcSurfaceSide typedef ENUMERATION IfcSurfaceSide; + // C++ wrapper type for IfcSpaceHeaterTypeEnum + typedef ENUMERATION IfcSpaceHeaterTypeEnum; // C++ wrapper type for IfcThermalTransmittanceMeasure typedef REAL IfcThermalTransmittanceMeasure; // C++ wrapper type for IfcTubeBundleTypeEnum @@ -433,8 +435,6 @@ namespace IFC { typedef ENUMERATION IfcBeamTypeEnum; // C++ wrapper type for IfcStateEnum typedef ENUMERATION IfcStateEnum; - // C++ wrapper type for IfcSpaceHeaterTypeEnum - typedef ENUMERATION IfcSpaceHeaterTypeEnum; // C++ wrapper type for IfcSectionTypeEnum typedef ENUMERATION IfcSectionTypeEnum; // C++ wrapper type for IfcFootingTypeEnum @@ -719,6 +719,9 @@ namespace IFC { // IFC Entities // ****************************************************************************** + struct IfcProfileDef; + struct IfcParameterizedProfileDef; + struct IfcZShapeProfileDef; struct IfcRoot; struct IfcObjectDefinition; struct IfcTypeObject; @@ -803,7 +806,6 @@ namespace IFC { typedef NotImplemented IfcPreDefinedItem; // (not currently used by Assimp) typedef NotImplemented IfcPreDefinedColour; // (not currently used by Assimp) typedef NotImplemented IfcDraughtingPreDefinedColour; // (not currently used by Assimp) - struct IfcProfileDef; struct IfcArbitraryClosedProfileDef; struct IfcCurve; struct IfcConic; @@ -890,6 +892,7 @@ namespace IFC { struct IfcAxis1Placement; typedef NotImplemented IfcLightIntensityDistribution; // (not currently used by Assimp) typedef NotImplemented IfcPreDefinedSymbol; // (not currently used by Assimp) + struct IfcColourSpecification; struct IfcStructuralPointAction; struct IfcSpatialStructureElement; struct IfcSpace; @@ -923,7 +926,6 @@ namespace IFC { struct IfcVertex; struct IfcVertexPoint; struct IfcFlowInstrumentType; - struct IfcParameterizedProfileDef; struct IfcUShapeProfileDef; struct IfcRamp; typedef NotImplemented IfcFillAreaStyle; // (not currently used by Assimp) @@ -1209,7 +1211,6 @@ namespace IFC { struct IfcRelAggregates; struct IfcBoilerType; typedef NotImplemented IfcRelProjectsElement; // (not currently used by Assimp) - struct IfcColourSpecification; struct IfcColourRgb; typedef NotImplemented IfcRelConnectsStructuralActivity; // (not currently used by Assimp) struct IfcDoorStyle; @@ -1221,7 +1222,6 @@ namespace IFC { struct IfcSensorType; struct IfcAirTerminalBoxType; struct IfcAnnotationSurfaceOccurrence; - struct IfcZShapeProfileDef; typedef NotImplemented IfcClassificationNotation; // (not currently used by Assimp) struct IfcRationalBezierCurve; struct IfcCartesianTransformationOperator2D; @@ -1375,6 +1375,27 @@ namespace IFC { + // C++ wrapper for IfcProfileDef + struct IfcProfileDef : ObjectHelper { IfcProfileDef() : Object("IfcProfileDef") {} + IfcProfileTypeEnum::Out ProfileType; + Maybe< IfcLabel::Out > ProfileName; + }; + + // C++ wrapper for IfcParameterizedProfileDef + struct IfcParameterizedProfileDef : IfcProfileDef, ObjectHelper { IfcParameterizedProfileDef() : Object("IfcParameterizedProfileDef") {} + Lazy< IfcAxis2Placement2D > Position; + }; + + // C++ wrapper for IfcZShapeProfileDef + struct IfcZShapeProfileDef : IfcParameterizedProfileDef, ObjectHelper { IfcZShapeProfileDef() : Object("IfcZShapeProfileDef") {} + IfcPositiveLengthMeasure::Out Depth; + IfcPositiveLengthMeasure::Out FlangeWidth; + IfcPositiveLengthMeasure::Out WebThickness; + IfcPositiveLengthMeasure::Out FlangeThickness; + Maybe< IfcPositiveLengthMeasure::Out > FilletRadius; + Maybe< IfcPositiveLengthMeasure::Out > EdgeRadius; + }; + // C++ wrapper for IfcRoot struct IfcRoot : ObjectHelper { IfcRoot() : Object("IfcRoot") {} IfcGloballyUniqueId::Out GlobalId; @@ -1654,12 +1675,6 @@ namespace IFC { Lazy< IfcCartesianPoint > Location; }; - // C++ wrapper for IfcProfileDef - struct IfcProfileDef : ObjectHelper { IfcProfileDef() : Object("IfcProfileDef") {} - IfcProfileTypeEnum::Out ProfileType; - Maybe< IfcLabel::Out > ProfileName; - }; - // C++ wrapper for IfcArbitraryClosedProfileDef struct IfcArbitraryClosedProfileDef : IfcProfileDef, ObjectHelper { IfcArbitraryClosedProfileDef() : Object("IfcArbitraryClosedProfileDef") {} Lazy< IfcCurve > OuterCurve; @@ -1997,6 +2012,11 @@ namespace IFC { Maybe< Lazy< IfcDirection > > Axis; }; + // C++ wrapper for IfcColourSpecification + struct IfcColourSpecification : ObjectHelper { IfcColourSpecification() : Object("IfcColourSpecification") {} + Maybe< IfcLabel::Out > Name; + }; + // C++ wrapper for IfcStructuralPointAction struct IfcStructuralPointAction : IfcStructuralAction, ObjectHelper { IfcStructuralPointAction() : Object("IfcStructuralPointAction") {} @@ -2103,11 +2123,6 @@ namespace IFC { IfcFlowInstrumentTypeEnum::Out PredefinedType; }; - // C++ wrapper for IfcParameterizedProfileDef - struct IfcParameterizedProfileDef : IfcProfileDef, ObjectHelper { IfcParameterizedProfileDef() : Object("IfcParameterizedProfileDef") {} - Lazy< IfcAxis2Placement2D > Position; - }; - // C++ wrapper for IfcUShapeProfileDef struct IfcUShapeProfileDef : IfcParameterizedProfileDef, ObjectHelper { IfcUShapeProfileDef() : Object("IfcUShapeProfileDef") {} IfcPositiveLengthMeasure::Out Depth; @@ -3215,11 +3230,6 @@ namespace IFC { IfcBoilerTypeEnum::Out PredefinedType; }; - // C++ wrapper for IfcColourSpecification - struct IfcColourSpecification : ObjectHelper { IfcColourSpecification() : Object("IfcColourSpecification") {} - Maybe< IfcLabel::Out > Name; - }; - // C++ wrapper for IfcColourRgb struct IfcColourRgb : IfcColourSpecification, ObjectHelper { IfcColourRgb() : Object("IfcColourRgb") {} IfcNormalisedRatioMeasure::Out Red; @@ -3270,16 +3280,6 @@ namespace IFC { }; - // C++ wrapper for IfcZShapeProfileDef - struct IfcZShapeProfileDef : IfcParameterizedProfileDef, ObjectHelper { IfcZShapeProfileDef() : Object("IfcZShapeProfileDef") {} - IfcPositiveLengthMeasure::Out Depth; - IfcPositiveLengthMeasure::Out FlangeWidth; - IfcPositiveLengthMeasure::Out WebThickness; - IfcPositiveLengthMeasure::Out FlangeThickness; - Maybe< IfcPositiveLengthMeasure::Out > FilletRadius; - Maybe< IfcPositiveLengthMeasure::Out > EdgeRadius; - }; - // C++ wrapper for IfcRationalBezierCurve struct IfcRationalBezierCurve : IfcBezierCurve, ObjectHelper { IfcRationalBezierCurve() : Object("IfcRationalBezierCurve") {} ListOf< REAL, 2, 0 >::Out WeightsData; @@ -3829,6 +3829,9 @@ namespace STEP { #define DECL_CONV_STUB(type) template <> size_t GenericFill(const STEP::DB& db, const EXPRESS::LIST& params, IFC::type* in) + DECL_CONV_STUB(IfcProfileDef); + DECL_CONV_STUB(IfcParameterizedProfileDef); + DECL_CONV_STUB(IfcZShapeProfileDef); DECL_CONV_STUB(IfcRoot); DECL_CONV_STUB(IfcObjectDefinition); DECL_CONV_STUB(IfcTypeObject); @@ -3880,7 +3883,6 @@ namespace STEP { DECL_CONV_STUB(IfcUnitaryEquipmentType); DECL_CONV_STUB(IfcPort); DECL_CONV_STUB(IfcPlacement); - DECL_CONV_STUB(IfcProfileDef); DECL_CONV_STUB(IfcArbitraryClosedProfileDef); DECL_CONV_STUB(IfcCurve); DECL_CONV_STUB(IfcConic); @@ -3943,6 +3945,7 @@ namespace STEP { DECL_CONV_STUB(IfcDimensionCurve); DECL_CONV_STUB(IfcBoundedCurve); DECL_CONV_STUB(IfcAxis1Placement); + DECL_CONV_STUB(IfcColourSpecification); DECL_CONV_STUB(IfcStructuralPointAction); DECL_CONV_STUB(IfcSpatialStructureElement); DECL_CONV_STUB(IfcSpace); @@ -3963,7 +3966,6 @@ namespace STEP { DECL_CONV_STUB(IfcVertex); DECL_CONV_STUB(IfcVertexPoint); DECL_CONV_STUB(IfcFlowInstrumentType); - DECL_CONV_STUB(IfcParameterizedProfileDef); DECL_CONV_STUB(IfcUShapeProfileDef); DECL_CONV_STUB(IfcRamp); DECL_CONV_STUB(IfcCompositeCurve); @@ -4150,7 +4152,6 @@ namespace STEP { DECL_CONV_STUB(IfcConstructionMaterialResource); DECL_CONV_STUB(IfcRelAggregates); DECL_CONV_STUB(IfcBoilerType); - DECL_CONV_STUB(IfcColourSpecification); DECL_CONV_STUB(IfcColourRgb); DECL_CONV_STUB(IfcDoorStyle); DECL_CONV_STUB(IfcDuctSilencerType); @@ -4159,7 +4160,6 @@ namespace STEP { DECL_CONV_STUB(IfcSensorType); DECL_CONV_STUB(IfcAirTerminalBoxType); DECL_CONV_STUB(IfcAnnotationSurfaceOccurrence); - DECL_CONV_STUB(IfcZShapeProfileDef); DECL_CONV_STUB(IfcRationalBezierCurve); DECL_CONV_STUB(IfcCartesianTransformationOperator2D); DECL_CONV_STUB(IfcCartesianTransformationOperator2DnonUniform); diff --git a/code/IFCUtil.h b/code/IFCUtil.h index 669befea4..a8fe6f680 100644 --- a/code/IFCUtil.h +++ b/code/IFCUtil.h @@ -100,7 +100,7 @@ struct ConversionData { ConversionData(const STEP::DB& db, const IFC::IfcProject& proj, aiScene* out,const IFCImporter::Settings& settings) : len_scale(1.0) - , angle_scale(1.0) + , angle_scale(-1.0) , db(db) , proj(proj) , out(out) diff --git a/code/MemoryIOWrapper.h b/code/MemoryIOWrapper.h index 231ae8111..ccb255fed 100644 --- a/code/MemoryIOWrapper.h +++ b/code/MemoryIOWrapper.h @@ -53,12 +53,20 @@ class MemoryIOStream : public IOStream { //friend class MemoryIOSystem; public: - MemoryIOStream (const uint8_t* buff, size_t len) - : buffer (buff), length(len), pos((size_t)0) { + MemoryIOStream (const uint8_t* buff, size_t len, bool own = false) + : buffer (buff) + , length(len) + , pos((size_t)0) + , own(own) + { } public: + ~MemoryIOStream () { + if(own) { + delete[] buffer; + } } // ------------------------------------------------------------------- @@ -124,6 +132,7 @@ public: private: const uint8_t* buffer; size_t length,pos; + bool own; }; // --------------------------------------------------------------------------- diff --git a/code/ObjTools.h b/code/ObjTools.h index d40241ef0..41de3f61f 100644 --- a/code/ObjTools.h +++ b/code/ObjTools.h @@ -172,6 +172,10 @@ inline char_t getName( char_t it, char_t end, std::string &name ) ++it; // Get name + // if there is no name, and the previous char is a separator, come back to start + while (&(*it) < pStart) { + ++it; + } std::string strName( pStart, &(*it) ); if ( strName.empty() ) return it; diff --git a/code/OgreImporter.cpp b/code/OgreImporter.cpp index e08c1776e..c16cfc0f0 100644 --- a/code/OgreImporter.cpp +++ b/code/OgreImporter.cpp @@ -176,8 +176,8 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass } else { - DefaultLogger::get()->warn("No skeleton file will be loaded"); - DefaultLogger::get()->warn(MeshFile->getNodeName()); + DefaultLogger::get()->debug("No skeleton file will be loaded"); + DefaultLogger::get()->debug(MeshFile->getNodeName()); } //__________________________________________________________________ diff --git a/code/OgreMesh.cpp b/code/OgreMesh.cpp index 39278b1ec..93451d49a 100644 --- a/code/OgreMesh.cpp +++ b/code/OgreMesh.cpp @@ -130,8 +130,7 @@ void OgreImporter::ReadSubMesh(SubMesh &theSubMesh, XmlReader *Reader) " Normale: ",theSubMesh.Normals.size(), " TexCoords: ",theSubMesh.Uvs.size(), " Tantents: ",theSubMesh.Tangents.size() - )); - DefaultLogger::get()->warn(Reader->getNodeName()); + )); } diff --git a/doc/AssimpDoc_Html/AnimationOverview.png b/doc/AssimpDoc_Html/AnimationOverview.png new file mode 100644 index 000000000..e2001528e Binary files /dev/null and b/doc/AssimpDoc_Html/AnimationOverview.png differ diff --git a/doc/AssimpDoc_Html/AnimationOverview.svg b/doc/AssimpDoc_Html/AnimationOverview.svg new file mode 100644 index 000000000..a832b57e7 --- /dev/null +++ b/doc/AssimpDoc_Html/AnimationOverview.svg @@ -0,0 +1,645 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + Pelvis + Spine + Head + Arm + Leg + + Pelvis + Head + Arm + Spine + Leg + + + Root + Root + Root + + Pelvis + Head + Arm + Spine + Leg + + + + + + + Pelvis + Head + Arm + Spine + Leg + + + + + + + Offset Matrices + Model + Bone Hierarchy + Node Transformations + + FinalTransform = Offset x (Scale x Rot x Trans) x (Scale x Rot x Trans) x (Scale x Rot x Trans) + Head + Spine + Head + Head + Pelvis + + + + + + + diff --git a/doc/AssimpDoc_Html/AssimpDoc.chm b/doc/AssimpDoc_Html/AssimpDoc.chm index 5206a92f5..66a0b7446 100644 Binary files a/doc/AssimpDoc_Html/AssimpDoc.chm and b/doc/AssimpDoc_Html/AssimpDoc.chm differ diff --git a/doc/dox.h b/doc/dox.h index 40db0ddad..16b19e7df 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -1690,3 +1690,12 @@ void xxxxImporter::InternReadFile( const std::string& pFile, @endcode */ + + + /** + @page AnimationOverview Animation Overview + \section Transformations + This diagram shows how you can calculate your transformationmatrices for an animated character: + + + **/ \ No newline at end of file diff --git a/include/assimp/postprocess.h b/include/assimp/postprocess.h index 91d727132..b3dc8cafb 100644 --- a/include/assimp/postprocess.h +++ b/include/assimp/postprocess.h @@ -620,7 +620,6 @@ enum aiPostProcessSteps aiProcess_FindInstances | \ aiProcess_ValidateDataStructure | \ aiProcess_OptimizeMeshes | \ - aiProcess_Debone | \ 0 ) diff --git a/revision.h b/revision.h index 500b490c6..17ce738de 100644 --- a/revision.h +++ b/revision.h @@ -1 +1 @@ -#define SVNRevision 1261 +#define SVNRevision 1270 diff --git a/samples/SimpleOpenGL/CMakeLists.txt b/samples/SimpleOpenGL/CMakeLists.txt index ae27bfd7f..49e5fc212 100644 --- a/samples/SimpleOpenGL/CMakeLists.txt +++ b/samples/SimpleOpenGL/CMakeLists.txt @@ -27,7 +27,7 @@ ADD_EXECUTABLE( assimp_simpleogl Sample_SimpleOpenGL.c ) -SET_PROPERTY(TARGET assimp_simpleogl PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_simpleogl PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES( assimp_simpleogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) SET_TARGET_PROPERTIES( assimp_simpleogl PROPERTIES @@ -35,5 +35,5 @@ SET_TARGET_PROPERTIES( assimp_simpleogl PROPERTIES ) INSTALL( TARGETS assimp_simpleogl - DESTINATION "${BIN_INSTALL_DIR}" COMPONENT assimp-dev + DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev ) diff --git a/samples/SimpleTexturedOpenGL/CMakeLists.txt b/samples/SimpleTexturedOpenGL/CMakeLists.txt index 736e45e2c..33edd38ce 100644 --- a/samples/SimpleTexturedOpenGL/CMakeLists.txt +++ b/samples/SimpleTexturedOpenGL/CMakeLists.txt @@ -1,7 +1,21 @@ +FIND_PACKAGE(OpenGL) +FIND_PACKAGE(GLUT) + +IF ( NOT GLUT_FOUND ) + IF ( MSVC ) + SET ( GLUT_FOUND 1 ) + SET ( GLUT_INCLUDE_DIR ${Assimp_SOURCE_DIR}/samples/glut/ ) + SET ( GLUT_LIBRARIES ${Assimp_SOURCE_DIR}/samples/glut/glut32.lib ) + ELSE ( MSVC ) + MESSAGE( WARNING "Please install glut." ) + ENDIF ( MSVC ) +ENDIF ( NOT GLUT_FOUND ) + INCLUDE_DIRECTORIES( ${Assimp_SOURCE_DIR}/include ${Assimp_SOURCE_DIR}/code - ${Assimp_SOURCE_DIR}/samples/glut/ + ${OPENGL_INCLUDE_DIR} + ${GLUT_INCLUDE_DIR} ${Assimp_SOURCE_DIR}/samples/DevIL/include/ ) @@ -17,26 +31,14 @@ ADD_EXECUTABLE( assimp_simpletexturedogl WIN32 SimpleTexturedOpenGL/src/model_loading.cpp ) -SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_simpletexturedogl PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) -IF( WIN32 ) - SET( PSDK_PATH "C:/Program Files/Microsoft Platform SDK/Bin" ) - SET( PSDK_INC "C:/Program Files/Microsoft Platform SDK/Include" ) - - FIND_LIBRARY( WIN32_COMCTRL comctl32.lib - PATHS - "C:/Programme/Microsoft Platform SDK for Windows Server 2003 R2/Lib" - DOC "Path to psdk" - ) -ENDIF( WIN32 ) - - -TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp opengl32.lib glu32.lib comctl32.lib devil.lib ) +TARGET_LINK_LIBRARIES( assimp_simpletexturedogl assimp ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} DevIL.lib ) SET_TARGET_PROPERTIES( assimp_simpletexturedogl PROPERTIES OUTPUT_NAME assimp_simpletexturedogl ) INSTALL( TARGETS assimp_simpletexturedogl - DESTINATION "${BIN_INSTALL_DIR}" COMPONENT assimp-dev + DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev ) diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp index 66e44250c..83d47795f 100644 --- a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp @@ -410,7 +410,9 @@ void recursive_render (const struct aiScene *sc, const struct aiNode* nd, float unsigned int n=0, t; aiMatrix4x4 m = nd->mTransformation; - m.Scaling(aiVector3D(scale, scale, scale), m); + aiMatrix4x4 m2; + aiMatrix4x4::Scaling(aiVector3D(scale, scale, scale), m2); + m = m * m2; // update transform m.Transpose(); diff --git a/scripts/IFCImporter/entitylist.txt b/scripts/IFCImporter/entitylist.txt index a83e3c3df..95cf46c91 100644 --- a/scripts/IFCImporter/entitylist.txt +++ b/scripts/IFCImporter/entitylist.txt @@ -94,6 +94,7 @@ IfcSurfaceStyleRendering IfcSurfaceStyleShading IfcSurfaceStyleWithTextures IfcSweptAreaSolid +IfcSweptDiskSolid IfcTopologicalRepresentationItem IfcTrimmedCurve IfcUnit diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 64fefc7c1..7f138e2a1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -219,35 +219,9 @@ add_executable( unit ) IF( WIN32 ) - SET( PSDK_PATH "C:/Program Files/Microsoft Platform SDK/Bin" ) - SET( PSDK_INC "C:/Program Files/Microsoft Platform SDK/Include" ) - - FIND_PATH(DX9_INCLUDE_PATH d3d9.h - PATHS - "$ENV{DXSDK_DIR}/Include" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include" - DOC "The directory where D3D9.h resides") - - FIND_LIBRARY(D3D9_LIBRARY d3d9.lib - PATHS - "$ENV{DXSDK_DIR}/Lib/x86" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" - DOC "The directory where d3d9.lib resides") - - FIND_LIBRARY(D3DX9_LIBRARY d3dx9.lib - PATHS - "$ENV{DXSDK_DIR}/Lib/x86" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" - DOC "The directory where d3dx9.lib resides") - - SET( DX9_LIBRARIES ${D3D9_LIBRARY} ${D3DX9_LIBRARY} ) - - FIND_LIBRARY( WIN32_COMCTRL comctl32.lib - PATHS - "C:/Programme/Microsoft Platform SDK for Windows Server 2003 R2/Lib" - DOC "Path to psdk" - ) + FIND_PACKAGE(DirectX REQUIRED) ENDIF( WIN32 ) +SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) # TODO: Port to non-Windows platforms. -target_link_libraries ( unit assimp ${DX9_LIBRARIES} comctl32.lib Winmm.lib ) +target_link_libraries ( unit assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib ) diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index f5758ece4..9d1a291d2 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -17,7 +17,7 @@ ADD_EXECUTABLE( assimp_cmd Export.cpp ) -SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) TARGET_LINK_LIBRARIES( assimp_cmd assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES @@ -25,5 +25,5 @@ SET_TARGET_PROPERTIES( assimp_cmd PROPERTIES ) INSTALL( TARGETS assimp_cmd - DESTINATION "${BIN_INSTALL_DIR}" COMPONENT assimp-bin + DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-bin ) diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index d207c3e7f..e3f15e9d8 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -1,8 +1,10 @@ +FIND_PACKAGE(DirectX REQUIRED) + # Make sure the compiler can find include files from our Hello library. include_directories ( ${Assimp_SOURCE_DIR}/include ${Assimp_SOURCE_DIR}/code - ${DX9_INCLUDE_PATH} + ${DirectX_INCLUDE_DIR} ) # Make sure the linker can find the Hello library once it is built. @@ -41,45 +43,16 @@ add_executable( assimp_viewer WIN32 txi.bmp ) -SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${DEBUG_POSTFIX}) +SET_PROPERTY(TARGET assimp_viewer PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) IF( WIN32 ) - SET( PSDK_PATH "C:/Program Files/Microsoft Platform SDK/Bin" ) - SET( PSDK_INC "C:/Program Files/Microsoft Platform SDK/Include" ) - - FIND_PATH(DX9_INCLUDE_PATH d3d9.h - PATHS - "$ENV{DXSDK_DIR}/Include" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Include" - DOC "The directory where D3D9.h resides") - - - FIND_LIBRARY(D3D9_LIBRARY d3d9.lib - PATHS - "$ENV{DXSDK_DIR}/Lib/x86" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" - DOC "The directory where d3d9.lib resides") - - FIND_LIBRARY(D3DX9_LIBRARY d3dx9.lib - PATHS - "$ENV{DXSDK_DIR}/Lib/x86" - "$ENV{PROGRAMFILES}/Microsoft DirectX SDK/Lib/x86" - DOC "The directory where d3dx9.lib resides") - - SET( DX9_LIBRARIES ${D3D9_LIBRARY} ${D3DX9_LIBRARY} ) - - FIND_LIBRARY( WIN32_COMCTRL comctl32.lib - PATHS - "C:/Programme/Microsoft Platform SDK for Windows Server 2003 R2/Lib" - DOC "Path to psdk" - ) ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) ENDIF( WIN32 ) # Link the executable to the Hello library. -target_link_libraries ( assimp_viewer assimp ${DX9_LIBRARIES} comctl32.lib Winmm.lib ) +target_link_libraries ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib Winmm.lib ) INSTALL( TARGETS assimp_viewer - DESTINATION "${BIN_INSTALL_DIR}" COMPONENT assimp-dev -) + DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev +)