Skip to content

Commit

Permalink
Merge branch 'master' into thomasbiang-fix_issue_joinIdenticalVertice…
Browse files Browse the repository at this point in the history
…s_notNeeded
  • Loading branch information
kimkulling committed Sep 7, 2019
2 parents 336ae0e + c1d4549 commit f8bcd7c
Show file tree
Hide file tree
Showing 51 changed files with 1,671 additions and 377 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -1 +1,2 @@
patreon: assimp
ko_fi: kimkulling
6 changes: 3 additions & 3 deletions CMakeLists.txt
Expand Up @@ -173,7 +173,6 @@ SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VER
SET (ASSIMP_SOVERSION 5)

SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )

if(NOT HUNTER_ENABLED)
# Enable C++11 support globally
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
Expand Down Expand Up @@ -254,6 +253,7 @@ ELSEIF(MSVC)
IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351)
ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob2 /DEBUG:FULL /Zi")
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
IF(NOT HUNTER_ENABLED)
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
Expand All @@ -271,7 +271,7 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW )
SET(CMAKE_CXX_FLAGS "-std=c++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 ${CMAKE_CXX_FLAGS}")
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()
Expand Down Expand Up @@ -341,7 +341,7 @@ SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING

get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)

IF (INJECT_DEBUG_POSTFIX AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
IF (INJECT_DEBUG_POSTFIX AND (is_multi_config OR CMAKE_BUILD_TYPE STREQUAL "Debug"))
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfix for lib, samples and tools")
ELSE()
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Debug Postfix for lib, samples and tools")
Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Expand Up @@ -14,7 +14,6 @@ matrix:
fast_finish: true

image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017

Expand All @@ -27,7 +26,6 @@ configuration: Release
install:
- set PATH=C:\Ruby24-x64\bin;%PATH%
- set CMAKE_DEFINES -DASSIMP_WERROR=ON
- 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 "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
Expand Down
2 changes: 1 addition & 1 deletion code/AMF/AMFImporter.cpp
Expand Up @@ -83,7 +83,7 @@ void AMFImporter::Clear()
mMaterial_Converted.clear();
mTexture_Converted.clear();
// Delete all elements
if(mNodeElement_List.size())
if(!mNodeElement_List.empty())
{
for(CAMFImporter_NodeElement* ne: mNodeElement_List) { delete ne; }

Expand Down
26 changes: 13 additions & 13 deletions code/AMF/AMFImporter_Postprocess.cpp
Expand Up @@ -66,7 +66,7 @@ aiColor4D AMFImporter::SPP_Material::GetColor(const float /*pX*/, const float /*
aiColor4D tcol;

// Check if stored data are supported.
if(Composition.size() != 0)
if(!Composition.empty())
{
throw DeadlyImportError("IME. GetColor for composition");
}
Expand Down Expand Up @@ -321,7 +321,7 @@ void AMFImporter::PostprocessHelper_SplitFacesByTextureID(std::list<SComplexFace
};

pOutputList_Separated.clear();
if(pInputList.size() == 0) return;
if(pInputList.empty()) return;

do
{
Expand All @@ -334,19 +334,19 @@ void AMFImporter::PostprocessHelper_SplitFacesByTextureID(std::list<SComplexFace
{
auto it_old = it;

it++;
++it;
face_list_cur.push_back(*it_old);
pInputList.erase(it_old);
}
else
{
it++;
++it;
}
}

if(face_list_cur.size() > 0) pOutputList_Separated.push_back(face_list_cur);
if(!face_list_cur.empty()) pOutputList_Separated.push_back(face_list_cur);

} while(pInputList.size() > 0);
} while(!pInputList.empty());
}

void AMFImporter::Postprocess_AddMetadata(const std::list<CAMFImporter_NodeElement_Metadata*>& metadataList, aiNode& sceneNode) const
Expand Down Expand Up @@ -712,7 +712,7 @@ std::list<unsigned int> mesh_idx;
}// for(const CAMFImporter_NodeElement* ne_child: pNodeElement.Child)

// if meshes was created then assign new indices with current aiNode
if(mesh_idx.size() > 0)
if(!mesh_idx.empty())
{
std::list<unsigned int>::const_iterator mit = mesh_idx.begin();

Expand Down Expand Up @@ -787,7 +787,7 @@ std::list<aiNode*> ch_node;
}// for(const CAMFImporter_NodeElement* ne: pConstellation.Child)

// copy found aiNode's as children
if(ch_node.size() == 0) throw DeadlyImportError("<constellation> must have at least one <instance>.");
if(ch_node.empty()) throw DeadlyImportError("<constellation> must have at least one <instance>.");

size_t ch_idx = 0;

Expand Down Expand Up @@ -883,13 +883,13 @@ std::list<CAMFImporter_NodeElement_Metadata*> meta_list;
if(node_list.size() > 1)
{
// walk through all nodes
for(std::list<aiNode*>::iterator nl_it = node_list.begin(); nl_it != node_list.end(); nl_it++)
for(std::list<aiNode*>::iterator nl_it = node_list.begin(); nl_it != node_list.end(); ++nl_it)
{
// and try to find them in another top nodes.
std::list<aiNode*>::const_iterator next_it = nl_it;

next_it++;
for(; next_it != node_list.end(); next_it++)
++next_it;
for(; next_it != node_list.end(); ++next_it)
{
if((*next_it)->FindNode((*nl_it)->mName) != nullptr)
{
Expand All @@ -907,7 +907,7 @@ std::list<CAMFImporter_NodeElement_Metadata*> meta_list;
//
//
// Nodes
if(node_list.size() > 0)
if(!node_list.empty())
{
std::list<aiNode*>::const_iterator nl_it = node_list.begin();

Expand All @@ -924,7 +924,7 @@ std::list<CAMFImporter_NodeElement_Metadata*> meta_list;

//
// Meshes
if(mesh_list.size() > 0)
if(!mesh_list.empty())
{
std::list<aiMesh*>::const_iterator ml_it = mesh_list.begin();

Expand Down
4 changes: 2 additions & 2 deletions code/Collada/ColladaLoader.cpp
Expand Up @@ -588,7 +588,7 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser& pParser, const Colla

// ------------------------------------------------------------------------------------------------
// Find mesh from either meshes or morph target meshes
aiMesh *ColladaLoader::findMesh(std::string meshid) {
aiMesh *ColladaLoader::findMesh(const std::string& meshid) {
for (unsigned int i = 0; i < mMeshes.size(); ++i) {
if (std::string(mMeshes[i]->mName.data) == meshid) {
return mMeshes[i];
Expand Down Expand Up @@ -688,7 +688,7 @@ aiMesh* ColladaLoader::CreateMesh(const ColladaParser& pParser, const Collada::M
Collada::MorphMethod method = Collada::Normalized;

for (std::map<std::string, Collada::Controller>::const_iterator it = pParser.mControllerLibrary.begin();
it != pParser.mControllerLibrary.end(); it++) {
it != pParser.mControllerLibrary.end(); ++it) {
const Collada::Controller &c = it->second;
const Collada::Mesh* baseMesh = pParser.ResolveLibraryReference(pParser.mMeshLibrary, c.mMeshId);

Expand Down
2 changes: 1 addition & 1 deletion code/Collada/ColladaLoader.h
Expand Up @@ -120,7 +120,7 @@ class ColladaLoader : public BaseImporter
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
aiNode* pTarget);

aiMesh *findMesh(std::string meshid);
aiMesh *findMesh(const std::string& meshid);

/** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */
aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
Expand Down
27 changes: 25 additions & 2 deletions code/Common/BaseImporter.cpp
Expand Up @@ -76,9 +76,25 @@ BaseImporter::~BaseImporter() {
// nothing to do here
}

void BaseImporter::UpdateImporterScale( Importer* pImp )
{
ai_assert(pImp != nullptr);
ai_assert(importerScale != 0.0);
ai_assert(fileScale != 0.0);

double activeScale = importerScale * fileScale;

// Set active scaling
pImp->SetPropertyFloat( AI_CONFIG_APP_SCALE_KEY, activeScale);

ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: %f", activeScale );
}

// ------------------------------------------------------------------------------------------------
// Imports the given file and returns the imported data.
aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) {
aiScene* BaseImporter::ReadFile(Importer* pImp, const std::string& pFile, IOSystem* pIOHandler) {


m_progress = pImp->GetProgressHandler();
if (nullptr == m_progress) {
return nullptr;
Expand All @@ -100,6 +116,11 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
{
InternReadFile( pFile, sc.get(), &filter);

// Calculate import scale hook - required because pImp not available anywhere else
// passes scale into ScaleProcess
UpdateImporterScale(pImp);


} catch( const std::exception& err ) {
// extract error description
m_ErrorText = err.what();
Expand All @@ -112,7 +133,7 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
}

// ------------------------------------------------------------------------------------------------
void BaseImporter::SetupProperties(const Importer* /*pImp*/)
void BaseImporter::SetupProperties(const Importer* pImp)
{
// the default implementation does nothing
}
Expand Down Expand Up @@ -588,6 +609,8 @@ aiScene* BatchLoader::GetImport( unsigned int which )
return nullptr;
}



// ------------------------------------------------------------------------------------------------
void BatchLoader::LoadAll()
{
Expand Down

0 comments on commit f8bcd7c

Please sign in to comment.