diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index e0c2bec9e..e1ab13396 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,2 +1 @@
-patreon: assimp
-custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4
+open_collective: assimp
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index dd84ea782..0f9a5f105 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,8 +1,8 @@
---
name: Bug report
about: Create a report to help us improve
-title: ''
-labels: ''
+title: 'Bug:'
+labels: 'Bug'
assignees: ''
---
@@ -23,16 +23,10 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
-**Desktop (please complete the following information):**
+**Platform (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
-**Smartphone (please complete the following information):**
- - Device: [e.g. iPhone6]
- - OS: [e.g. iOS8.1]
- - Browser [e.g. stock browser, safari]
- - Version [e.g. 22]
-
**Additional context**
Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index bbcbbe7d6..87302a0f0 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
-labels: ''
+labels: 'Feature-Request'
assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/tech_debt.md b/.github/ISSUE_TEMPLATE/tech_debt.md
new file mode 100644
index 000000000..a1172d932
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/tech_debt.md
@@ -0,0 +1,25 @@
+---
+name: Technical debt
+about: Create a report to help us to fix and detect tech debts
+title: ''
+labels: 'Techdebt'
+assignees: ''
+
+---
+
+**Describe the technical debt**
+A clear and concise description of what the tech debt is about.
+
+**Better solution**
+A clear and concise description of what you would expect.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
index f29e2e500..510ae8e7f 100644
--- a/.github/workflows/ccpp.yml
+++ b/.github/workflows/ccpp.yml
@@ -67,7 +67,13 @@ jobs:
uses: actions/checkout@v2
with:
repository: cpp-pm/polly
- path: cmake/polly
+ path: cmake/polly
+
+ - name: Remove contrib directory for Hunter builds
+ if: contains(matrix.name, 'hunter')
+ uses: JesseTG/rm@v1.0.2
+ with:
+ path: contrib
- name: Cache DX SDK
id: dxcache
diff --git a/.gitignore b/.gitignore
index fe59f9a70..7849cab65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,11 +18,14 @@ build
*.VC.db-wal
*.VC.opendb
*.ipch
+.vs/
+out/
+CMakeSettings.json
# Output
bin/
lib/
-
+x64/
# QtCreator
CMakeLists.txt.user
@@ -113,3 +116,6 @@ tools/assimp_qt_viewer/moc_glview.cpp_parameters
tools/assimp_qt_viewer/moc_mainwindow.cpp
tools/assimp_qt_viewer/moc_mainwindow.cpp_parameters
tools/assimp_qt_viewer/ui_mainwindow.h
+
+#Generated directory
+generated/*
\ No newline at end of file
diff --git a/Build.md b/Build.md
index 4b7513313..b4d1bdad0 100644
--- a/Build.md
+++ b/Build.md
@@ -1,6 +1,6 @@
-# Build Instructions
+# Build / Install Instructions
-## Build on all platforms using vcpkg
+## Install on all platforms using vcpkg
You can download and install assimp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
```bash
git clone https://github.com/Microsoft/vcpkg.git
@@ -11,6 +11,18 @@ You can download and install assimp using the [vcpkg](https://github.com/Microso
```
The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
+## Install on Ubuntu
+You can install the Asset-Importer-Lib via apt:
+```
+sudo apt-get install assimp
+```
+
+## Install pyassimp
+You need to have pip installed:
+```
+pip install pyassimp
+```
+
## Manual build instructions
### Install CMake
@@ -24,6 +36,12 @@ Make sure you have a working git-installation. Open a command prompt and clone t
```bash
git clone https://github.com/assimp/assimp.git
```
+### Build from source:
+```bash
+cd assimp
+cmake CMakeLists.txt
+cmake --build .
+```
### Build instructions for Windows with Visual-Studio
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b553ef9e..bfa30e96a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
-# Copyright (c) 2006-2020, assimp team
+# Copyright (c) 2006-2021, assimp team
#
# All rights reserved.
#
@@ -38,16 +38,16 @@ SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
-CMAKE_MINIMUM_REQUIRED( VERSION 3.0 )
+CMAKE_MINIMUM_REQUIRED( VERSION 3.10 )
# Toggles the use of the hunter package manager
option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
IF(ASSIMP_HUNTER_ENABLED)
- include("cmake/HunterGate.cmake")
+ include("cmake-modules/HunterGate.cmake")
HunterGate(
- URL "https://github.com/cpp-pm/hunter/archive/v0.23.269.tar.gz"
- SHA1 "64024b7b95b4c86d50ae05b926814448c93a70a0"
+ URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz"
+ SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410"
)
add_definitions(-DASSIMP_USE_HUNTER)
@@ -61,7 +61,6 @@ OPTION( BUILD_SHARED_LIBS
"Build package with shared libraries."
ON
)
-
OPTION( ASSIMP_BUILD_FRAMEWORK
"Build package as Mac OS X Framework bundle."
OFF
@@ -133,9 +132,22 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH
)
IF ( WIN32 )
+ # Use subset of Windows.h
+ ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
+
+ IF(MSVC)
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW
"If the Assimp view tool is built. (requires DirectX)"
OFF )
+
+ OPTION( ASSIMP_INSTALL_PDB
+ "Install MSVC debug files."
+ ON )
+ IF(NOT (MSVC_VERSION LESS 1900))
+ # Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
+ ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
+ ENDIF()
+ ENDIF()
ENDIF()
IF (IOS AND NOT ASSIMP_HUNTER_ENABLED)
@@ -145,21 +157,6 @@ IF (IOS AND NOT ASSIMP_HUNTER_ENABLED)
ADD_DEFINITIONS(-DENABLE_BITCODE)
ENDIF ()
-# Use subset of Windows.h
-if (WIN32)
- ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
-endif()
-
-IF(MSVC)
- OPTION( ASSIMP_INSTALL_PDB
- "Install MSVC debug files."
- ON
- )
- IF(NOT (MSVC_VERSION LESS 1900))
- # Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
- ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
- ENDIF()
-ENDIF()
IF (ASSIMP_BUILD_FRAMEWORK)
SET (BUILD_SHARED_LIBS ON)
@@ -271,6 +268,8 @@ ELSEIF(MSVC)
ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
+ SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_CXX_STANDARD 11)
@@ -337,9 +336,9 @@ INCLUDE (FindPkgMacros)
INCLUDE (PrecompiledHeader)
# Set Assimp project output directory variables.
-SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
-SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
-SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
+SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files")
+SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files")
+SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for archive output files")
# Macro used to set the output directories of a target to the
# respective Assimp output directories.
@@ -398,14 +397,14 @@ set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
IF(ASSIMP_HUNTER_ENABLED)
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
- set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-hunter-config.cmake.in")
+ set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
set(NAMESPACE "${PROJECT_NAME}::")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
ELSE()
set(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
- set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-plain-config.cmake.in")
+ set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets")
@@ -455,6 +454,12 @@ IF(ASSIMP_HUNTER_ENABLED)
set(ZLIB_LIBRARIES ZLIB::zlib)
set(ASSIMP_BUILD_MINIZIP TRUE)
ELSE()
+ # If the zlib is already found outside, add an export in case assimpTargets can't find it.
+ IF( ZLIB_FOUND )
+ INSTALL( TARGETS zlib zlibstatic
+ EXPORT "${TARGETS_EXPORT_NAME}")
+ ENDIF()
+
IF ( NOT ASSIMP_BUILD_ZLIB )
FIND_PACKAGE(ZLIB)
ENDIF()
@@ -524,12 +529,12 @@ ENDIF()
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 Cineware SDK."
)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
IF ( MSVC )
- SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/includes")
+ SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/includes")
# pick the correct prebuilt library
IF(MSVC15)
@@ -548,28 +553,117 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
)
ENDIF()
- SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/libraries/win")
+ SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/libraries/win")
SET(C4D_DEBUG_LIBRARIES
- "${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_debug.lib"
+ "${C4D_LIB_BASE_PATH}/cinewarelib${C4D_LIB_POSTFIX}/cinewarelib_debug.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_debug.lib"
)
SET(C4D_RELEASE_LIBRARIES
- "${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_release.lib"
+ "${C4D_LIB_BASE_PATH}/cinewarelib${C4D_LIB_POSTFIX}/cinewarelib_release.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_release.lib"
)
- # winsock and winmm are necessary dependencies of melange (this is undocumented, but true.)
+ # winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because
+ # it can be used to communicate with a running Cinema 4D instance
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
ELSE ()
MESSAGE( FATAL_ERROR
- "C4D is currently only available on Windows with melange SDK installed in contrib/Melange"
+ "C4D is currently only available on Windows with Cineware SDK installed in contrib/Cineware"
)
ENDIF ()
ELSE ()
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
ENDIF ()
+# Draco requires cmake 3.12
+IF (DEFINED CMAKE_VERSION AND "${CMAKE_VERSION}" VERSION_LESS "3.12")
+ message(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled")
+ SET ( ASSIMP_BUILD_DRACO OFF CACHE BOOL "Disabled: Draco requires newer cmake" FORCE )
+ELSE()
+ OPTION ( ASSIMP_BUILD_DRACO "If the Draco libraries are to be built. Primarily for glTF" OFF )
+ IF ( ASSIMP_BUILD_DRACO )
+ # Primarily for glTF v2
+ # Enable Draco glTF feature set
+ set(DRACO_GLTF ON CACHE BOOL "" FORCE)
+ # Disable unnecessary or omitted components
+ set(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE)
+ set(DRACO_WASM OFF CACHE BOOL "" FORCE)
+ set(DRACO_MAYA_PLUGIN OFF CACHE BOOL "" FORCE)
+ set(DRACO_UNITY_PLUGIN OFF CACHE BOOL "" FORCE)
+ set(DRACO_TESTS OFF CACHE BOOL "" FORCE)
+
+ IF(ASSIMP_HUNTER_ENABLED)
+ hunter_add_package(draco)
+ find_package(draco CONFIG REQUIRED)
+ set(draco_LIBRARIES draco::draco)
+ ELSE()
+ # Draco 1.4.1 has many warnings and will not build with /WX or -Werror
+ # See https://github.com/google/draco/issues/672
+ # and https://github.com/google/draco/issues/673
+ IF(MSVC)
+ set(DRACO_CXX_FLAGS "/W0")
+ ELSE()
+ list(APPEND DRACO_CXX_FLAGS
+ "-Wno-bool-compare"
+ "-Wno-comment"
+ "-Wno-maybe-uninitialized"
+ "-Wno-sign-compare"
+ "-Wno-unused-local-typedefs"
+ )
+ # Draco 1.4.1 does not explicitly export any symbols under GCC/clang
+ list(APPEND DRACO_CXX_FLAGS
+ "-fvisibility=default"
+ )
+ ENDIF()
+
+ # Don't build or install all of Draco by default
+ ADD_SUBDIRECTORY( "contrib/draco" EXCLUDE_FROM_ALL )
+
+ if(MSVC OR WIN32)
+ set(draco_LIBRARIES "draco")
+ else()
+ if(BUILD_SHARED_LIBS)
+ set(draco_LIBRARIES "draco_shared")
+ else()
+ set(draco_LIBRARIES "draco_static")
+ endif()
+ endif()
+
+ # Don't build the draco command-line tools by default
+ set_target_properties(draco_encoder draco_decoder PROPERTIES
+ EXCLUDE_FROM_ALL TRUE
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE
+ )
+
+ # Do build the draco shared library
+ set_target_properties(${draco_LIBRARIES} PROPERTIES
+ EXCLUDE_FROM_ALL FALSE
+ EXCLUDE_FROM_DEFAULT_BUILD FALSE
+ )
+
+ TARGET_USE_COMMON_OUTPUT_DIRECTORY(${draco_LIBRARIES})
+ TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_encoder)
+ TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_decoder)
+
+ set(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src")
+
+ # This is probably wrong
+ INSTALL( TARGETS ${draco_LIBRARIES}
+ EXPORT "${TARGETS_EXPORT_NAME}"
+ LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
+ RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
+ FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
+ COMPONENT ${LIBASSIMP_COMPONENT}
+ INCLUDES DESTINATION include
+ )
+
+ ENDIF()
+ ENDIF()
+ENDIF()
+
+# Main assimp code
ADD_SUBDIRECTORY( code/ )
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
# The viewer for windows only
@@ -583,7 +677,7 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
ENDIF ()
-IF ( ASSIMP_BUILD_SAMPLES)
+IF ( ASSIMP_BUILD_SAMPLES )
SET( SAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/samples )
SET( SAMPLES_SHARED_CODE_DIR ${SAMPLES_DIR}/SharedCode )
IF ( WIN32 )
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..b65d131a4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,25 @@
+FROM ubuntu:14.04
+
+RUN apt-get update && apt-get install -y \
+ git cmake build-essential software-properties-common
+
+RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && apt-get install -y gcc-4.9 g++-4.9 && \
+ cd /usr/bin && \
+ rm gcc g++ cpp && \
+ ln -s gcc-4.9 gcc && \
+ ln -s g++-4.9 g++ && \
+ ln -s cpp-4.9 cpp
+
+WORKDIR /opt
+
+# Build Assimp
+RUN git clone https://github.com/assimp/assimp.git /opt/assimp
+
+WORKDIR /opt/assimp
+
+RUN git checkout master \
+ && mkdir build && cd build && \
+ cmake \
+ -DCMAKE_BUILD_TYPE=Release \
+ .. && \
+ make && make install
diff --git a/INSTALL b/INSTALL
index ecec2585b..2cfd38078 100644
--- a/INSTALL
+++ b/INSTALL
@@ -8,43 +8,10 @@ Getting the documentation
------------------------------
A regularly-updated copy is available at
-http://assimp.sourceforge.net/lib_html/index.html
-
-A CHM file is included in the SVN repos: ./doc/AssimpDoc_Html/AssimpDoc.chm.
-To build the doxygen documentation on your own, follow these steps:
-
-a) download & install latest doxygen
-b) make sure doxygen is in the executable search path
-c) navigate to ./doc
-d) and run 'doxygen'
-
-Open the generated HTML (AssimpDoc_Html/index.html) in the browser of your choice.
-Windows only: To generate the CHM doc, install 'Microsoft HTML Workshop'
-and configure the path to it in the DOXYFILE first.
+https://assimp-docs.readthedocs.io/en/latest/
------------------------------
Building Assimp
------------------------------
-More detailed build instructions can be found in the documentation,
-this section is just for the inpatient among you.
-
-CMake is the preferred build system for Assimp. The minimum required version
-is 2.6. If you don't have it yet, downloads for CMake can be found on
-http://www.cmake.org/.
-
-For Unix:
-
-1. mkdir build && cd build
-2. cmake .. -G 'Unix Makefiles'
-3. make -j4
-
-For Windows:
-1. Open a command prompt
-2. mkdir build
-3. cd build
-4. cmake ..
-5. cmake --build .
-
-For iOS:
-Just check the following project, which deploys a compiler toolchain for different iOS-versions: https://github.com/assimp/assimp/tree/master/port/iOS
+Just check the build-instaructions which you can find here: https://github.com/assimp/assimp/blob/master/Build.md
diff --git a/LICENSE b/LICENSE
index dc8e24706..acaaf016e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
Open Asset Import Library (assimp)
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
diff --git a/Readme.md b/Readme.md
index c6212bcc0..949d60966 100644
--- a/Readme.md
+++ b/Readme.md
@@ -8,10 +8,10 @@ A library to import and export various 3d-model-formats including scene-post-pro
+[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
[![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master)
[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5be56faac64f46fc941ac890fb4febef)](https://www.codacy.com/app/kimkulling/assimp?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/)
@@ -39,12 +39,13 @@ Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file.
### Ports ###
* [Android](port/AndroidJNI/README.md)
* [Python](port/PyAssimp/README.md)
-* [.NET](https://github.com/assimp/assimp-net)
+* [.NET](https://bitbucket.org/Starnick/assimpnet/src/master/)
* [Pascal](port/AssimpPascal/Readme.md)
* [Javascript (Alpha)](https://github.com/makc/assimp2json)
-* [Unity 3d Plugin](https://www.assetstore.unity3d.com/en/#!/content/91777)
+* [Unity 3d Plugin](https://ricardoreis.net/trilib-2/)
* [JVM](https://github.com/kotlin-graphics/assimp) Full jvm port (current [status](https://github.com/kotlin-graphics/assimp/wiki/Status))
* [HAXE-Port](https://github.com/longde123/assimp-haxe) The Assimp-HAXE-port.
+* [Rust](https://github.com/jkvargas/russimp)
### Other tools ###
[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.
@@ -65,9 +66,9 @@ Open Asset Import Library is implemented in C++. The directory structure looks l
The source code is organized in the following way:
- code/Common The base implementation for importers and the infrastructure
- code/PostProcessing The post-processing steps
- code/ Implementation for import and export for the format
+ code/Common The base implementation for importers and the infrastructure
+ code/PostProcessing The post-processing steps
+ code/AssetLib/ Implementation for import and export for the format
### Where to get help ###
For more information, visit [our website](http://assimp.org/). Or check out the `./doc`- folder, which contains the official documentation in HTML format.
@@ -75,9 +76,6 @@ For more information, visit [our website](http://assimp.org/). Or check out the
If the docs don't solve your problem, ask on [StackOverflow with the assimp-tag](http://stackoverflow.com/questions/tagged/assimp?sort=newest). If you think you found a bug, please open an issue on Github.
-For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
- [(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
-
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -102,15 +100,6 @@ Become a financial contributor and help us sustain our community. [[Contribute](
-Monthly donations via Patreon:
-
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/assimp)
-
-
-
-One-off donations via PayPal:
-
[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
-
-
#### Organizations
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 4fb79dd69..000000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-# AppVeyor file
-# http://www.appveyor.com/docs/appveyor-yml
-
-# clone directory
-clone_folder: c:\projects\assimp
-
-clone_depth: 1
-
-# branches to build
-branches:
- # whitelist
- only:
- - master
-
-matrix:
- fast_finish: true
-
-image:
- - Visual Studio 2013
- #- Visual Studio 2015
- #- Visual Studio 2017
- - Visual Studio 2019
- #- MinGW
-
-platform:
- - Win32
- - x64
-
-configuration: Release
-
-install:
- - set PATH=C:\Ruby24-x64\bin;%PATH%
- - set CMAKE_DEFINES -DASSIMP_WERROR=ON
- - if [%COMPILER%]==[MinGW] set PATH=C:\MinGW\bin;%PATH%
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" set CMAKE_GENERATOR_NAME=Visual Studio 12 2013
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set CMAKE_GENERATOR_NAME=Visual Studio 16 2019
- - cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" -A %platform% .
- # Rename sh.exe as sh.exe in PATH interferes with MinGW - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
-
- - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
- - set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
- - ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
- - ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
-
-cache:
- - code\assimp.dir\%CONFIGURATION%
- - contrib\zlib\zlibstatic.dir\%CONFIGURATION%
- - contrib\zlib\zlib.dir\%CONFIGURATION%
- - tools\assimp_cmd\assimp_cmd.dir\%CONFIGURATION%
- - tools\assimp_view\assimp_viewer.dir\%CONFIGURATION%
- - test\unit.dir\%CONFIGURATION%
- - bin\.mtime_cache
-
-before_build:
- - echo NUMBER_OF_PROCESSORS=%NUMBER_OF_PROCESSORS%
- - ruby scripts\AppVeyor\mtime_cache -g scripts\AppVeyor\cacheglobs.txt -c bin\.mtime_cache\cache.json
-
-build_script:
- cmake --build . --config Release -- /maxcpucount:2
-
-after_build:
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (
- if "%platform%"=="x64" (
- iscc packaging\windows-innosetup\script_x64.iss
- ) else (
- iscc packaging\windows-innosetup\script_x86.iss
- )
- )
- - 7z a assimp.7z bin\%CONFIGURATION%\* lib\%CONFIGURATION%\*
-
-test_script:
- - cmd: bin\%CONFIGURATION%\unit.exe --gtest_output=xml:testout.xml
-
-on_finish:
- - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\testout.xml))
-
-artifacts:
- - path: assimp.7z
- name: assimp_lib
diff --git a/cmake-modules/FindIrrXML.cmake b/cmake-modules/FindIrrXML.cmake
deleted file mode 100644
index 5434e0b86..000000000
--- a/cmake-modules/FindIrrXML.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-# Find IrrXMl from irrlicht project
-#
-# Find LibIrrXML headers and library
-#
-# IRRXML_FOUND - IrrXML found
-# IRRXML_INCLUDE_DIR - Headers location
-# IRRXML_LIBRARY - IrrXML main library
-
-find_path(IRRXML_INCLUDE_DIR irrXML.h
- PATH_SUFFIXES include/irrlicht include/irrxml)
-find_library(IRRXML_LIBRARY IrrXML)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(IrrXML REQUIRED_VARS IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
-
-
-mark_as_advanced(IRRXML_INCLUDE_DIR IRRXML_LIBRARY)
diff --git a/cmake/HunterGate.cmake b/cmake-modules/HunterGate.cmake
similarity index 100%
rename from cmake/HunterGate.cmake
rename to cmake-modules/HunterGate.cmake
diff --git a/cmake-modules/assimp-hunter-config.cmake.in b/cmake-modules/assimp-hunter-config.cmake.in
new file mode 100644
index 000000000..1988f7e7d
--- /dev/null
+++ b/cmake-modules/assimp-hunter-config.cmake.in
@@ -0,0 +1,19 @@
+@PACKAGE_INIT@
+
+find_package(RapidJSON CONFIG REQUIRED)
+find_package(ZLIB CONFIG REQUIRED)
+find_package(utf8cpp CONFIG REQUIRED)
+find_package(minizip CONFIG REQUIRED)
+find_package(openddlparser CONFIG REQUIRED)
+find_package(poly2tri CONFIG REQUIRED)
+find_package(polyclipping CONFIG REQUIRED)
+find_package(zip CONFIG REQUIRED)
+find_package(pugixml CONFIG REQUIRED)
+find_package(stb CONFIG REQUIRED)
+
+if(@ASSIMP_BUILD_DRACO@)
+ find_package(draco CONFIG REQUIRED)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
+check_required_components("@PROJECT_NAME@")
diff --git a/cmake/assimp-plain-config.cmake.in b/cmake-modules/assimp-plain-config.cmake.in
similarity index 100%
rename from cmake/assimp-plain-config.cmake.in
rename to cmake-modules/assimp-plain-config.cmake.in
diff --git a/cmake/assimp-hunter-config.cmake.in b/cmake/assimp-hunter-config.cmake.in
deleted file mode 100644
index b5283f4fb..000000000
--- a/cmake/assimp-hunter-config.cmake.in
+++ /dev/null
@@ -1,14 +0,0 @@
-@PACKAGE_INIT@
-
-find_package(RapidJSON CONFIG REQUIRED)
-find_package(ZLIB CONFIG REQUIRED)
-find_package(utf8cpp CONFIG REQUIRED)
-find_package(minizip CONFIG REQUIRED)
-find_package(openddlparser CONFIG REQUIRED)
-find_package(poly2tri CONFIG REQUIRED)
-find_package(polyclipping CONFIG REQUIRED)
-find_package(zip CONFIG REQUIRED)
-find_package(pugixml CONFIG REQUIRED)
-
-include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
-check_required_components("@PROJECT_NAME@")
diff --git a/code/AssetLib/3DS/3DSConverter.cpp b/code/AssetLib/3DS/3DSConverter.cpp
index ef37e03de..add1553bc 100644
--- a/code/AssetLib/3DS/3DSConverter.cpp
+++ b/code/AssetLib/3DS/3DSConverter.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -68,8 +68,8 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
unsigned int idx(NotSet);
for (unsigned int i = 0; i < mScene->mMaterials.size(); ++i) {
std::string s = mScene->mMaterials[i].mName;
- for (std::string::iterator it = s.begin(); it != s.end(); ++it) {
- *it = static_cast(::tolower(*it));
+ for (char & it : s) {
+ it = static_cast(::tolower(static_cast(it)));
}
if (std::string::npos == s.find("default")) continue;
@@ -79,12 +79,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial() {
mScene->mMaterials[i].mDiffuse.r !=
mScene->mMaterials[i].mDiffuse.b) continue;
- if (mScene->mMaterials[i].sTexDiffuse.mMapName.length() != 0 ||
- mScene->mMaterials[i].sTexBump.mMapName.length() != 0 ||
- mScene->mMaterials[i].sTexOpacity.mMapName.length() != 0 ||
- mScene->mMaterials[i].sTexEmissive.mMapName.length() != 0 ||
- mScene->mMaterials[i].sTexSpecular.mMapName.length() != 0 ||
- mScene->mMaterials[i].sTexShininess.mMapName.length() != 0) {
+ if (ContainsTextures(i)) {
continue;
}
idx = i;
@@ -212,7 +207,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
mat.AddProperty(&tex, AI_MATKEY_GLOBAL_BACKGROUND_IMAGE);
// Be sure this is only done for the first material
- mBackgroundImage = std::string("");
+ mBackgroundImage = std::string();
}
// At first add the base ambient color of the scene to the material
diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp
index ad8e10afe..0beecd563 100644
--- a/code/AssetLib/3DS/3DSExporter.cpp
+++ b/code/AssetLib/3DS/3DSExporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -102,13 +102,14 @@ private:
// preserves the mesh's given name if it has one. |index| is the index
// of the mesh in |aiScene::mMeshes|.
std::string GetMeshName(const aiMesh &mesh, unsigned int index, const aiNode &node) {
- static const std::string underscore = "_";
+ static const char underscore = '_';
char postfix[10] = { 0 };
ASSIMP_itoa10(postfix, index);
std::string result = node.mName.C_Str();
if (mesh.mName.length > 0) {
- result += underscore + mesh.mName.C_Str();
+ result += underscore;
+ result += mesh.mName.C_Str();
}
return result + underscore + postfix;
}
@@ -290,7 +291,7 @@ void Discreet3DSExporter::WriteMaterials() {
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_SPECULAR);
WriteColor(color);
}
-
+
if (mat.Get(AI_MATKEY_COLOR_AMBIENT, color) == AI_SUCCESS) {
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_MAT_AMBIENT);
WriteColor(color);
@@ -378,7 +379,7 @@ void Discreet3DSExporter::WriteTexture(const aiMaterial &mat, aiTextureType type
// TODO: handle embedded textures properly
if (path.data[0] == '*') {
- ASSIMP_LOG_ERROR("Ignoring embedded texture for export: " + std::string(path.C_Str()));
+ ASSIMP_LOG_ERROR("Ignoring embedded texture for export: ", path.C_Str());
return;
}
@@ -444,7 +445,7 @@ void Discreet3DSExporter::WriteMeshes() {
const uint16_t count = static_cast(mesh.mNumVertices);
writer.PutU2(count);
for (unsigned int i = 0; i < mesh.mNumVertices; ++i) {
- const aiVector3D &v = trafo * mesh.mVertices[i];
+ const aiVector3D &v = mesh.mVertices[i];
writer.PutF4(v.x);
writer.PutF4(v.y);
writer.PutF4(v.z);
@@ -506,11 +507,16 @@ void Discreet3DSExporter::WriteMeshes() {
// Transformation matrix by which the mesh vertices have been pre-transformed with.
{
ChunkWriter curChunk(writer, Discreet3DS::CHUNK_TRMATRIX);
- for (unsigned int r = 0; r < 4; ++r) {
+ // Store rotation 3x3 matrix row wise
+ for (unsigned int r = 0; r < 3; ++r) {
for (unsigned int c = 0; c < 3; ++c) {
writer.PutF4(trafo[r][c]);
}
}
+ // Store translation sub vector column wise
+ for (unsigned int r = 0; r < 3; ++r) {
+ writer.PutF4(trafo[r][3]);
+ }
}
}
}
diff --git a/code/AssetLib/3DS/3DSExporter.h b/code/AssetLib/3DS/3DSExporter.h
index 9dcd92d58..c48ecb2fc 100644
--- a/code/AssetLib/3DS/3DSExporter.h
+++ b/code/AssetLib/3DS/3DSExporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h
index a2be07874..e8efbf949 100644
--- a/code/AssetLib/3DS/3DSHelper.h
+++ b/code/AssetLib/3DS/3DSHelper.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -61,20 +61,10 @@ namespace D3DS {
#include
// ---------------------------------------------------------------------------
-/** Discreet3DS class: Helper class for loading 3ds files. Defines chunks
-* and data structures.
+/** Defines chunks and data structures.
*/
-class Discreet3DS {
-private:
- Discreet3DS() AI_NO_EXCEPT {
- // empty
- }
+namespace Discreet3DS {
- ~Discreet3DS() {
- // empty
- }
-
-public:
//! data structure for a single chunk in a .3ds file
struct Chunk {
uint16_t Flag;
@@ -314,7 +304,7 @@ public:
// camera sub-chunks
CHUNK_CAM_RANGES = 0x4720
};
-};
+}
// ---------------------------------------------------------------------------
/** Helper structure representing a 3ds mesh face */
@@ -358,16 +348,16 @@ struct Texture {
// empty
}
- Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(std::move(other.mTextureBlend)),
+ Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend),
mMapName(std::move(other.mMapName)),
- mOffsetU(std::move(other.mOffsetU)),
- mOffsetV(std::move(other.mOffsetV)),
- mScaleU(std::move(other.mScaleU)),
- mScaleV(std::move(other.mScaleV)),
- mRotation(std::move(other.mRotation)),
- mMapMode(std::move(other.mMapMode)),
- bPrivate(std::move(other.bPrivate)),
- iUVSrc(std::move(other.iUVSrc)) {
+ mOffsetU(other.mOffsetU),
+ mOffsetV(other.mOffsetV),
+ mScaleU(other.mScaleU),
+ mScaleV(other.mScaleV),
+ mRotation(other.mRotation),
+ mMapMode(other.mMapMode),
+ bPrivate(other.bPrivate),
+ iUVSrc(other.iUVSrc) {
// empty
}
@@ -376,16 +366,16 @@ struct Texture {
return *this;
}
- mTextureBlend = std::move(other.mTextureBlend);
+ mTextureBlend = other.mTextureBlend;
mMapName = std::move(other.mMapName);
- mOffsetU = std::move(other.mOffsetU);
- mOffsetV = std::move(other.mOffsetV);
- mScaleU = std::move(other.mScaleU);
- mScaleV = std::move(other.mScaleV);
- mRotation = std::move(other.mRotation);
- mMapMode = std::move(other.mMapMode);
- bPrivate = std::move(other.bPrivate);
- iUVSrc = std::move(other.iUVSrc);
+ mOffsetU = other.mOffsetU;
+ mOffsetV = other.mOffsetV;
+ mScaleU = other.mScaleU;
+ mScaleV = other.mScaleV;
+ mRotation = other.mRotation;
+ mMapMode = other.mMapMode;
+ bPrivate = other.bPrivate;
+ iUVSrc = other.iUVSrc;
return *this;
}
@@ -471,13 +461,13 @@ struct Material {
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)),
- mDiffuse(std::move(other.mDiffuse)),
- mSpecularExponent(std::move(other.mSpecularExponent)),
- mShininessStrength(std::move(other.mShininessStrength)),
- mSpecular(std::move(other.mSpecular)),
- mAmbient(std::move(other.mAmbient)),
- mShading(std::move(other.mShading)),
- mTransparency(std::move(other.mTransparency)),
+ mDiffuse(other.mDiffuse),
+ mSpecularExponent(other.mSpecularExponent),
+ mShininessStrength(other.mShininessStrength),
+ mSpecular(other.mSpecular),
+ mAmbient(other.mAmbient),
+ mShading(other.mShading),
+ mTransparency(other.mTransparency),
sTexDiffuse(std::move(other.sTexDiffuse)),
sTexOpacity(std::move(other.sTexOpacity)),
sTexSpecular(std::move(other.sTexSpecular)),
@@ -485,10 +475,10 @@ struct Material {
sTexBump(std::move(other.sTexBump)),
sTexEmissive(std::move(other.sTexEmissive)),
sTexShininess(std::move(other.sTexShininess)),
- mBumpHeight(std::move(other.mBumpHeight)),
- mEmissive(std::move(other.mEmissive)),
+ mBumpHeight(other.mBumpHeight),
+ mEmissive(other.mEmissive),
sTexAmbient(std::move(other.sTexAmbient)),
- mTwoSided(std::move(other.mTwoSided)) {
+ mTwoSided(other.mTwoSided) {
// empty
}
@@ -498,13 +488,13 @@ struct Material {
}
mName = std::move(other.mName);
- mDiffuse = std::move(other.mDiffuse);
- mSpecularExponent = std::move(other.mSpecularExponent);
- mShininessStrength = std::move(other.mShininessStrength),
- mSpecular = std::move(other.mSpecular);
- mAmbient = std::move(other.mAmbient);
- mShading = std::move(other.mShading);
- mTransparency = std::move(other.mTransparency);
+ mDiffuse = other.mDiffuse;
+ mSpecularExponent = other.mSpecularExponent;
+ mShininessStrength = other.mShininessStrength,
+ mSpecular = other.mSpecular;
+ mAmbient = other.mAmbient;
+ mShading = other.mShading;
+ mTransparency = other.mTransparency;
sTexDiffuse = std::move(other.sTexDiffuse);
sTexOpacity = std::move(other.sTexOpacity);
sTexSpecular = std::move(other.sTexSpecular);
@@ -512,10 +502,10 @@ struct Material {
sTexBump = std::move(other.sTexBump);
sTexEmissive = std::move(other.sTexEmissive);
sTexShininess = std::move(other.sTexShininess);
- mBumpHeight = std::move(other.mBumpHeight);
- mEmissive = std::move(other.mEmissive);
+ mBumpHeight = other.mBumpHeight;
+ mEmissive = other.mEmissive;
sTexAmbient = std::move(other.sTexAmbient);
- mTwoSided = std::move(other.mTwoSided);
+ mTwoSided = other.mTwoSided;
return *this;
}
diff --git a/code/AssetLib/3DS/3DSLoader.cpp b/code/AssetLib/3DS/3DSLoader.cpp
index 4c24394fb..b5e6f749b 100644
--- a/code/AssetLib/3DS/3DSLoader.cpp
+++ b/code/AssetLib/3DS/3DSLoader.cpp
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -143,7 +143,13 @@ void Discreet3DSImporter::SetupProperties(const Importer * /*pImp*/) {
// Imports the given file into the given scene structure.
void Discreet3DSImporter::InternReadFile(const std::string &pFile,
aiScene *pScene, IOSystem *pIOHandler) {
- StreamReaderLE theStream(pIOHandler->Open(pFile, "rb"));
+
+ auto theFile = pIOHandler->Open(pFile, "rb");
+ if (!theFile) {
+ throw DeadlyImportError("3DS: Could not open ", pFile);
+ }
+
+ StreamReaderLE theStream(theFile);
// We should have at least one chunk
if (theStream.GetRemainingSize() < 16) {
@@ -164,7 +170,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
mRootNode->mHierarchyIndex = -1;
mRootNode->mParent = nullptr;
mMasterScale = 1.0f;
- mBackgroundImage = "";
+ mBackgroundImage = std::string();
bHasBG = false;
bIsPrj = false;
@@ -266,6 +272,7 @@ void Discreet3DSImporter::ParseMainChunk() {
case Discreet3DS::CHUNK_PRJ:
bIsPrj = true;
+ break;
case Discreet3DS::CHUNK_MAIN:
ParseEditorChunk();
break;
@@ -298,7 +305,7 @@ void Discreet3DSImporter::ParseEditorChunk() {
// print the version number
char buff[10];
ASSIMP_itoa10(buff, stream->GetI2());
- ASSIMP_LOG_INFO_F(std::string("3DS file format version: "), buff);
+ ASSIMP_LOG_INFO("3DS file format version: ", buff);
} break;
};
ASSIMP_3DS_END_CHUNK();
@@ -323,7 +330,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
case Discreet3DS::CHUNK_MAT_MATERIAL:
// Add a new material to the list
- mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + to_string(mScene->mMaterials.size()))));
+ mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size()))));
ParseMaterialChunk();
break;
@@ -927,7 +934,7 @@ void Discreet3DSImporter::ParseFaceChunk() {
}
}
if (0xcdcdcdcd == idx) {
- ASSIMP_LOG_ERROR_F("3DS: Unknown material: ", sz);
+ ASSIMP_LOG_ERROR("3DS: Unknown material: ", sz);
}
// Now continue and read all material indices
diff --git a/code/AssetLib/3DS/3DSLoader.h b/code/AssetLib/3DS/3DSLoader.h
index 68a48e7a2..04dcac237 100644
--- a/code/AssetLib/3DS/3DSLoader.h
+++ b/code/AssetLib/3DS/3DSLoader.h
@@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -208,6 +208,15 @@ protected:
*/
void ReplaceDefaultMaterial();
+ bool ContainsTextures(unsigned int i) const {
+ return !mScene->mMaterials[i].sTexDiffuse.mMapName.empty() ||
+ !mScene->mMaterials[i].sTexBump.mMapName.empty() ||
+ !mScene->mMaterials[i].sTexOpacity.mMapName.empty() ||
+ !mScene->mMaterials[i].sTexEmissive.mMapName.empty() ||
+ !mScene->mMaterials[i].sTexSpecular.mMapName.empty() ||
+ !mScene->mMaterials[i].sTexShininess.mMapName.empty() ;
+ }
+
// -------------------------------------------------------------------
/** Convert the whole scene
*/
diff --git a/code/AssetLib/3MF/3MFTypes.h b/code/AssetLib/3MF/3MFTypes.h
new file mode 100644
index 000000000..c4e9e4243
--- /dev/null
+++ b/code/AssetLib/3MF/3MFTypes.h
@@ -0,0 +1,165 @@
+/*
+Open Asset Import Library (assimp)
+----------------------------------------------------------------------
+
+Copyright (c) 2006-2021, 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.
+
+----------------------------------------------------------------------
+*/
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+
+struct aiMaterial;
+struct aiMesh;
+
+namespace Assimp {
+namespace D3MF {
+
+enum class ResourceType {
+ RT_Object,
+ RT_BaseMaterials,
+ RT_EmbeddedTexture2D,
+ RT_Texture2DGroup,
+ RT_Unknown
+}; // To be extended with other resource types (eg. material extension resources like Texture2d, Texture2dGroup...)
+
+class Resource {
+public:
+ int mId;
+
+ Resource(int id) :
+ mId(id) {
+ // empty
+ }
+
+ virtual ~Resource() {
+ // empty
+ }
+
+ virtual ResourceType getType() const {
+ return ResourceType::RT_Unknown;
+ }
+};
+
+class EmbeddedTexture : public Resource {
+public:
+ std::string mPath;
+ std::string mContentType;
+ std::string mTilestyleU;
+ std::string mTilestyleV;
+ std::vector mBuffer;
+
+ EmbeddedTexture(int id) :
+ Resource(id),
+ mPath(),
+ mContentType(),
+ mTilestyleU(),
+ mTilestyleV() {
+ // empty
+ }
+
+ ~EmbeddedTexture() = default;
+
+ ResourceType getType() const override {
+ return ResourceType::RT_EmbeddedTexture2D;
+ }
+};
+
+class Texture2DGroup : public Resource {
+public:
+ std::vector mTex2dCoords;
+ int mTexId;
+ Texture2DGroup(int id) :
+ Resource(id),
+ mTexId(-1) {
+ // empty
+ }
+
+ ~Texture2DGroup() = default;
+
+ ResourceType getType() const override {
+ return ResourceType::RT_Texture2DGroup;
+ }
+};
+
+class BaseMaterials : public Resource {
+public:
+ std::vector mMaterialIndex;
+
+ BaseMaterials(int id) :
+ Resource(id),
+ mMaterialIndex() {
+ // empty
+ }
+
+ ~BaseMaterials() = default;
+
+ ResourceType getType() const override {
+ return ResourceType::RT_BaseMaterials;
+ }
+};
+
+struct Component {
+ int mObjectId;
+ aiMatrix4x4 mTransformation;
+};
+
+class Object : public Resource {
+public:
+ std::vector mMeshes;
+ std::vector mMeshIndex;
+ std::vector mComponents;
+ std::string mName;
+
+ Object(int id) :
+ Resource(id),
+ mName(std::string("Object_") + ai_to_string(id)) {
+ // empty
+ }
+
+ ~Object() = default;
+
+ ResourceType getType() const override {
+ return ResourceType::RT_Object;
+ }
+};
+
+} // namespace D3MF
+} // namespace Assimp
diff --git a/code/AssetLib/3MF/3MFXmlTags.h b/code/AssetLib/3MF/3MFXmlTags.h
index 49e19c658..a6e9758c1 100644
--- a/code/AssetLib/3MF/3MFXmlTags.h
+++ b/code/AssetLib/3MF/3MFXmlTags.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -44,62 +44,73 @@ namespace Assimp {
namespace D3MF {
namespace XmlTag {
+ // Root tag
+ const char* const RootTag = "3MF";
+
// Meta-data
- static const std::string meta = "metadata";
- static const std::string meta_name = "name";
+ const char* const meta = "metadata";
+ const char* const meta_name = "name";
// Model-data specific tags
- static const std::string model = "model";
- static const std::string model_unit = "unit";
- static const std::string metadata = "metadata";
- static const std::string resources = "resources";
- static const std::string object = "object";
- static const std::string mesh = "mesh";
- static const std::string components = "components";
- static const std::string component = "component";
- static const std::string vertices = "vertices";
- static const std::string vertex = "vertex";
- static const std::string triangles = "triangles";
- static const std::string triangle = "triangle";
- static const std::string x = "x";
- static const std::string y = "y";
- static const std::string z = "z";
- static const std::string v1 = "v1";
- static const std::string v2 = "v2";
- static const std::string v3 = "v3";
- static const std::string id = "id";
- static const std::string pid = "pid";
- static const std::string pindex = "pindex";
- static const std::string p1 = "p1";
- static const std::string name = "name";
- static const std::string type = "type";
- static const std::string build = "build";
- static const std::string item = "item";
- static const std::string objectid = "objectid";
- static const std::string transform = "transform";
+ const char* const model = "model";
+ const char* const model_unit = "unit";
+ const char* const metadata = "metadata";
+ const char* const resources = "resources";
+ const char* const object = "object";
+ const char* const mesh = "mesh";
+ const char* const components = "components";
+ const char* const component = "component";
+ const char* const vertices = "vertices";
+ const char* const vertex = "vertex";
+ const char* const triangles = "triangles";
+ const char* const triangle = "triangle";
+ const char* const x = "x";
+ const char* const y = "y";
+ const char* const z = "z";
+ const char* const v1 = "v1";
+ const char* const v2 = "v2";
+ const char* const v3 = "v3";
+ const char* const id = "id";
+ const char* const pid = "pid";
+ const char* const pindex = "pindex";
+ const char* const p1 = "p1";
+ const char* const name = "name";
+ const char* const type = "type";
+ const char* const build = "build";
+ const char* const item = "item";
+ const char* const objectid = "objectid";
+ const char* const transform = "transform";
+ const char *const path = "path";
// Material definitions
- static const std::string basematerials = "basematerials";
- static const std::string basematerials_id = "id";
- static const std::string basematerials_base = "base";
- static const std::string basematerials_name = "name";
- static const std::string basematerials_displaycolor = "displaycolor";
+ const char* const basematerials = "basematerials";
+ const char* const basematerials_base = "base";
+ const char* const basematerials_name = "name";
+ const char* const basematerials_displaycolor = "displaycolor";
+ const char* const texture_2d = "m:texture2d";
+ const char *const texture_group = "m:texture2dgroup";
+ const char *const texture_content_type = "contenttype";
+ const char *const texture_tilestyleu = "tilestyleu";
+ const char *const texture_tilestylev = "tilestylev";
+ const char *const texture_2d_coord = "m:tex2coord";
+ const char *const texture_cuurd_u = "u";
+ const char *const texture_cuurd_v = "v";
// Meta info tags
- static const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
- static const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
- static const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
- static const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
- static const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
- static const std::string RELS_RELATIONSHIP_NODE = "Relationship";
- static const std::string RELS_ATTRIB_TARGET = "Target";
- static const std::string RELS_ATTRIB_TYPE = "Type";
- static const std::string RELS_ATTRIB_ID = "Id";
- static const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
- static const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
- static const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
- static const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
- static const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
+ const char* const CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
+ const char* const ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
+ const char* const SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
+ const char* const SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
+ const char* const RELS_RELATIONSHIP_CONTAINER = "Relationships";
+ const char* const RELS_RELATIONSHIP_NODE = "Relationship";
+ const char* const RELS_ATTRIB_TARGET = "Target";
+ const char* const RELS_ATTRIB_TYPE = "Type";
+ const char* const RELS_ATTRIB_ID = "Id";
+ const char* const PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
+ const char* const PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
+ const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
+ const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
+ const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
} // Namespace D3MF
diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp
index b4e5d515c..76a601cbe 100644
--- a/code/AssetLib/3MF/D3MFExporter.cpp
+++ b/code/AssetLib/3MF/D3MFExporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -237,7 +237,7 @@ void D3MFExporter::writeBaseMaterials() {
aiMaterial *mat = mScene->mMaterials[i];
aiString name;
if (mat->Get(AI_MATKEY_NAME, name) != aiReturn_SUCCESS) {
- strName = "basemat_" + to_string(i);
+ strName = "basemat_" + ai_to_string(i);
} else {
strName = name.C_Str();
}
@@ -248,7 +248,7 @@ void D3MFExporter::writeBaseMaterials() {
// rgbs %
if (color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1) {
- hexDiffuseColor = Rgba2Hex(
+ hexDiffuseColor = ai_rgba2hex(
(int)((ai_real)color.r) * 255,
(int)((ai_real)color.g) * 255,
(int)((ai_real)color.b) * 255,
@@ -257,13 +257,13 @@ void D3MFExporter::writeBaseMaterials() {
} else {
hexDiffuseColor = "#";
- tmp = DecimalToHexa((ai_real)color.r);
+ tmp = ai_decimal_to_hexa((ai_real)color.r);
hexDiffuseColor += tmp;
- tmp = DecimalToHexa((ai_real)color.g);
+ tmp = ai_decimal_to_hexa((ai_real)color.g);
hexDiffuseColor += tmp;
- tmp = DecimalToHexa((ai_real)color.b);
+ tmp = ai_decimal_to_hexa((ai_real)color.b);
hexDiffuseColor += tmp;
- tmp = DecimalToHexa((ai_real)color.a);
+ tmp = ai_decimal_to_hexa((ai_real)color.a);
hexDiffuseColor += tmp;
}
} else {
@@ -307,18 +307,26 @@ void D3MFExporter::writeMesh(aiMesh *mesh) {
return;
}
- mModelOutput << "<" << XmlTag::mesh << ">" << std::endl;
- mModelOutput << "<" << XmlTag::vertices << ">" << std::endl;
+ mModelOutput << "<"
+ << XmlTag::mesh
+ << ">" << "\n";
+ mModelOutput << "<"
+ << XmlTag::vertices
+ << ">" << "\n";
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
writeVertex(mesh->mVertices[i]);
}
- mModelOutput << "" << XmlTag::vertices << ">" << std::endl;
+ mModelOutput << ""
+ << XmlTag::vertices << ">"
+ << "\n";
const unsigned int matIdx(mesh->mMaterialIndex);
writeFaces(mesh, matIdx);
- mModelOutput << "" << XmlTag::mesh << ">" << std::endl;
+ mModelOutput << ""
+ << XmlTag::mesh << ">"
+ << "\n";
}
void D3MFExporter::writeVertex(const aiVector3D &pos) {
@@ -334,27 +342,34 @@ void D3MFExporter::writeFaces(aiMesh *mesh, unsigned int matIdx) {
if (!mesh->HasFaces()) {
return;
}
- mModelOutput << "<" << XmlTag::triangles << ">" << std::endl;
+ mModelOutput << "<"
+ << XmlTag::triangles << ">"
+ << "\n";
for (unsigned int i = 0; i < mesh->mNumFaces; ++i) {
aiFace ¤tFace = mesh->mFaces[i];
mModelOutput << "<" << XmlTag::triangle << " v1=\"" << currentFace.mIndices[0] << "\" v2=\""
<< currentFace.mIndices[1] << "\" v3=\"" << currentFace.mIndices[2]
- << "\" pid=\"1\" p1=\"" + to_string(matIdx) + "\" />";
- mModelOutput << std::endl;
+ << "\" pid=\"1\" p1=\"" + ai_to_string(matIdx) + "\" />";
+ mModelOutput << "\n";
}
- mModelOutput << "" << XmlTag::triangles << ">";
- mModelOutput << std::endl;
+ mModelOutput << ""
+ << XmlTag::triangles
+ << ">";
+ mModelOutput << "\n";
}
void D3MFExporter::writeBuild() {
- mModelOutput << "<" << XmlTag::build << ">" << std::endl;
+ mModelOutput << "<"
+ << XmlTag::build
+ << ">"
+ << "\n";
for (size_t i = 0; i < mBuildItems.size(); ++i) {
mModelOutput << "<" << XmlTag::item << " objectid=\"" << i + 2 << "\"/>";
- mModelOutput << std::endl;
+ mModelOutput << "\n";
}
mModelOutput << "" << XmlTag::build << ">";
- mModelOutput << std::endl;
+ mModelOutput << "\n";
}
void D3MFExporter::zipContentType(const std::string &filename) {
diff --git a/code/AssetLib/3MF/D3MFExporter.h b/code/AssetLib/3MF/D3MFExporter.h
index abde3cea3..d2fc82483 100644
--- a/code/AssetLib/3MF/D3MFExporter.h
+++ b/code/AssetLib/3MF/D3MFExporter.h
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp
index 66b2c965b..58dde9738 100644
--- a/code/AssetLib/3MF/D3MFImporter.cpp
+++ b/code/AssetLib/3MF/D3MFImporter.cpp
@@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
-Copyright (c) 2006-2020, assimp team
+Copyright (c) 2006-2021, assimp team
All rights reserved.
@@ -42,6 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
#include "D3MFImporter.h"
+#include "3MFXmlTags.h"
+#include "D3MFOpcPackage.h"
+#include "XmlSerializer.h"
#include
#include
@@ -51,517 +54,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
#include
+#include
+
#include
#include