Initiual commit: AssetImporter source moved from ZFXCE repository to its own repository. PLease do not use the ZFXCE repo any more.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
kimmi
2008-05-05 12:36:31 +00:00
commit b76f999cb7
131 changed files with 24989 additions and 0 deletions

68
include/ObjFileParser.h Normal file
View File

@@ -0,0 +1,68 @@
#ifndef OBJ_FILEPARSER_H_INC
#define OBJ_FILEPARSER_H_INC
#include <vector>
#include <string>
#include "aiTypes.h"
/*struct aiVector2D_t;
struct aiVector3D_t;*/
namespace Assimp
{
namespace ObjFile
{
struct Model;
struct Object;
struct Material;
struct Point3;
struct Point2;
}
class ObjFileImporter;
class ObjFileParser
{
public:
static const size_t BUFFERSIZE = 1024;
typedef std::vector<char> DataArray;
typedef std::vector<char>::iterator DataArrayIt;
typedef std::vector<char>::const_iterator ConstDataArrayIt;
public:
ObjFileParser(std::vector<char> &Data, const std::string &strAbsPath, const std::string &strModelName);
~ObjFileParser();
ObjFile::Model *GetModel() const;
private:
void parseFile();
void copyNextWord(char *pBuffer, size_t length);
void copyNextLine(char *pBuffer, size_t length);
void getVector3(std::vector<aiVector3D_t*> &point3d_array);
void getVector2(std::vector<aiVector2D_t*> &point2d_array);
void skipLine();
void getFace();
void getMaterialDesc();
void getComment();
void getMaterialLib();
void getNewMaterial();
void getGroupName();
void getGroupNumber();
void getObjectName();
void createObject(const std::string &strObjectName);
void reportErrorTokenInFace();
void extractExtension(const std::string strFile, std::string &strExt);
private:
std::string m_strAbsPath;
DataArrayIt m_DataIt;
DataArrayIt m_DataItEnd;
ObjFile::Model *m_pModel;
unsigned int m_uiLine;
char m_buffer[BUFFERSIZE];
};
} // Namespace Assimp
#endif