- REFACTORING : Remove not used header from ObjFileParser.
- REFACTORING : Rename IO instance of ObjParser. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@509 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
e4e47eab07
commit
a870710f56
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "ObjTools.h"
|
#include "ObjTools.h"
|
||||||
#include "ObjFileData.h"
|
#include "ObjFileData.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
#include "../include/aiTypes.h"
|
||||||
#include "DefaultIOSystem.h"
|
#include "DefaultIOSystem.h"
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
@ -57,12 +57,12 @@ const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Constructor with loaded data and directories.
|
// Constructor with loaded data and directories.
|
||||||
ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem* _io) :
|
ObjFileParser::ObjFileParser(std::vector<char> &Data,const std::string &strModelName, IOSystem *io ) :
|
||||||
m_DataIt(Data.begin()),
|
m_DataIt(Data.begin()),
|
||||||
m_DataItEnd(Data.end()),
|
m_DataItEnd(Data.end()),
|
||||||
m_pModel(NULL),
|
m_pModel(NULL),
|
||||||
m_uiLine(0),
|
m_uiLine(0),
|
||||||
io(_io)
|
m_pIO( io )
|
||||||
{
|
{
|
||||||
// Create the model instance to store all the data
|
// Create the model instance to store all the data
|
||||||
m_pModel = new ObjFile::Model();
|
m_pModel = new ObjFile::Model();
|
||||||
|
@ -438,7 +438,7 @@ void ObjFileParser::getMaterialLib()
|
||||||
|
|
||||||
// Check for existence
|
// Check for existence
|
||||||
const std::string strMatName(pStart, &(*m_DataIt));
|
const std::string strMatName(pStart, &(*m_DataIt));
|
||||||
IOStream *pFile = io->Open(strMatName);
|
IOStream *pFile = m_pIO->Open(strMatName);
|
||||||
|
|
||||||
if (!pFile )
|
if (!pFile )
|
||||||
{
|
{
|
||||||
|
@ -450,7 +450,7 @@ void ObjFileParser::getMaterialLib()
|
||||||
// Import material library data from file
|
// Import material library data from file
|
||||||
std::vector<char> buffer;
|
std::vector<char> buffer;
|
||||||
BaseImporter::TextFileToBuffer(pFile,buffer);
|
BaseImporter::TextFileToBuffer(pFile,buffer);
|
||||||
io->Close( pFile );
|
m_pIO->Close( pFile );
|
||||||
|
|
||||||
// Importing the material library
|
// Importing the material library
|
||||||
ObjFileMtlImporter mtlImporter( buffer, strMatName, m_pModel );
|
ObjFileMtlImporter mtlImporter( buffer, strMatName, m_pModel );
|
||||||
|
|
|
@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "../include/aiTypes.h"
|
|
||||||
|
|
||||||
namespace Assimp
|
namespace Assimp
|
||||||
{
|
{
|
||||||
|
@ -59,6 +58,7 @@ struct Point3;
|
||||||
struct Point2;
|
struct Point2;
|
||||||
}
|
}
|
||||||
class ObjFileImporter;
|
class ObjFileImporter;
|
||||||
|
class IOSystem;
|
||||||
|
|
||||||
/// \class ObjFileParser
|
/// \class ObjFileParser
|
||||||
/// \brief Parser for a obj waveform file
|
/// \brief Parser for a obj waveform file
|
||||||
|
@ -102,18 +102,18 @@ private:
|
||||||
void getGroupName();
|
void getGroupName();
|
||||||
/// Gets the group number from file.
|
/// Gets the group number from file.
|
||||||
void getGroupNumber();
|
void getGroupNumber();
|
||||||
///
|
/// Returns the index of the material. Is -1 if not material was found.
|
||||||
int getMaterialIndex( const std::string &strMaterialName );
|
int getMaterialIndex( const std::string &strMaterialName );
|
||||||
///
|
/// Parse object name
|
||||||
void getObjectName();
|
void getObjectName();
|
||||||
///
|
/// Creates a new object.
|
||||||
void createObject(const std::string &strObjectName);
|
void createObject(const std::string &strObjectName);
|
||||||
/// Error report in token
|
/// Error report in token
|
||||||
void reportErrorTokenInFace();
|
void reportErrorTokenInFace();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Default material name
|
/// Default material name
|
||||||
static const std::string DEFAULT_MATERIAL;/* = "defaultmaterial";*/
|
static const std::string DEFAULT_MATERIAL;
|
||||||
//! Iterator to current position in buffer
|
//! Iterator to current position in buffer
|
||||||
DataArrayIt m_DataIt;
|
DataArrayIt m_DataIt;
|
||||||
//! Iterator to end position of buffer
|
//! Iterator to end position of buffer
|
||||||
|
@ -124,8 +124,8 @@ private:
|
||||||
unsigned int m_uiLine;
|
unsigned int m_uiLine;
|
||||||
//! Helper buffer
|
//! Helper buffer
|
||||||
char m_buffer[BUFFERSIZE];
|
char m_buffer[BUFFERSIZE];
|
||||||
|
/// Pointer to IO system instance.
|
||||||
IOSystem* io;
|
IOSystem *m_pIO;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace Assimp
|
} // Namespace Assimp
|
||||||
|
|
Loading…
Reference in New Issue