Merge pull request #1715 from assimp/issue_1660
STLLoader: closes https://github.com/assimp/assimp/issues/1660: use m…pull/1712/head^2
commit
bedf506c0a
|
@ -444,27 +444,29 @@ bool STLImporter::LoadBinaryFile()
|
||||||
|
|
||||||
pMesh->mNumVertices = pMesh->mNumFaces*3;
|
pMesh->mNumVertices = pMesh->mNumFaces*3;
|
||||||
|
|
||||||
aiVector3D* vp,*vn;
|
|
||||||
vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
|
||||||
vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pMesh->mNumFaces;++i) {
|
aiVector3D *vp = pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
||||||
|
aiVector3D *vn = pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
||||||
|
|
||||||
|
for ( unsigned int i = 0; i < pMesh->mNumFaces; ++i ) {
|
||||||
// NOTE: Blender sometimes writes empty normals ... this is not
|
// NOTE: Blender sometimes writes empty normals ... this is not
|
||||||
// our fault ... the RemoveInvalidData helper step should fix that
|
// our fault ... the RemoveInvalidData helper step should fix that
|
||||||
*vn = *((aiVector3D*)sz);
|
::memcpy( vn, sz, sizeof( aiVector3D ) );
|
||||||
sz += sizeof(aiVector3D);
|
sz += sizeof(aiVector3D);
|
||||||
*(vn+1) = *vn;
|
*(vn+1) = *vn;
|
||||||
*(vn+2) = *vn;
|
*(vn+2) = *vn;
|
||||||
vn += 3;
|
vn += 3;
|
||||||
|
|
||||||
*vp++ = *((aiVector3D*)sz);
|
::memcpy( vp, sz, sizeof( aiVector3D ) );
|
||||||
|
++vp;
|
||||||
sz += sizeof(aiVector3D);
|
sz += sizeof(aiVector3D);
|
||||||
|
|
||||||
*vp++ = *((aiVector3D*)sz);
|
::memcpy( vp, sz, sizeof( aiVector3D ) );
|
||||||
|
++vp;
|
||||||
sz += sizeof(aiVector3D);
|
sz += sizeof(aiVector3D);
|
||||||
|
|
||||||
*vp++ = *((aiVector3D*)sz);
|
::memcpy( vp, sz, sizeof( aiVector3D ) );
|
||||||
|
++vp;
|
||||||
sz += sizeof(aiVector3D);
|
sz += sizeof(aiVector3D);
|
||||||
|
|
||||||
uint16_t color = *((uint16_t*)sz);
|
uint16_t color = *((uint16_t*)sz);
|
||||||
|
|
Loading…
Reference in New Issue