Merge branch 'master' into patch-1

pull/3986/head
Kim Kulling 2021-07-14 11:34:58 +02:00 committed by GitHub
commit 23e416de3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 65 additions and 8698 deletions

2
.gitignore vendored
View File

@ -25,7 +25,7 @@ CMakeSettings.json
# Output
bin/
lib/
x64/
# QtCreator
CMakeLists.txt.user

View File

@ -46,8 +46,8 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
IF(ASSIMP_HUNTER_ENABLED)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.293.tar.gz"
SHA1 "e8e5470652db77149d9b38656db2a6c0b7642693"
URL "https://github.com/cpp-pm/hunter/archive/v0.23.311.tar.gz"
SHA1 "1a82b9b73055879181cb1466b2ab5d48ee8ae410"
)
add_definitions(-DASSIMP_USE_HUNTER)

View File

@ -55,6 +55,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Assimp specific M3D configuration. Comment out these defines to remove functionality
//#define ASSIMP_USE_M3D_READFILECB
// Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy.
#define STBI_ONLY_PNG
#include <stb/stb_image.h>
#include "m3d.h"
namespace Assimp {

File diff suppressed because it is too large Load Diff

View File

@ -419,8 +419,7 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
if (PLY::Element::ParseElement(streamBuffer, buffer, &out)) {
// add the element to the list of elements
alElements.push_back(out);
} else if ( TokenMatch(buffer, "end_header\r", 11) || //checks for header end with /r/n ending
TokenMatch(buffer, "end_header", 10)) { //checks for /n ending, if it doesn't end with /r/n
} else if (TokenMatch(buffer, "end_header", 10)) { //checks for /n ending, if it doesn't end with /r/n
// we have reached the end of the header
break;
} else {
@ -501,6 +500,11 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM *p_pc
}
streamBuffer.getNextBlock(buffer);
// remove first char if it's /n in case of file with /r/n
if (((char *)&buffer[0])[0] == '\n')
buffer.erase(buffer.begin(), buffer.begin() + 1);
unsigned int bufferSize = static_cast<unsigned int>(buffer.size());
const char *pCur = (char *)&buffer[0];
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE)) {

View File

@ -873,6 +873,7 @@ ELSE()
../contrib/pugixml/src/pugiconfig.hpp
../contrib/pugixml/src/pugixml.hpp
)
INCLUDE_DIRECTORIES("../contrib/pugixml/src")
SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
ENDIF()
@ -1033,16 +1034,26 @@ IF(ASSIMP_HUNTER_ENABLED)
hunter_add_package(RapidJSON)
find_package(RapidJSON CONFIG REQUIRED)
ELSE()
INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
INCLUDE_DIRECTORIES( "../contrib" )
INCLUDE_DIRECTORIES( "../contrib/pugixml/src" )
ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1 )
INCLUDE_DIRECTORIES("../contrib/rapidjson/include")
ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1)
option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON )
if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR)
ADD_DEFINITIONS( -DRAPIDJSON_NOMEMBERITERATORCLASS )
endif()
ENDIF()
# stb
IF(ASSIMP_HUNTER_ENABLED)
hunter_add_package(stb)
find_package(stb CONFIG REQUIRED)
ELSE()
SET( stb_SRCS
../contrib/stb/stb_image.h
)
INCLUDE_DIRECTORIES("../contrib")
SOURCE_GROUP( Contrib\\stb FILES ${stb_SRCS})
ENDIF()
# VC2010 fixes
if(MSVC10)
option( VC10_STDINT_FIX "Fix for VC10 Compiler regarding pstdint.h redefinition errors" OFF )
@ -1101,6 +1112,7 @@ SET( assimp_src
${open3dgc_SRCS}
${ziplib_SRCS}
${Pugixml_SRCS}
${stb_SRCS}
# Necessary to show the headers in the project when using the VC++ generator:
${PUBLIC_HEADERS}
@ -1158,8 +1170,9 @@ IF(ASSIMP_HUNTER_ENABLED)
utf8cpp
zip::zip
pugixml
stb::stb
)
if (ASSIMP_BUILD_DRACO)
target_link_libraries(assimp PUBLIC ${draco_LIBRARIES})
endif()

View File

@ -1251,3 +1251,36 @@ ASSIMP_API void aiQuaternionInterpolate(
ai_assert(nullptr != end);
aiQuaternion::Interpolate(*dst, *start, *end, factor);
}
// stb_image is a lightweight image loader. It is shared by:
// - M3D import
// - PBRT export
// Since it's a header-only library, its implementation must be instantiated in some cpp file.
// Don't scatter this task over multiple importers/exporters. Maintain it in a central place (here!).
#define ASSIMP_HAS_PBRT_EXPORT (!ASSIMP_BUILD_NO_EXPORT && !ASSIMP_BUILD_NO_PBRT_EXPORTER)
#define ASSIMP_HAS_M3D ((!ASSIMP_BUILD_NO_EXPORT && !ASSIMP_BUILD_NO_M3D_EXPORTER) || !ASSIMP_BUILD_NO_M3D_IMPORTER)
#if ASSIMP_HAS_PBRT_EXPORT
# define ASSIMP_NEEDS_STB_IMAGE 1
#elif ASSIMP_HAS_M3D
# define ASSIMP_NEEDS_STB_IMAGE 1
# define STBI_ONLY_PNG
#endif
#if ASSIMP_NEEDS_STB_IMAGE
# if _MSC_VER // "unreferenced function has been removed" (SSE2 detection routine in x64 builds)
# pragma warning(push)
# pragma warning(disable: 4505)
# endif
# define STB_IMAGE_IMPLEMENTATION
# include "stb/stb_image.h"
# if _MSC_VER
# pragma warning(pop)
# endif
#endif

View File

@ -83,8 +83,7 @@ Other:
#include <sstream>
#include <string>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include "stb/stb_image.h"
using namespace Assimp;

File diff suppressed because it is too large Load Diff