Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/assimp/assimp
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Oct 7, 2023
2 parents d65049a + 5b8cfa9 commit 3dd8327
Show file tree
Hide file tree
Showing 315 changed files with 83,410 additions and 26,435 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
toolchain: ninja-vs-win64-cxx17

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -69,7 +69,7 @@ jobs:

- name: Checkout Hunter toolchains
if: endsWith(matrix.name, 'hunter')
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: cpp-pm/polly
path: cmake/polly
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
IF(ASSIMP_HUNTER_ENABLED)
include("cmake-modules/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.24.17.tar.gz"
SHA1 "e6396699e414120e32557fe92db097b7655b760b"
URL "https://github.com/cpp-pm/hunter/archive/v0.24.18.tar.gz"
SHA1 "1292e4d661e1770d6d6ca08c12c07cf34a0bf718"
)
add_definitions(-DASSIMP_USE_HUNTER)
ENDIF()

PROJECT(Assimp VERSION 5.2.5)
PROJECT(Assimp VERSION 5.3.0)

# All supported options ###############################################

Expand Down Expand Up @@ -258,7 +258,7 @@ IF( UNIX )
ENDIF()

# Grouped compiler settings ########################################
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW)
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU)
IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()
Expand Down Expand Up @@ -777,7 +777,7 @@ IF ( ASSIMP_INSTALL )
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
SET(cPACK_DEBIAN_PACKAGE_NAME "assimp")
SET(CPACK_DEBIAN_PACKAGE_NAME "assimp")
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest contrib/zlib workspaces test doc obj samples packaging)
SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
SET(CPACK_DEBIAN_CHANGELOG)
Expand Down
10 changes: 5 additions & 5 deletions code/AssetLib/MD5/MD5Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2023, assimp team
All rights reserved.
Expand Down Expand Up @@ -87,15 +87,15 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b

// ------------------------------------------------------------------------------------------------
// Report error to the log stream
/*static*/ AI_WONT_RETURN void MD5Parser::ReportError(const char *error, unsigned int line) {
AI_WONT_RETURN void MD5Parser::ReportError(const char *error, unsigned int line) {
char szBuffer[1024];
::ai_snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, error);
throw DeadlyImportError(szBuffer);
}

// ------------------------------------------------------------------------------------------------
// Report warning to the log stream
/*static*/ void MD5Parser::ReportWarning(const char *warn, unsigned int line) {
void MD5Parser::ReportWarning(const char *warn, unsigned int line) {
char szBuffer[1024];
::snprintf(szBuffer, sizeof(szBuffer), "[MD5] Line %u: %s", line, warn);
ASSIMP_LOG_WARN(szBuffer);
Expand All @@ -122,8 +122,8 @@ void MD5Parser::ParseHeader() {
// print the command line options to the console
// FIX: can break the log length limit, so we need to be careful
char *sz = buffer;
while (!IsLineEnd(*buffer++))
;
while (!IsLineEnd(*buffer++));

ASSIMP_LOG_INFO(std::string(sz, std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer - sz))));
SkipSpacesAndLineEnd();
}
Expand Down
62 changes: 33 additions & 29 deletions code/AssetLib/MD5/MD5Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2023, assimp team
All rights reserved.
Expand Down Expand Up @@ -93,7 +92,7 @@ struct Section {
std::string mName;

//! For global elements: the value of the element as string
//! Iif !length() the section is not a global element
//! if !length() the section is not a global element
std::string mGlobalValue;
};

