diff --git a/libs/assimp/CMakeLists.txt b/libs/assimp/CMakeLists.txt
index 97a3641f..34bcb966 100644
--- a/libs/assimp/CMakeLists.txt
+++ b/libs/assimp/CMakeLists.txt
@@ -40,20 +40,23 @@ SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
CMAKE_MINIMUM_REQUIRED( VERSION 3.10 )
+# Disabled importers: m3d for 5.1
+ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
+ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
# 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.293.tar.gz"
- SHA1 "e8e5470652db77149d9b38656db2a6c0b7642693"
+ URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz"
+ SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410"
)
add_definitions(-DASSIMP_USE_HUNTER)
ENDIF()
-PROJECT( Assimp VERSION 5.0.1 )
+PROJECT(Assimp VERSION 5.1.3)
# All supported options ###############################################
@@ -135,11 +138,11 @@ IF ( WIN32 )
# Use subset of Windows.h
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
- OPTION ( ASSIMP_BUILD_ASSIMP_VIEW
- "If the Assimp view tool is built. (requires DirectX)"
- OFF )
-
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 )
@@ -265,9 +268,12 @@ ELSEIF(MSVC)
ENDIF()
# disable "elements of array '' will be default initialized" warning on MSVC2013
IF(MSVC12)
- ADD_COMPILE_OPTIONS(/wd4351)
+ ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
+ ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated
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)
@@ -282,12 +288,11 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW )
message(WARNING "MinGW is old, if you experience errors, update MinGW.")
ENDIF()
IF(NOT ASSIMP_HUNTER_ENABLED)
- SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
ENDIF()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
- ADD_DEFINITIONS( -U__STRICT_ANSI__ )
ENDIF()
IF ( IOS AND NOT ASSIMP_HUNTER_ENABLED)
@@ -334,9 +339,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.
@@ -395,14 +400,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")
@@ -527,12 +532,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)
@@ -551,22 +556,23 @@ 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 ()
diff --git a/libs/assimp/Readme.md b/libs/assimp/Readme.md
index 51684c4a..f4167c9f 100644
--- a/libs/assimp/Readme.md
+++ b/libs/assimp/Readme.md
@@ -8,10 +8,10 @@ A library to import and export various 3d-model-formats including scene-post-pro
+[](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
[](https://coveralls.io/github/assimp/assimp?branch=master)
[](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
-[](https://www.codacy.com/app/kimkulling/assimp?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade)
[](https://lgtm.com/projects/g/assimp/assimp/alerts/)
@@ -39,10 +39,12 @@ 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)
+* [Javascript/Node.js Interface](https://github.com/kovacsv/assimpjs)
+* [Unity 3d Plugin](https://ricardoreis.net/trilib-2/)
+* [Unreal Engine Plugin](https://github.com/irajsb/UE4_Assimp/)
* [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)
@@ -66,9 +68,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.
diff --git a/libs/assimp/cmake-modules/FindIrrXML.cmake b/libs/assimp/cmake-modules/FindIrrXML.cmake
deleted file mode 100644
index 5434e0b8..00000000
--- a/libs/assimp/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/libs/assimp/cmake/HunterGate.cmake b/libs/assimp/cmake-modules/HunterGate.cmake
similarity index 100%
rename from libs/assimp/cmake/HunterGate.cmake
rename to libs/assimp/cmake-modules/HunterGate.cmake
diff --git a/libs/assimp/cmake-modules/assimp-hunter-config.cmake.in b/libs/assimp/cmake-modules/assimp-hunter-config.cmake.in
new file mode 100644
index 00000000..1988f7e7
--- /dev/null
+++ b/libs/assimp/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/libs/assimp/cmake/assimp-plain-config.cmake.in b/libs/assimp/cmake-modules/assimp-plain-config.cmake.in
similarity index 100%
rename from libs/assimp/cmake/assimp-plain-config.cmake.in
rename to libs/assimp/cmake-modules/assimp-plain-config.cmake.in
diff --git a/libs/assimp/cmake/assimp-hunter-config.cmake.in b/libs/assimp/cmake/assimp-hunter-config.cmake.in
deleted file mode 100644
index 91efcbf2..00000000
--- a/libs/assimp/cmake/assimp-hunter-config.cmake.in
+++ /dev/null
@@ -1,18 +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)
-
-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/libs/assimp/code/AssetLib/3DS/3DSConverter.cpp b/libs/assimp/code/AssetLib/3DS/3DSConverter.cpp
index 12ac7e69..add1553b 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSConverter.cpp
+++ b/libs/assimp/code/AssetLib/3DS/3DSConverter.cpp
@@ -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/libs/assimp/code/AssetLib/3DS/3DSExporter.cpp b/libs/assimp/code/AssetLib/3DS/3DSExporter.cpp
index 108d917d..ea92fa12 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSExporter.cpp
+++ b/libs/assimp/code/AssetLib/3DS/3DSExporter.cpp
@@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
-using namespace Assimp;
namespace Assimp {
+
using namespace D3DS;
namespace {
@@ -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);
@@ -329,6 +330,7 @@ void Discreet3DSExporter::WriteMaterials() {
case aiShadingMode_Blinn:
case aiShadingMode_CookTorrance:
case aiShadingMode_Fresnel:
+ case aiShadingMode_PBR_BRDF: // Possibly should be Discreet3DS::Metal in some cases but this is undocumented
shading_mode_out = Discreet3DS::Phong;
break;
@@ -355,7 +357,10 @@ void Discreet3DSExporter::WriteMaterials() {
writer.PutI2(1);
}
- WriteTexture(mat, aiTextureType_DIFFUSE, Discreet3DS::CHUNK_MAT_TEXTURE);
+ // Fallback to BASE_COLOR if no DIFFUSE
+ if (!WriteTexture(mat, aiTextureType_DIFFUSE, Discreet3DS::CHUNK_MAT_TEXTURE))
+ WriteTexture(mat, aiTextureType_BASE_COLOR, Discreet3DS::CHUNK_MAT_TEXTURE);
+
WriteTexture(mat, aiTextureType_HEIGHT, Discreet3DS::CHUNK_MAT_BUMPMAP);
WriteTexture(mat, aiTextureType_OPACITY, Discreet3DS::CHUNK_MAT_OPACMAP);
WriteTexture(mat, aiTextureType_SHININESS, Discreet3DS::CHUNK_MAT_MAT_SHINMAP);
@@ -366,20 +371,21 @@ void Discreet3DSExporter::WriteMaterials() {
}
// ------------------------------------------------------------------------------------------------
-void Discreet3DSExporter::WriteTexture(const aiMaterial &mat, aiTextureType type, uint16_t chunk_flags) {
+// returns true if the texture existed
+bool Discreet3DSExporter::WriteTexture(const aiMaterial &mat, aiTextureType type, uint16_t chunk_flags) {
aiString path;
aiTextureMapMode map_mode[2] = {
aiTextureMapMode_Wrap, aiTextureMapMode_Wrap
};
ai_real blend = 1.0;
if (mat.GetTexture(type, 0, &path, nullptr, nullptr, &blend, nullptr, map_mode) != AI_SUCCESS || !path.length) {
- return;
+ return false;
}
// TODO: handle embedded textures properly
if (path.data[0] == '*') {
- ASSIMP_LOG_ERROR("Ignoring embedded texture for export: " + std::string(path.C_Str()));
- return;
+ ASSIMP_LOG_ERROR("Ignoring embedded texture for export: ", path.C_Str());
+ return false;
}
ChunkWriter chunk(writer, chunk_flags);
@@ -401,6 +407,7 @@ void Discreet3DSExporter::WriteTexture(const aiMaterial &mat, aiTextureType type
writer.PutU2(val);
}
// TODO: export texture transformation (i.e. UV offset, scale, rotation)
+ return true;
}
// ------------------------------------------------------------------------------------------------
diff --git a/libs/assimp/code/AssetLib/3DS/3DSExporter.h b/libs/assimp/code/AssetLib/3DS/3DSExporter.h
index c48ecb2f..8ac3da98 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSExporter.h
+++ b/libs/assimp/code/AssetLib/3DS/3DSExporter.h
@@ -73,7 +73,7 @@ public:
private:
void WriteMeshes();
void WriteMaterials();
- void WriteTexture(const aiMaterial& mat, aiTextureType type, uint16_t chunk_flags);
+ bool WriteTexture(const aiMaterial& mat, aiTextureType type, uint16_t chunk_flags);
void WriteFaceMaterialChunk(const aiMesh& mesh);
int WriteHierarchy(const aiNode& node, int level, int sibling_level);
void WriteString(const std::string& s);
diff --git a/libs/assimp/code/AssetLib/3DS/3DSHelper.h b/libs/assimp/code/AssetLib/3DS/3DSHelper.h
index f3f9efb2..3a5479de 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSHelper.h
+++ b/libs/assimp/code/AssetLib/3DS/3DSHelper.h
@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include
#include
#include
-#include //sprintf
+#include //sprintf
namespace Assimp {
namespace D3DS {
@@ -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;
@@ -269,7 +259,7 @@ public:
// Specifies the file name of a texture
CHUNK_MAPFILE = 0xA300,
- // Specifies whether a materail requires two-sided rendering
+ // Specifies whether a material requires two-sided rendering
CHUNK_MAT_TWO_SIDE = 0xA081,
// ********************************************************************
@@ -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/libs/assimp/code/AssetLib/3DS/3DSLoader.cpp b/libs/assimp/code/AssetLib/3DS/3DSLoader.cpp
index 3dabf9da..05b5117b 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSLoader.cpp
+++ b/libs/assimp/code/AssetLib/3DS/3DSLoader.cpp
@@ -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;
@@ -299,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();
@@ -443,7 +449,7 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
// Read the lense angle
camera->mHorizontalFOV = AI_DEG_TO_RAD(stream->GetF4());
if (camera->mHorizontalFOV < 0.001f) {
- camera->mHorizontalFOV = AI_DEG_TO_RAD(45.f);
+ camera->mHorizontalFOV = float(AI_DEG_TO_RAD(45.f));
}
// Now check for further subchunks
@@ -928,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/libs/assimp/code/AssetLib/3DS/3DSLoader.h b/libs/assimp/code/AssetLib/3DS/3DSLoader.h
index 2091fbeb..bd167872 100644
--- a/libs/assimp/code/AssetLib/3DS/3DSLoader.h
+++ b/libs/assimp/code/AssetLib/3DS/3DSLoader.h
@@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AI_3DSIMPORTER_H_INC
#define AI_3DSIMPORTER_H_INC
+#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
#include
#include
-#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
#include "3DSHelper.h"
#include
@@ -75,14 +75,14 @@ public:
* See BaseImporter::CanRead() for details.
*/
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
- bool checkSig) const;
+ bool checkSig) const override;
// -------------------------------------------------------------------
/** Called prior to ReadFile().
* The function is a request to the importer to update its configuration
* basing on the Importer's configuration property list.
*/
- void SetupProperties(const Importer* pImp);
+ void SetupProperties(const Importer* pImp) override;
protected:
@@ -90,14 +90,14 @@ protected:
/** Return importer meta information.
* See #BaseImporter::GetInfo for the details
*/
- const aiImporterDesc* GetInfo () const;
+ const aiImporterDesc* GetInfo () const override;
// -------------------------------------------------------------------
/** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details
*/
void InternReadFile( const std::string& pFile, aiScene* pScene,
- IOSystem* pIOHandler);
+ IOSystem* pIOHandler) override;
// -------------------------------------------------------------------
/** Converts a temporary material to the outer representation
@@ -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/libs/assimp/code/AssetLib/3MF/3MFTypes.h b/libs/assimp/code/AssetLib/3MF/3MFTypes.h
new file mode 100644
index 00000000..c4e9e424
--- /dev/null
+++ b/libs/assimp/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/libs/assimp/code/AssetLib/3MF/3MFXmlTags.h b/libs/assimp/code/AssetLib/3MF/3MFXmlTags.h
index 3996c60e..a6e9758c 100644
--- a/libs/assimp/code/AssetLib/3MF/3MFXmlTags.h
+++ b/libs/assimp/code/AssetLib/3MF/3MFXmlTags.h
@@ -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/libs/assimp/code/AssetLib/3MF/D3MFExporter.cpp b/libs/assimp/code/AssetLib/3MF/D3MFExporter.cpp
index 4a16a0ad..76a601cb 100644
--- a/libs/assimp/code/AssetLib/3MF/D3MFExporter.cpp
+++ b/libs/assimp/code/AssetLib/3MF/D3MFExporter.cpp
@@ -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=\"" + ai_to_string(matIdx) + "\" />";
- mModelOutput << std::endl;
+ 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/libs/assimp/code/AssetLib/3MF/D3MFExporter.h b/libs/assimp/code/AssetLib/3MF/D3MFExporter.h
index d2fc8248..df25e305 100644
--- a/libs/assimp/code/AssetLib/3MF/D3MFExporter.h
+++ b/libs/assimp/code/AssetLib/3MF/D3MFExporter.h
@@ -40,6 +40,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
+#ifndef ASSIMP_BUILD_NO_EXPORT
+#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
+
#include
#include
#include
@@ -58,8 +61,6 @@ class IOStream;
namespace D3MF {
-#ifndef ASSIMP_BUILD_NO_EXPORT
-#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
struct OpcPackageRelationship;
@@ -100,9 +101,11 @@ private:
std::vector mRelations;
};
-#endif // ASSIMP_BUILD_NO_3MF_EXPORTER
-#endif // ASSIMP_BUILD_NO_EXPORT
} // Namespace D3MF
} // Namespace Assimp
+#endif // ASSIMP_BUILD_NO_3MF_EXPORTER
+#endif // ASSIMP_BUILD_NO_EXPORT
+
+
diff --git a/libs/assimp/code/AssetLib/3MF/D3MFImporter.cpp b/libs/assimp/code/AssetLib/3MF/D3MFImporter.cpp
index f4ddb605..58dde973 100644
--- a/libs/assimp/code/AssetLib/3MF/D3MFImporter.cpp
+++ b/libs/assimp/code/AssetLib/3MF/D3MFImporter.cpp
@@ -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