Merge remote-tracking branch 'upstream/master' into feature/jassimp-classloader-license
commit
9d2bcb56c7
|
@ -26,6 +26,10 @@ function generate()
|
||||||
OPTIONS="$OPTIONS -DASSIMP_ASAN=OFF"
|
OPTIONS="$OPTIONS -DASSIMP_ASAN=OFF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$UBSAN" = "ON" ] ; then
|
||||||
|
OPTIONS="$OPTIONS -DASSIMP_UBSAN=ON"
|
||||||
|
fi
|
||||||
|
|
||||||
cmake -G "Unix Makefiles" $OPTIONS
|
cmake -G "Unix Makefiles" $OPTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ matrix:
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: ASAN=ON
|
env: ASAN=ON
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: UBSAN=ON
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: clang
|
compiler: clang
|
||||||
env: SHARED_BUILD=ON
|
env: SHARED_BUILD=ON
|
||||||
|
|
|
@ -86,6 +86,10 @@ OPTION ( ASSIMP_ASAN
|
||||||
"Enable AddressSanitizer."
|
"Enable AddressSanitizer."
|
||||||
OFF
|
OFF
|
||||||
)
|
)
|
||||||
|
OPTION ( ASSIMP_UBSAN
|
||||||
|
"Enable Undefined Behavior sanitizer."
|
||||||
|
OFF
|
||||||
|
)
|
||||||
OPTION ( SYSTEM_IRRXML
|
OPTION ( SYSTEM_IRRXML
|
||||||
"Use system installed Irrlicht/IrrXML library."
|
"Use system installed Irrlicht/IrrXML library."
|
||||||
OFF
|
OFF
|
||||||
|
@ -234,6 +238,12 @@ if (ASSIMP_ASAN)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ASSIMP_UBSAN)
|
||||||
|
MESSAGE(STATUS "Undefined Behavior sanitizer enabled")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
|
||||||
|
endif()
|
||||||
|
|
||||||
INCLUDE (FindPkgMacros)
|
INCLUDE (FindPkgMacros)
|
||||||
INCLUDE (PrecompiledHeader)
|
INCLUDE (PrecompiledHeader)
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,8 @@ int B3DImporter::ReadByte(){
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
int B3DImporter::ReadInt(){
|
int B3DImporter::ReadInt(){
|
||||||
if( _pos+4<=_buf.size() ){
|
if( _pos+4<=_buf.size() ){
|
||||||
int n=*(int*)&_buf[_pos];
|
int n;
|
||||||
|
memcpy(&n, &_buf[_pos], 4);
|
||||||
_pos+=4;
|
_pos+=4;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,8 @@ int B3DImporter::ReadInt(){
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
float B3DImporter::ReadFloat(){
|
float B3DImporter::ReadFloat(){
|
||||||
if( _pos+4<=_buf.size() ){
|
if( _pos+4<=_buf.size() ){
|
||||||
float n=*(float*)&_buf[_pos];
|
float n;
|
||||||
|
memcpy(&n, &_buf[_pos], 4);
|
||||||
_pos+=4;
|
_pos+=4;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,8 @@ uint32_t ReadWord(const char* input, const char*& cursor, const char* end)
|
||||||
TokenizeError("cannot ReadWord, out of bounds",input, cursor);
|
TokenizeError("cannot ReadWord, out of bounds",input, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t word = *reinterpret_cast<const uint32_t*>(cursor);
|
uint32_t word;
|
||||||
|
memcpy(&word, cursor, 4);
|
||||||
AI_SWAP4(word);
|
AI_SWAP4(word);
|
||||||
|
|
||||||
cursor += k_to_read;
|
cursor += k_to_read;
|
||||||
|
|
|
@ -272,7 +272,6 @@ bool IntersectsBoundaryProfile(const IfcVector3& e0, const IfcVector3& e1, const
|
||||||
const IfcVector3& b0 = boundary[i];
|
const IfcVector3& b0 = boundary[i];
|
||||||
const IfcVector3& b1 = boundary[(i + 1) % bcount];
|
const IfcVector3& b1 = boundary[(i + 1) % bcount];
|
||||||
IfcVector3 b = b1 - b0;
|
IfcVector3 b = b1 - b0;
|
||||||
IfcFloat b_sqlen_inv = 1.0 / b.SquareLength();
|
|
||||||
|
|
||||||
// segment-segment intersection
|
// segment-segment intersection
|
||||||
// solve b0 + b*s = e0 + e*t for (s,t)
|
// solve b0 + b*s = e0 + e*t for (s,t)
|
||||||
|
@ -281,6 +280,7 @@ bool IntersectsBoundaryProfile(const IfcVector3& e0, const IfcVector3& e1, const
|
||||||
// no solutions (parallel lines)
|
// no solutions (parallel lines)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
IfcFloat b_sqlen_inv = 1.0 / b.SquareLength();
|
||||||
|
|
||||||
const IfcFloat x = b0.x - e0.x;
|
const IfcFloat x = b0.x - e0.x;
|
||||||
const IfcFloat y = b0.y - e0.y;
|
const IfcFloat y = b0.y - e0.y;
|
||||||
|
|
|
@ -90,8 +90,9 @@ void PretransformVerticesTest::SetUp()
|
||||||
|
|
||||||
// add 5 empty materials
|
// add 5 empty materials
|
||||||
scene->mMaterials = new aiMaterial*[scene->mNumMaterials = 5];
|
scene->mMaterials = new aiMaterial*[scene->mNumMaterials = 5];
|
||||||
for (unsigned int i = 0; i < 5;++i)
|
for (unsigned int i = 0; i < 5;++i) {
|
||||||
scene->mMaterials[i] = new aiMaterial();
|
scene->mMaterials[i] = new aiMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
// add 25 test meshes
|
// add 25 test meshes
|
||||||
scene->mMeshes = new aiMesh*[scene->mNumMeshes = 25];
|
scene->mMeshes = new aiMesh*[scene->mNumMeshes = 25];
|
||||||
|
@ -110,8 +111,15 @@ void PretransformVerticesTest::SetUp()
|
||||||
}
|
}
|
||||||
mesh->mMaterialIndex = i%5;
|
mesh->mMaterialIndex = i%5;
|
||||||
|
|
||||||
if (i % 2)
|
if (i % 2) {
|
||||||
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
|
||||||
|
for ( unsigned int normalIdx=0; normalIdx<mesh->mNumVertices; ++normalIdx ) {
|
||||||
|
mesh->mNormals[ normalIdx ].x = 1.0f;
|
||||||
|
mesh->mNormals[ normalIdx ].y = 1.0f;
|
||||||
|
mesh->mNormals[ normalIdx ].z = 1.0f;
|
||||||
|
mesh->mNormals[ normalIdx ].Normalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct some nodes (1+25)
|
// construct some nodes (1+25)
|
||||||
|
|
Loading…
Reference in New Issue