Merge branch 'master' into issue_3165

issue_3165
Kim Kulling 2020-06-09 10:48:27 +02:00 committed by GitHub
commit ffaa634c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 7 deletions

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, 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,
@ -239,11 +238,13 @@ bool Structure :: ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
try { try {
f = &(*this)[name]; f = &(*this)[name];
#ifdef _DEBUG
// sanity check, should never happen if the genblenddna script is right // sanity check, should never happen if the genblenddna script is right
if ((FieldFlag_Pointer|FieldFlag_Pointer) != (f->flags & (FieldFlag_Pointer|FieldFlag_Pointer))) { if ((FieldFlag_Pointer|FieldFlag_Pointer) != (f->flags & (FieldFlag_Pointer|FieldFlag_Pointer))) {
throw Error((Formatter::format(),"Field `",name,"` of structure `", throw Error((Formatter::format(),"Field `",name,"` of structure `",
this->name,"` ought to be a pointer AND an array")); this->name,"` ought to be a pointer AND an array"));
} }
#endif // _DEBUG
db.reader->IncPtr(f->offset); db.reader->IncPtr(f->offset);

View File

@ -5071,7 +5071,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size
ptr += sprintf(ptr, "\r\n"); ptr += sprintf(ptr, "\r\n");
} }
/* mathematical shapes face */ /* mathematical shapes face */
if (model->numshape && model->numshape && !(flags & M3D_EXP_NOFACE)) { if (model->numshape !(flags & M3D_EXP_NOFACE)) {
for (j = 0; j < model->numshape; j++) { for (j = 0; j < model->numshape; j++) {
sn = _m3d_safestr(model->shape[j].name, 0); sn = _m3d_safestr(model->shape[j].name, 0);
if (!sn) { if (!sn) {

View File

@ -69,6 +69,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma GCC diagnostic ignored "-Wclass-memaccess" #pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif #endif
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
#define RAPIDJSON_NOMEMBERITERATORCLASS
#endif
#include <rapidjson/rapidjson.h> #include <rapidjson/rapidjson.h>
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <rapidjson/error/en.h> #include <rapidjson/error/en.h>

View File

@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#define RAPIDJSON_HAS_STDSTRING 1 #define RAPIDJSON_HAS_STDSTRING 1
#define RAPIDJSON_NOMEMBERITERATORCLASS
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <rapidjson/error/en.h> #include <rapidjson/error/en.h>
#include <rapidjson/rapidjson.h> #include <rapidjson/rapidjson.h>

View File

@ -71,6 +71,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma GCC diagnostic ignored "-Wclass-memaccess" #pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif #endif
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
#define RAPIDJSON_NOMEMBERITERATORCLASS
#endif
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <rapidjson/error/en.h> #include <rapidjson/error/en.h>
#include <rapidjson/rapidjson.h> #include <rapidjson/rapidjson.h>

View File

@ -72,9 +72,12 @@ namespace o3dgc
unsigned char mask = bstream.ReadUChar(m_iterator, m_streamType); unsigned char mask = bstream.ReadUChar(m_iterator, m_streamType);
ifs.SetCCW ((mask & 1) == 1); ifs.SetCCW ((mask & 1) == 1);
ifs.SetSolid ((mask & 2) == 1); // (mask & 2) == 1
ifs.SetConvex ((mask & 4) == 1); ifs.SetSolid (false);
ifs.SetIsTriangularMesh((mask & 8) == 1); // (mask & 4) == 1
ifs.SetConvex (false);
// (mask & 8) == 1
ifs.SetIsTriangularMesh(false);
//bool markerBit0 = (mask & 16 ) == 1; //bool markerBit0 = (mask & 16 ) == 1;
//bool markerBit1 = (mask & 32 ) == 1; //bool markerBit1 = (mask & 32 ) == 1;
//bool markerBit2 = (mask & 64 ) == 1; //bool markerBit2 = (mask & 64 ) == 1;

View File

@ -73,9 +73,21 @@ TEST_F(utMatrix3x3Test, FromToMatrixTest) {
aiVector3D from, to; aiVector3D from, to;
auto random_ratio = []() -> float {
return static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
};
for (int i = 0; i < NUM_SAMPLES; ++i) { for (int i = 0; i < NUM_SAMPLES; ++i) {
from = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize(); from = aiVector3D(
to = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize(); 1.f * random_ratio(),
1.f * random_ratio(),
1.f * random_ratio())
.Normalize();
to = aiVector3D(
1.f * random_ratio(),
1.f * random_ratio(),
1.f * random_ratio())
.Normalize();
aiMatrix3x3::FromToMatrix(from, to, trafo); aiMatrix3x3::FromToMatrix(from, to, trafo);
res = trafo * from; res = trafo * from;