Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd5c1dcfd | ||
|
|
ce61ea56a5 | ||
|
|
ed8612ea35 | ||
|
|
389fc11e5b | ||
|
|
a9e2864cb4 | ||
|
|
836d12b9af | ||
|
|
9a15ca1007 | ||
|
|
eb5a7938e0 | ||
|
|
9335cc30ab | ||
|
|
ecfb9757d0 | ||
|
|
d643146192 | ||
|
|
a595cdad06 | ||
|
|
ce880331df | ||
|
|
4141260fc9 | ||
|
|
6c4addf158 | ||
|
|
ed6b6cd65c | ||
|
|
3976f9a092 | ||
|
|
a214b0833f | ||
|
|
f217bd4b5f | ||
|
|
305d1f45aa | ||
|
|
50b00d33b5 | ||
|
|
5698d41bf9 | ||
|
|
06fffb4f83 |
9
.github/workflows/ccpp.yml
vendored
9
.github/workflows/ccpp.yml
vendored
@@ -13,7 +13,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter]
|
||||
#name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter]
|
||||
name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter]
|
||||
# For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux.
|
||||
include:
|
||||
- name: windows-latest-cl.exe
|
||||
@@ -38,9 +39,9 @@ jobs:
|
||||
- name: macos-clang-hunter
|
||||
os: macos-latest
|
||||
toolchain: ninja-clang-cxx17-fpic
|
||||
- name: windows-msvc-hunter
|
||||
os: windows-latest
|
||||
toolchain: ninja-vs-win64-cxx17
|
||||
#- name: windows-msvc-hunter
|
||||
# os: windows-latest
|
||||
# toolchain: ninja-vs-win64-cxx17
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
67
.travis.sh
67
.travis.sh
@@ -1,67 +0,0 @@
|
||||
#---------------------------------------------------------------------------
|
||||
#Open Asset Import Library (assimp)
|
||||
#---------------------------------------------------------------------------
|
||||
# Copyright (c) 2006-2020, assimp team
|
||||
#
|
||||
# License see LICENSE file
|
||||
#
|
||||
function generate() {
|
||||
OPTIONS="-DASSIMP_WERROR=ON"
|
||||
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
|
||||
|
||||
if [ "$DISABLE_EXPORTERS" = "YES" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=YES"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"
|
||||
fi
|
||||
|
||||
if [ "$SHARED_BUILD" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DBUILD_SHARED_LIBS=OFF"
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_COVERALLS" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_COVERALLS=OFF"
|
||||
fi
|
||||
|
||||
if [ "$ASAN" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_ASAN=ON"
|
||||
else
|
||||
OPTIONS="$OPTIONS -DASSIMP_ASAN=OFF"
|
||||
fi
|
||||
|
||||
if [ "$UBSAN" = "ON" ] ; then
|
||||
OPTIONS="$OPTIONS -DASSIMP_UBSAN=ON"
|
||||
fi
|
||||
|
||||
cmake -G "Unix Makefiles" $OPTIONS
|
||||
}
|
||||
# build and run unittests, if not android
|
||||
if [ $ANDROID ]; then
|
||||
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni
|
||||
fi
|
||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
if [ $ANALYZE = "ON" ] ; then
|
||||
if [ "$CC" = "clang" ]; then
|
||||
scan-build cmake -G "Unix Makefiles" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_TESTS=OFF
|
||||
scan-build --status-bugs make -j2
|
||||
else
|
||||
cppcheck --version
|
||||
generate \
|
||||
&& cppcheck --error-exitcode=1 -j2 -Iinclude -Icode code 2> cppcheck.txt
|
||||
if [ -s cppcheck.txt ]; then
|
||||
cat cppcheck.txt
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
generate \
|
||||
&& make -j4 \
|
||||
&& sudo make install \
|
||||
&& sudo ldconfig \
|
||||
&& (cd test/unit; ../../bin/unit)
|
||||
fi
|
||||
fi
|
||||
78
.travis.yml
78
.travis.yml
@@ -1,78 +0,0 @@
|
||||
sudo: required
|
||||
language: cpp
|
||||
|
||||
cache: ccache
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake cppcheck && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi
|
||||
- 'if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
if brew ls --versions cmake > /dev/null; then
|
||||
echo cmake already installed.;
|
||||
else
|
||||
brew install cmake;
|
||||
fi;
|
||||
brew install python3;
|
||||
brew install homebrew/x11/freeglut;
|
||||
fi'
|
||||
- echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h
|
||||
# install latest LCOV (1.9 was failing)
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz && tar xf lcov_1.11.orig.tar.gz && sudo make -C lcov-1.11/ install && gem install coveralls-lcov && lcov --version && g++ --version ; fi
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc="
|
||||
- PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME}
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ASAN=ON
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: UBSAN=ON
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: SHARED_BUILD=ON
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ANALYZE=ON
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ENABLE_COVERALLS=ON
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: SHARED_BUILD=ON
|
||||
|
||||
install:
|
||||
- if [ $ANDROID ]; then wget -c http://dl.google.com/android/ndk/android-ndk-${PV}-${PLATF}.tar.bz2 && tar xf android-ndk-${PV}-${PLATF}.tar.bz2 ; fi
|
||||
|
||||
before_script:
|
||||
cmake . -DASSIMP_ENABLE_BOOST_WORKAROUND=YES
|
||||
|
||||
script:
|
||||
- export COVERALLS_SERVICE_NAME=travis-ci
|
||||
- export COVERALLS_REPO_TOKEN=abc12345
|
||||
- . ./.travis.sh
|
||||
|
||||
after_success:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ${TRAVIS_BUILD_DIR} && lcov --directory . --capture --output-file coverage.info && lcov --remove coverage.info '/usr/*' 'contrib/*' 'test/*' --output-file coverage.info && lcov --list coverage.info && coveralls-lcov --source-encoding=ISO-8859-1 --repo-token=${COVERALLS_TOKEN} coverage.info ; fi
|
||||
|
||||
addons:
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "assimp/assimp"
|
||||
notification_email: kim.kulling@googlemail.com
|
||||
build_command_prepend: "cmake ./"
|
||||
build_command: "make -j4"
|
||||
branch_pattern: coverity_scan
|
||||
@@ -112,6 +112,7 @@ using namespace Assimp::ASE;
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Parser::Parser(const char *szFile, unsigned int fileFormatDefault) {
|
||||
ai_assert(nullptr != szFile);
|
||||
|
||||
filePtr = szFile;
|
||||
iFileFormat = fileFormatDefault;
|
||||
|
||||
@@ -486,7 +487,7 @@ void Parser::ParseLV1MaterialListBlock() {
|
||||
ParseLV4MeshLong(iIndex);
|
||||
|
||||
if (iIndex >= iMaterialCount) {
|
||||
LogError("Out of range: material index is too large");
|
||||
LogWarning("Out of range: material index is too large");
|
||||
iIndex = iMaterialCount - 1;
|
||||
return;
|
||||
}
|
||||
@@ -905,7 +906,6 @@ void Parser::ParseLV2LightSettingsBlock(ASE::Light &light) {
|
||||
}
|
||||
AI_ASE_HANDLE_SECTION("2", "LIGHT_SETTINGS");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -1782,7 +1782,9 @@ void Parser::ParseLV4MeshFace(ASE::Face &out) {
|
||||
|
||||
// *MESH_MTLID is optional, too
|
||||
while (true) {
|
||||
if ('*' == *filePtr) break;
|
||||
if ('*' == *filePtr) {
|
||||
break;
|
||||
}
|
||||
if (IsLineEnd(*filePtr)) {
|
||||
return;
|
||||
}
|
||||
@@ -1831,8 +1833,9 @@ void Parser::ParseLV4MeshFloatTriple(ai_real *apOut, unsigned int &rIndexOut) {
|
||||
void Parser::ParseLV4MeshFloatTriple(ai_real *apOut) {
|
||||
ai_assert(nullptr != apOut);
|
||||
|
||||
for (unsigned int i = 0; i < 3; ++i)
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
ParseLV4MeshFloat(apOut[i]);
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Parser::ParseLV4MeshFloat(ai_real &fOut) {
|
||||
|
||||
@@ -182,6 +182,8 @@ inline size_t Write<aiVertexWeight>(IOStream *stream, const aiVertexWeight &v) {
|
||||
return t + Write<float>(stream, v.mWeight);
|
||||
}
|
||||
|
||||
constexpr size_t MatrixSize = 64;
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
// Serialize a mat4x4
|
||||
template <>
|
||||
@@ -192,7 +194,7 @@ inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) {
|
||||
}
|
||||
}
|
||||
|
||||
return 64;
|
||||
return MatrixSize;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
@@ -275,7 +275,9 @@ void HMPImporter::InternReadFile_HMP7() {
|
||||
|
||||
// now load all vertices from the file
|
||||
aiVector3D *pcVertOut = pcMesh->mVertices;
|
||||
ai_assert(pcVertOut != nullptr);
|
||||
aiVector3D *pcNorOut = pcMesh->mNormals;
|
||||
ai_assert(pcNorOut != nullptr);
|
||||
const HMP::Vertex_HMP7 *src = (const HMP::Vertex_HMP7 *)szCurrent;
|
||||
for (unsigned int y = 0; y < height; ++y) {
|
||||
for (unsigned int x = 0; x < width; ++x) {
|
||||
@@ -327,29 +329,31 @@ void HMPImporter::CreateMaterial(const unsigned char *szCurrent,
|
||||
|
||||
// now read the first skin and skip all others
|
||||
ReadFirstSkin(pcHeader->numskins, szCurrent, &szCurrent);
|
||||
} else {
|
||||
// generate a default material
|
||||
const int iMode = (int)aiShadingMode_Gouraud;
|
||||
aiMaterial *pcHelper = new aiMaterial();
|
||||
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
|
||||
*szCurrentOut = szCurrent;
|
||||
return;
|
||||
}
|
||||
|
||||
aiColor3D clr;
|
||||
clr.b = clr.g = clr.r = 0.6f;
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_DIFFUSE);
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_SPECULAR);
|
||||
// generate a default material
|
||||
const int iMode = (int)aiShadingMode_Gouraud;
|
||||
aiMaterial *pcHelper = new aiMaterial();
|
||||
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
|
||||
|
||||
clr.b = clr.g = clr.r = 0.05f;
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_AMBIENT);
|
||||
aiColor3D clr;
|
||||
clr.b = clr.g = clr.r = 0.6f;
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_DIFFUSE);
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_SPECULAR);
|
||||
|
||||
aiString szName;
|
||||
szName.Set(AI_DEFAULT_MATERIAL_NAME);
|
||||
pcHelper->AddProperty(&szName, AI_MATKEY_NAME);
|
||||
clr.b = clr.g = clr.r = 0.05f;
|
||||
pcHelper->AddProperty<aiColor3D>(&clr, 1, AI_MATKEY_COLOR_AMBIENT);
|
||||
|
||||
// add the material to the scene
|
||||
pScene->mNumMaterials = 1;
|
||||
pScene->mMaterials = new aiMaterial *[1];
|
||||
pScene->mMaterials[0] = pcHelper;
|
||||
}
|
||||
aiString szName;
|
||||
szName.Set(AI_DEFAULT_MATERIAL_NAME);
|
||||
pcHelper->AddProperty(&szName, AI_MATKEY_NAME);
|
||||
|
||||
// add the material to the scene
|
||||
pScene->mNumMaterials = 1;
|
||||
pScene->mMaterials = new aiMaterial *[1];
|
||||
pScene->mMaterials[0] = pcHelper;
|
||||
*szCurrentOut = szCurrent;
|
||||
}
|
||||
|
||||
@@ -373,27 +377,36 @@ void HMPImporter::CreateOutputFaceList(unsigned int width, unsigned int height)
|
||||
aiVector3D *pcUVOut(pcUVs);
|
||||
|
||||
// Build the terrain square
|
||||
const unsigned int upperBound = pcMesh->mNumVertices;
|
||||
unsigned int iCurrent = 0;
|
||||
for (unsigned int y = 0; y < height - 1; ++y) {
|
||||
const size_t offset0 = y * width;
|
||||
const size_t offset1 = (y + 1) * width;
|
||||
for (unsigned int x = 0; x < width - 1; ++x, ++pcFaceOut) {
|
||||
pcFaceOut->mNumIndices = 4;
|
||||
pcFaceOut->mIndices = new unsigned int[4];
|
||||
if ((offset0 + x + 1) >= upperBound){
|
||||
continue;
|
||||
}
|
||||
if ((offset1 + x + 1) >= upperBound){
|
||||
continue;
|
||||
}
|
||||
|
||||
*pcVertOut++ = pcMesh->mVertices[y * width + x];
|
||||
*pcVertOut++ = pcMesh->mVertices[(y + 1) * width + x];
|
||||
*pcVertOut++ = pcMesh->mVertices[(y + 1) * width + x + 1];
|
||||
*pcVertOut++ = pcMesh->mVertices[y * width + x + 1];
|
||||
*pcVertOut++ = pcMesh->mVertices[offset0 + x];
|
||||
*pcVertOut++ = pcMesh->mVertices[offset1 + x];
|
||||
*pcVertOut++ = pcMesh->mVertices[offset1 + x + 1];
|
||||
*pcVertOut++ = pcMesh->mVertices[offset0 + x + 1];
|
||||
|
||||
*pcNorOut++ = pcMesh->mNormals[y * width + x];
|
||||
*pcNorOut++ = pcMesh->mNormals[(y + 1) * width + x];
|
||||
*pcNorOut++ = pcMesh->mNormals[(y + 1) * width + x + 1];
|
||||
*pcNorOut++ = pcMesh->mNormals[y * width + x + 1];
|
||||
*pcNorOut++ = pcMesh->mNormals[offset0 + x];
|
||||
*pcNorOut++ = pcMesh->mNormals[offset1 + x];
|
||||
*pcNorOut++ = pcMesh->mNormals[offset1 + x + 1];
|
||||
*pcNorOut++ = pcMesh->mNormals[offset0 + x + 1];
|
||||
|
||||
if (pcMesh->mTextureCoords[0]) {
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][y * width + x];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][(y + 1) * width + x];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][(y + 1) * width + x + 1];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][y * width + x + 1];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][offset0 + x];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][offset1 + x];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][offset1 + x + 1];
|
||||
*pcUVOut++ = pcMesh->mTextureCoords[0][offset0 + x + 1];
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
|
||||
@@ -83,9 +83,13 @@ AnimResolver::AnimResolver(std::list<Envelope> &_envelopes, double tick) :
|
||||
(*it).old_first = 0;
|
||||
(*it).old_last = (*it).keys.size() - 1;
|
||||
|
||||
if ((*it).keys.empty()) continue;
|
||||
if ((*it).keys.empty()) {
|
||||
continue;
|
||||
}
|
||||
if ((int)(*it).type < 1 || (int)(*it).type>EnvelopeType_Unknown) {
|
||||
continue;
|
||||
}
|
||||
switch ((*it).type) {
|
||||
|
||||
// translation
|
||||
case LWO::EnvelopeType_Position_X:
|
||||
trans_x = &*it;
|
||||
|
||||
@@ -44,9 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef ASSIMP_BUILD_NO_XGL_IMPORTER
|
||||
|
||||
#include "XGLLoader.h"
|
||||
#include "Common/Compression.h"
|
||||
|
||||
#include <assimp/ParsingUtils.h>
|
||||
#include <assimp/fast_atof.h>
|
||||
|
||||
#include <assimp/MemoryIOWrapper.h>
|
||||
#include <assimp/StreamReader.h>
|
||||
#include <assimp/importerdesc.h>
|
||||
@@ -57,15 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
// zlib is needed for compressed XGL files
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||
# ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||
# include <zlib.h>
|
||||
# else
|
||||
# include <contrib/zlib/zlib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace Assimp { // this has to be in here because LogFunctions is in ::Assimp
|
||||
|
||||
template <>
|
||||
@@ -73,6 +65,7 @@ const char *LogFunctions<XGLImporter>::Prefix() {
|
||||
static auto prefix = "XGL: ";
|
||||
return prefix;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
@@ -118,8 +111,8 @@ const aiImporterDesc *XGLImporter::GetInfo() const {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||
std::vector<Bytef> uncompressed;
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_XGL
|
||||
std::vector<unsigned char> uncompressed;
|
||||
#endif
|
||||
|
||||
m_scene = pScene;
|
||||
@@ -137,46 +130,14 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||
#else
|
||||
std::unique_ptr<StreamReaderLE> raw_reader(new StreamReaderLE(stream));
|
||||
|
||||
// build a zlib stream
|
||||
z_stream zstream;
|
||||
zstream.opaque = Z_NULL;
|
||||
zstream.zalloc = Z_NULL;
|
||||
zstream.zfree = Z_NULL;
|
||||
zstream.data_type = Z_BINARY;
|
||||
|
||||
// raw decompression without a zlib or gzip header
|
||||
inflateInit2(&zstream, -MAX_WBITS);
|
||||
|
||||
// skip two extra bytes, zgl files do carry a crc16 upfront (I think)
|
||||
raw_reader->IncPtr(2);
|
||||
|
||||
zstream.next_in = reinterpret_cast<Bytef *>(raw_reader->GetPtr());
|
||||
zstream.avail_in = (uInt) raw_reader->GetRemainingSize();
|
||||
|
||||
size_t total = 0l;
|
||||
|
||||
// TODO: be smarter about this, decompress directly into heap buffer
|
||||
// and decompress the data .... do 1k chunks in the hope that we won't kill the stack
|
||||
#define MYBLOCK 1024
|
||||
Bytef block[MYBLOCK];
|
||||
int ret;
|
||||
do {
|
||||
zstream.avail_out = MYBLOCK;
|
||||
zstream.next_out = block;
|
||||
ret = inflate(&zstream, Z_NO_FLUSH);
|
||||
|
||||
if (ret != Z_STREAM_END && ret != Z_OK) {
|
||||
ThrowException("Failure decompressing this file using gzip, seemingly it is NOT a compressed .XGL file");
|
||||
}
|
||||
const size_t have = MYBLOCK - zstream.avail_out;
|
||||
total += have;
|
||||
uncompressed.resize(total);
|
||||
memcpy(uncompressed.data() + total - have, block, have);
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
// terminate zlib
|
||||
inflateEnd(&zstream);
|
||||
|
||||
Compression c;
|
||||
size_t total = 0l;
|
||||
if (c.open()) {
|
||||
// skip two extra bytes, zgl files do carry a crc16 upfront (I think)
|
||||
raw_reader->IncPtr(2);
|
||||
total = c.decompress((unsigned char *)raw_reader->GetPtr(), raw_reader->GetRemainingSize(), uncompressed);
|
||||
c.close();
|
||||
}
|
||||
// replace the input stream with a memory stream
|
||||
stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t *>(uncompressed.data()), total));
|
||||
#endif
|
||||
@@ -291,7 +252,8 @@ aiNode *XGLImporter::ReadObject(XmlNode &node, TempScope &scope) {
|
||||
const std::string &s = ai_stdStrToLower(child.name());
|
||||
if (s == "mesh") {
|
||||
const size_t prev = scope.meshes_linear.size();
|
||||
if (ReadMesh(child, scope)) {
|
||||
bool empty;
|
||||
if (ReadMesh(child, scope, empty)) {
|
||||
const size_t newc = scope.meshes_linear.size();
|
||||
for (size_t i = 0; i < newc - prev; ++i) {
|
||||
meshes.push_back(static_cast<unsigned int>(i + prev));
|
||||
@@ -475,12 +437,12 @@ aiMesh *XGLImporter::ToOutputMesh(const TempMaterialMesh &m) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
|
||||
bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope, bool &empty) {
|
||||
TempMesh t;
|
||||
|
||||
std::map<unsigned int, TempMaterialMesh> bymat;
|
||||
const unsigned int mesh_id = ReadIDAttr(node);
|
||||
|
||||
bool empty_mesh = true;
|
||||
for (XmlNode &child : node.children()) {
|
||||
const std::string &s = ai_stdStrToLower(child.name());
|
||||
|
||||
@@ -539,6 +501,9 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
|
||||
mid = ResolveMaterialRef(sub_child, scope);
|
||||
}
|
||||
}
|
||||
if (has[0] || has[1] || has[2]) {
|
||||
empty_mesh = false;
|
||||
}
|
||||
|
||||
if (mid == ~0u) {
|
||||
ThrowException("missing material index");
|
||||
@@ -590,6 +555,11 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
|
||||
scope.meshes.insert(std::pair<unsigned int, aiMesh *>(mesh_id, m));
|
||||
}
|
||||
}
|
||||
if (empty_mesh) {
|
||||
LogWarn("Mesh is empty, skipping.");
|
||||
empty = empty_mesh;
|
||||
return false;
|
||||
}
|
||||
|
||||
// no id == not a reference, insert this mesh right *here*
|
||||
return mesh_id == ~0u;
|
||||
@@ -759,7 +729,7 @@ aiVector2D XGLImporter::ReadVec2(XmlNode &node) {
|
||||
std::string val;
|
||||
XmlParser::getValueAsString(node, val);
|
||||
const char *s = val.c_str();
|
||||
ai_real v[2];
|
||||
ai_real v[2] = {};
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (!SkipSpaces(&s)) {
|
||||
LogError("unexpected EOL, failed to parse vec2");
|
||||
|
||||
@@ -186,7 +186,7 @@ private:
|
||||
void ReadLighting(XmlNode &node, TempScope &scope);
|
||||
aiLight *ReadDirectionalLight(XmlNode &node);
|
||||
aiNode *ReadObject(XmlNode &node, TempScope &scope);
|
||||
bool ReadMesh(XmlNode &node, TempScope &scope);
|
||||
bool ReadMesh(XmlNode &node, TempScope &scope, bool &empty);
|
||||
void ReadMaterial(XmlNode &node, TempScope &scope);
|
||||
aiVector2D ReadVec2(XmlNode &node);
|
||||
aiVector3D ReadVec3(XmlNode &node);
|
||||
|
||||
@@ -166,6 +166,8 @@ SET( Logging_SRCS
|
||||
SOURCE_GROUP(Logging FILES ${Logging_SRCS})
|
||||
|
||||
SET( Common_SRCS
|
||||
Common/Compression.cpp
|
||||
Common/Compression.h
|
||||
Common/BaseImporter.cpp
|
||||
Common/BaseProcess.cpp
|
||||
Common/BaseProcess.h
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -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 const char *tableEncodeBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
static inline char EncodeChar(uint8_t b) {
|
||||
return tableEncodeBase64[size_t(b)];
|
||||
@@ -104,17 +104,16 @@ void Encode(const uint8_t *in, size_t inLength, std::string &out) {
|
||||
}
|
||||
}
|
||||
|
||||
void Encode(const std::vector<uint8_t>& in, std::string &out) {
|
||||
Encode (in.data (), in.size (), out);
|
||||
void Encode(const std::vector<uint8_t> &in, std::string &out) {
|
||||
Encode(in.data(), in.size(), out);
|
||||
}
|
||||
|
||||
std::string Encode (const std::vector<uint8_t>& in) {
|
||||
std::string Encode(const std::vector<uint8_t> &in) {
|
||||
std::string encoded;
|
||||
Encode (in, encoded);
|
||||
Encode(in, encoded);
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
size_t Decode(const char *in, size_t inLength, uint8_t *&out) {
|
||||
if (inLength % 4 != 0) {
|
||||
throw DeadlyImportError("Invalid base64 encoded data: \"", std::string(in, std::min(size_t(32), inLength)), "\", length:", inLength);
|
||||
@@ -159,23 +158,22 @@ size_t Decode(const char *in, size_t inLength, uint8_t *&out) {
|
||||
return outLength;
|
||||
}
|
||||
|
||||
size_t Decode(const std::string& in, std::vector<uint8_t>& out) {
|
||||
uint8_t* outPtr = nullptr;
|
||||
size_t decodedSize = Decode (in.data (), in.size (), outPtr);
|
||||
size_t Decode(const std::string &in, std::vector<uint8_t> &out) {
|
||||
uint8_t *outPtr = nullptr;
|
||||
size_t decodedSize = Decode(in.data(), in.size(), outPtr);
|
||||
if (outPtr == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
out.assign (outPtr, outPtr + decodedSize);
|
||||
out.assign(outPtr, outPtr + decodedSize);
|
||||
delete[] outPtr;
|
||||
return decodedSize;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> Decode (const std::string& in) {
|
||||
std::vector<uint8_t> Decode(const std::string &in) {
|
||||
std::vector<uint8_t> result;
|
||||
Decode (in, result);
|
||||
Decode(in, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Base64
|
||||
} // namespace Assimp
|
||||
|
||||
141
code/Common/Compression.cpp
Normal file
141
code/Common/Compression.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Compression.h"
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/Exceptional.h>
|
||||
|
||||
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||
#include <zlib.h>
|
||||
#else
|
||||
#include "../contrib/zlib/zlib.h"
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
struct Compression::impl {
|
||||
bool mOpen;
|
||||
z_stream mZSstream;
|
||||
|
||||
impl() :
|
||||
mOpen(false) {}
|
||||
};
|
||||
|
||||
Compression::Compression() :
|
||||
mImpl(new impl) {
|
||||
// empty
|
||||
}
|
||||
|
||||
Compression::~Compression() {
|
||||
ai_assert(mImpl != nullptr);
|
||||
|
||||
delete mImpl;
|
||||
}
|
||||
|
||||
bool Compression::open() {
|
||||
ai_assert(mImpl != nullptr);
|
||||
|
||||
if (mImpl->mOpen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// build a zlib stream
|
||||
mImpl->mZSstream.opaque = Z_NULL;
|
||||
mImpl->mZSstream.zalloc = Z_NULL;
|
||||
mImpl->mZSstream.zfree = Z_NULL;
|
||||
mImpl->mZSstream.data_type = Z_BINARY;
|
||||
|
||||
// raw decompression without a zlib or gzip header
|
||||
inflateInit2(&mImpl->mZSstream, -MAX_WBITS);
|
||||
mImpl->mOpen = true;
|
||||
|
||||
return mImpl->mOpen;
|
||||
}
|
||||
|
||||
constexpr size_t MYBLOCK = 1024;
|
||||
|
||||
size_t Compression::decompress(unsigned char *data, size_t in, std::vector<unsigned char> &uncompressed) {
|
||||
ai_assert(mImpl != nullptr);
|
||||
|
||||
mImpl->mZSstream.next_in = reinterpret_cast<Bytef *>(data);
|
||||
mImpl->mZSstream.avail_in = (uInt)in;
|
||||
|
||||
Bytef block[MYBLOCK] = {};
|
||||
int ret = 0;
|
||||
size_t total = 0l;
|
||||
do {
|
||||
mImpl->mZSstream.avail_out = MYBLOCK;
|
||||
mImpl->mZSstream.next_out = block;
|
||||
ret = inflate(&mImpl->mZSstream, Z_NO_FLUSH);
|
||||
|
||||
if (ret != Z_STREAM_END && ret != Z_OK) {
|
||||
throw DeadlyImportError("Compression", "Failure decompressing this file using gzip.");
|
||||
|
||||
}
|
||||
const size_t have = MYBLOCK - mImpl->mZSstream.avail_out;
|
||||
total += have;
|
||||
uncompressed.resize(total);
|
||||
::memcpy(uncompressed.data() + total - have, block, have);
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
bool Compression::isOpen() const {
|
||||
ai_assert(mImpl != nullptr);
|
||||
|
||||
return mImpl->mOpen;
|
||||
}
|
||||
|
||||
bool Compression::close() {
|
||||
ai_assert(mImpl != nullptr);
|
||||
|
||||
if (!mImpl->mOpen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
inflateEnd(&mImpl->mZSstream);
|
||||
mImpl->mOpen = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
80
code/Common/Compression.h
Normal file
80
code/Common/Compression.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
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 <vector>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
/// @brief This class provides the decompression of zlib-compressed data.
|
||||
class Compression {
|
||||
public:
|
||||
/// @brief The class constructor.
|
||||
Compression();
|
||||
|
||||
/// @brief The class destructor.
|
||||
~Compression();
|
||||
|
||||
/// @brief Will open the access to the compression.
|
||||
/// @return true if close was successful, false if not.
|
||||
bool open();
|
||||
|
||||
/// @brief Will return the open state.
|
||||
/// @return true if the access is opened, false if not.
|
||||
bool isOpen() const;
|
||||
|
||||
/// @brief Will close the decompress access.
|
||||
/// @return true if close was successful, false if not.
|
||||
bool close();
|
||||
|
||||
/// @brief Will decompress the data buffer.
|
||||
/// @param[in] data The data to decompress
|
||||
/// @param[in] in The size of the data.
|
||||
/// @param[out uncompressed A std::vector containing the decompressed data.
|
||||
size_t decompress(unsigned char *data, size_t in, std::vector<unsigned char> &uncompressed);
|
||||
|
||||
private:
|
||||
struct impl;
|
||||
impl *mImpl;
|
||||
};
|
||||
|
||||
} // namespace Assimp
|
||||
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2019, assimp team
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,6 +50,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace Base64 {
|
||||
|
||||
/// @brief Will encode the given
|
||||
/// @param in
|
||||
/// @param inLength
|
||||
/// @param out
|
||||
void Encode(const uint8_t *in, size_t inLength, std::string &out);
|
||||
void Encode(const std::vector<uint8_t>& in, std::string &out);
|
||||
std::string Encode(const std::vector<uint8_t>& in);
|
||||
|
||||
@@ -211,7 +211,7 @@ template <typename T> struct ByteSwap::_swapper<T,8> {
|
||||
// --------------------------------------------------------------------------------------
|
||||
#if (defined AI_BUILD_BIG_ENDIAN)
|
||||
# define AI_LE(t) (t)
|
||||
# define AI_BE(t) ByteSwap::Swapped(t)
|
||||
# define AI_BE(t) Assimp::ByteSwap::Swapped(t)
|
||||
# define AI_LSWAP2(p)
|
||||
# define AI_LSWAP4(p)
|
||||
# define AI_LSWAP8(p)
|
||||
@@ -219,16 +219,16 @@ template <typename T> struct ByteSwap::_swapper<T,8> {
|
||||
# define AI_LSWAP4P(p)
|
||||
# define AI_LSWAP8P(p)
|
||||
# define LE_NCONST const
|
||||
# define AI_SWAP2(p) ByteSwap::Swap2(&(p))
|
||||
# define AI_SWAP4(p) ByteSwap::Swap4(&(p))
|
||||
# define AI_SWAP8(p) ByteSwap::Swap8(&(p))
|
||||
# define AI_SWAP2P(p) ByteSwap::Swap2((p))
|
||||
# define AI_SWAP4P(p) ByteSwap::Swap4((p))
|
||||
# define AI_SWAP8P(p) ByteSwap::Swap8((p))
|
||||
# define AI_SWAP2(p) Assimp::ByteSwap::Swap2(&(p))
|
||||
# define AI_SWAP4(p) Assimp::ByteSwap::Swap4(&(p))
|
||||
# define AI_SWAP8(p) Assimp::ByteSwap::Swap8(&(p))
|
||||
# define AI_SWAP2P(p) Assimp::ByteSwap::Swap2((p))
|
||||
# define AI_SWAP4P(p) Assimp::ByteSwap::Swap4((p))
|
||||
# define AI_SWAP8P(p) Assimp::ByteSwap::Swap8((p))
|
||||
# define BE_NCONST
|
||||
#else
|
||||
# define AI_BE(t) (t)
|
||||
# define AI_LE(t) ByteSwap::Swapped(t)
|
||||
# define AI_LE(t) Assimp::ByteSwap::Swapped(t)
|
||||
# define AI_SWAP2(p)
|
||||
# define AI_SWAP4(p)
|
||||
# define AI_SWAP8(p)
|
||||
@@ -236,12 +236,12 @@ template <typename T> struct ByteSwap::_swapper<T,8> {
|
||||
# define AI_SWAP4P(p)
|
||||
# define AI_SWAP8P(p)
|
||||
# define BE_NCONST const
|
||||
# define AI_LSWAP2(p) ByteSwap::Swap2(&(p))
|
||||
# define AI_LSWAP4(p) ByteSwap::Swap4(&(p))
|
||||
# define AI_LSWAP8(p) ByteSwap::Swap8(&(p))
|
||||
# define AI_LSWAP2P(p) ByteSwap::Swap2((p))
|
||||
# define AI_LSWAP4P(p) ByteSwap::Swap4((p))
|
||||
# define AI_LSWAP8P(p) ByteSwap::Swap8((p))
|
||||
# define AI_LSWAP2(p) Assimp::ByteSwap::Swap2(&(p))
|
||||
# define AI_LSWAP4(p) Assimp::ByteSwap::Swap4(&(p))
|
||||
# define AI_LSWAP8(p) Assimp::ByteSwap::Swap8(&(p))
|
||||
# define AI_LSWAP2P(p) Assimp::ByteSwap::Swap2((p))
|
||||
# define AI_LSWAP4P(p) Assimp::ByteSwap::Swap4((p))
|
||||
# define AI_LSWAP8P(p) Assimp::ByteSwap::Swap8((p))
|
||||
# define LE_NCONST
|
||||
#endif
|
||||
|
||||
|
||||
@@ -98,10 +98,6 @@ public:
|
||||
DeadlyErrorBase(Assimp::Formatter::format(), std::forward<T>(args)...) {
|
||||
// empty
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
DeadlyImportError(DeadlyImportError& other) = delete;
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -114,10 +110,6 @@ public:
|
||||
template<typename... T>
|
||||
explicit DeadlyExportError(T&&... args) :
|
||||
DeadlyErrorBase(Assimp::Formatter::format(), std::forward<T>(args)...) {}
|
||||
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
DeadlyExportError(DeadlyExportError& other) = delete;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -119,29 +119,41 @@ public:
|
||||
* work for const references, so many function prototypes will
|
||||
* include const basic_formatter<T>& s but might still want to
|
||||
* modify the formatted string without the need for a full copy.*/
|
||||
template <typename TToken>
|
||||
const basic_formatter& operator << (const TToken& s) const {
|
||||
template <typename TToken, typename std::enable_if<!std::is_base_of<std::exception, TToken>::value>::type * = nullptr>
|
||||
const basic_formatter &operator<<(const TToken &s) const {
|
||||
underlying << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename TToken>
|
||||
basic_formatter& operator << (const TToken& s) {
|
||||
template <typename TToken, typename std::enable_if<std::is_base_of<std::exception, TToken>::value>::type * = nullptr>
|
||||
const basic_formatter &operator<<(const TToken &s) const {
|
||||
underlying << s.what();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename TToken, typename std::enable_if<!std::is_base_of<std::exception, TToken>::value>::type * = nullptr>
|
||||
basic_formatter &operator<<(const TToken &s) {
|
||||
underlying << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename TToken, typename std::enable_if<std::is_base_of<std::exception, TToken>::value>::type * = nullptr>
|
||||
basic_formatter &operator<<(const TToken &s) {
|
||||
underlying << s.what();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// comma operator overloaded as well, choose your preferred way.
|
||||
template <typename TToken>
|
||||
const basic_formatter& operator, (const TToken& s) const {
|
||||
underlying << s;
|
||||
*this << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename TToken>
|
||||
basic_formatter& operator, (const TToken& s) {
|
||||
underlying << s;
|
||||
*this << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -149,7 +161,7 @@ public:
|
||||
// See https://sourceforge.net/projects/assimp/forums/forum/817654/topic/4372824
|
||||
template <typename TToken>
|
||||
basic_formatter& operator, (TToken& s) {
|
||||
underlying << s;
|
||||
*this << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user