Merge branch 'master' into external-minizip
commit
b2c80ea5ba
|
@ -185,7 +185,7 @@ void IFCImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
int read = 0;
|
int read = 0;
|
||||||
do {
|
do {
|
||||||
int bufferSize = fileInfo.uncompressed_size < INT16_MAX ? fileInfo.uncompressed_size : INT16_MAX;
|
unsigned bufferSize = fileInfo.uncompressed_size < INT16_MAX ? static_cast<unsigned>(fileInfo.uncompressed_size) : INT16_MAX;
|
||||||
void *buffer = malloc(bufferSize);
|
void *buffer = malloc(bufferSize);
|
||||||
read = unzReadCurrentFile(zip, buffer, bufferSize);
|
read = unzReadCurrentFile(zip, buffer, bufferSize);
|
||||||
if (read > 0) {
|
if (read > 0) {
|
||||||
|
|
|
@ -1372,7 +1372,7 @@ std::vector<IfcVector2> GetContourInPlane2D(const std::shared_ptr<TempMesh>& mes
|
||||||
const std::vector<IfcVector3>& va = mesh->mVerts;
|
const std::vector<IfcVector3>& va = mesh->mVerts;
|
||||||
if(va.size() <= 2) {
|
if(va.size() <= 2) {
|
||||||
std::stringstream msg;
|
std::stringstream msg;
|
||||||
msg << "Skipping: Only " << va.size() << " verticies in opening mesh.";
|
msg << "Skipping: Only " << va.size() << " vertices in opening mesh.";
|
||||||
IFCImporter::LogDebug(msg.str().c_str());
|
IFCImporter::LogDebug(msg.str().c_str());
|
||||||
ok = false;
|
ok = false;
|
||||||
return contour;
|
return contour;
|
||||||
|
|
|
@ -575,8 +575,8 @@ void SetupMapping(aiMaterial *mat, aiTextureMapping mode, const aiVector3D &axis
|
||||||
m->mSemantic = prop->mSemantic;
|
m->mSemantic = prop->mSemantic;
|
||||||
m->mType = aiPTI_Float;
|
m->mType = aiPTI_Float;
|
||||||
|
|
||||||
m->mDataLength = 12;
|
m->mDataLength = sizeof(aiVector3D);
|
||||||
m->mData = new char[12];
|
m->mData = new char[m->mDataLength];
|
||||||
*((aiVector3D *)m->mData) = axis;
|
*((aiVector3D *)m->mData) = axis;
|
||||||
p.push_back(m);
|
p.push_back(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,12 +290,6 @@ void PretransformVertices::ComputeAbsoluteTransform(aiNode *pcNode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void normalizeVectorArray(aiVector3D *vectorArrayIn, aiVector3D *vectorArrayOut, size_t numVectors) {
|
|
||||||
for (size_t i=0; i<numVectors; ++i) {
|
|
||||||
vectorArrayOut[i] = vectorArrayIn[i].Normalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Apply the node transformation to a mesh
|
// Apply the node transformation to a mesh
|
||||||
void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const {
|
void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat) const {
|
||||||
|
@ -322,8 +316,11 @@ void PretransformVertices::ApplyTransform(aiMesh *mesh, const aiMatrix4x4 &mat)
|
||||||
const aiMatrix3x3 m = aiMatrix3x3(mat).Inverse().Transpose();
|
const aiMatrix3x3 m = aiMatrix3x3(mat).Inverse().Transpose();
|
||||||
|
|
||||||
if (mesh->HasNormals()) {
|
if (mesh->HasNormals()) {
|
||||||
normalizeVectorArray(mesh->mNormals, mesh->mNormals, mesh->mNumVertices);
|
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
|
||||||
|
mesh->mNormals[i] = (m * mesh->mNormals[i]).Normalize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh->HasTangentsAndBitangents()) {
|
if (mesh->HasTangentsAndBitangents()) {
|
||||||
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
|
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
|
||||||
mesh->mTangents[i] = (m * mesh->mTangents[i]).Normalize();
|
mesh->mTangents[i] = (m * mesh->mTangents[i]).Normalize();
|
||||||
|
|
|
@ -59,6 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -872,11 +874,15 @@ struct aiMesh {
|
||||||
|
|
||||||
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
||||||
if (mNumBones && mBones) {
|
if (mNumBones && mBones) {
|
||||||
|
std::unordered_set<const aiBone *> bones;
|
||||||
for (unsigned int a = 0; a < mNumBones; a++) {
|
for (unsigned int a = 0; a < mNumBones; a++) {
|
||||||
if (mBones[a]) {
|
if (mBones[a]) {
|
||||||
delete mBones[a];
|
bones.insert(mBones[a]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const aiBone *bone: bones) {
|
||||||
|
delete bone;
|
||||||
|
}
|
||||||
delete[] mBones;
|
delete[] mBones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
class BlendImportAreaLight : public ::testing::Test {
|
class BlendImportAreaLight : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
|
BlendImportAreaLight() :
|
||||||
|
im(nullptr) {}
|
||||||
|
~BlendImportAreaLight() override = default;
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
im = new Assimp::Importer();
|
im = new Assimp::Importer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,14 @@ using namespace ::Assimp;
|
||||||
|
|
||||||
class BlenderWorkTest : public ::testing::Test {
|
class BlenderWorkTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
BlenderWorkTest() : im(nullptr) {}
|
||||||
|
~BlenderWorkTest() override = default;
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
im = new Assimp::Importer();
|
im = new Assimp::Importer();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
delete im;
|
delete im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue