Merge branch 'master' into kimkulling/release_candidate_assimp_5_4_0
commit
e0eead6fa3
|
@ -93,10 +93,6 @@ BaseImporter::BaseImporter() AI_NO_EXCEPT
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
BaseImporter::~BaseImporter() = default;
|
|
||||||
|
|
||||||
void BaseImporter::UpdateImporterScale(Importer *pImp) {
|
void BaseImporter::UpdateImporterScale(Importer *pImp) {
|
||||||
ai_assert(pImp != nullptr);
|
ai_assert(pImp != nullptr);
|
||||||
ai_assert(importerScale != 0.0);
|
ai_assert(importerScale != 0.0);
|
||||||
|
|
|
@ -57,10 +57,6 @@ BaseProcess::BaseProcess() AI_NO_EXCEPT
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor, private as well
|
|
||||||
BaseProcess::~BaseProcess() = default;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void BaseProcess::ExecuteOnScene(Importer *pImp) {
|
void BaseProcess::ExecuteOnScene(Importer *pImp) {
|
||||||
ai_assert( nullptr != pImp );
|
ai_assert( nullptr != pImp );
|
||||||
|
|
|
@ -179,11 +179,11 @@ class ASSIMP_API BaseProcess {
|
||||||
friend class Importer;
|
friend class Importer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** @brief onstructor to be privately used by Importer */
|
/** @brief Constructor to be privately used by Importer */
|
||||||
BaseProcess() AI_NO_EXCEPT;
|
BaseProcess() AI_NO_EXCEPT;
|
||||||
|
|
||||||
/** @brief Destructor, private as well */
|
/** @brief Destructor */
|
||||||
virtual ~BaseProcess();
|
virtual ~BaseProcess() = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,11 +74,11 @@ public:
|
||||||
typedef unsigned int KeyType;
|
typedef unsigned int KeyType;
|
||||||
|
|
||||||
// typedefs for our configuration maps.
|
// typedefs for our configuration maps.
|
||||||
typedef std::map<KeyType, int> IntPropertyMap;
|
using IntPropertyMap = std::map<KeyType, int>;
|
||||||
typedef std::map<KeyType, ai_real> FloatPropertyMap;
|
using FloatPropertyMap = std::map<KeyType, ai_real>;
|
||||||
typedef std::map<KeyType, std::string> StringPropertyMap;
|
using StringPropertyMap = std::map<KeyType, std::string>;
|
||||||
typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;
|
using MatrixPropertyMap = std::map<KeyType, aiMatrix4x4>;
|
||||||
typedef std::map<KeyType, void*> PointerPropertyMap;
|
using PointerPropertyMap = std::map<KeyType, void*>;
|
||||||
|
|
||||||
/** IO handler to use for all file accesses. */
|
/** IO handler to use for all file accesses. */
|
||||||
IOSystem* mIOHandler;
|
IOSystem* mIOHandler;
|
||||||
|
@ -128,10 +128,12 @@ public:
|
||||||
|
|
||||||
/// The default class constructor.
|
/// The default class constructor.
|
||||||
ImporterPimpl() AI_NO_EXCEPT;
|
ImporterPimpl() AI_NO_EXCEPT;
|
||||||
|
|
||||||
|
/// The class destructor.
|
||||||
|
~ImporterPimpl() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline ImporterPimpl::ImporterPimpl() AI_NO_EXCEPT :
|
||||||
ImporterPimpl::ImporterPimpl() AI_NO_EXCEPT :
|
|
||||||
mIOHandler( nullptr ),
|
mIOHandler( nullptr ),
|
||||||
mIsDefaultHandler( false ),
|
mIsDefaultHandler( false ),
|
||||||
mProgressHandler( nullptr ),
|
mProgressHandler( nullptr ),
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -50,16 +48,13 @@ the 3ds loader handling smooth groups correctly */
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SGSpatialSort::SGSpatialSort()
|
SGSpatialSort::SGSpatialSort() {
|
||||||
{
|
|
||||||
// define the reference plane. We choose some arbitrary vector away from all basic axes
|
// define the reference plane. We choose some arbitrary vector away from all basic axes
|
||||||
// in the hope that no model spreads all its vertices along this plane.
|
// in the hope that no model spreads all its vertices along this plane.
|
||||||
mPlaneNormal.Set( 0.8523f, 0.34321f, 0.5736f);
|
mPlaneNormal.Set( 0.8523f, 0.34321f, 0.5736f);
|
||||||
mPlaneNormal.Normalize();
|
mPlaneNormal.Normalize();
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor
|
|
||||||
SGSpatialSort::~SGSpatialSort() = default;
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SGSpatialSort::Add(const aiVector3D& vPosition, unsigned int index,
|
void SGSpatialSort::Add(const aiVector3D& vPosition, unsigned int index,
|
||||||
unsigned int smoothingGroup)
|
unsigned int smoothingGroup)
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -56,7 +55,7 @@ class ScenePreprocessorTest;
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
/** ScenePreprocessor: Preprocess a scene before any post-processing
|
/** ScenePreprocessor: Pre-process a scene before any post-processing
|
||||||
* steps are executed.
|
* steps are executed.
|
||||||
*
|
*
|
||||||
* The step computes data that needn't necessarily be provided by the
|
* The step computes data that needn't necessarily be provided by the
|
||||||
|
@ -79,6 +78,9 @@ public:
|
||||||
ScenePreprocessor(aiScene *_scene) :
|
ScenePreprocessor(aiScene *_scene) :
|
||||||
scene(_scene) {}
|
scene(_scene) {}
|
||||||
|
|
||||||
|
/// @brief The class destructor.
|
||||||
|
~ScenePreprocessor() = default;
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
/** Assign a (new) scene to the object.
|
/** Assign a (new) scene to the object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -61,9 +61,10 @@ namespace Assimp {
|
||||||
class StackAllocator {
|
class StackAllocator {
|
||||||
public:
|
public:
|
||||||
/// @brief Constructs the allocator
|
/// @brief Constructs the allocator
|
||||||
inline StackAllocator();
|
StackAllocator();
|
||||||
|
|
||||||
/// @brief Destructs the allocator and frees all memory
|
/// @brief Destructs the allocator and frees all memory
|
||||||
inline ~StackAllocator();
|
~StackAllocator();
|
||||||
|
|
||||||
// non copyable
|
// non copyable
|
||||||
StackAllocator(const StackAllocator &) = delete;
|
StackAllocator(const StackAllocator &) = delete;
|
||||||
|
|
|
@ -45,8 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
inline StackAllocator::StackAllocator() {
|
inline StackAllocator::StackAllocator() : m_storageBlocks() {}
|
||||||
}
|
|
||||||
|
|
||||||
inline StackAllocator::~StackAllocator() {
|
inline StackAllocator::~StackAllocator() {
|
||||||
FreeAll();
|
FreeAll();
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -119,12 +118,16 @@ private:
|
||||||
* look-at target */
|
* look-at target */
|
||||||
class TargetAnimationHelper {
|
class TargetAnimationHelper {
|
||||||
public:
|
public:
|
||||||
|
/// @brief The class constructor.
|
||||||
TargetAnimationHelper() :
|
TargetAnimationHelper() :
|
||||||
targetPositions(nullptr),
|
targetPositions(nullptr),
|
||||||
objectPositions(nullptr) {
|
objectPositions(nullptr) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief The class destructor.
|
||||||
|
~TargetAnimationHelper() = default;
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
/** Sets the target animation channel
|
/** Sets the target animation channel
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -62,13 +62,13 @@ namespace Assimp {
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// A read-only file inside a ZIP
|
// A read-only file inside a ZIP
|
||||||
|
|
||||||
class ZipFile : public IOStream {
|
class ZipFile final : public IOStream {
|
||||||
friend class ZipFileInfo;
|
friend class ZipFileInfo;
|
||||||
explicit ZipFile(std::string &filename, size_t size);
|
explicit ZipFile(std::string &filename, size_t size);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string m_Filename;
|
std::string m_Filename;
|
||||||
virtual ~ZipFile() override;
|
~ZipFile() override = default;
|
||||||
|
|
||||||
// IOStream interface
|
// IOStream interface
|
||||||
size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override;
|
size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override;
|
||||||
|
@ -89,6 +89,8 @@ private:
|
||||||
// Wraps an existing Assimp::IOSystem for unzip
|
// Wraps an existing Assimp::IOSystem for unzip
|
||||||
class IOSystem2Unzip {
|
class IOSystem2Unzip {
|
||||||
public:
|
public:
|
||||||
|
IOSystem2Unzip() = default;
|
||||||
|
~IOSystem2Unzip() = default;
|
||||||
static voidpf open(voidpf opaque, const char *filename, int mode);
|
static voidpf open(voidpf opaque, const char *filename, int mode);
|
||||||
static voidpf opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
|
static voidpf opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
|
||||||
static uLong read(voidpf opaque, voidpf stream, void *buf, uLong size);
|
static uLong read(voidpf opaque, voidpf stream, void *buf, uLong size);
|
||||||
|
@ -100,6 +102,7 @@ public:
|
||||||
static zlib_filefunc_def get(IOSystem *pIOHandler);
|
static zlib_filefunc_def get(IOSystem *pIOHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
voidpf IOSystem2Unzip::open(voidpf opaque, const char *filename, int mode) {
|
voidpf IOSystem2Unzip::open(voidpf opaque, const char *filename, int mode) {
|
||||||
IOSystem *io_system = reinterpret_cast<IOSystem *>(opaque);
|
IOSystem *io_system = reinterpret_cast<IOSystem *>(opaque);
|
||||||
|
|
||||||
|
@ -119,6 +122,7 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char *filename, int mode) {
|
||||||
return (voidpf)io_system->Open(filename, mode_fopen);
|
return (voidpf)io_system->Open(filename, mode_fopen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode) {
|
voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode) {
|
||||||
ZipFile *io_stream = (ZipFile *)stream;
|
ZipFile *io_stream = (ZipFile *)stream;
|
||||||
voidpf ret = nullptr;
|
voidpf ret = nullptr;
|
||||||
|
@ -141,24 +145,28 @@ voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_di
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void *buf, uLong size) {
|
uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void *buf, uLong size) {
|
||||||
IOStream *io_stream = (IOStream *)stream;
|
IOStream *io_stream = (IOStream *)stream;
|
||||||
|
|
||||||
return static_cast<uLong>(io_stream->Read(buf, 1, size));
|
return static_cast<uLong>(io_stream->Read(buf, 1, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void *buf, uLong size) {
|
uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void *buf, uLong size) {
|
||||||
IOStream *io_stream = (IOStream *)stream;
|
IOStream *io_stream = (IOStream *)stream;
|
||||||
|
|
||||||
return static_cast<uLong>(io_stream->Write(buf, 1, size));
|
return static_cast<uLong>(io_stream->Write(buf, 1, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
|
long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) {
|
||||||
IOStream *io_stream = (IOStream *)stream;
|
IOStream *io_stream = (IOStream *)stream;
|
||||||
|
|
||||||
return static_cast<long>(io_stream->Tell());
|
return static_cast<long>(io_stream->Tell());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
|
long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
|
||||||
IOStream *io_stream = (IOStream *)stream;
|
IOStream *io_stream = (IOStream *)stream;
|
||||||
|
|
||||||
|
@ -179,6 +187,7 @@ long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int or
|
||||||
return (io_stream->Seek(offset, assimp_origin) == aiReturn_SUCCESS ? 0 : -1);
|
return (io_stream->Seek(offset, assimp_origin) == aiReturn_SUCCESS ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
int IOSystem2Unzip::close(voidpf opaque, voidpf stream) {
|
int IOSystem2Unzip::close(voidpf opaque, voidpf stream) {
|
||||||
IOSystem *io_system = (IOSystem *)opaque;
|
IOSystem *io_system = (IOSystem *)opaque;
|
||||||
IOStream *io_stream = (IOStream *)stream;
|
IOStream *io_stream = (IOStream *)stream;
|
||||||
|
@ -188,10 +197,12 @@ int IOSystem2Unzip::close(voidpf opaque, voidpf stream) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) {
|
int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
|
zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
|
||||||
zlib_filefunc_def mapping;
|
zlib_filefunc_def mapping;
|
||||||
|
|
||||||
|
@ -213,9 +224,10 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// Info about a read-only file inside a ZIP
|
// Info about a read-only file inside a ZIP
|
||||||
class ZipFileInfo {
|
class ZipFileInfo final {
|
||||||
public:
|
public:
|
||||||
explicit ZipFileInfo(unzFile zip_handle, size_t size);
|
explicit ZipFileInfo(unzFile zip_handle, size_t size);
|
||||||
|
~ZipFileInfo() = default;
|
||||||
|
|
||||||
// Allocate and Extract data from the ZIP
|
// Allocate and Extract data from the ZIP
|
||||||
ZipFile *Extract(std::string &filename, unzFile zip_handle) const;
|
ZipFile *Extract(std::string &filename, unzFile zip_handle) const;
|
||||||
|
@ -225,6 +237,7 @@ private:
|
||||||
unz_file_pos_s m_ZipFilePos;
|
unz_file_pos_s m_ZipFilePos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipFileInfo::ZipFileInfo(unzFile zip_handle, size_t size) :
|
ZipFileInfo::ZipFileInfo(unzFile zip_handle, size_t size) :
|
||||||
m_Size(size) {
|
m_Size(size) {
|
||||||
ai_assert(m_Size != 0);
|
ai_assert(m_Size != 0);
|
||||||
|
@ -234,6 +247,7 @@ ZipFileInfo::ZipFileInfo(unzFile zip_handle, size_t size) :
|
||||||
unzGetFilePos(zip_handle, &(m_ZipFilePos));
|
unzGetFilePos(zip_handle, &(m_ZipFilePos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipFile *ZipFileInfo::Extract(std::string &filename, unzFile zip_handle) const {
|
ZipFile *ZipFileInfo::Extract(std::string &filename, unzFile zip_handle) const {
|
||||||
// Find in the ZIP. This cannot fail
|
// Find in the ZIP. This cannot fail
|
||||||
unz_file_pos_s *filepos = const_cast<unz_file_pos_s *>(&(m_ZipFilePos));
|
unz_file_pos_s *filepos = const_cast<unz_file_pos_s *>(&(m_ZipFilePos));
|
||||||
|
@ -273,14 +287,14 @@ ZipFile *ZipFileInfo::Extract(std::string &filename, unzFile zip_handle) const {
|
||||||
return zip_file;
|
return zip_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipFile::ZipFile(std::string &filename, size_t size) :
|
ZipFile::ZipFile(std::string &filename, size_t size) :
|
||||||
m_Filename(filename), m_Size(size) {
|
m_Filename(filename), m_Size(size) {
|
||||||
ai_assert(m_Size != 0);
|
ai_assert(m_Size != 0);
|
||||||
m_Buffer = std::unique_ptr<uint8_t[]>(new uint8_t[m_Size]);
|
m_Buffer = std::unique_ptr<uint8_t[]>(new uint8_t[m_Size]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipFile::~ZipFile() = default;
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
size_t ZipFile::Read(void *pvBuffer, size_t pSize, size_t pCount) {
|
size_t ZipFile::Read(void *pvBuffer, size_t pSize, size_t pCount) {
|
||||||
// Should be impossible
|
// Should be impossible
|
||||||
ai_assert(m_Buffer != nullptr);
|
ai_assert(m_Buffer != nullptr);
|
||||||
|
@ -305,10 +319,12 @@ size_t ZipFile::Read(void *pvBuffer, size_t pSize, size_t pCount) {
|
||||||
return pCount;
|
return pCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
size_t ZipFile::FileSize() const {
|
size_t ZipFile::FileSize() const {
|
||||||
return m_Size;
|
return m_Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
aiReturn ZipFile::Seek(size_t pOffset, aiOrigin pOrigin) {
|
aiReturn ZipFile::Seek(size_t pOffset, aiOrigin pOrigin) {
|
||||||
switch (pOrigin) {
|
switch (pOrigin) {
|
||||||
case aiOrigin_SET: {
|
case aiOrigin_SET: {
|
||||||
|
@ -334,6 +350,7 @@ aiReturn ZipFile::Seek(size_t pOffset, aiOrigin pOrigin) {
|
||||||
return aiReturn_FAILURE;
|
return aiReturn_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
size_t ZipFile::Tell() const {
|
size_t ZipFile::Tell() const {
|
||||||
return m_SeekPtr;
|
return m_SeekPtr;
|
||||||
}
|
}
|
||||||
|
@ -365,6 +382,7 @@ private:
|
||||||
ZipFileInfoMap m_ArchiveMap;
|
ZipFileInfoMap m_ArchiveMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipArchiveIOSystem::Implement::Implement(IOSystem *pIOHandler, const char *pFilename, const char *pMode) {
|
ZipArchiveIOSystem::Implement::Implement(IOSystem *pIOHandler, const char *pFilename, const char *pMode) {
|
||||||
ai_assert(strcmp(pMode, "r") == 0);
|
ai_assert(strcmp(pMode, "r") == 0);
|
||||||
ai_assert(pFilename != nullptr);
|
ai_assert(pFilename != nullptr);
|
||||||
|
@ -376,12 +394,14 @@ ZipArchiveIOSystem::Implement::Implement(IOSystem *pIOHandler, const char *pFile
|
||||||
m_ZipFileHandle = unzOpen2(pFilename, &mapping);
|
m_ZipFileHandle = unzOpen2(pFilename, &mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipArchiveIOSystem::Implement::~Implement() {
|
ZipArchiveIOSystem::Implement::~Implement() {
|
||||||
if (m_ZipFileHandle != nullptr) {
|
if (m_ZipFileHandle != nullptr) {
|
||||||
unzClose(m_ZipFileHandle);
|
unzClose(m_ZipFileHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::Implement::MapArchive() {
|
void ZipArchiveIOSystem::Implement::MapArchive() {
|
||||||
if (m_ZipFileHandle == nullptr)
|
if (m_ZipFileHandle == nullptr)
|
||||||
return;
|
return;
|
||||||
|
@ -408,10 +428,12 @@ void ZipArchiveIOSystem::Implement::MapArchive() {
|
||||||
} while (unzGoToNextFile(m_ZipFileHandle) != UNZ_END_OF_LIST_OF_FILE);
|
} while (unzGoToNextFile(m_ZipFileHandle) != UNZ_END_OF_LIST_OF_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
bool ZipArchiveIOSystem::Implement::isOpen() const {
|
bool ZipArchiveIOSystem::Implement::isOpen() const {
|
||||||
return (m_ZipFileHandle != nullptr);
|
return (m_ZipFileHandle != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::Implement::getFileList(std::vector<std::string> &rFileList) {
|
void ZipArchiveIOSystem::Implement::getFileList(std::vector<std::string> &rFileList) {
|
||||||
MapArchive();
|
MapArchive();
|
||||||
rFileList.clear();
|
rFileList.clear();
|
||||||
|
@ -421,6 +443,7 @@ void ZipArchiveIOSystem::Implement::getFileList(std::vector<std::string> &rFileL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::Implement::getFileListExtension(std::vector<std::string> &rFileList, const std::string &extension) {
|
void ZipArchiveIOSystem::Implement::getFileListExtension(std::vector<std::string> &rFileList, const std::string &extension) {
|
||||||
MapArchive();
|
MapArchive();
|
||||||
rFileList.clear();
|
rFileList.clear();
|
||||||
|
@ -431,6 +454,7 @@ void ZipArchiveIOSystem::Implement::getFileListExtension(std::vector<std::string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
bool ZipArchiveIOSystem::Implement::Exists(std::string &filename) {
|
bool ZipArchiveIOSystem::Implement::Exists(std::string &filename) {
|
||||||
MapArchive();
|
MapArchive();
|
||||||
|
|
||||||
|
@ -438,6 +462,7 @@ bool ZipArchiveIOSystem::Implement::Exists(std::string &filename) {
|
||||||
return (it != m_ArchiveMap.end());
|
return (it != m_ArchiveMap.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
IOStream *ZipArchiveIOSystem::Implement::OpenFile(std::string &filename) {
|
IOStream *ZipArchiveIOSystem::Implement::OpenFile(std::string &filename) {
|
||||||
MapArchive();
|
MapArchive();
|
||||||
|
|
||||||
|
@ -452,6 +477,7 @@ IOStream *ZipArchiveIOSystem::Implement::OpenFile(std::string &filename) {
|
||||||
return zip_file.Extract(filename, m_ZipFileHandle);
|
return zip_file.Extract(filename, m_ZipFileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
inline void ReplaceAll(std::string &data, const std::string &before, const std::string &after) {
|
inline void ReplaceAll(std::string &data, const std::string &before, const std::string &after) {
|
||||||
size_t pos = data.find(before);
|
size_t pos = data.find(before);
|
||||||
while (pos != std::string::npos) {
|
while (pos != std::string::npos) {
|
||||||
|
@ -460,6 +486,7 @@ inline void ReplaceAll(std::string &data, const std::string &before, const std::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
inline void ReplaceAllChar(std::string &data, const char before, const char after) {
|
inline void ReplaceAllChar(std::string &data, const char before, const char after) {
|
||||||
size_t pos = data.find(before);
|
size_t pos = data.find(before);
|
||||||
while (pos != std::string::npos) {
|
while (pos != std::string::npos) {
|
||||||
|
@ -468,6 +495,7 @@ inline void ReplaceAllChar(std::string &data, const char before, const char afte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::Implement::SimplifyFilename(std::string &filename) {
|
void ZipArchiveIOSystem::Implement::SimplifyFilename(std::string &filename) {
|
||||||
ReplaceAllChar(filename, '\\', '/');
|
ReplaceAllChar(filename, '\\', '/');
|
||||||
|
|
||||||
|
@ -492,6 +520,7 @@ void ZipArchiveIOSystem::Implement::SimplifyFilename(std::string &filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipArchiveIOSystem::ZipArchiveIOSystem(IOSystem *pIOHandler, const char *pFilename, const char *pMode) :
|
ZipArchiveIOSystem::ZipArchiveIOSystem(IOSystem *pIOHandler, const char *pFilename, const char *pMode) :
|
||||||
pImpl(new Implement(pIOHandler, pFilename, pMode)) {
|
pImpl(new Implement(pIOHandler, pFilename, pMode)) {
|
||||||
}
|
}
|
||||||
|
@ -502,10 +531,12 @@ ZipArchiveIOSystem::ZipArchiveIOSystem(IOSystem *pIOHandler, const std::string &
|
||||||
pImpl(new Implement(pIOHandler, rFilename.c_str(), pMode)) {
|
pImpl(new Implement(pIOHandler, rFilename.c_str(), pMode)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
ZipArchiveIOSystem::~ZipArchiveIOSystem() {
|
ZipArchiveIOSystem::~ZipArchiveIOSystem() {
|
||||||
delete pImpl;
|
delete pImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
bool ZipArchiveIOSystem::Exists(const char *pFilename) const {
|
bool ZipArchiveIOSystem::Exists(const char *pFilename) const {
|
||||||
ai_assert(pFilename != nullptr);
|
ai_assert(pFilename != nullptr);
|
||||||
|
|
||||||
|
@ -517,11 +548,13 @@ bool ZipArchiveIOSystem::Exists(const char *pFilename) const {
|
||||||
return pImpl->Exists(filename);
|
return pImpl->Exists(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
// This is always '/' in a ZIP
|
// This is always '/' in a ZIP
|
||||||
char ZipArchiveIOSystem::getOsSeparator() const {
|
char ZipArchiveIOSystem::getOsSeparator() const {
|
||||||
return '/';
|
return '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
// Only supports Reading
|
// Only supports Reading
|
||||||
IOStream *ZipArchiveIOSystem::Open(const char *pFilename, const char *pMode) {
|
IOStream *ZipArchiveIOSystem::Open(const char *pFilename, const char *pMode) {
|
||||||
ai_assert(pFilename != nullptr);
|
ai_assert(pFilename != nullptr);
|
||||||
|
@ -536,22 +569,27 @@ IOStream *ZipArchiveIOSystem::Open(const char *pFilename, const char *pMode) {
|
||||||
return pImpl->OpenFile(filename);
|
return pImpl->OpenFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::Close(IOStream *pFile) {
|
void ZipArchiveIOSystem::Close(IOStream *pFile) {
|
||||||
delete pFile;
|
delete pFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
bool ZipArchiveIOSystem::isOpen() const {
|
bool ZipArchiveIOSystem::isOpen() const {
|
||||||
return (pImpl->isOpen());
|
return (pImpl->isOpen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::getFileList(std::vector<std::string> &rFileList) const {
|
void ZipArchiveIOSystem::getFileList(std::vector<std::string> &rFileList) const {
|
||||||
return pImpl->getFileList(rFileList);
|
return pImpl->getFileList(rFileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
void ZipArchiveIOSystem::getFileListExtension(std::vector<std::string> &rFileList, const std::string &extension) const {
|
void ZipArchiveIOSystem::getFileListExtension(std::vector<std::string> &rFileList, const std::string &extension) const {
|
||||||
return pImpl->getFileListExtension(rFileList, extension);
|
return pImpl->getFileListExtension(rFileList, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
bool ZipArchiveIOSystem::isZipArchive(IOSystem *pIOHandler, const char *pFilename) {
|
bool ZipArchiveIOSystem::isZipArchive(IOSystem *pIOHandler, const char *pFilename) {
|
||||||
Implement tmp(pIOHandler, pFilename, "r");
|
Implement tmp(pIOHandler, pFilename, "r");
|
||||||
return tmp.isOpen();
|
return tmp.isOpen();
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
BaseImporter() AI_NO_EXCEPT;
|
BaseImporter() AI_NO_EXCEPT;
|
||||||
|
|
||||||
/** Destructor, private as well */
|
/** Destructor, private as well */
|
||||||
virtual ~BaseImporter();
|
virtual ~BaseImporter() = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns whether the class can handle the format of the given file.
|
/** Returns whether the class can handle the format of the given file.
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -66,10 +65,10 @@ namespace Assimp {
|
||||||
* and vice versa. Direct use of this class is DEPRECATED. Use #StreamReader instead. */
|
* and vice versa. Direct use of this class is DEPRECATED. Use #StreamReader instead. */
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
class ByteSwap {
|
class ByteSwap {
|
||||||
ByteSwap() AI_NO_EXCEPT {}
|
ByteSwap() AI_NO_EXCEPT = default;
|
||||||
|
~ByteSwap() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
/** Swap two bytes of data
|
/** Swap two bytes of data
|
||||||
* @param[inout] _szOut A void* to save the reintcasts for the caller. */
|
* @param[inout] _szOut A void* to save the reintcasts for the caller. */
|
||||||
|
@ -89,8 +88,7 @@ public:
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
/** Swap four bytes of data
|
/** Swap four bytes of data
|
||||||
* @param[inout] _szOut A void* to save the reintcasts for the caller. */
|
* @param[inout] _szOut A void* to save the reintcasts for the caller. */
|
||||||
static inline void Swap4(void* _szOut)
|
static inline void Swap4(void* _szOut) {
|
||||||
{
|
|
||||||
ai_assert(_szOut);
|
ai_assert(_szOut);
|
||||||
|
|
||||||
#if _MSC_VER >= 1400
|
#if _MSC_VER >= 1400
|
||||||
|
|
|
@ -73,14 +73,14 @@ class ASSIMP_API IOStream
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/** Constructor protected, use IOSystem::Open() to create an instance. */
|
/** Constructor protected, use IOSystem::Open() to create an instance. */
|
||||||
IOStream() AI_NO_EXCEPT;
|
IOStream() AI_NO_EXCEPT = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Destructor. Deleting the object closes the underlying file,
|
/** @brief Destructor. Deleting the object closes the underlying file,
|
||||||
* alternatively you may use IOSystem::Close() to release the file.
|
* alternatively you may use IOSystem::Close() to release the file.
|
||||||
*/
|
*/
|
||||||
virtual ~IOStream();
|
virtual ~IOStream() = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Read from the file
|
/** @brief Read from the file
|
||||||
|
@ -126,15 +126,6 @@ public:
|
||||||
virtual void Flush() = 0;
|
virtual void Flush() = 0;
|
||||||
}; //! class IOStream
|
}; //! class IOStream
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------
|
|
||||||
AI_FORCE_INLINE
|
|
||||||
IOStream::IOStream() AI_NO_EXCEPT = default;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------
|
|
||||||
AI_FORCE_INLINE
|
|
||||||
IOStream::~IOStream() = default;
|
|
||||||
// ----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
} //!namespace Assimp
|
} //!namespace Assimp
|
||||||
|
|
||||||
#endif //!!AI_IOSTREAM_H_INC
|
#endif //!!AI_IOSTREAM_H_INC
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
IOStreamBuffer(size_t cache = 4096 * 4096);
|
IOStreamBuffer(size_t cache = 4096 * 4096);
|
||||||
|
|
||||||
/// @brief The class destructor.
|
/// @brief The class destructor.
|
||||||
~IOStreamBuffer();
|
~IOStreamBuffer() = default;
|
||||||
|
|
||||||
/// @brief Will open the cached access for a given stream.
|
/// @brief Will open the cached access for a given stream.
|
||||||
/// @param stream The stream to cache.
|
/// @param stream The stream to cache.
|
||||||
|
@ -140,9 +140,6 @@ AI_FORCE_INLINE IOStreamBuffer<T>::IOStreamBuffer(size_t cache) :
|
||||||
std::fill(m_cache.begin(), m_cache.end(), '\n');
|
std::fill(m_cache.begin(), m_cache.end(), '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() = default;
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) {
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) {
|
||||||
// file still opened!
|
// file still opened!
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
*/
|
*/
|
||||||
LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true);
|
LineSplitter(StreamReaderLE& stream, bool skip_empty_lines = true, bool trim = true);
|
||||||
|
|
||||||
~LineSplitter();
|
~LineSplitter() = default;
|
||||||
|
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
/** pseudo-iterator increment */
|
/** pseudo-iterator increment */
|
||||||
|
@ -160,8 +160,6 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp
|
||||||
mIdx = 0;
|
mIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AI_FORCE_INLINE LineSplitter::~LineSplitter() = default;
|
|
||||||
|
|
||||||
AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
|
AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
|
||||||
if (mSwallow) {
|
if (mSwallow) {
|
||||||
mSwallow = false;
|
mSwallow = false;
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2024, assimp team
|
Copyright (c) 2006-2024, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -63,10 +62,8 @@ namespace Assimp {
|
||||||
* implementation to handle all details of its file format correctly.
|
* implementation to handle all details of its file format correctly.
|
||||||
*/
|
*/
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
class ASSIMP_API SGSpatialSort
|
class ASSIMP_API SGSpatialSort {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SGSpatialSort();
|
SGSpatialSort();
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -90,7 +87,7 @@ public:
|
||||||
void Prepare();
|
void Prepare();
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
~SGSpatialSort();
|
~SGSpatialSort() = default;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Returns an iterator for all positions close to the given position.
|
/** Returns an iterator for all positions close to the given position.
|
||||||
|
|
|
@ -59,18 +59,12 @@ struct aiAABB {
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
/// @brief The default class constructor.
|
/// @brief The default class constructor.
|
||||||
aiAABB() :
|
aiAABB() = default;
|
||||||
mMin(), mMax() {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief The class constructor with the minimum and maximum.
|
/// @brief The class constructor with the minimum and maximum.
|
||||||
/// @param min The minimum dimension.
|
/// @param min The minimum dimension.
|
||||||
/// @param max The maximum dimension.
|
/// @param max The maximum dimension.
|
||||||
aiAABB(const aiVector3D &min, const aiVector3D &max) :
|
aiAABB(const aiVector3D &min, const aiVector3D &max) : mMin(min), mMax(max) {}
|
||||||
mMin(min), mMax(max) {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief The class destructor.
|
/// @brief The class destructor.
|
||||||
~aiAABB() = default;
|
~aiAABB() = default;
|
||||||
|
|
|
@ -90,6 +90,7 @@ struct aiVectorKey {
|
||||||
bool operator==(const aiVectorKey &rhs) const {
|
bool operator==(const aiVectorKey &rhs) const {
|
||||||
return rhs.mValue == this->mValue;
|
return rhs.mValue == this->mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const aiVectorKey &rhs) const {
|
bool operator!=(const aiVectorKey &rhs) const {
|
||||||
return rhs.mValue != this->mValue;
|
return rhs.mValue != this->mValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue