diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index e0c2bec9e..84e3123fe 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,2 +1,3 @@
patreon: assimp
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4
+open_collective: assimp
diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
index 60bfba170..08292d55f 100644
--- a/.github/workflows/ccpp.yml
+++ b/.github/workflows/ccpp.yml
@@ -7,40 +7,53 @@ on:
branches: [ master ]
jobs:
- linux:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: configure
- run: cmake CMakeLists.txt
- - name: build
- run: cmake --build .
- - name: test
- run: cd bin && ./unit
-
- mac:
- runs-on: macos-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: configure
- run: cmake CMakeLists.txt
- - name: build
- run: cmake --build .
- - name: test
- run: cd bin && ./unit
+ job:
+ name: ${{ matrix.os }}-${{ matrix.cxx }}-build-and-test
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ name: [ubuntu-gcc, macos-clang, windows-msvc, ubuntu-clang]
+ # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
+ include:
+ - name: windows-msvc
+ os: windows-latest
+ cxx: cl.exe
+ cc: cl.exe
+ - name: ubuntu-clang
+ os: ubuntu-latest
+ cxx: clang++
+ cc: clang
+ - name: macos-clang
+ os: macos-latest
+ cxx: clang++
+ cc: clang
+ - name: ubuntu-gcc
+ os: ubuntu-latest
+ cxx: g++
+ cc: gcc
- windows:
- runs-on: windows-latest
-
steps:
- uses: actions/checkout@v2
- - name: configure
- run: cmake CMakeLists.txt
- - name: build
- run: cmake --build . --config Release
+
+ - uses: lukka/get-cmake@latest
+
+ - uses: ilammy/msvc-dev-cmd@v1
+
+ - uses: lukka/set-shell-env@v1
+ with:
+ CXX: ${{ matrix.cxx }}
+ CC: ${{ matrix.cc }}
+
+ - name: configure and build
+ uses: lukka/run-cmake@v2
+ with:
+ cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
+ cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
+ cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release'
+ buildWithCMakeArgs: '-- -v'
+ buildDirectory: '${{ github.workspace }}/build/'
+
- name: test
- run: |
- cd bin\Release
- .\unit
+ run: cd build/bin && ./unit
+ shell: bash
diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml
new file mode 100644
index 000000000..9bba5f6fd
--- /dev/null
+++ b/.github/workflows/sanitizer.yml
@@ -0,0 +1,56 @@
+name: C/C++ Sanitizer
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ job1:
+ name: adress-sanitizer
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: lukka/get-cmake@latest
+ - uses: lukka/set-shell-env@v1
+ with:
+ CXX: clang++
+ CC: clang
+
+ - name: configure and build
+ uses: lukka/run-cmake@v2
+ with:
+ cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
+ cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
+ cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Debug -DASSIMP_ASAN=ON'
+ buildWithCMakeArgs: '-- -v'
+ buildDirectory: '${{ github.workspace }}/build/'
+
+ - name: test
+ run: cd build/bin && ./unit
+ shell: bash
+
+ job2:
+ name: undefined-behavior-sanitizer
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: lukka/get-cmake@latest
+ - uses: lukka/set-shell-env@v1
+ with:
+ CXX: clang++
+ CC: clang
+
+ - name: configure and build
+ uses: lukka/run-cmake@v2
+ with:
+ cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
+ cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
+ cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Debug -DASSIMP_UBSAN=ON'
+ buildWithCMakeArgs: '-- -v'
+ buildDirectory: '${{ github.workspace }}/build/'
+
+ - name: test
+ run: cd build/bin && ./unit
+ shell: bash
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3bfd5800f..c631b7685 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,22 +239,14 @@ IF( UNIX )
INCLUDE(GNUInstallDirs)
ENDIF()
-# enable warnings as errors ########################################
-IF (MSVC)
- ADD_COMPILE_OPTIONS(/WX)
-ELSE()
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
-ENDIF()
-
# Grouped compiler settings ########################################
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
IF(NOT ASSIMP_HUNTER_ENABLED)
- SET(CMAKE_CXX_FLAGS "-fPIC -std=c++0x ${CMAKE_CXX_FLAGS}")
- SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
+ SET(CMAKE_CXX_STANDARD 11)
+ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
# hide all not-exported symbols
- SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
SET(LIBSTDC++_LIBRARIES -lstdc++)
ELSEIF(MSVC)
@@ -267,10 +259,10 @@ ELSEIF(MSVC)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED)
- SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
- SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
+ SET(CMAKE_CXX_STANDARD 11)
+ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
- SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
+ SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ELSEIF( CMAKE_COMPILER_IS_MINGW )
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
diff --git a/Readme.md b/Readme.md
index 61fff538f..15e76b9d2 100644
--- a/Readme.md
+++ b/Readme.md
@@ -2,6 +2,7 @@ Open Asset Import Library (assimp)
==================================
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
### Current project status ###
+[![Financial Contributors on Open Collective](https://opencollective.com/assimp/all/badge.svg?label=financial+contributors)](https://opencollective.com/assimp)
![C/C++ CI](https://github.com/assimp/assimp/workflows/C/C++%20CI/badge.svg)
[![Linux Build Status](https://travis-ci.org/assimp/assimp.svg)](https://travis-ci.org/assimp/assimp)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp)
@@ -179,6 +180,28 @@ And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/a
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
a pull request with your changes against the main repository's `master` branch.
+## Contributors
+
+### Code Contributors
+
+This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
+
+
+
+### Financial Contributors
+
+Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/assimp/contribute)]
+
+#### Individuals
+
+
+
+#### Organizations
+
+Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/assimp/contribute)]
+
+
+
### License ###
Our license is based on the modified, __3-clause BSD__-License.
diff --git a/code/ASE/ASEParser.cpp b/code/ASE/ASEParser.cpp
index efc6ecd0d..72e8b3373 100644
--- a/code/ASE/ASEParser.cpp
+++ b/code/ASE/ASEParser.cpp
@@ -142,11 +142,11 @@ void Parser::LogWarning(const char* szWarn)
{
ai_assert(NULL != szWarn);
- char szTemp[1024];
+ char szTemp[2048];
#if _MSC_VER >= 1400
sprintf_s(szTemp, "Line %u: %s",iLineNumber,szWarn);
#else
- ai_snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn);
+ ai_snprintf(szTemp,sizeof(szTemp),"Line %u: %s",iLineNumber,szWarn);
#endif
// output the warning to the logger ...
diff --git a/code/Blender/BlenderBMesh.cpp b/code/Blender/BlenderBMesh.cpp
index 039302e12..937d9d073 100644
--- a/code/Blender/BlenderBMesh.cpp
+++ b/code/Blender/BlenderBMesh.cpp
@@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Conversion of Blender's new BMesh stuff
*/
-
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
#include "BlenderDNA.h"
@@ -181,6 +180,7 @@ void BlenderBMeshConverter::AddFace( int v1, int v2, int v3, int v4 )
face.v2 = v2;
face.v3 = v3;
face.v4 = v4;
+ face.flag = 0;
// TODO - Work out how materials work
face.mat_nr = 0;
triMesh->mface.push_back( face );
diff --git a/code/CApi/AssimpCExport.cpp b/code/CApi/AssimpCExport.cpp
index 137cc2894..a6e7a304f 100644
--- a/code/CApi/AssimpCExport.cpp
+++ b/code/CApi/AssimpCExport.cpp
@@ -73,11 +73,11 @@ ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index)
aiExportFormatDesc *desc = new aiExportFormatDesc;
desc->description = new char[ strlen( orig->description ) + 1 ]();
- ::strncpy( (char*) desc->description, orig->description, strlen( orig->description ) );
+ ::memcpy( (char*) desc->description, orig->description, strlen( orig->description ) );
desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ]();
- ::strncpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) );
+ ::memcpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) );
desc->id = new char[ strlen( orig->id ) + 1 ]();
- ::strncpy( ( char* ) desc->id, orig->id, strlen( orig->id ) );
+ ::memcpy( ( char* ) desc->id, orig->id, strlen( orig->id ) );
return desc;
}
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index 49583c0c8..6afed40f9 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -1134,6 +1134,13 @@ ENDIF ()
ADD_LIBRARY( assimp ${assimp_src} )
ADD_LIBRARY(assimp::assimp ALIAS assimp)
+# enable warnings as errors ########################################
+IF (MSVC)
+ TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
+ELSE()
+ TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)
+ENDIF()
+
TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
$
$
diff --git a/code/Common/SceneCombiner.cpp b/code/Common/SceneCombiner.cpp
index b7511ff4e..4d2a411f2 100644
--- a/code/Common/SceneCombiner.cpp
+++ b/code/Common/SceneCombiner.cpp
@@ -1065,7 +1065,7 @@ void SceneCombiner::Copy( aiMesh** _dest, const aiMesh* src ) {
aiMesh* dest = *_dest = new aiMesh();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiMesh));
+ *dest = *src;
// and reallocate all arrays
GetArrayCopy( dest->mVertices, dest->mNumVertices );
@@ -1104,7 +1104,7 @@ void SceneCombiner::Copy(aiAnimMesh** _dest, const aiAnimMesh* src) {
aiAnimMesh* dest = *_dest = new aiAnimMesh();
// get a flat copy
- ::memcpy(dest, src, sizeof(aiAnimMesh));
+ *dest = *src;
// and reallocate all arrays
GetArrayCopy(dest->mVertices, dest->mNumVertices);
@@ -1161,7 +1161,7 @@ void SceneCombiner::Copy(aiTexture** _dest, const aiTexture* src) {
aiTexture* dest = *_dest = new aiTexture();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiTexture));
+ *dest = *src;
// and reallocate all arrays. We must do it manually here
const char* old = (const char*)dest->pcData;
@@ -1191,7 +1191,7 @@ void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src ) {
aiAnimation* dest = *_dest = new aiAnimation();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiAnimation));
+ *dest = *src;
// and reallocate all arrays
CopyPtrArray( dest->mChannels, src->mChannels, dest->mNumChannels );
@@ -1207,7 +1207,7 @@ void SceneCombiner::Copy(aiNodeAnim** _dest, const aiNodeAnim* src) {
aiNodeAnim* dest = *_dest = new aiNodeAnim();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiNodeAnim));
+ *dest = *src;
// and reallocate all arrays
GetArrayCopy( dest->mPositionKeys, dest->mNumPositionKeys );
@@ -1223,7 +1223,7 @@ void SceneCombiner::Copy(aiMeshMorphAnim** _dest, const aiMeshMorphAnim* src) {
aiMeshMorphAnim* dest = *_dest = new aiMeshMorphAnim();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiMeshMorphAnim));
+ *dest = *src;
// and reallocate all arrays
GetArrayCopy( dest->mKeys, dest->mNumKeys );
@@ -1244,7 +1244,7 @@ void SceneCombiner::Copy( aiCamera** _dest,const aiCamera* src) {
aiCamera* dest = *_dest = new aiCamera();
// get a flat copy, that's already OK
- ::memcpy(dest,src,sizeof(aiCamera));
+ *dest = *src;
}
// ------------------------------------------------------------------------------------------------
@@ -1256,7 +1256,7 @@ void SceneCombiner::Copy(aiLight** _dest, const aiLight* src) {
aiLight* dest = *_dest = new aiLight();
// get a flat copy, that's already OK
- ::memcpy(dest,src,sizeof(aiLight));
+ *dest = *src;
}
// ------------------------------------------------------------------------------------------------
@@ -1268,10 +1268,7 @@ void SceneCombiner::Copy(aiBone** _dest, const aiBone* src) {
aiBone* dest = *_dest = new aiBone();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiBone));
-
- // and reallocate all arrays
- GetArrayCopy( dest->mWeights, dest->mNumWeights );
+ *dest = *src;
}
// ------------------------------------------------------------------------------------------------
@@ -1282,7 +1279,7 @@ void SceneCombiner::Copy (aiNode** _dest, const aiNode* src)
aiNode* dest = *_dest = new aiNode();
// get a flat copy
- ::memcpy(dest,src,sizeof(aiNode));
+ *dest = *src;
if (src->mMetaData) {
Copy(&dest->mMetaData, src->mMetaData);
diff --git a/code/FBX/FBXConverter.cpp b/code/FBX/FBXConverter.cpp
index 880b5de76..1bf977189 100644
--- a/code/FBX/FBXConverter.cpp
+++ b/code/FBX/FBXConverter.cpp
@@ -3401,7 +3401,8 @@ void FBXConverter::ConvertGlobalSettings() {
mSceneOut->mMetaData->Set(5, "CoordAxisSign", doc.GlobalSettings().CoordAxisSign());
mSceneOut->mMetaData->Set(6, "OriginalUpAxis", doc.GlobalSettings().OriginalUpAxis());
mSceneOut->mMetaData->Set(7, "OriginalUpAxisSign", doc.GlobalSettings().OriginalUpAxisSign());
- mSceneOut->mMetaData->Set(8, "UnitScaleFactor", (double)doc.GlobalSettings().UnitScaleFactor());
+ //const double unitScaleFactor = (double)doc.GlobalSettings().UnitScaleFactor();
+ mSceneOut->mMetaData->Set(8, "UnitScaleFactor", doc.GlobalSettings().UnitScaleFactor());
mSceneOut->mMetaData->Set(9, "OriginalUnitScaleFactor", doc.GlobalSettings().OriginalUnitScaleFactor());
mSceneOut->mMetaData->Set(10, "AmbientColor", doc.GlobalSettings().AmbientColor());
mSceneOut->mMetaData->Set(11, "FrameRate", (int)doc.GlobalSettings().TimeMode());
diff --git a/code/M3D/m3d.h b/code/M3D/m3d.h
index 83c8d8a52..75bcdfeb7 100644
--- a/code/M3D/m3d.h
+++ b/code/M3D/m3d.h
@@ -1556,7 +1556,7 @@ static int _m3dstbi__create_png_image(_m3dstbi__png *a, unsigned char *image_dat
return 1;
}
-static int _m3dstbi__compute_transparency(_m3dstbi__png *z, unsigned char tc[3], int out_n) {
+static int _m3dstbi__compute_transparency(_m3dstbi__png *z, unsigned char* tc, int out_n) {
_m3dstbi__context *s = z->s;
_m3dstbi__uint32 i, pixel_count = s->img_x * s->img_y;
unsigned char *p = z->out;
@@ -1639,7 +1639,7 @@ static int _m3dstbi__expand_png_palette(_m3dstbi__png *a, unsigned char *palette
static int _m3dstbi__parse_png_file(_m3dstbi__png *z, int scan, int req_comp) {
unsigned char palette[1024], pal_img_n = 0;
- unsigned char has_trans = 0, tc[3];
+ unsigned char has_trans = 0, tc[3] = {};
_m3dstbi__uint16 tc16[3];
_m3dstbi__uint32 ioff = 0, idata_limit = 0, i, pal_len = 0;
int first = 1, k, interlace = 0, color = 0;
@@ -4350,7 +4350,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size
M3D_INDEX last, *vrtxidx = NULL, *mtrlidx = NULL, *tmapidx = NULL, *skinidx = NULL;
uint32_t idx, numcmap = 0, *cmap = NULL, numvrtx = 0, maxvrtx = 0, numtmap = 0, maxtmap = 0, numproc = 0;
uint32_t numskin = 0, maxskin = 0, numstr = 0, maxt = 0, maxbone = 0, numgrp = 0, maxgrp = 0, *grpidx = NULL;
- uint8_t *opa;
+ uint8_t *opa = nullptr;
m3dcd_t *cd;
m3dc_t *cmd;
m3dstr_t *str = NULL;
diff --git a/code/glTF/glTFAsset.h b/code/glTF/glTFAsset.h
index cd2e3166b..9673624f5 100644
--- a/code/glTF/glTFAsset.h
+++ b/code/glTF/glTFAsset.h
@@ -382,7 +382,12 @@ namespace glTF
{
friend struct Accessor;
- Accessor& accessor;
+ // This field is reported as not used, making it protectd is the easiest way to work around it without going to the bottom of what the problem is:
+ // ../code/glTF2/glTF2Asset.h:392:19: error: private field 'accessor' is not used [-Werror,-Wunused-private-field]
+ protected:
+ Accessor &accessor;
+
+ private:
uint8_t* data;
size_t elemSize, stride;
diff --git a/code/glTF2/glTF2Asset.h b/code/glTF2/glTF2Asset.h
index a78d6b53a..f9add768e 100644
--- a/code/glTF2/glTF2Asset.h
+++ b/code/glTF2/glTF2Asset.h
@@ -389,12 +389,18 @@ struct Accessor : public Object {
class Indexer {
friend struct Accessor;
+ // This field is reported as not used, making it protectd is the easiest way to work around it without going to the bottom of what the problem is:
+ // ../code/glTF2/glTF2Asset.h:392:19: error: private field 'accessor' is not used [-Werror,-Wunused-private-field]
+ protected:
Accessor &accessor;
+
+ private:
uint8_t *data;
size_t elemSize, stride;
Indexer(Accessor &acc);
-
+
+
public:
//! Accesses the i-th value as defined by the accessor
template
diff --git a/contrib/irrXML/irrString.h b/contrib/irrXML/irrString.h
index 1abf22b78..246348891 100644
--- a/contrib/irrXML/irrString.h
+++ b/contrib/irrXML/irrString.h
@@ -635,9 +635,6 @@ private:
s32 amount = used < new_size ? used : new_size;
for (s32 i=0; i
- inline bool Set( const std::string &key, const T &value ) {
+ inline bool Set(const std::string &key, const T &value) {
if (key.empty()) {
return false;
}
diff --git a/test/unit/utFBXImporterExporter.cpp b/test/unit/utFBXImporterExporter.cpp
index 88a3e067e..2f1ea79e8 100644
--- a/test/unit/utFBXImporterExporter.cpp
+++ b/test/unit/utFBXImporterExporter.cpp
@@ -210,13 +210,13 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
EXPECT_NE(nullptr, scene);
EXPECT_NE(nullptr, scene->mMetaData);
- double factor(0.0);
+ float factor(0.0f);
scene->mMetaData->Get("UnitScaleFactor", factor);
- EXPECT_DOUBLE_EQ(500.0, factor);
+ EXPECT_EQ(500.0f, factor);
- scene->mMetaData->Set("UnitScaleFactor", factor * 2);
+ scene->mMetaData->Set("UnitScaleFactor", factor * 2.0f);
scene->mMetaData->Get("UnitScaleFactor", factor);
- EXPECT_DOUBLE_EQ(1000.0, factor);
+ EXPECT_EQ(1000.0f, factor);
}
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {