OFFLoader: Don't use assignments as expressions
parent
1b3381d03d
commit
fba7ede639
|
@ -138,9 +138,15 @@ void OFFImporter::InternReadFile( const std::string& pFile,
|
|||
throw DeadlyImportError("OFF: There are no valid faces");
|
||||
}
|
||||
|
||||
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes = 1 ];
|
||||
aiMesh* mesh = pScene->mMeshes[0] = new aiMesh();
|
||||
aiFace* faces = mesh->mFaces = new aiFace [mesh->mNumFaces = numFaces];
|
||||
pScene->mNumMeshes = 1;
|
||||
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ];
|
||||
|
||||
aiMesh* mesh = new aiMesh();
|
||||
pScene->mMeshes[0] = mesh;
|
||||
|
||||
mesh->mNumFaces = numFaces;
|
||||
aiFace* faces = new aiFace [mesh->mNumFaces];
|
||||
mesh->mFaces = faces;
|
||||
|
||||
std::vector<aiVector3D> tempPositions(numVertices);
|
||||
|
||||
|
@ -171,7 +177,8 @@ void OFFImporter::InternReadFile( const std::string& pFile,
|
|||
break;
|
||||
}
|
||||
sz = line;SkipSpaces(&sz);
|
||||
if(!(faces->mNumIndices = strtoul10(sz,&sz)) || faces->mNumIndices > 9)
|
||||
faces->mNumIndices = strtoul10(sz,&sz);
|
||||
if(!(faces->mNumIndices) || faces->mNumIndices > 9)
|
||||
{
|
||||
DefaultLogger::get()->error("OFF: Faces with zero indices aren't allowed");
|
||||
--mesh->mNumFaces;
|
||||
|
@ -185,24 +192,28 @@ void OFFImporter::InternReadFile( const std::string& pFile,
|
|||
throw DeadlyImportError("OFF: There are no valid faces");
|
||||
|
||||
// allocate storage for the output vertices
|
||||
aiVector3D* verts = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
||||
aiVector3D* verts = new aiVector3D[mesh->mNumVertices];
|
||||
mesh->mVertices = verts;
|
||||
|
||||
// second: now parse all face indices
|
||||
buffer = old;faces = mesh->mFaces;
|
||||
buffer = old;
|
||||
faces = mesh->mFaces;
|
||||
for (unsigned int i = 0, p = 0; i< mesh->mNumFaces;)
|
||||
{
|
||||
if(!GetNextLine(buffer,line))break;
|
||||
|
||||
unsigned int idx;
|
||||
sz = line;SkipSpaces(&sz);
|
||||
if(!(idx = strtoul10(sz,&sz)) || idx > 9)
|
||||
idx = strtoul10(sz,&sz);
|
||||
if(!(idx) || idx > 9)
|
||||
continue;
|
||||
|
||||
faces->mIndices = new unsigned int [faces->mNumIndices];
|
||||
for (unsigned int m = 0; m < faces->mNumIndices;++m)
|
||||
{
|
||||
SkipSpaces(&sz);
|
||||
if ((idx = strtoul10(sz,&sz)) >= numVertices)
|
||||
idx = strtoul10(sz,&sz);
|
||||
if ((idx) >= numVertices)
|
||||
{
|
||||
DefaultLogger::get()->error("OFF: Vertex index is out of range");
|
||||
idx = numVertices-1;
|
||||
|
@ -217,11 +228,13 @@ void OFFImporter::InternReadFile( const std::string& pFile,
|
|||
// generate the output node graph
|
||||
pScene->mRootNode = new aiNode();
|
||||
pScene->mRootNode->mName.Set("<OFFRoot>");
|
||||
pScene->mRootNode->mMeshes = new unsigned int [pScene->mRootNode->mNumMeshes = 1];
|
||||
pScene->mRootNode->mNumMeshes = 1;
|
||||
pScene->mRootNode->mMeshes = new unsigned int [pScene->mRootNode->mNumMeshes];
|
||||
pScene->mRootNode->mMeshes[0] = 0;
|
||||
|
||||
// generate a default material
|
||||
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = 1];
|
||||
pScene->mNumMaterials = 1;
|
||||
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
|
||||
aiMaterial* pcMat = new aiMaterial();
|
||||
|
||||
aiColor4D clr(0.6f,0.6f,0.6f,1.0f);
|
||||
|
|
Loading…
Reference in New Issue