Merge branch 'master' into gltfIndexOutOfRangeFix

pull/3329/head
Kim Kulling 2020-07-23 11:27:34 +02:00 committed by GitHub
commit 0f442b1ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 896 additions and 790 deletions

View File

@ -45,15 +45,45 @@ jobs:
CXX: ${{ matrix.cxx }}
CC: ${{ matrix.cc }}
- name: Cache DX SDK
id: dxcache
if: matrix.name == 'windows-msvc'
uses: actions/cache@v2
with:
path: '${{ github.workspace }}/DX_SDK'
key: ${{ runner.os }}-DX_SDK
restore-keys: |
${{ runner.os }}-DX_SDK
- name: Download DXSetup
if: matrix.name == 'windows-msvc' && steps.dxcache.outputs.cache-hit != 'true'
run: |
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
- name: Set Windows specific CMake arguments
if: matrix.name == 'windows-msvc'
id: windows_extra_cmake_args
run: echo "::set-output name=args::'-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1'"
- name: configure and build
uses: lukka/run-cmake@v2
env:
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release'
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }}'
buildWithCMakeArgs: '-- -v'
buildDirectory: '${{ github.workspace }}/build/'
- name: test
run: cd build/bin && ./unit
shell: bash
- uses: actions/upload-artifact@v2
if: matrix.name == 'windows-msvc'
with:
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
path: build/bin

View File

@ -35,6 +35,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#----------------------------------------------------------------------
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
CMAKE_MINIMUM_REQUIRED( VERSION 3.0 )
@ -44,8 +45,8 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
IF(ASSIMP_HUNTER_ENABLED)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.176.tar.gz"
SHA1 "2e9ae973d028660b735ac4c6142725ca36a0048a"
URL "https://github.com/cpp-pm/hunter/archive/v0.23.261.tar.gz"
SHA1 "1540dad7b97c849784a09e8c452ba811c9f71ba2"
)
add_definitions(-DASSIMP_USE_HUNTER)
@ -257,7 +258,11 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
SET(LIBSTDC++_LIBRARIES -lstdc++)
ELSEIF(MSVC)
# enable multi-core compilation with MSVC
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX )
IF( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) # clang-cl
ADD_COMPILE_OPTIONS(/bigobj /W4 /WX )
ELSE() # msvc
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
ENDIF()
# disable "elements of array '' will be default initialized" warning on MSVC2013
IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351)
@ -357,6 +362,34 @@ IF (NOT TARGET uninstall)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
# cmake configuration files
if(${BUILD_SHARED_LIBS})
set(BUILD_LIB_TYPE SHARED)
else()
set(BUILD_LIB_TYPE STATIC)
endif()
IF( UNIX )
# Use GNUInstallDirs for Unix predefined directories
INCLUDE(GNUInstallDirs)
SET( ASSIMP_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
SET( ASSIMP_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
SET( ASSIMP_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
ELSE()
# Cache these to allow the user to override them on non-Unix platforms
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
"Path the built library files are installed to." )
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
"Path the header files are installed to." )
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
"Path the tool executables are installed to." )
SET(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_INCLUDE_INSTALL_DIR})
SET(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR})
SET(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_BIN_INSTALL_DIR})
ENDIF()
IF(ASSIMP_HUNTER_ENABLED)
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(INCLUDE_INSTALL_DIR "include")
@ -395,34 +428,6 @@ IF(ASSIMP_HUNTER_ENABLED)
DESTINATION "${CONFIG_INSTALL_DIR}"
)
ELSE()
# cmake configuration files
if(${BUILD_SHARED_LIBS})
set(BUILD_LIB_TYPE SHARED)
else()
set(BUILD_LIB_TYPE STATIC)
endif()
IF( UNIX )
# Use GNUInstallDirs for Unix predefined directories
INCLUDE(GNUInstallDirs)
SET( ASSIMP_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
SET( ASSIMP_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
SET( ASSIMP_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
ELSE()
# Cache these to allow the user to override them on non-Unix platforms
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
"Path the built library files are installed to." )
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
"Path the header files are installed to." )
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
"Path the tool executables are installed to." )
SET(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_INCLUDE_INSTALL_DIR})
SET(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR})
SET(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_BIN_INSTALL_DIR})
ENDIF()
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
IF (is_multi_config)

View File

