Fixed bug in the AC loader causing lines to load incorrectly. Seems to work now.

Added some more essential includes to AssimpPCH.hAdded support for line and point meshes to most steps - I did nto yet adapt all unit tests, so meshes with mixed primitive types are not absolutely safe at the moment.
Added camera and light support to the PretransformVert step. Fixed some small inaccuracies and fixed a bug reported by Mark Sibly causing all transformations to be invalid. However the step is nto yet completely correct, there are still some small artifacts.
Updated light and camera data structures, added temporary validation code for the
Renamed AI_SCENE_FLAGS_ANIM_SKELETON_ONLY to a more generic AI_SCENE_FLAGS_INCOMPLETE flag.
Fixed bug in the OFF loader causing meshes with polygons to crash
Added line support to the DXF loader - seems to fail for the moment cause of SortByPType.
Added support for lights and cameras to NFF, implemented another NFF format subtype (file starts with 'nff'). Implemented NFF 'tpp' chunk and a corresponding texture extension.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@185 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2008-10-19 11:32:33 +00:00
parent 3aecad406c
commit 2da2835b29
47 changed files with 1886 additions and 809 deletions

View File

@@ -109,8 +109,6 @@ void OFFImporter::InternReadFile( const std::string& pFile,
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes = 1 ];
aiMesh* mesh = pScene->mMeshes[0] = new aiMesh();
mesh->mNumVertices = numFaces*3;
aiVector3D* verts = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
aiFace* faces = mesh->mFaces = new aiFace [mesh->mNumFaces = numFaces];
std::vector<aiVector3D> tempPositions(numVertices);
@@ -131,21 +129,43 @@ void OFFImporter::InternReadFile( const std::string& pFile,
fast_atof_move(sz,(float&)v.z);
}
// now read all faces lines
for (unsigned int i = 0, p = 0; i< mesh->mNumFaces;++i)
// First find out how many vertices we'll need
const char* old = buffer;
for (unsigned int i = 0; i< mesh->mNumFaces;++i)
{
if(!GetNextLine(buffer,line))
{
DefaultLogger::get()->error("OFF: The number of faces in the header is incorrect");
break;
}
unsigned int idx;sz = line;SkipSpaces(&sz);
if(!(faces->mNumIndices = strtol10(sz,&sz)) || faces->mNumIndices > 100)
sz = line;SkipSpaces(&sz);
if(!(faces->mNumIndices = strtol10(sz,&sz)) || faces->mNumIndices > 9)
{
DefaultLogger::get()->error("OFF: Faces with zero indices aren't allowed");
--mesh->mNumFaces;
continue;
}
mesh->mNumVertices += faces->mNumIndices;
++faces;
}
if (!mesh->mNumVertices)
throw new ImportErrorException("OFF: There are no valid faces");
// allocate storage for the output vertices
aiVector3D* verts = mesh->mVertices = new aiVector3D[mesh->mNumVertices];
// second: now parse all face indices
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 = strtol10(sz,&sz)) || idx > 9)
continue;
faces->mIndices = new unsigned int [faces->mNumIndices];
for (unsigned int m = 0; m < faces->mNumIndices;++m)
@@ -156,10 +176,10 @@ void OFFImporter::InternReadFile( const std::string& pFile,
DefaultLogger::get()->error("OFF: Vertex index is out of range");
idx = numVertices-1;
}
faces->mIndices[m] = p++;
*verts++ = tempPositions[idx];
}
++i;
++faces;
}