Merge remote-tracking branch 'upstream/master'

pull/3194/head
RichardTea 2020-05-01 12:07:10 +01:00
commit e27f3791ab
8 changed files with 92 additions and 11 deletions

1
.github/FUNDING.yml vendored
View File

@ -1,2 +1,3 @@
patreon: assimp patreon: assimp
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4 custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4
open_collective: assimp

56
.github/workflows/sanitizer.yml vendored 100644
View File

@ -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

View File

@ -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. A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
### Current project status ### ### 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) ![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) [![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) [![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 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. 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)].
<a href="https://github.com/assimp/assimp/graphs/contributors"><img src="https://opencollective.com/assimp/contributors.svg?width=890&button=false" /></a>
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/assimp/contribute)]
#### Individuals
<a href="https://opencollective.com/assimp"><img src="https://opencollective.com/assimp/individuals.svg?width=890"></a>
#### 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)]
<a href="https://opencollective.com/assimp/organization/0/website"><img src="https://opencollective.com/assimp/organization/0/avatar.svg"></a>
### License ### ### License ###
Our license is based on the modified, __3-clause BSD__-License. Our license is based on the modified, __3-clause BSD__-License.

View File

@ -979,7 +979,7 @@ void GetArrayCopy(Type*& dest, ai_uint num ) {
dest = new Type[num]; dest = new Type[num];
::memcpy(dest, old, sizeof(Type) * num); ::memcpy(dest, old, sizeof(Type) * num);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src) { void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src) {
@ -1269,9 +1269,6 @@ void SceneCombiner::Copy(aiBone** _dest, const aiBone* src) {
// get a flat copy // get a flat copy
*dest = *src; *dest = *src;
// and reallocate all arrays
GetArrayCopy( dest->mWeights, dest->mNumWeights );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -3401,7 +3401,8 @@ void FBXConverter::ConvertGlobalSettings() {
mSceneOut->mMetaData->Set(5, "CoordAxisSign", doc.GlobalSettings().CoordAxisSign()); mSceneOut->mMetaData->Set(5, "CoordAxisSign", doc.GlobalSettings().CoordAxisSign());
mSceneOut->mMetaData->Set(6, "OriginalUpAxis", doc.GlobalSettings().OriginalUpAxis()); mSceneOut->mMetaData->Set(6, "OriginalUpAxis", doc.GlobalSettings().OriginalUpAxis());
mSceneOut->mMetaData->Set(7, "OriginalUpAxisSign", doc.GlobalSettings().OriginalUpAxisSign()); 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(9, "OriginalUnitScaleFactor", doc.GlobalSettings().OriginalUnitScaleFactor());
mSceneOut->mMetaData->Set(10, "AmbientColor", doc.GlobalSettings().AmbientColor()); mSceneOut->mMetaData->Set(10, "AmbientColor", doc.GlobalSettings().AmbientColor());
mSceneOut->mMetaData->Set(11, "FrameRate", (int)doc.GlobalSettings().TimeMode()); mSceneOut->mMetaData->Set(11, "FrameRate", (int)doc.GlobalSettings().TimeMode());

View File

@ -308,7 +308,10 @@ struct aiBone {
//! Copy constructor //! Copy constructor
aiBone(const aiBone &other) : aiBone(const aiBone &other) :
mName(other.mName), mNumWeights(other.mNumWeights), mWeights(nullptr), mOffsetMatrix(other.mOffsetMatrix) { mName(other.mName),
mNumWeights(other.mNumWeights),
mWeights(nullptr),
mOffsetMatrix(other.mOffsetMatrix) {
if (other.mWeights && other.mNumWeights) { if (other.mWeights && other.mNumWeights) {
mWeights = new aiVertexWeight[mNumWeights]; mWeights = new aiVertexWeight[mNumWeights];
::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight)); ::memcpy(mWeights, other.mWeights, mNumWeights * sizeof(aiVertexWeight));

View File

@ -320,7 +320,7 @@ struct aiMetadata {
} }
template <typename T> template <typename T>
inline bool Set( const std::string &key, const T &value ) { inline bool Set(const std::string &key, const T &value) {
if (key.empty()) { if (key.empty()) {
return false; return false;
} }

View File

@ -210,13 +210,13 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_NE(nullptr, scene->mMetaData); EXPECT_NE(nullptr, scene->mMetaData);
double factor(0.0); float factor(0.0f);
scene->mMetaData->Get("UnitScaleFactor", factor); 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); scene->mMetaData->Get("UnitScaleFactor", factor);
EXPECT_DOUBLE_EQ(1000.0, factor); EXPECT_EQ(1000.0f, factor);
} }
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) { TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {