Merge branch 'assimp:master' into patch-6
commit
75a966022f
|
@ -49,13 +49,13 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
||||||
IF(ASSIMP_HUNTER_ENABLED)
|
IF(ASSIMP_HUNTER_ENABLED)
|
||||||
include("cmake-modules/HunterGate.cmake")
|
include("cmake-modules/HunterGate.cmake")
|
||||||
HunterGate(
|
HunterGate(
|
||||||
URL "https://github.com/cpp-pm/hunter/archive/v0.24.17.tar.gz"
|
URL "https://github.com/cpp-pm/hunter/archive/v0.24.18.tar.gz"
|
||||||
SHA1 "e6396699e414120e32557fe92db097b7655b760b"
|
SHA1 "1292e4d661e1770d6d6ca08c12c07cf34a0bf718"
|
||||||
)
|
)
|
||||||
add_definitions(-DASSIMP_USE_HUNTER)
|
add_definitions(-DASSIMP_USE_HUNTER)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
PROJECT(Assimp VERSION 5.2.5)
|
PROJECT(Assimp VERSION 5.3.0)
|
||||||
|
|
||||||
# All supported options ###############################################
|
# All supported options ###############################################
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ IF( UNIX )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Grouped compiler settings ########################################
|
# 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)
|
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -777,7 +777,7 @@ IF ( ASSIMP_INSTALL )
|
||||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
|
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
|
||||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
|
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
|
||||||
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
|
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_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_PACKAGE_SOURCE_COPY svn export --force)
|
||||||
SET(CPACK_DEBIAN_CHANGELOG)
|
SET(CPACK_DEBIAN_CHANGELOG)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Report error to the log stream
|
// 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];
|
char szBuffer[1024];
|
||||||
::ai_snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, error);
|
::ai_snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, error);
|
||||||
throw DeadlyImportError(szBuffer);
|
throw DeadlyImportError(szBuffer);
|
||||||
|
@ -95,7 +95,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Report warning to the log stream
|
// 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];
|
char szBuffer[1024];
|
||||||
::snprintf(szBuffer, sizeof(szBuffer), "[MD5] Line %u: %s", line, warn);
|
::snprintf(szBuffer, sizeof(szBuffer), "[MD5] Line %u: %s", line, warn);
|
||||||
ASSIMP_LOG_WARN(szBuffer);
|
ASSIMP_LOG_WARN(szBuffer);
|
||||||
|
@ -122,8 +122,8 @@ void MD5Parser::ParseHeader() {
|
||||||
// print the command line options to the console
|
// print the command line options to the console
|
||||||
// FIX: can break the log length limit, so we need to be careful
|
// FIX: can break the log length limit, so we need to be careful
|
||||||
char *sz = buffer;
|
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))));
|
ASSIMP_LOG_INFO(std::string(sz, std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer - sz))));
|
||||||
SkipSpacesAndLineEnd();
|
SkipSpacesAndLineEnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ struct Section {
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
//! For global elements: the value of the element as string
|
//! 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;
|
std::string mGlobalValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,7 +184,7 @@ using FrameList = std::vector<FrameDesc>;
|
||||||
*/
|
*/
|
||||||
struct VertexDesc {
|
struct VertexDesc {
|
||||||
VertexDesc() AI_NO_EXCEPT
|
VertexDesc() AI_NO_EXCEPT
|
||||||
: mFirstWeight(0), mNumWeights(0) {
|
: mFirstWeight(0), mNumWeights(0) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,62 +348,61 @@ public:
|
||||||
*/
|
*/
|
||||||
MD5Parser(char* buffer, unsigned int fileSize);
|
MD5Parser(char* buffer, unsigned int fileSize);
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Report a specific error message and throw an exception
|
/** Report a specific error message and throw an exception
|
||||||
* @param error Error message to be reported
|
* @param error Error message to be reported
|
||||||
* @param line Index of the line where the error occurred
|
* @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
|
/** Report a specific warning
|
||||||
* @param warn Warn message to be reported
|
* @param warn Warn message to be reported
|
||||||
* @param line Index of the line where the error occurred
|
* @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;
|
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
|
//! List of all sections which have been read
|
||||||
SectionList mSections;
|
SectionList mSections;
|
||||||
|
|
||||||
private:
|
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);
|
bool ParseSection(Section& out);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
/** Parses the file header
|
|
||||||
* @throws ImportErrorException if an error occurs
|
|
||||||
*/
|
|
||||||
void ParseHeader();
|
void ParseHeader();
|
||||||
|
|
||||||
bool SkipLine(const char* in, const char** out);
|
bool SkipLine(const char* in, const char** out);
|
||||||
bool SkipLine( );
|
bool SkipLine( );
|
||||||
bool SkipSpacesAndLineEnd( const char* in, const char** out);
|
bool SkipSpacesAndLineEnd( const char* in, const char** out);
|
||||||
bool SkipSpacesAndLineEnd();
|
bool SkipSpacesAndLineEnd();
|
||||||
bool SkipSpaces();
|
bool SkipSpaces();
|
||||||
|
|
||||||
|
private:
|
||||||
char* buffer;
|
char* buffer;
|
||||||
char* bufferEnd;
|
char* bufferEnd;
|
||||||
unsigned int fileSize;
|
unsigned int fileSize;
|
||||||
unsigned int lineNumber;
|
unsigned int lineNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
inline void MD5Parser::ReportWarning (const char* warn) {
|
||||||
|
return ReportWarning(warn, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
inline void MD5Parser::ReportError(const char* error) {
|
inline void MD5Parser::ReportError(const char* error) {
|
||||||
ReportError(error, lineNumber);
|
ReportError(error, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
inline bool MD5Parser::SkipLine(const char* in, const char** out) {
|
inline bool MD5Parser::SkipLine(const char* in, const char** out) {
|
||||||
++lineNumber;
|
++lineNumber;
|
||||||
|
@ -418,18 +416,24 @@ inline bool MD5Parser::SkipLine( ) {
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
inline bool MD5Parser::SkipSpacesAndLineEnd( const char* in, const char** out) {
|
inline bool MD5Parser::SkipSpacesAndLineEnd( const char* in, const char** out) {
|
||||||
bool bHad = false;
|
if (in == bufferEnd) {
|
||||||
bool running = true;
|
*out = in;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bHad = false, running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
if( *in == '\r' || *in == '\n') {
|
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) {
|
if (!bHad) {
|
||||||
bHad = true;
|
bHad = true;
|
||||||
++lineNumber;
|
++lineNumber;
|
||||||
}
|
}
|
||||||
|
} else if (*in == '\t' || *in == ' ') {
|
||||||
|
bHad = false;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (*in == '\t' || *in == ' ')bHad = false;
|
|
||||||
else break;
|
|
||||||
++in;
|
++in;
|
||||||
if (in == bufferEnd) {
|
if (in == bufferEnd) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
// Legal information string - don't remove this.
|
// Legal information string - don't remove this.
|
||||||
static const char *LEGAL_INFORMATION =
|
static constexpr char LEGAL_INFORMATION[] =
|
||||||
"Open Asset Import Library (Assimp).\n"
|
"Open Asset Import Library (Assimp).\n"
|
||||||
"A free C/C++ library to import various 3D file formats into applications\n\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"
|
"License under the terms and conditions of the 3-clause BSD license\n"
|
||||||
"https://www.assimp.org\n";
|
"https://www.assimp.org\n";
|
||||||
|
|
||||||
|
@ -150,9 +150,11 @@ ASSIMP_API aiScene::~aiScene() {
|
||||||
// To make sure we won't crash if the data is invalid it's
|
// To make sure we won't crash if the data is invalid it's
|
||||||
// much better to check whether both mNumXXX and mXXX are
|
// much better to check whether both mNumXXX and mXXX are
|
||||||
// valid instead of relying on just one of them.
|
// valid instead of relying on just one of them.
|
||||||
if (mNumMeshes && mMeshes)
|
if (mNumMeshes && mMeshes) {
|
||||||
for (unsigned int a = 0; a < mNumMeshes; a++)
|
for (unsigned int a = 0; a < mNumMeshes; ++a) {
|
||||||
delete mMeshes[a];
|
delete mMeshes[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
delete[] mMeshes;
|
delete[] mMeshes;
|
||||||
|
|
||||||
if (mNumMaterials && mMaterials) {
|
if (mNumMaterials && mMaterials) {
|
||||||
|
@ -162,24 +164,32 @@ ASSIMP_API aiScene::~aiScene() {
|
||||||
}
|
}
|
||||||
delete[] mMaterials;
|
delete[] mMaterials;
|
||||||
|
|
||||||
if (mNumAnimations && mAnimations)
|
if (mNumAnimations && mAnimations) {
|
||||||
for (unsigned int a = 0; a < mNumAnimations; a++)
|
for (unsigned int a = 0; a < mNumAnimations; ++a) {
|
||||||
delete mAnimations[a];
|
delete mAnimations[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
delete[] mAnimations;
|
delete[] mAnimations;
|
||||||
|
|
||||||
if (mNumTextures && mTextures)
|
if (mNumTextures && mTextures) {
|
||||||
for (unsigned int a = 0; a < mNumTextures; a++)
|
for (unsigned int a = 0; a < mNumTextures; ++a) {
|
||||||
delete mTextures[a];
|
delete mTextures[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
delete[] mTextures;
|
delete[] mTextures;
|
||||||
|
|
||||||
if (mNumLights && mLights)
|
if (mNumLights && mLights) {
|
||||||
for (unsigned int a = 0; a < mNumLights; a++)
|
for (unsigned int a = 0; a < mNumLights; ++a) {
|
||||||
delete mLights[a];
|
delete mLights[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
delete[] mLights;
|
delete[] mLights;
|
||||||
|
|
||||||
if (mNumCameras && mCameras)
|
if (mNumCameras && mCameras) {
|
||||||
for (unsigned int a = 0; a < mNumCameras; a++)
|
for (unsigned int a = 0; a < mNumCameras; ++a) {
|
||||||
delete mCameras[a];
|
delete mCameras[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
delete[] mCameras;
|
delete[] mCameras;
|
||||||
|
|
||||||
aiMetadata::Dealloc(mMetaData);
|
aiMetadata::Dealloc(mMetaData);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -273,7 +273,8 @@ void FindInvalidDataProcess::ProcessAnimation(aiAnimation *anim) {
|
||||||
void FindInvalidDataProcess::ProcessAnimationChannel(aiNodeAnim *anim) {
|
void FindInvalidDataProcess::ProcessAnimationChannel(aiNodeAnim *anim) {
|
||||||
ai_assert(nullptr != anim);
|
ai_assert(nullptr != anim);
|
||||||
if (anim->mNumPositionKeys == 0 && anim->mNumRotationKeys == 0 && anim->mNumScalingKeys == 0) {
|
if (anim->mNumPositionKeys == 0 && anim->mNumRotationKeys == 0 && anim->mNumScalingKeys == 0) {
|
||||||
ai_assert_entry();
|
ASSIMP_LOG_ERROR("Invalid node anuimation instance detected.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ bool areVerticesEqual(
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class XMesh>
|
template<class XMesh>
|
||||||
void updateXMeshVertices(XMesh *pMesh, std::vector<Vertex> &uniqueVertices) {
|
void updateXMeshVertices(XMesh *pMesh, std::vector<int> &uniqueVertices) {
|
||||||
// replace vertex data with the unique data sets
|
// replace vertex data with the unique data sets
|
||||||
pMesh->mNumVertices = (unsigned int)uniqueVertices.size();
|
pMesh->mNumVertices = (unsigned int)uniqueVertices.size();
|
||||||
|
|
||||||
|
@ -156,53 +157,47 @@ void updateXMeshVertices(XMesh *pMesh, std::vector<Vertex> &uniqueVertices) {
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Position, if present (check made for aiAnimMesh)
|
// Position, if present (check made for aiAnimMesh)
|
||||||
if (pMesh->mVertices) {
|
if (pMesh->mVertices) {
|
||||||
delete [] pMesh->mVertices;
|
std::unique_ptr<aiVector3D[]> oldVertices(pMesh->mVertices);
|
||||||
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||||
for (unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
for (unsigned int a = 0; a < pMesh->mNumVertices; a++)
|
||||||
pMesh->mVertices[a] = uniqueVertices[a].position;
|
pMesh->mVertices[a] = oldVertices[uniqueVertices[a]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normals, if present
|
// Normals, if present
|
||||||
if (pMesh->mNormals) {
|
if (pMesh->mNormals) {
|
||||||
delete [] pMesh->mNormals;
|
std::unique_ptr<aiVector3D[]> oldNormals(pMesh->mNormals);
|
||||||
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||||
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
for (unsigned int a = 0; a < pMesh->mNumVertices; a++)
|
||||||
pMesh->mNormals[a] = uniqueVertices[a].normal;
|
pMesh->mNormals[a] = oldNormals[uniqueVertices[a]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Tangents, if present
|
// Tangents, if present
|
||||||
if (pMesh->mTangents) {
|
if (pMesh->mTangents) {
|
||||||
delete [] pMesh->mTangents;
|
std::unique_ptr<aiVector3D[]> oldTangents(pMesh->mTangents);
|
||||||
pMesh->mTangents = new aiVector3D[pMesh->mNumVertices];
|
pMesh->mTangents = new aiVector3D[pMesh->mNumVertices];
|
||||||
for (unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
for (unsigned int a = 0; a < pMesh->mNumVertices; a++)
|
||||||
pMesh->mTangents[a] = uniqueVertices[a].tangent;
|
pMesh->mTangents[a] = oldTangents[uniqueVertices[a]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Bitangents as well
|
// Bitangents as well
|
||||||
if (pMesh->mBitangents) {
|
if (pMesh->mBitangents) {
|
||||||
delete [] pMesh->mBitangents;
|
std::unique_ptr<aiVector3D[]> oldBitangents(pMesh->mBitangents);
|
||||||
pMesh->mBitangents = new aiVector3D[pMesh->mNumVertices];
|
pMesh->mBitangents = new aiVector3D[pMesh->mNumVertices];
|
||||||
for (unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
for (unsigned int a = 0; a < pMesh->mNumVertices; a++)
|
||||||
pMesh->mBitangents[a] = uniqueVertices[a].bitangent;
|
pMesh->mBitangents[a] = oldBitangents[uniqueVertices[a]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Vertex colors
|
// Vertex colors
|
||||||
for (unsigned int a = 0; pMesh->HasVertexColors(a); a++) {
|
for (unsigned int a = 0; pMesh->HasVertexColors(a); a++) {
|
||||||
delete [] pMesh->mColors[a];
|
std::unique_ptr<aiColor4D[]> oldColors(pMesh->mColors[a]);
|
||||||
pMesh->mColors[a] = new aiColor4D[pMesh->mNumVertices];
|
pMesh->mColors[a] = new aiColor4D[pMesh->mNumVertices];
|
||||||
for( unsigned int b = 0; b < pMesh->mNumVertices; b++) {
|
for (unsigned int b = 0; b < pMesh->mNumVertices; b++)
|
||||||
pMesh->mColors[a][b] = uniqueVertices[b].colors[a];
|
pMesh->mColors[a][b] = oldColors[uniqueVertices[b]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Texture coords
|
// Texture coords
|
||||||
for (unsigned int a = 0; pMesh->HasTextureCoords(a); a++) {
|
for (unsigned int a = 0; pMesh->HasTextureCoords(a); a++) {
|
||||||
delete [] pMesh->mTextureCoords[a];
|
std::unique_ptr<aiVector3D[]> oldTextureCoords(pMesh->mTextureCoords[a]);
|
||||||
pMesh->mTextureCoords[a] = new aiVector3D[pMesh->mNumVertices];
|
pMesh->mTextureCoords[a] = new aiVector3D[pMesh->mNumVertices];
|
||||||
for (unsigned int b = 0; b < pMesh->mNumVertices; b++) {
|
for (unsigned int b = 0; b < pMesh->mNumVertices; b++)
|
||||||
pMesh->mTextureCoords[a][b] = uniqueVertices[b].texcoords[a];
|
pMesh->mTextureCoords[a][b] = oldTextureCoords[uniqueVertices[b]];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +265,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll never have more vertices afterwards.
|
// We'll never have more vertices afterwards.
|
||||||
std::vector<Vertex> uniqueVertices;
|
std::vector<int> uniqueVertices;
|
||||||
uniqueVertices.reserve( pMesh->mNumVertices);
|
uniqueVertices.reserve( pMesh->mNumVertices);
|
||||||
|
|
||||||
// For each vertex the index of the vertex it was replaced by.
|
// For each vertex the index of the vertex it was replaced by.
|
||||||
|
@ -311,7 +306,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
||||||
const bool hasAnimMeshes = pMesh->mNumAnimMeshes > 0;
|
const bool hasAnimMeshes = pMesh->mNumAnimMeshes > 0;
|
||||||
|
|
||||||
// We'll never have more vertices afterwards.
|
// We'll never have more vertices afterwards.
|
||||||
std::vector<std::vector<Vertex>> uniqueAnimatedVertices;
|
std::vector<std::vector<int>> uniqueAnimatedVertices;
|
||||||
if (hasAnimMeshes) {
|
if (hasAnimMeshes) {
|
||||||
uniqueAnimatedVertices.resize(pMesh->mNumAnimMeshes);
|
uniqueAnimatedVertices.resize(pMesh->mNumAnimMeshes);
|
||||||
for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) {
|
for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) {
|
||||||
|
@ -345,10 +340,10 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
||||||
//keep track of its index and increment 1
|
//keep track of its index and increment 1
|
||||||
replaceIndex[a] = newIndex++;
|
replaceIndex[a] = newIndex++;
|
||||||
// add the vertex to the unique vertices
|
// add the vertex to the unique vertices
|
||||||
uniqueVertices.push_back(v);
|
uniqueVertices.push_back(a);
|
||||||
if (hasAnimMeshes) {
|
if (hasAnimMeshes) {
|
||||||
for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) {
|
for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) {
|
||||||
uniqueAnimatedVertices[animMeshIndex].emplace_back(pMesh->mAnimMeshes[animMeshIndex], a);
|
uniqueAnimatedVertices[animMeshIndex].emplace_back(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#define ftello64 ftell
|
#define ftello64 ftell
|
||||||
#define fseeko64 fseek
|
#define fseeko64 fseek
|
||||||
#else
|
#else
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||||
#define fopen64 fopen
|
#define fopen64 fopen
|
||||||
#define ftello64 ftello
|
#define ftello64 ftello
|
||||||
#define fseeko64 fseeko
|
#define fseeko64 fseeko
|
||||||
|
|
|
@ -83,9 +83,9 @@ typedef long ssize_t; /* byte count or error */
|
||||||
#define ZIP_EFWRITE -29 // fwrite error
|
#define ZIP_EFWRITE -29 // fwrite error
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the error message string coresponding to an error number.
|
* Looks up the error message string corresponding to an error number.
|
||||||
* @param errnum error number
|
* @param errnum error number
|
||||||
* @return error message string coresponding to errnum or NULL if error is not
|
* @return error message string corresponding to errnum or NULL if error is not
|
||||||
* found.
|
* found.
|
||||||
*/
|
*/
|
||||||
extern const char *zip_strerror(int errnum);
|
extern const char *zip_strerror(int errnum);
|
||||||
|
|
|
@ -73,14 +73,8 @@ typedef uint32_t ai_uint32;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#ifdef ASSIMP_USE_HUNTER
|
|
||||||
# include <utf8.h>
|
|
||||||
#else
|
|
||||||
# include "../contrib/utf8cpp/source/utf8.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <new> // for std::nothrow_t
|
#include <new> // for std::nothrow_t
|
||||||
#include <string> // for aiString::Set(const std::string&)
|
#include <string> // for aiString::Set(const std::string&)
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -88,16 +82,16 @@ namespace Assimp {
|
||||||
namespace Intern {
|
namespace Intern {
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/** @brief Internal helper class to utilize our internal new/delete
|
/** @brief Internal helper class to utilize our internal new/delete
|
||||||
* routines for allocating object of this and derived classes.
|
* routines for allocating object of this and derived classes.
|
||||||
*
|
*
|
||||||
* By doing this you can safely share class objects between Assimp
|
* By doing this you can safely share class objects between Assimp
|
||||||
* and the application - it works even over DLL boundaries. A good
|
* and the application - it works even over DLL boundaries. A good
|
||||||
* example is the #IOSystem where the application allocates its custom
|
* example is the #IOSystem where the application allocates its custom
|
||||||
* #IOSystem, then calls #Importer::SetIOSystem(). When the Importer
|
* #IOSystem, then calls #Importer::SetIOSystem(). When the Importer
|
||||||
* destructs, Assimp calls operator delete on the stored #IOSystem.
|
* destructs, Assimp calls operator delete on the stored #IOSystem.
|
||||||
* If it lies on a different heap than Assimp is working with,
|
* If it lies on a different heap than Assimp is working with,
|
||||||
* the application is determined to crash.
|
* the application is determined to crash.
|
||||||
*/
|
*/
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
struct ASSIMP_API AllocateFromAssimpHeap {
|
struct ASSIMP_API AllocateFromAssimpHeap {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=Open Asset Import Library - Viewer
|
AppName=Open Asset Import Library - Viewer
|
||||||
AppVerName=Open Asset Import Library - Viewer (v2.0)
|
AppVerName=Open Asset Import Library - Viewer (v5.3.0)
|
||||||
DefaultDirName={pf}\AssimpView
|
DefaultDirName={pf}\AssimpView
|
||||||
DefaultGroupName=AssimpView
|
DefaultGroupName=AssimpView
|
||||||
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
||||||
|
@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||||
LicenseFile=License.rtf
|
LicenseFile=License.rtf
|
||||||
OutputBaseFileName=assimp-view-2.0-setup
|
OutputBaseFileName=assimp-view-5.0-setup
|
||||||
VersionInfoVersion=2.0.0.0
|
VersionInfoVersion=5.3.0.0
|
||||||
VersionInfoTextVersion=2.0
|
VersionInfoTextVersion=5.3.0
|
||||||
VersionInfoCompany=Assimp Development Team
|
VersionInfoCompany=Assimp Development Team
|
||||||
ArchitecturesInstallIn64BitMode=x64
|
ArchitecturesInstallIn64BitMode=x64
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=Open Asset Import Library - SDK
|
AppName=Open Asset Import Library - SDK
|
||||||
AppVerName=Open Asset Import Library - SDK (v5.1.0)
|
AppVerName=Open Asset Import Library - SDK (v5.3.0)
|
||||||
DefaultDirName={pf}\Assimp
|
DefaultDirName={pf}\Assimp
|
||||||
DefaultGroupName=Assimp
|
DefaultGroupName=Assimp
|
||||||
UninstallDisplayIcon={app}\bin\x64\assimp.exe
|
UninstallDisplayIcon={app}\bin\x64\assimp.exe
|
||||||
|
@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||||
LicenseFile=License.rtf
|
LicenseFile=License.rtf
|
||||||
OutputBaseFileName=assimp-sdk-5.1.0-setup
|
OutputBaseFileName=assimp-sdk-5.2.6-setup
|
||||||
VersionInfoVersion=5.1.0.0
|
VersionInfoVersion=5.3.0.0
|
||||||
VersionInfoTextVersion=5.1.0
|
VersionInfoTextVersion=5.3.0
|
||||||
VersionInfoCompany=Assimp Development Team
|
VersionInfoCompany=Assimp Development Team
|
||||||
ArchitecturesInstallIn64BitMode=x64
|
ArchitecturesInstallIn64BitMode=x64
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=Open Asset Import Library - SDK
|
AppName=Open Asset Import Library - SDK
|
||||||
AppVerName=Open Asset Import Library - SDK (v5.1.0)
|
AppVerName=Open Asset Import Library - SDK (v5.3.0)
|
||||||
DefaultDirName={pf}\Assimp
|
DefaultDirName={pf}\Assimp
|
||||||
DefaultGroupName=Assimp
|
DefaultGroupName=Assimp
|
||||||
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
||||||
|
@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||||
LicenseFile=License.rtf
|
LicenseFile=License.rtf
|
||||||
OutputBaseFileName=assimp-sdk-5.1.0-setup
|
OutputBaseFileName=assimp-sdk-5.2.6-setup
|
||||||
VersionInfoVersion=5.1.0.0
|
VersionInfoVersion=5.3.0.
|
||||||
VersionInfoTextVersion=5.1.0
|
VersionInfoTextVersion=5.3.0
|
||||||
VersionInfoCompany=Assimp Development Team
|
VersionInfoCompany=Assimp Development Team
|
||||||
;ArchitecturesInstallIn64BitMode=x64
|
;ArchitecturesInstallIn64BitMode=x64
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#else
|
#else
|
||||||
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit @GIT_COMMIT_HASH@)"
|
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit @GIT_COMMIT_HASH@)"
|
||||||
#endif
|
#endif
|
||||||
#define VER_COPYRIGHT_STR "\xA9 2006-2022"
|
#define VER_COPYRIGHT_STR "\xA9 2006-2023"
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@.dll"
|
#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@.dll"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Good IFC test cases
|
Good IFC test cases
|
||||||
===================
|
===================
|
||||||
|
|
||||||
http://www.iai.fzk.de/www-extern/index.php?id=1135
|
https://www.ifcwiki.org/index.php/Examples
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2022, assimp team
|
Copyright (c) 2006-2023, assimp team
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -48,12 +48,12 @@ TEST_F( utVersion, aiGetLegalStringTest ) {
|
||||||
EXPECT_NE( lv, nullptr );
|
EXPECT_NE( lv, nullptr );
|
||||||
std::string text( lv );
|
std::string text( lv );
|
||||||
|
|
||||||
size_t pos = text.find(std::string("2022"));
|
size_t pos = text.find(std::string("2023"));
|
||||||
EXPECT_NE(pos, std::string::npos);
|
EXPECT_NE(pos, std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( utVersion, aiGetVersionMinorTest ) {
|
TEST_F( utVersion, aiGetVersionMinorTest ) {
|
||||||
EXPECT_EQ(aiGetVersionMinor(), 2U);
|
EXPECT_EQ(aiGetVersionMinor(), 3U);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( utVersion, aiGetVersionMajorTest ) {
|
TEST_F( utVersion, aiGetVersionMajorTest ) {
|
||||||
|
@ -61,7 +61,7 @@ TEST_F( utVersion, aiGetVersionMajorTest ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( utVersion, aiGetVersionPatchTest ) {
|
TEST_F( utVersion, aiGetVersionPatchTest ) {
|
||||||
EXPECT_EQ(aiGetVersionPatch(), 5U );
|
EXPECT_EQ(aiGetVersionPatch(), 0U );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F( utVersion, aiGetCompileFlagsTest ) {
|
TEST_F( utVersion, aiGetCompileFlagsTest ) {
|
||||||
|
|
Loading…
Reference in New Issue