closes https://github.com/assimp/assimp/issues/3165: fix gcc build.
This commit is contained in:
@@ -370,13 +370,23 @@ void STLImporter::LoadASCIIFile(aiNode *root) {
|
||||
pMesh->mNumFaces = static_cast<unsigned int>(positionBuffer.size() / 3);
|
||||
pMesh->mNumVertices = static_cast<unsigned int>(positionBuffer.size());
|
||||
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||
memcpy(pMesh->mVertices, &positionBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D));
|
||||
for (size_t i=0; i<pMesh->mNumVertices; ++i ) {
|
||||
pMesh->mVertices[i].x = positionBuffer[i].x;
|
||||
pMesh->mVertices[i].y = positionBuffer[i].y;
|
||||
pMesh->mVertices[i].z = positionBuffer[i].z;
|
||||
}
|
||||
//memcpy(pMesh->mVertices, &positionBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D));
|
||||
positionBuffer.clear();
|
||||
}
|
||||
// also only process normalBuffer when filled, else exception when accessing with index operator
|
||||
if (!normalBuffer.empty()) {
|
||||
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||
memcpy(pMesh->mNormals, &normalBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D));
|
||||
for (size_t i=0; i<pMesh->mNumVertices; ++i ) {
|
||||
pMesh->mNormals[i].x = normalBuffer[i].x;
|
||||
pMesh->mNormals[i].y = normalBuffer[i].y;
|
||||
pMesh->mNormals[i].z = normalBuffer[i].z;
|
||||
}
|
||||
// memcpy(pMesh->mNormals, &normalBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D));
|
||||
normalBuffer.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
@@ -62,10 +61,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <stdexcept>
|
||||
|
||||
#define RAPIDJSON_HAS_STDSTRING 1
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#include <rapidjson/rapidjson.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
#ifdef ASSIMP_API
|
||||
# include <memory>
|
||||
# include <assimp/DefaultIOSystem.h>
|
||||
|
||||
@@ -64,10 +64,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <vector>
|
||||
|
||||
#define RAPIDJSON_HAS_STDSTRING 1
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/error/en.h>
|
||||
#include <rapidjson/rapidjson.h>
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
#ifdef ASSIMP_API
|
||||
#include <assimp/ByteSwapper.h>
|
||||
#include <assimp/DefaultIOSystem.h>
|
||||
|
||||
Reference in New Issue
Block a user