@ -2,7 +2,7 @@
find_package(RapidJSON CONFIG REQUIRED)
find_package(ZLIB CONFIG REQUIRED)
find_package(utf8 CONFIG REQUIRED)
find_package(utf8cpp CONFIG REQUIRED)
find_package(irrXML CONFIG REQUIRED)
find_package(minizip CONFIG REQUIRED)
find_package(openddlparser CONFIG REQUIRED)

View File

@ -321,9 +321,10 @@ public:
struct Face : public FaceWithSmoothingGroup {
};
#if _MSC_VER > 1920
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4315)
#endif
#endif // _MSC_VER
// ---------------------------------------------------------------------------
/** Helper structure representing a texture */
@ -412,6 +413,10 @@ struct Texture {
#include <assimp/Compiler/poppack1.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER
// ---------------------------------------------------------------------------
/** Helper structure representing a 3ds material */
struct Material {

View File

@ -471,32 +471,33 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
++node->mNumMeshes;
}
switch ((*it).flags & 0xf) {
switch ((*it).GetType()) {
// closed line
case 0x1:
case Surface::ClosedLine:
needMat[idx].first += (unsigned int)(*it).entries.size();
needMat[idx].second += (unsigned int)(*it).entries.size() << 1u;
break;
// unclosed line
case 0x2:
case Surface::OpenLine:
needMat[idx].first += (unsigned int)(*it).entries.size() - 1;
needMat[idx].second += ((unsigned int)(*it).entries.size() - 1) << 1u;
break;
// triangle strip
case 0x4:
case Surface::TriangleStrip:
needMat[idx].first += (unsigned int)(*it).entries.size() - 2;
needMat[idx].second += ((unsigned int)(*it).entries.size() - 2) * 3;
break;
// 0 == polygon, else unknown
default:
if ((*it).flags & 0xf) {
ASSIMP_LOG_WARN("AC3D: The type flag of a surface is unknown");
(*it).flags &= ~(0xf);
}
// Coerce unknowns to a polygon and warn
ASSIMP_LOG_WARN_F("AC3D: The type flag of a surface is unknown: ", (*it).flags);
(*it).flags &= ~(Surface::Mask);
// fallthrough
// polygon
case Surface::Polygon:
// the number of faces increments by one, the number
// of vertices by surface.numref.
needMat[idx].first++;
@ -552,8 +553,8 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
const Surface &src = *it;
// closed polygon
unsigned int type = (*it).flags & 0xf;
if (!type) {
uint8_t type = (*it).GetType();
if (type == Surface::Polygon) {
aiFace &face = *faces++;
face.mNumIndices = (unsigned int)src.entries.size();
if (0 != face.mNumIndices) {
@ -576,7 +577,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
}
}
}
} else if (type == 0x4) {
} else if (type == Surface::TriangleStrip) {
for (unsigned int i = 0; i < (unsigned int)src.entries.size() - 2; ++i) {
const Surface::SurfaceEntry &entry1 = src.entries[i];
const Surface::SurfaceEntry &entry2 = src.entries[i + 1];
@ -584,8 +585,8 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
// skip degenerate triangles
if (object.vertices[entry1.first] == object.vertices[entry2.first] ||
object.vertices[entry1.first] == object.vertices[entry3.first] ||
object.vertices[entry2.first] == object.vertices[entry3.first]) {
object.vertices[entry1.first] == object.vertices[entry3.first] ||
object.vertices[entry2.first] == object.vertices[entry3.first]) {
mesh->mNumFaces--;
mesh->mNumVertices -= 3;
continue;
@ -640,7 +641,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
// either a closed or an unclosed line
unsigned int tmp = (unsigned int)(*it).entries.size();
if (0x2 == type) --tmp;
if (Surface::OpenLine == type) --tmp;
for (unsigned int m = 0; m < tmp; ++m) {
aiFace &face = *faces++;
@ -663,7 +664,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
++uv;
}
if (0x1 == type && tmp - 1 == m) {
if (Surface::ClosedLine == type && tmp - 1 == m) {
// if this is a closed line repeat its beginning now
it2 = (*it).entries.begin();
} else

View File

@ -69,7 +69,10 @@ public:
// Represents an AC3D material
struct Material {
Material() :
rgb(0.6f, 0.6f, 0.6f), spec(1.f, 1.f, 1.f), shin(0.f), trans(0.f) {}
rgb(0.6f, 0.6f, 0.6f),
spec(1.f, 1.f, 1.f),
shin(0.f),
trans(0.f) {}
// base color of the material
aiColor3D rgb;
@ -96,18 +99,43 @@ public:
// Represents an AC3D surface
struct Surface {
Surface() :
mat(0), flags(0) {}
mat(0),
flags(0) {}
unsigned int mat, flags;
typedef std::pair<unsigned int, aiVector2D> SurfaceEntry;
std::vector<SurfaceEntry> entries;
// Type is low nibble of flags
enum Type : uint8_t {
Polygon = 0x0,
ClosedLine = 0x1,
OpenLine = 0x2,
TriangleStrip = 0x4, // ACC extension (TORCS and Speed Dreams)
Mask = 0xf,
};
inline constexpr uint8_t GetType() const { return (flags & Mask); }
};
// Represents an AC3D object
struct Object {
Object() :
type(World), name(""), children(), texture(""), texRepeat(1.f, 1.f), texOffset(0.0f, 0.0f), rotation(), translation(), vertices(), surfaces(), numRefs(0), subDiv(0), crease() {}
type(World),
name(""),
children(),
texture(""),
texRepeat(1.f, 1.f),
texOffset(0.0f, 0.0f),
rotation(),
translation(),
vertices(),
surfaces(),
numRefs(0),
subDiv(0),
crease() {}
// Type description
enum Type {

View File

@ -386,7 +386,14 @@ void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& p
// ------------------------------------------------------------------------------------------------
inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& point ) const
{
#if defined __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Winvalid-offsetof"
#endif // __clang__
unsigned int pointOffset = offsetof( PointP2T, point2D );
#if defined __clang__
# pragma clang diagnostic pop
#endif
PointP2T& pointStruct = *reinterpret_cast< PointP2T* >( reinterpret_cast< char* >( &point ) - pointOffset );
if ( pointStruct.magic != static_cast<int>( BLEND_TESS_MAGIC ) )
{
@ -394,7 +401,6 @@ inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& poi
}
return pointStruct;
}
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorP2T::MakeFacesFromTriangles( std::vector< p2t::Triangle* >& triangles ) const
{

View File

@ -45,9 +45,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AssetLib/Step/STEPFile.h"
#if _MSC_VER > 1920
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning( disable : 4512 )
#endif // _WIN32
#endif // _MSC_VER
namespace Assimp {
namespace IFC {
@ -4372,4 +4373,8 @@ namespace STEP {
} //! STEP
} //! Assimp
#ifdef _MSC_VER
# pragma warning(pop)
#endif // _MSC_VER
#endif // INCLUDED_IFC_READER_GEN_H

File diff suppressed because it is too large Load Diff

View File

@ -68,9 +68,9 @@ namespace Assimp {
namespace MDL {
namespace HalfLife {
#if _MSC_VER > 1920
#ifdef _MSC_VER
# pragma warning(disable : 4706)
#endif // _WIN32
#endif // _MSC_VER
// ------------------------------------------------------------------------------------------------
HL1MDLLoader::HL1MDLLoader(

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MMDPmxParser.h"
#include <assimp/StringUtils.h>
#ifdef ASSIMP_USE_HUNTER
# include <utf8/utf8.h>
# include <utf8.h>
#else
# include "../contrib/utf8cpp/source/utf8.h"
#endif

View File

@ -59,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/StreamReader.h>
#include <assimp/TinyFormatter.h>
#ifdef ASSIMP_USE_HUNTER
#include <utf8/utf8.h>
#include <utf8.h>
#else
//# include "../contrib/ConvertUTF/ConvertUTF.h"
#include "../contrib/utf8cpp/source/utf8.h"

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "STEPFileEncoding.h"
#include <assimp/fast_atof.h>
#ifdef ASSIMP_USE_HUNTER
# include <utf8/utf8.h>
# include <utf8.h>
#else
# include <contrib/utf8cpp/source/utf8.h>
#endif

View File

@ -54,10 +54,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/DefaultLogger.hpp>
#if _MSC_VER > 1920
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4127 4456 4245 4512 )
#endif // _WIN32
#endif // _MSC_VER
//
#if _MSC_VER > 1500 || (defined __GNUC___)
@ -130,8 +130,8 @@ namespace STEP {
* coupled with a line number. */
// -------------------------------------------------------------------------------
struct SyntaxError : DeadlyImportError {
enum {
LINE_NOT_SPECIFIED = 0xffffffffffffffffLL
enum : uint64_t {
LINE_NOT_SPECIFIED = 0xfffffffffffffffLL
};
SyntaxError(const std::string &s, uint64_t line = LINE_NOT_SPECIFIED);
@ -143,8 +143,8 @@ struct SyntaxError : DeadlyImportError {
* It is typically coupled with both an entity id and a line number.*/
// -------------------------------------------------------------------------------
struct TypeError : DeadlyImportError {
enum {
ENTITY_NOT_SPECIFIED = 0xffffffffffffffffLL,
enum : uint64_t {
ENTITY_NOT_SPECIFIED = 0xffffffffffffffffUL,
ENTITY_NOT_SPECIFIED_32 = 0x00000000ffffffff
};
@ -960,9 +960,9 @@ private:
const EXPRESS::ConversionSchema *schema;
};
#if _MSC_VER > 1920
#ifdef _MSC_VER
#pragma warning(pop)
#endif // _WIN32
#endif // _MSC_VER
} // namespace STEP

View File

@ -61,7 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/MemoryIOWrapper.h>
#include <assimp/irrXMLWrapper.h>
#ifdef ASSIMP_USE_HUNTER
# include <utf8/utf8.h>
# include <utf8.h>
#else
# include "../contrib/utf8cpp/source/utf8.h"
#endif

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GLTFASSET_H_INC
#define GLTFASSET_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
#include <assimp/Exceptional.h>

View File

@ -836,8 +836,8 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
if (json_extensions == nullptr) goto mr_skip_extensions;
for (Value::MemberIterator it_memb = json_extensions->MemberBegin(); it_memb != json_extensions->MemberEnd(); it_memb++) {
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
for (Value::MemberIterator it_memb = json_extensions->MemberBegin(); it_memb != json_extensions->MemberEnd(); it_memb++) {
if (it_memb->name.GetString() == std::string("Open3DGC-compression")) {
// Search for compressed data.
// Compressed data contain description of part of "buffer" which is encoded. This part must be decoded and
@ -887,11 +887,11 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
Extension.push_back(ext_o3dgc); // store info in mesh extensions list.
} // if(it_memb->name.GetString() == "Open3DGC-compression")
else
#endif
{
throw DeadlyImportError(std::string("GLTF: Unknown mesh extension: \"") + it_memb->name.GetString() + "\".");
}
} // for(Value::MemberIterator it_memb = json_extensions->MemberBegin(); it_memb != json_extensions->MemberEnd(); json_extensions++)
#endif
mr_skip_extensions:

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GLTFASSETWRITER_H_INC
#define GLTFASSETWRITER_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
#include "glTFAsset.h"

View File

@ -305,11 +305,11 @@ namespace glTF {
Value json_extensions;
json_extensions.SetObject();
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
for(Mesh::SExtension* ptr_ext : m.Extension)
{
switch(ptr_ext->Type)
{
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
case Mesh::SExtension::EType::Compression_Open3DGC:
{
Value json_comp_data;
@ -339,11 +339,11 @@ namespace glTF {
}
break;
#endif
default:
throw DeadlyImportError("GLTF: Can not write mesh: unknown mesh extension, only Open3DGC is supported.");
}// switch(ptr_ext->Type)
}// for(Mesh::SExtension* ptr_ext : m.Extension)
#endif
// Add extensions to mesh
obj.AddMember("extensions", json_extensions, w.mAl);

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_GLTFEXPORTER_H_INC
#define AI_GLTFEXPORTER_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER)
#include <assimp/types.h>
#include <assimp/material.h>

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
#include "AssetLib/glTF/glTFImporter.h"
#include "AssetLib/glTF/glTFAsset.h"
@ -215,8 +215,8 @@ void glTFImporter::ImportMeshes(glTF::Asset &r) {
// Check if mesh extensions is used
if (mesh.Extension.size() > 0) {
for (Mesh::SExtension *cur_ext : mesh.Extension) {
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
for (Mesh::SExtension *cur_ext : mesh.Extension) {
if (cur_ext->Type == Mesh::SExtension::EType::Compression_Open3DGC) {
// Limitations for meshes when using Open3DGC-compression.
// It's a current limitation of sp... Specification have not this part still - about mesh compression. Why only one primitive?
@ -233,12 +233,12 @@ void glTFImporter::ImportMeshes(glTF::Asset &r) {
buf->EncodedRegion_SetCurrent(mesh.id);
} else
#endif
{
throw DeadlyImportError("GLTF: Can not import mesh: unknown mesh extension (code: \"" + to_string(cur_ext->Type) +
"\"), only Open3DGC is supported.");
}
}
#endif
} // if(mesh.Extension.size() > 0)
meshOffsets.push_back(k);

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GLTF2ASSET_H_INC
#define GLTF2ASSET_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include <assimp/Exceptional.h>

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef GLTF2ASSETWRITER_H_INC
#define GLTF2ASSETWRITER_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include "glTF2Asset.h"

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_GLTF2EXPORTER_H_INC
#define AI_GLTF2EXPORTER_H_INC
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include <assimp/types.h>
#include <assimp/material.h>

View File

@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include "AssetLib/glTF2/glTF2Importer.h"
#include "PostProcessing/MakeVerboseFormat.h"

View File

@ -899,7 +899,7 @@ ENDIF()
# utf8
IF(ASSIMP_HUNTER_ENABLED)
hunter_add_package(utf8)
find_package(utf8 CONFIG REQUIRED)
find_package(utf8cpp CONFIG REQUIRED)
ELSE()
# utf8 is header-only, so Assimp doesn't need to do anything.
ENDIF()
@ -1066,7 +1066,7 @@ endif()
ADD_DEFINITIONS( -DASSIMP_BUILD_DLL_EXPORT )
if ( MSVC )
IF( MSVC OR "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") # clang with MSVC ABI
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
endif ()
@ -1159,7 +1159,7 @@ IF(ASSIMP_HUNTER_ENABLED)
minizip::minizip
ZLIB::zlib
RapidJSON::rapidjson
utf8::utf8
utf8cpp
zip::zip
)
ELSE()

View File

@ -343,7 +343,7 @@ std::string BaseImporter::GetExtension(const std::string &file) {
}
#ifdef ASSIMP_USE_HUNTER
#include <utf8/utf8.h>
#include <utf8.h>
#else
#include "../contrib/utf8cpp/source/utf8.h"
#endif

View File

@ -100,7 +100,6 @@ size_t DefaultIOStream::Write(const void *pvBuffer,
size_t pCount) {
ai_assert(nullptr != pvBuffer);
ai_assert(0 != pSize);
ai_assert(0 != pCount);
return (mFile ? ::fwrite(pvBuffer, pSize, pCount, mFile) : 0);
}

View File

@ -74,9 +74,9 @@ Here we implement only the C++ interface (Assimp::Exporter).
namespace Assimp {
#if _MSC_VER > 1920
#ifdef _MSC_VER
# pragma warning( disable : 4800 )
#endif // _WIN32
#endif // _MSC_VER
// PostStepRegistry.cpp
@ -179,11 +179,14 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices));
#endif
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_EXPORTER)
exporters.push_back(Exporter::ExportFormatEntry("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
exporters.push_back(Exporter::ExportFormatEntry("glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
#endif
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER)
exporters.push_back(Exporter::ExportFormatEntry("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
exporters.push_back(Exporter::ExportFormatEntry("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,

View File

@ -1174,7 +1174,7 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const {
// add all bone anims
for (unsigned int a = 0; a < pc->mNumChannels; ++a) {
const aiNodeAnim* pc2 = pc->mChannels[i];
const aiNodeAnim* pc2 = pc->mChannels[a];
in.animations += sizeof(aiNodeAnim);
in.animations += pc2->mNumPositionKeys * sizeof(aiVectorKey);
in.animations += pc2->mNumScalingKeys * sizeof(aiVectorKey);

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
@ -179,8 +179,10 @@ corresponding preprocessor flag to selectively disable formats.
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
#include "AssetLib/Assbin/AssbinLoader.h"
#endif
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
#include "AssetLib/glTF/glTFImporter.h"
#endif
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include "AssetLib/glTF2/glTF2Importer.h"
#endif
#ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
@ -339,8 +341,10 @@ void GetImporterInstanceList(std::vector<BaseImporter *> &out) {
#if (!defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER)
out.push_back(new AssbinImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER)
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF1_IMPORTER)
out.push_back(new glTFImporter());
#endif
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF2_IMPORTER)
out.push_back(new glTF2Importer());
#endif
#if (!defined ASSIMP_BUILD_NO_C4D_IMPORTER)

View File

@ -53,9 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
void mydummy() {}
#if _MSC_VER > 1920
#ifdef _MSC_VER
#pragma warning(disable : 4709)
#endif // _WIN32
#endif // _MSC_VER
// ------------------------------------------------------------------------------------------------
/** Subdivider stub class to implement the Catmull-Clarke subdivision algorithm. The
* implementation is basing on recursive refinement. Directly evaluating the result is also

View File

@ -312,10 +312,22 @@
__pragma(warning(disable: warnings))
# define GTEST_DISABLE_MSC_WARNINGS_POP_() \
__pragma(warning(pop))
# if defined(__clang__)
# define GTEST_DISABLE_CLANG_DEPRECATED_WARNINGS_PUSH_() \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
# define GTEST_DISABLE_CLANG_WARNINGS_POP_() \
_Pragma("clang diagnostic pop")
# else
# define GTEST_DISABLE_CLANG_DEPRECATED_WARNINGS_PUSH_()
# define GTEST_DISABLE_CLANG_WARNINGS_POP_()
# endif
#else
// Older versions of MSVC don't have __pragma.
# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
# define GTEST_DISABLE_CLANG_DEPRECATED_WARNINGS_PUSH_()
# define GTEST_DISABLE_CLANG_WARNINGS_POP_()
#endif
#ifndef GTEST_LANG_CXX11
@ -2352,6 +2364,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
// Functions deprecated by MSVC 8.0.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
GTEST_DISABLE_CLANG_DEPRECATED_WARNINGS_PUSH_()
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
return strncpy(dest, src, n);
@ -2399,6 +2412,7 @@ inline const char* GetEnv(const char* name) {
#endif
}
GTEST_DISABLE_CLANG_WARNINGS_POP_()
GTEST_DISABLE_MSC_WARNINGS_POP_()
#if GTEST_OS_WINDOWS_MOBILE

View File

@ -926,7 +926,7 @@ GTestLog::~GTestLog() {
// Disable Microsoft deprecation warnings for POSIX functions called from
// this class (creat, dup, dup2, and close)
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
GTEST_DISABLE_CLANG_DEPRECATED_WARNINGS_PUSH_()
#if GTEST_HAS_STREAM_REDIRECTION
// Object that captures an output stream (stdout/stderr).
@ -1010,6 +1010,7 @@ class CapturedStream {
};
GTEST_DISABLE_MSC_WARNINGS_POP_()
GTEST_DISABLE_CLANG_WARNINGS_POP_()
static CapturedStream* g_captured_stderr = NULL;
static CapturedStream* g_captured_stdout = NULL;

View File

@ -31,7 +31,7 @@
#include <limits>
RAPIDJSON_DIAG_PUSH
#ifdef _MSC_VER
#if defined(_MSC_VER) && !(__clang__)
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data
#endif

View File

@ -17,7 +17,7 @@
#include "rapidjson.h"
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4244) // conversion from 'type1' to 'type2', possible loss of data
RAPIDJSON_DIAG_OFF(4702) // unreachable code
@ -709,7 +709,7 @@ struct Transcoder<Encoding, Encoding> {
RAPIDJSON_NAMESPACE_END
#if defined(__GNUC__) || defined(_MSC_VER)
#if defined(__GNUC__) || (defined(_MSC_VER) && !defined(__clang__))
RAPIDJSON_DIAG_POP
#endif

View File

@ -21,7 +21,7 @@
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(6334)
#endif
@ -174,7 +174,7 @@ template <typename T> struct RemoveSfinaeTag<SfinaeTag&(*)(T)> { typedef T Type;
RAPIDJSON_NAMESPACE_END
//@endcond
#if defined(__GNUC__) || defined(_MSC_VER)
#if defined(__GNUC__) || (defined(_MSC_VER) && !defined(__clang__))
RAPIDJSON_DIAG_POP
#endif

View File

@ -37,7 +37,7 @@
#include <arm_neon.h>
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
RAPIDJSON_DIAG_OFF(4702) // unreachable code
@ -2214,7 +2214,7 @@ RAPIDJSON_DIAG_POP
RAPIDJSON_DIAG_POP
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_POP
#endif

View File

@ -36,7 +36,7 @@
#include <arm_neon.h>
#endif
#ifdef _MSC_VER
#if defined (_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
#endif
@ -700,11 +700,11 @@ inline bool Writer<StringBuffer>::ScanWriteUnescapedString(StringStream& is, siz
RAPIDJSON_NAMESPACE_END
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
RAPIDJSON_DIAG_POP
#endif
#ifdef __clang__
#if defined(__clang__)
RAPIDJSON_DIAG_POP
#endif

View File

@ -16,6 +16,10 @@
#ifdef _WIN32
# pragma warning(push)
# pragma warning(disable : 4131 4100)
# ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-parameter"
# endif
#endif // _WIN32
/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
@ -181,4 +185,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
#ifdef _WIN32
# pragma warning(pop)
# ifdef __clang__
# pragma clang diagnostic pop
# endif
#endif // _WIN32

View File

@ -24,7 +24,7 @@
#ifndef ZCALLBACK
#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
#if (defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
#define ZCALLBACK CALLBACK
#else
#define ZCALLBACK

View File

@ -1554,7 +1554,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
char *szComment;
uLong uSizeBuf;
{
int err=UNZ_OK;
unz_s* s;
uLong uReadThis ;
if (file==NULL)

View File

@ -5361,7 +5361,7 @@ mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip,
} else {
// Temporarily allocate a read buffer.
read_buf_size = MZ_MIN(file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE);
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
if (((0, sizeof(size_t) == sizeof(mz_uint32))) &&
(read_buf_size > 0x7FFFFFFF))
#else
@ -5454,7 +5454,7 @@ void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index,
uncomp_size = MZ_READ_LE32(p + MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS);
alloc_size = (flags & MZ_ZIP_FLAG_COMPRESSED_DATA) ? comp_size : uncomp_size;
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
if (((0, sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF))
#else
if (((sizeof(size_t) == sizeof(mz_uint32))) && (alloc_size > 0x7FFFFFFF))
@ -5560,7 +5560,7 @@ mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip,
if ((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!file_stat.m_method)) {
// The file is stored or the caller has requested the compressed data.
if (pZip->m_pState->m_pMem) {
#ifdef _MSC_VER
#if defined (_MSC_VER) && !defined(__clang__)
if (((0, sizeof(size_t) == sizeof(mz_uint32))) &&
(file_stat.m_comp_size > 0xFFFFFFFF))
#else

View File

@ -14,7 +14,7 @@
#endif
// reset packing to the original value
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#if (defined(_MSC_VER) && !defined(__clang__)) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop )
#endif
#undef PACK_STRUCT

View File

@ -22,7 +22,7 @@
# error poppack1.h must be included after pushpack1.h
#endif
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#if (defined(_MSC_VER) && !defined(__clang__)) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack(push,1)
# define PACK_STRUCT
#elif defined( __GNUC__ ) || defined(__clang__)

View File

@ -44,21 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib>
#include <gtest/gtest.h>
#if defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
inline FILE* MakeTmpFile(char* tmplate)
{
auto fd = mkstemp(tmplate);
EXPECT_NE(-1, fd);
if(fd == -1)
{
return nullptr;
}
auto fs = fdopen(fd, "w+");
EXPECT_NE(nullptr, fs);
return fs;
}
#elif defined(_MSC_VER)
#if defined(_MSC_VER)
#include <io.h>
#define TMP_PATH "./"
inline FILE* MakeTmpFile(char* tmplate)
@ -73,4 +59,18 @@ inline FILE* MakeTmpFile(char* tmplate)
EXPECT_NE(fs, nullptr);
return fs;
}
#elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
inline FILE* MakeTmpFile(char* tmplate)
{
auto fd = mkstemp(tmplate);
EXPECT_NE(-1, fd);
if(fd == -1)
{
return nullptr;
}
auto fs = fdopen(fd, "w+");
EXPECT_NE(nullptr, fs);
return fs;
}
#endif

View File

@ -157,7 +157,6 @@ public:
static inline void CheckNodeIdNames(IdNameMap &nodeIdMap, IdNameMap &nodeNameMap, const aiNode *parent, size_t index) {
IdNameString namePair = GetItemIdName(parent, index);
const auto result = nodeNameMap.insert(namePair);
IdNameString idPair = GetColladaIdName(parent, index);
ReportDuplicate(nodeIdMap, idPair, typeid(aiNode).name());