Update Assimp from 5.2.3 to 5.2.5

This commit is contained in:
Bloodknight 2022-10-02 19:02:49 +01:00
parent ea7ca63301
commit 16f3710058
379 changed files with 14469 additions and 47175 deletions

View file

@ -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,
@ -50,23 +48,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream>
#include <cstdlib>
void Assimp::defaultAiAssertHandler(const char* failedExpression, const char* file, int line)
{
void Assimp::defaultAiAssertHandler(const char* failedExpression, const char* file, int line) {
std::cerr << "ai_assert failure in " << file << "(" << line << "): " << failedExpression << std::endl;
std::abort();
}
namespace
{
namespace {
Assimp::AiAssertHandler s_handler = Assimp::defaultAiAssertHandler;
}
void Assimp::setAiAssertHandler(AiAssertHandler handler)
{
s_handler = handler;
void Assimp::setAiAssertHandler(AiAssertHandler handler) {
if (handler != nullptr) {
s_handler = handler;
} else {
s_handler = Assimp::defaultAiAssertHandler;
}
}
void Assimp::aiAssertViolation(const char* failedExpression, const char* file, int line)
{
void Assimp::aiAssertViolation(const char* failedExpression, const char* file, int line) {
s_handler(failedExpression, file, line);
}

View file

@ -47,29 +47,33 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/ai_assert.h>
#include <assimp/defs.h>
namespace Assimp
{
// ---------------------------------------------------------------------------
/** Signature of functions which handle assert violations.
*/
using AiAssertHandler = void (*)(const char* failedExpression, const char* file, int line);
namespace Assimp {
// ---------------------------------------------------------------------------
/** Set the assert handler.
*/
ASSIMP_API void setAiAssertHandler(AiAssertHandler handler);
// ---------------------------------------------------------------------------
/**
* @brief Signature of functions which handle assert violations.
*/
using AiAssertHandler = void (*)(const char* failedExpression, const char* file, int line);
// ---------------------------------------------------------------------------
/** The assert handler which is set by default.
*
* This issues a message to stderr and calls abort.
*/
ASSIMP_API void defaultAiAssertHandler(const char* failedExpression, const char* file, int line);
// ---------------------------------------------------------------------------
/**
* @brief Set the assert handler.
*/
ASSIMP_API void setAiAssertHandler(AiAssertHandler handler);
// ---------------------------------------------------------------------------
/** The assert handler which is set by default.
*
* @brief This issues a message to stderr and calls abort.
*/
ASSIMP_API void defaultAiAssertHandler(const char* failedExpression, const char* file, int line);
// ---------------------------------------------------------------------------
/**
* @brief Dispatches an assert violation to the assert handler.
*/
ASSIMP_API void aiAssertViolation(const char* failedExpression, const char* file, int line);
// ---------------------------------------------------------------------------
/** Dispatches an assert violation to the assert handler.
*/
ASSIMP_API void aiAssertViolation(const char* failedExpression, const char* file, int line);
} // end of namespace Assimp
#endif // INCLUDED_AI_ASSERTHANDLER_H
#endif // INCLUDED_AI_ASSERTHANDLER_H

View file

@ -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,
@ -1275,25 +1273,22 @@ ASSIMP_API void aiQuaternionInterpolate(
#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
#ifndef STB_USE_HUNTER
# 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
#endif
// Ensure all symbols are linked correctly
#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)
// Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy.
# define STBI_ONLY_PNG
# ifdef ASSIMP_USE_STB_IMAGE_STATIC
# define STB_IMAGE_STATIC
# endif
# define STB_IMAGE_IMPLEMENTATION
# include "stb/stb_image.h"
# if _MSC_VER
# pragma warning(pop)
# endif
# include "Common/StbCommon.h"
#endif

View file

@ -46,7 +46,7 @@ namespace Assimp {
namespace Base64 {
static const uint8_t tableDecodeBase64[128] = {
static constexpr uint8_t tableDecodeBase64[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63,
@ -57,7 +57,7 @@ static const uint8_t tableDecodeBase64[128] = {
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0
};
static const char *tableEncodeBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
static constexpr char tableEncodeBase64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
static inline char EncodeChar(uint8_t b) {
return tableEncodeBase64[size_t(b)];
@ -71,6 +71,11 @@ inline uint8_t DecodeChar(char c) {
}
void Encode(const uint8_t *in, size_t inLength, std::string &out) {
if (in == nullptr || inLength==0) {
out.clear();
return;
}
size_t outLength = ((inLength + 2) / 3) * 4;
size_t j = out.size();
@ -115,8 +120,14 @@ std::string Encode(const std::vector<uint8_t> &in) {
}
size_t Decode(const char *in, size_t inLength, uint8_t *&out) {
if (in == nullptr) {
out = nullptr;
return 0;
}
if (inLength % 4 != 0) {
throw DeadlyImportError("Invalid base64 encoded data: \"", std::string(in, std::min(size_t(32), inLength)), "\", length:", inLength);
throw DeadlyImportError("Invalid base64 encoded data: \"", std::string(in, std::min(size_t(32), inLength)),
"\", length:", inLength);
}
if (inLength < 4) {

View file

@ -70,9 +70,7 @@ BaseImporter::BaseImporter() AI_NO_EXCEPT
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
BaseImporter::~BaseImporter() {
// nothing to do here
}
BaseImporter::~BaseImporter() = default;
void BaseImporter::UpdateImporterScale(Importer *pImp) {
ai_assert(pImp != nullptr);
@ -234,19 +232,23 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
std::string::size_type pos = pFile.find_last_of('.');
// no file extension - can't read
if (pos == std::string::npos)
if (pos == std::string::npos) {
return false;
}
const char *ext_real = &pFile[pos + 1];
if (!ASSIMP_stricmp(ext_real, ext0))
if (!ASSIMP_stricmp(ext_real, ext0)) {
return true;
}
// check for other, optional, file extensions
if (ext1 && !ASSIMP_stricmp(ext_real, ext1))
if (ext1 && !ASSIMP_stricmp(ext_real, ext1)) {
return true;
}
if (ext2 && !ASSIMP_stricmp(ext_real, ext2))
return true;
if (ext2 && !ASSIMP_stricmp(ext_real, ext2)) {
return true;
}
return false;
}

View file

@ -59,24 +59,31 @@ BaseProcess::BaseProcess() AI_NO_EXCEPT
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
BaseProcess::~BaseProcess() {
// nothing to do here
}
BaseProcess::~BaseProcess() = default;
// ------------------------------------------------------------------------------------------------
void BaseProcess::ExecuteOnScene(Importer *pImp) {
ai_assert( nullptr != pImp );
ai_assert( nullptr != pImp->Pimpl()->mScene);
if (pImp == nullptr) {
return;
}
ai_assert(nullptr != pImp->Pimpl()->mScene);
if (pImp->Pimpl()->mScene == nullptr) {
return;
}
progress = pImp->GetProgressHandler();
ai_assert(nullptr != progress);
if (progress == nullptr) {
return;
}
SetupProperties(pImp);
// catch exceptions thrown inside the PostProcess-Step
try {
Execute(pImp->Pimpl()->mScene);
} catch (const std::exception &err) {
// extract error description

View file

@ -63,7 +63,7 @@ class Importer;
class SharedPostProcessInfo {
public:
struct Base {
virtual ~Base() {}
virtual ~Base() = default;
};
//! Represents data that is allocated on the heap, thus needs to be deleted
@ -84,7 +84,7 @@ public:
explicit TStaticData(T in) :
data(in) {}
~TStaticData() {}
~TStaticData() = default;
T data;
};
@ -175,23 +175,24 @@ private:
* should be executed. If the function returns true, the class' Execute()
* function is called subsequently.
*/
class ASSIMP_API_WINONLY BaseProcess {
class ASSIMP_API BaseProcess {
friend class Importer;
public:
/** Constructor to be privately used by Importer */
/** @brief onstructor to be privately used by Importer */
BaseProcess() AI_NO_EXCEPT;
/** Destructor, private as well */
/** @brief Destructor, private as well */
virtual ~BaseProcess();
// -------------------------------------------------------------------
/** Returns whether the processing step is present in the given flag.
/**
* @brief Returns whether the processing step is present in the given flag.
* @param pFlags The processing flags the importer was called with. A
* bitwise combination of #aiPostProcessSteps.
* @return true if the process is present in this flag fields,
* false if not.
*/
*/
virtual bool IsActive(unsigned int pFlags) const = 0;
// -------------------------------------------------------------------
@ -200,33 +201,36 @@ public:
virtual bool RequireVerboseFormat() const;
// -------------------------------------------------------------------
/** Executes the post processing step on the given imported data.
* The function deletes the scene if the postprocess step fails (
* the object pointer will be set to nullptr).
* @param pImp Importer instance (pImp->mScene must be valid)
*/
/**
* @brief Executes the post processing step on the given imported data.
* The function deletes the scene if the post-process step fails (
* the object pointer will be set to nullptr).
* @param pImp Importer instance (pImp->mScene must be valid)
*/
void ExecuteOnScene(Importer *pImp);
// -------------------------------------------------------------------
/** Called prior to ExecuteOnScene().
* The function is a request to the process to update its configuration
* basing on the Importer's configuration property list.
*/
/**
* @brief Called prior to ExecuteOnScene().
* The function is a request to the process to update its configuration
* basing on the Importer's configuration property list.
*/
virtual void SetupProperties(const Importer *pImp);
// -------------------------------------------------------------------
/** Executes the post processing step on the given imported data.
* A process should throw an ImportErrorException* if it fails.
* This method must be implemented by deriving classes.
* @param pScene The imported data to work at.
*/
/**
* @brief Executes the post processing step on the given imported data.
* A process should throw an ImportErrorException* if it fails.
* This method must be implemented by deriving classes.
* @param pScene The imported data to work at.
*/
virtual void Execute(aiScene *pScene) = 0;
// -------------------------------------------------------------------
/** Assign a new SharedPostProcessInfo to the step. This object
* allows multiple postprocess steps to share data.
* allows multiple post-process steps to share data.
* @param sh May be nullptr
*/
*/
inline void SetSharedData(SharedPostProcessInfo *sh) {
shared = sh;
}

View file

@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
#include <zlib.h>
# include <zlib.h>
#else
#include "../contrib/zlib/zlib.h"
# include "../contrib/zlib/zlib.h"
#endif
#include <vector>

View file

@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) {
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
#if defined _WIN32 && (!defined __GNUC__ || !defined __CLANG__ && __MSVCRT_VERSION__ >= 0x0601)
template <>
inline size_t select_ftell<8>(FILE *file) {
return (size_t)::_ftelli64(file);
@ -74,7 +74,7 @@ inline int select_fseek<8>(FILE *file, int64_t offset, int origin) {
return ::_fseeki64(file, offset, origin);
}
#endif // #if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
#endif
} // namespace
@ -149,13 +149,20 @@ size_t DefaultIOStream::FileSize() const {
//
// See here for details:
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
#if defined _WIN32 && (!defined __GNUC__ || !defined __CLANG__ && __MSVCRT_VERSION__ >= 0x0601)
struct __stat64 fileStat;
//using fileno + fstat avoids having to handle the filename
int err = _fstat64(_fileno(mFile), &fileStat);
if (0 != err)
return 0;
mCachedSize = (size_t)(fileStat.st_size);
#elif defined _WIN32
struct _stat32 fileStat;
//using fileno + fstat avoids having to handle the filename
int err = _fstat32(_fileno(mFile), &fileStat);
if (0 != err)
return 0;
mCachedSize = (size_t)(fileStat.st_size);
#elif defined __GNUC__ || defined __APPLE__ || defined __MACH__ || defined __FreeBSD__
struct stat fileStat;
int err = stat(mFilename.c_str(), &fileStat);

View file

@ -146,73 +146,73 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
(void)exporters;
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada));
exporters.emplace_back("collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada);
#endif
#ifndef ASSIMP_BUILD_NO_X_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("x", "X Files", "x", &ExportSceneXFile,
aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs));
exporters.emplace_back("x", "X Files", "x", &ExportSceneXFile,
aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs);
#endif
#ifndef ASSIMP_BUILD_NO_STEP_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("stp", "Step Files", "stp", &ExportSceneStep, 0));
exporters.emplace_back("stp", "Step Files", "stp", &ExportSceneStep, 0);
#endif
#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */));
exporters.push_back(Exporter::ExportFormatEntry("objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */));
exporters.emplace_back("obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */);
exporters.emplace_back("objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */);
#endif
#ifndef ASSIMP_BUILD_NO_STL_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("stl", "Stereolithography", "stl", &ExportSceneSTL,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices));
exporters.push_back(Exporter::ExportFormatEntry("stlb", "Stereolithography (binary)", "stl", &ExportSceneSTLBinary,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices));
exporters.emplace_back("stl", "Stereolithography", "stl", &ExportSceneSTL,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices);
exporters.emplace_back("stlb", "Stereolithography (binary)", "stl", &ExportSceneSTLBinary,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices);
#endif
#ifndef ASSIMP_BUILD_NO_PLY_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("ply", "Stanford Polygon Library", "ply", &ExportScenePly,
aiProcess_PreTransformVertices));
exporters.push_back(Exporter::ExportFormatEntry("plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
aiProcess_PreTransformVertices));
exporters.emplace_back("ply", "Stanford Polygon Library", "ply", &ExportScenePly,
aiProcess_PreTransformVertices);
exporters.emplace_back("plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
aiProcess_PreTransformVertices);
#endif
#ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("3ds", "Autodesk 3DS (legacy)", "3ds", &ExportScene3DS,
aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices));
exporters.emplace_back("3ds", "Autodesk 3DS (legacy)", "3ds", &ExportScene3DS,
aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices);
#endif
#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));
exporters.emplace_back("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType);
exporters.emplace_back("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,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
exporters.emplace_back("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType);
exporters.emplace_back("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType);
#endif
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("assbin", "Assimp Binary File", "assbin", &ExportSceneAssbin, 0));
exporters.emplace_back("assbin", "Assimp Binary File", "assbin", &ExportSceneAssbin, 0);
#endif
#ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("assxml", "Assimp XML Document", "assxml", &ExportSceneAssxml, 0));
exporters.emplace_back("assxml", "Assimp XML Document", "assxml", &ExportSceneAssxml, 0);
#endif
#ifndef ASSIMP_BUILD_NO_X3D_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("x3d", "Extensible 3D", "x3d", &ExportSceneX3D, 0));
exporters.emplace_back("x3d", "Extensible 3D", "x3d", &ExportSceneX3D, 0);
#endif
#ifndef ASSIMP_BUILD_NO_FBX_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0));
exporters.push_back(Exporter::ExportFormatEntry("fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0));
exporters.emplace_back("fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0);
exporters.emplace_back("fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0);
#endif
#ifndef ASSIMP_BUILD_NO_M3D_EXPORTER
@ -221,15 +221,15 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
#endif
#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0));
exporters.emplace_back("3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0);
#endif
#ifndef ASSIMP_BUILD_NO_PBRT_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("pbrt", "pbrt-v4 scene description file", "pbrt", &ExportScenePbrt, aiProcess_Triangulate | aiProcess_SortByPType));
exporters.emplace_back("pbrt", "pbrt-v4 scene description file", "pbrt", &ExportScenePbrt, aiProcess_Triangulate | aiProcess_SortByPType);
#endif
#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER
exporters.push_back(Exporter::ExportFormatEntry("assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0));
exporters.emplace_back("assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0);
#endif
}
@ -585,19 +585,10 @@ void Exporter::UnregisterExporter(const char* id) {
}
// ------------------------------------------------------------------------------------------------
ExportProperties::ExportProperties() {
// empty
}
ExportProperties::ExportProperties() = default;
// ------------------------------------------------------------------------------------------------
ExportProperties::ExportProperties(const ExportProperties &other)
: mIntProperties(other.mIntProperties)
, mFloatProperties(other.mFloatProperties)
, mStringProperties(other.mStringProperties)
, mMatrixProperties(other.mMatrixProperties)
, mCallbackProperties(other.mCallbackProperties){
// empty
}
ExportProperties::ExportProperties(const ExportProperties &other) = default;
bool ExportProperties::SetPropertyCallback(const char *szName, const std::function<void *(void *)> &f) {
return SetGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName, f);

View file

@ -300,10 +300,10 @@ private:
const char separator = getOsSeparator();
for (it = in.begin(); it != in.end(); ++it) {
int remaining = std::distance(in.end(), it);
const size_t remaining = std::distance(in.end(), it);
// Exclude :// and \\, which remain untouched.
// https://sourceforge.net/tracker/?func=detail&aid=3031725&group_id=226462&atid=1067632
if (remaining >= 3 && !strncmp(&*it, "://", 3 )) {
if (remaining >= 3u && !strncmp(&*it, "://", 3 )) {
it += 3;
continue;
}

View file

@ -0,0 +1,92 @@
/*
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,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#pragma once
#include <assimp/ai_assert.h>
#include <utility>
namespace Assimp {
/// @brief This class implements an optional type
/// @tparam T The type to store.
template <typename T>
struct Maybe {
/// @brief
Maybe() = default;
/// @brief
/// @param val
template <typename U>
explicit Maybe(U &&val) :
_val(std::forward<U>(val)), _valid(true) {}
/// @brief Validate the value
/// @return true if valid.
operator bool() const {
return _valid;
}
/// @brief Will assign a value.
/// @param v The new valid value.
template <typename U>
void Set(U &&v) {
ai_assert(!_valid);
_valid = true;
_val = std::forward<U>(v);
}
/// @brief Will return the value when it is valid.
/// @return The value.
const T &Get() const {
ai_assert(_valid);
return _val;
}
Maybe &operator&() = delete;
Maybe(const Maybe &) = delete;
private:
T _val;
bool _valid = false;
};
} // namespace Assimp

View file

@ -59,18 +59,15 @@ SGSpatialSort::SGSpatialSort()
}
// ------------------------------------------------------------------------------------------------
// Destructor
SGSpatialSort::~SGSpatialSort()
{
// nothing to do here, everything destructs automatically
}
SGSpatialSort::~SGSpatialSort() = default;
// ------------------------------------------------------------------------------------------------
void SGSpatialSort::Add(const aiVector3D& vPosition, unsigned int index,
unsigned int smoothingGroup)
{
// store position by index and distance
float distance = vPosition * mPlaneNormal;
mPositions.push_back( Entry( index, vPosition,
distance, smoothingGroup));
mPositions.emplace_back( index, vPosition,
distance, smoothingGroup);
}
// ------------------------------------------------------------------------------------------------
void SGSpatialSort::Prepare()

View file

@ -510,7 +510,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
OffsetNodeMeshIndices(node, offset[n]);
}
if (n) // src[0] is the master node
nodes.push_back(NodeAttachmentInfo(node, srcList[n - 1].attachToNode, n));
nodes.emplace_back(node, srcList[n - 1].attachToNode, n);
// add name prefixes?
if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES) {
@ -685,19 +685,19 @@ void SceneCombiner::BuildUniqueBoneList(std::list<BoneWithHash> &asBones,
for (; it2 != end2; ++it2) {
if ((*it2).first == itml) {
(*it2).pSrcBones.push_back(BoneSrcIndex(p, iOffset));
(*it2).pSrcBones.emplace_back(p, iOffset);
break;
}
}
if (end2 == it2) {
// need to begin a new bone entry
asBones.push_back(BoneWithHash());
asBones.emplace_back();
BoneWithHash &btz = asBones.back();
// setup members
btz.first = itml;
btz.second = &p->mName;
btz.pSrcBones.push_back(BoneSrcIndex(p, iOffset));
btz.pSrcBones.emplace_back(p, iOffset);
}
}
iOffset += (*it)->mNumVertices;

View file

@ -105,36 +105,37 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) {
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
if (!mesh->mTextureCoords[i]) {
mesh->mNumUVComponents[i] = 0;
} else {
if (!mesh->mNumUVComponents[i]) {
mesh->mNumUVComponents[i] = 2;
continue;
}
if (!mesh->mNumUVComponents[i]) {
mesh->mNumUVComponents[i] = 2;
}
aiVector3D *p = mesh->mTextureCoords[i], *end = p + mesh->mNumVertices;
// Ensure unused components are zeroed. This will make 1D texture channels work
// as if they were 2D channels .. just in case an application doesn't handle
// this case
if (2 == mesh->mNumUVComponents[i]) {
for (; p != end; ++p) {
p->z = 0.f;
}
aiVector3D *p = mesh->mTextureCoords[i], *end = p + mesh->mNumVertices;
// Ensure unused components are zeroed. This will make 1D texture channels work
// as if they were 2D channels .. just in case an application doesn't handle
// this case
if (2 == mesh->mNumUVComponents[i]) {
for (; p != end; ++p) {
p->z = 0.f;
}
} else if (1 == mesh->mNumUVComponents[i]) {
for (; p != end; ++p) {
p->z = p->y = 0.f;
}
} else if (3 == mesh->mNumUVComponents[i]) {
// Really 3D coordinates? Check whether the third coordinate is != 0 for at least one element
for (; p != end; ++p) {
if (p->z != 0) {
break;
}
}
if (p == end) {
ASSIMP_LOG_WARN("ScenePreprocessor: UVs are declared to be 3D but they're obviously not. Reverting to 2D.");
mesh->mNumUVComponents[i] = 2;
} else if (1 == mesh->mNumUVComponents[i]) {
for (; p != end; ++p) {
p->z = p->y = 0.f;
}
} else if (3 == mesh->mNumUVComponents[i]) {
// Really 3D coordinates? Check whether the third coordinate is != 0 for at least one element
for (; p != end; ++p) {
if (p->z != 0) {
break;
}
}
if (p == end) {
ASSIMP_LOG_WARN("ScenePreprocessor: UVs are declared to be 3D but they're obviously not. Reverting to 2D.");
mesh->mNumUVComponents[i] = 2;
}
}
}

View file

@ -4,7 +4,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,
@ -97,13 +96,14 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
const aiMatrix4x4 &childTransform = pNode->mChildren[a]->mTransformation;
aiVector3D childpos(childTransform.a4, childTransform.b4, childTransform.c4);
ai_real distanceToChild = childpos.Length();
if (distanceToChild < 0.0001)
if (distanceToChild < ai_epsilon) {
continue;
}
aiVector3D up = aiVector3D(childpos).Normalize();
aiVector3D orth(1.0, 0.0, 0.0);
if (std::fabs(orth * up) > 0.99)
if (std::fabs(orth * up) > 0.99) {
orth.Set(0.0, 1.0, 0.0);
}
aiVector3D front = (up ^ orth).Normalize();
aiVector3D side = (front ^ up).Normalize();
@ -122,50 +122,50 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
mVertices.push_back(childpos);
mVertices.push_back(-front * distanceToChild * (ai_real)0.1);
mFaces.push_back(Face(localVertexStart + 0, localVertexStart + 1, localVertexStart + 2));
mFaces.push_back(Face(localVertexStart + 3, localVertexStart + 4, localVertexStart + 5));
mFaces.push_back(Face(localVertexStart + 6, localVertexStart + 7, localVertexStart + 8));
mFaces.push_back(Face(localVertexStart + 9, localVertexStart + 10, localVertexStart + 11));
mFaces.emplace_back(localVertexStart + 0, localVertexStart + 1, localVertexStart + 2);
mFaces.emplace_back(localVertexStart + 3, localVertexStart + 4, localVertexStart + 5);
mFaces.emplace_back(localVertexStart + 6, localVertexStart + 7, localVertexStart + 8);
mFaces.emplace_back(localVertexStart + 9, localVertexStart + 10, localVertexStart + 11);
}
} else {
// if the node has no children, it's an end node. Put a little knob there instead
aiVector3D ownpos(pNode->mTransformation.a4, pNode->mTransformation.b4, pNode->mTransformation.c4);
ai_real sizeEstimate = ownpos.Length() * ai_real(0.18);
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mFaces.push_back(Face(vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2));
mFaces.push_back(Face(vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5));
mFaces.push_back(Face(vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8));
mFaces.push_back(Face(vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11));
mFaces.push_back(Face(vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14));
mFaces.push_back(Face(vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17));
mFaces.push_back(Face(vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20));
mFaces.push_back(Face(vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23));
mFaces.emplace_back(vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2);
mFaces.emplace_back(vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5);
mFaces.emplace_back(vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8);
mFaces.emplace_back(vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11);
mFaces.emplace_back(vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14);
mFaces.emplace_back(vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17);
mFaces.emplace_back(vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20);
mFaces.emplace_back(vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23);
}
unsigned int numVertices = static_cast<unsigned int>(mVertices.size() - vertexStartIndex);
@ -183,8 +183,9 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
// add all the vertices to the bone's influences
bone->mNumWeights = numVertices;
bone->mWeights = new aiVertexWeight[numVertices];
for (unsigned int a = 0; a < numVertices; a++)
for (unsigned int a = 0; a < numVertices; ++a) {
bone->mWeights[a] = aiVertexWeight(vertexStartIndex + a, 1.0);
}
// HACK: (thom) transform all vertices to the bone's local space. Should be done before adding
// them to the array, but I'm tired now and I'm annoyed.
@ -194,8 +195,9 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
}
// and finally recurse into the children list
for (unsigned int a = 0; a < pNode->mNumChildren; a++)
for (unsigned int a = 0; a < pNode->mNumChildren; ++a) {
CreateGeometry(pNode->mChildren[a]);
}
}
// ------------------------------------------------------------------------------------------------

View file

@ -73,9 +73,7 @@ SpatialSort::SpatialSort() :
// ------------------------------------------------------------------------------------------------
// Destructor
SpatialSort::~SpatialSort() {
// empty
}
SpatialSort::~SpatialSort() = default;
// ------------------------------------------------------------------------------------------------
void SpatialSort::Fill(const aiVector3D *pPositions, unsigned int pNumPositions,
@ -116,7 +114,7 @@ void SpatialSort::Append(const aiVector3D *pPositions, unsigned int pNumPosition
for (unsigned int a = 0; a < pNumPositions; a++) {
const char *tempPointer = reinterpret_cast<const char *>(pPositions);
const aiVector3D *vec = reinterpret_cast<const aiVector3D *>(tempPointer + a * pElementOffset);
mPositions.push_back(Entry(static_cast<unsigned int>(a + initial), *vec));
mPositions.emplace_back(static_cast<unsigned int>(a + initial), *vec);
}
if (pFinalize) {

View file

@ -422,15 +422,15 @@ void StandardShapes::MakeCone(ai_real height, ai_real radius1,
if (!bOpen) {
// generate the end 'cap'
positions.push_back(aiVector3D(s * radius2, halfHeight, t * radius2));
positions.push_back(aiVector3D(s2 * radius2, halfHeight, t2 * radius2));
positions.push_back(aiVector3D(0.0, halfHeight, 0.0));
positions.emplace_back(s * radius2, halfHeight, t * radius2);
positions.emplace_back(s2 * radius2, halfHeight, t2 * radius2);
positions.emplace_back(0.0, halfHeight, 0.0);
if (radius1) {
// generate the other end 'cap'
positions.push_back(aiVector3D(s * radius1, -halfHeight, t * radius1));
positions.push_back(aiVector3D(s2 * radius1, -halfHeight, t2 * radius1));
positions.push_back(aiVector3D(0.0, -halfHeight, 0.0));
positions.emplace_back(s * radius1, -halfHeight, t * radius1);
positions.emplace_back(s2 * radius1, -halfHeight, t2 * radius1);
positions.emplace_back(0.0, -halfHeight, 0.0);
}
}
s = s2;
@ -466,13 +466,13 @@ void StandardShapes::MakeCircle(ai_real radius, unsigned int tess,
ai_real t = 0.0; // std::sin(angle == 0);
for (ai_real angle = 0.0; angle < angle_max;) {
positions.push_back(aiVector3D(s * radius, 0.0, t * radius));
positions.emplace_back(s * radius, 0.0, t * radius);
angle += angle_delta;
s = std::cos(angle);
t = std::sin(angle);
positions.push_back(aiVector3D(s * radius, 0.0, t * radius));
positions.emplace_back(s * radius, 0.0, t * radius);
positions.push_back(aiVector3D(0.0, 0.0, 0.0));
positions.emplace_back(0.0, 0.0, 0.0);
}
}

View file

@ -0,0 +1,116 @@
/*
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,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
#pragma once
#if _MSC_VER // "unreferenced function has been removed" (SSE2 detection routine in x64 builds)
#pragma warning(push)
#pragma warning(disable : 4505)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#ifndef STB_USE_HUNTER
/* Use prefixed names for the symbols from stb_image as it is a very commonly embedded library.
Including vanilla stb_image symbols causes duplicate symbol problems if assimp is linked
statically together with another library or executable that also embeds stb_image.
Symbols are not prefixed if using Hunter because in such case there exists a single true
stb_image library on the system that is used by assimp and can be used by all the other
libraries and executables.
The list can be regenerated using the following:
cat <path/to/stb/stb_image.h> | fgrep STBIDEF | fgrep '(' | sed -E 's/\*|\(.+//g' | \
awk '{print "#define " $(NF) " assimp_" $(NF) }' | sort | uniq"
*/
#define stbi_convert_iphone_png_to_rgb assimp_stbi_convert_iphone_png_to_rgb
#define stbi_convert_wchar_to_utf8 assimp_stbi_convert_wchar_to_utf8
#define stbi_failure_reason assimp_stbi_failure_reason
#define stbi_hdr_to_ldr_gamma assimp_stbi_hdr_to_ldr_gamma
#define stbi_hdr_to_ldr_scale assimp_stbi_hdr_to_ldr_scale
#define stbi_image_free assimp_stbi_image_free
#define stbi_info assimp_stbi_info
#define stbi_info_from_callbacks assimp_stbi_info_from_callbacks
#define stbi_info_from_file assimp_stbi_info_from_file
#define stbi_info_from_memory assimp_stbi_info_from_memory
#define stbi_is_16_bit assimp_stbi_is_16_bit
#define stbi_is_16_bit_from_callbacks assimp_stbi_is_16_bit_from_callbacks
#define stbi_is_16_bit_from_file assimp_stbi_is_16_bit_from_file
#define stbi_is_16_bit_from_memory assimp_stbi_is_16_bit_from_memory
#define stbi_is_hdr assimp_stbi_is_hdr
#define stbi_is_hdr_from_callbacks assimp_stbi_is_hdr_from_callbacks
#define stbi_is_hdr_from_file assimp_stbi_is_hdr_from_file
#define stbi_is_hdr_from_memory assimp_stbi_is_hdr_from_memory
#define stbi_ldr_to_hdr_gamma assimp_stbi_ldr_to_hdr_gamma
#define stbi_ldr_to_hdr_scale assimp_stbi_ldr_to_hdr_scale
#define stbi_load_16 assimp_stbi_load_16
#define stbi_load_16_from_callbacks assimp_stbi_load_16_from_callbacks
#define stbi_load_16_from_memory assimp_stbi_load_16_from_memory
#define stbi_load assimp_stbi_load
#define stbi_loadf assimp_stbi_loadf
#define stbi_loadf_from_callbacks assimp_stbi_loadf_from_callbacks
#define stbi_loadf_from_file assimp_stbi_loadf_from_file
#define stbi_loadf_from_memory assimp_stbi_loadf_from_memory
#define stbi_load_from_callbacks assimp_stbi_load_from_callbacks
#define stbi_load_from_file_16 assimp_stbi_load_from_file_16
#define stbi_load_from_file assimp_stbi_load_from_file
#define stbi_load_from_memory assimp_stbi_load_from_memory
#define stbi_load_gif_from_memory assimp_stbi_load_gif_from_memory
#define stbi_set_flip_vertically_on_load assimp_stbi_set_flip_vertically_on_load
#define stbi_set_flip_vertically_on_load_thread assimp_stbi_set_flip_vertically_on_load_thread
#define stbi_set_unpremultiply_on_load assimp_stbi_set_unpremultiply_on_load
#define stbi_zlib_decode_buffer assimp_stbi_zlib_decode_buffer
#define stbi_zlib_decode_malloc assimp_stbi_zlib_decode_malloc
#define stbi_zlib_decode_malloc_guesssize assimp_stbi_zlib_decode_malloc_guesssize
#define stbi_zlib_decode_malloc_guesssize_headerflag assimp_stbi_zlib_decode_malloc_guesssize_headerflag
#define stbi_zlib_decode_noheader_buffer assimp_stbi_zlib_decode_noheader_buffer
#define stbi_zlib_decode_noheader_malloc assimp_stbi_zlib_decode_noheader_malloc
#endif
#include "stb/stb_image.h"
#if _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif

View file

@ -135,6 +135,9 @@ ASSIMP_API aiScene::aiScene() :
mNumCameras(0),
mCameras(nullptr),
mMetaData(nullptr),
mName(),
mNumSkeletons(0),
mSkeletons(nullptr),
mPrivate(new Assimp::ScenePrivateData()) {
// empty
}
@ -180,7 +183,8 @@ ASSIMP_API aiScene::~aiScene() {
delete[] mCameras;
aiMetadata::Dealloc(mMetaData);
mMetaData = nullptr;
delete[] mSkeletons;
delete static_cast<Assimp::ScenePrivateData *>(mPrivate);
}

View file

@ -196,7 +196,9 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
zlib_filefunc_def mapping;
mapping.zopen_file = (open_file_func)open;
#ifdef _UNZ_H
mapping.zopendisk_file = (opendisk_file_func)opendisk;
#endif
mapping.zread_file = (read_file_func)read;
mapping.zwrite_file = (write_file_func)write;
mapping.ztell_file = (tell_file_func)tell;
@ -277,8 +279,7 @@ ZipFile::ZipFile(std::string &filename, size_t size) :
m_Buffer = std::unique_ptr<uint8_t[]>(new uint8_t[m_Size]);
}
ZipFile::~ZipFile() {
}
ZipFile::~ZipFile() = default;
size_t ZipFile::Read(void *pvBuffer, size_t pSize, size_t pCount) {
// Should be impossible

View file

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h>
// -------------------------------------------------------------------------------
const char *TextureTypeToString(aiTextureType in) {
const char *aiTextureTypeToString(aiTextureType in) {
switch (in) {
case aiTextureType_NONE:
return "n/a";

View file

@ -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,