Merge branch 'master' into patch-2

This commit is contained in:
JeffH-BMG
2018-03-09 14:40:16 -05:00
committed by GitHub
5 changed files with 62 additions and 30 deletions
-3
View File
@@ -235,9 +235,6 @@ void FBXExporter::WriteBinaryFooter()
outfile->Write(NULL_RECORD.c_str(), NULL_RECORD.size(), 1);
outfile->Write(GENERIC_FOOTID.c_str(), GENERIC_FOOTID.size(), 1);
for (size_t i = 0; i < 4; ++i) {
outfile->Write("\x00", 1, 1);
}
// here some padding is added for alignment to 16 bytes.
// if already aligned, the full 16 bytes is added.
+6 -3
View File
@@ -54,6 +54,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXProperties.h"
#include <assimp/ByteSwapper.h>
#include <algorithm> // std::transform
namespace Assimp {
namespace FBX {
@@ -82,11 +84,12 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
std::string templateName;
const char* const sh = shading.c_str();
if(!strcmp(sh,"phong")) {
// lower-case shading because Blender (for example) writes "Phong"
std::transform(shading.begin(), shading.end(), shading.begin(), ::tolower);
if(shading == "phong") {
templateName = "Material.FbxSurfacePhong";
}
else if(!strcmp(sh,"lambert")) {
else if(shading == "lambert") {
templateName = "Material.FbxSurfaceLambert";
}
else {
+1 -22
View File
@@ -245,28 +245,7 @@ void PLYImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy
// list is containing a list of points
bool pointsOnly = mGeneratedMesh->mFaces == NULL ? true : false;
if (pointsOnly) {
if (mGeneratedMesh->mNumVertices < 3) {
if (mGeneratedMesh != NULL) {
delete(mGeneratedMesh);
mGeneratedMesh = nullptr;
}
streamedBuffer.close();
throw DeadlyImportError("Invalid .ply file: Not enough "
"vertices to build a proper face list. ");
}
const unsigned int iNum = (unsigned int)mGeneratedMesh->mNumVertices / 3;
mGeneratedMesh->mNumFaces = iNum;
mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces];
for (unsigned int i = 0; i < iNum; ++i) {
mGeneratedMesh->mFaces[i].mNumIndices = 3;
mGeneratedMesh->mFaces[i].mIndices = new unsigned int[3];
mGeneratedMesh->mFaces[i].mIndices[0] = (i * 3);
mGeneratedMesh->mFaces[i].mIndices[1] = (i * 3) + 1;
mGeneratedMesh->mFaces[i].mIndices[2] = (i * 3) + 2;
}
mGeneratedMesh->mPrimitiveTypes = aiPrimitiveType::aiPrimitiveType_POINT;
}
// now load a list of all materials