Expand Down Expand Up @@ -185,7 +184,7 @@ using FrameList = std::vector<FrameDesc>;
*/
struct VertexDesc {
VertexDesc() AI_NO_EXCEPT
: mFirstWeight(0), mNumWeights(0) {
: mFirstWeight(0), mNumWeights(0) {
// empty
}

Expand Down Expand Up @@ -349,62 +348,61 @@ class MD5Parser {
*/
MD5Parser(char* buffer, unsigned int fileSize);


// -------------------------------------------------------------------
/** Report a specific error message and throw an exception
* @param error Error message to be reported
* @param line Index of the line where the error occurred
*/
AI_WONT_RETURN static void ReportError (const char* error, unsigned int line) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN static void ReportError(const char* error, unsigned int line) AI_WONT_RETURN_SUFFIX;

// -------------------------------------------------------------------
/** Report a specific warning
* @param warn Warn message to be reported
* @param line Index of the line where the error occurred
*/
static void ReportWarning (const char* warn, unsigned int line);

static void ReportWarning(const char* warn, unsigned int line);

// -------------------------------------------------------------------
/** Report a specific error
* @param error Error message to be reported
*/
AI_WONT_RETURN void ReportError (const char* error) AI_WONT_RETURN_SUFFIX;

void ReportWarning (const char* warn) {
return ReportWarning(warn, lineNumber);
}
// -------------------------------------------------------------------
/** Report a specific warning
* @param error Warn message to be reported
*/
void ReportWarning (const char* warn);

//! List of all sections which have been read
SectionList mSections;

private:
// -------------------------------------------------------------------
/** Parses a file section. The current file pointer must be outside
* of a section.
* @param out Receives the section data
* @return true if the end of the file has been reached
* @throws ImportErrorException if an error occurs
*/
bool ParseSection(Section& out);

// -------------------------------------------------------------------
/** Parses the file header
* @throws ImportErrorException if an error occurs
*/
void ParseHeader();

bool SkipLine(const char* in, const char** out);
bool SkipLine( );
bool SkipSpacesAndLineEnd( const char* in, const char** out);
bool SkipSpacesAndLineEnd();
bool SkipSpaces();

private:
char* buffer;
char* bufferEnd;
unsigned int fileSize;
unsigned int lineNumber;
};

// -------------------------------------------------------------------
inline void MD5Parser::ReportWarning (const char* warn) {
return ReportWarning(warn, lineNumber);
}

// -------------------------------------------------------------------
inline void MD5Parser::ReportError(const char* error) {
ReportError(error, lineNumber);
}

// -------------------------------------------------------------------
inline bool MD5Parser::SkipLine(const char* in, const char** out) {
++lineNumber;
Expand All @@ -418,18 +416,24 @@ inline bool MD5Parser::SkipLine( ) {

// -------------------------------------------------------------------
inline bool MD5Parser::SkipSpacesAndLineEnd( const char* in, const char** out) {
bool bHad = false;
bool running = true;
if (in == bufferEnd) {
*out = in;
return false;
}

bool bHad = false, running = true;
while (running) {
if( *in == '\r' || *in == '\n') {
// we open files in binary mode, so there could be \r\n sequences ...
// we open files in binary mode, so there could be \r\n sequences ...
if (!bHad) {
bHad = true;
++lineNumber;
}
} else if (*in == '\t' || *in == ' ') {
bHad = false;
} else {
break;
}
else if (*in == '\t' || *in == ' ')bHad = false;
else break;
++in;
if (in == bufferEnd) {
break;
Expand Down
36 changes: 23 additions & 13 deletions code/Common/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2023, assimp team
All rights reserved.
Expand Down Expand Up @@ -49,10 +49,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// --------------------------------------------------------------------------------
// Legal information string - don't remove this.
static const char *LEGAL_INFORMATION =
static constexpr char LEGAL_INFORMATION[] =
"Open Asset Import Library (Assimp).\n"
"A free C/C++ library to import various 3D file formats into applications\n\n"
"(c) 2006-2022, Assimp team\n"
"(c) 2006-2023, Assimp team\n"
"License under the terms and conditions of the 3-clause BSD license\n"
"https://www.assimp.org\n";

Expand Down Expand Up @@ -150,9 +150,11 @@ ASSIMP_API aiScene::~aiScene() {
// To make sure we won't crash if the data is invalid it's
// much better to check whether both mNumXXX and mXXX are
// valid instead of relying on just one of them.
if (mNumMeshes && mMeshes)
for (unsigned int a = 0; a < mNumMeshes; a++)
if (mNumMeshes && mMeshes) {
for (unsigned int a = 0; a < mNumMeshes; ++a) {
delete mMeshes[a];
}
}
delete[] mMeshes;

if (mNumMaterials && mMaterials) {
Expand All @@ -162,24 +164,32 @@ ASSIMP_API aiScene::~aiScene() {
}
delete[] mMaterials;

if (mNumAnimations && mAnimations)
for (unsigned int a = 0; a < mNumAnimations; a++)
if (mNumAnimations && mAnimations) {
for (unsigned int a = 0; a < mNumAnimations; ++a) {
delete mAnimations[a];
}
}
delete[] mAnimations;

if (mNumTextures && mTextures)
for (unsigned int a = 0; a < mNumTextures; a++)
if (mNumTextures && mTextures) {
for (unsigned int a = 0; a < mNumTextures; ++a) {
delete mTextures[a];
}
}
delete[] mTextures;

if (mNumLights && mLights)
for (unsigned int a = 0; a < mNumLights; a++)
if (mNumLights && mLights) {
for (unsigned int a = 0; a < mNumLights; ++a) {
delete mLights[a];
}
}
delete[] mLights;

if (mNumCameras && mCameras)
for (unsigned int a = 0; a < mNumCameras; a++)
if (mNumCameras && mCameras) {
for (unsigned int a = 0; a < mNumCameras; ++a) {
delete mCameras[a];
}
}
delete[] mCameras;

aiMetadata::Dealloc(mMetaData);
Expand Down
5 changes: 3 additions & 2 deletions code/PostProcessing/FindInvalidDataProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team
Copyright (c) 2006-2023, assimp team
All rights reserved.
Expand Down Expand Up @@ -273,7 +273,8 @@ void FindInvalidDataProcess::ProcessAnimation(aiAnimation *anim) {
void FindInvalidDataProcess::ProcessAnimationChannel(aiNodeAnim *anim) {
ai_assert(nullptr != anim);
if (anim->mNumPositionKeys == 0 && anim->mNumRotationKeys == 0 && anim->mNumScalingKeys == 0) {
ai_assert_entry();
ASSIMP_LOG_ERROR("Invalid node anuimation instance detected.");

return;
}

Expand Down
3 changes: 1 addition & 2 deletions code/PostProcessing/GenVertexNormalsProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
Expand Down Expand Up @@ -109,6 +107,7 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals(aiMesh *pMesh, unsigned int m
return false;
}
delete[] pMesh->mNormals;
pMesh->mNormals = nullptr;
}

// If the mesh consists of lines and/or points but not of
Expand Down

0 comments on commit 3dd8327

Please sign in to comment.