added open file ability from the old project to Qt,
texture seams not to open, texture display does not work
This commit is contained in:
@@ -10,14 +10,21 @@
|
||||
// public constructor/destructor
|
||||
|
||||
MshFile::MshFile(const char * path)
|
||||
: m_vModels(new std::vector<Model*>)
|
||||
: FileInterface(path)
|
||||
{
|
||||
//open file
|
||||
m_fsMesh.open(path, std::ios::in | std::ios::binary);
|
||||
import();
|
||||
}
|
||||
|
||||
if (!m_fsMesh.is_open())
|
||||
throw std::invalid_argument(std::string("file not found: ") += path);
|
||||
MshFile::~MshFile()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// private functions
|
||||
|
||||
void MshFile::import()
|
||||
{
|
||||
// go to file size information
|
||||
m_fsMesh.seekg(4);
|
||||
|
||||
@@ -57,20 +64,8 @@ MshFile::MshFile(const char * path)
|
||||
tmp_mainChunks.pop_front();
|
||||
delete cur;
|
||||
}
|
||||
|
||||
// close file
|
||||
m_fsMesh.close();
|
||||
}
|
||||
|
||||
MshFile::~MshFile()
|
||||
{
|
||||
m_vTextureNames.clear();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// private functions
|
||||
|
||||
void MshFile::loadChunks(std::list<ChunkHeader*>& destination, std::streampos start, const std::uint32_t length)
|
||||
{
|
||||
// jump to first chunk
|
||||
@@ -572,22 +567,3 @@ void MshFile::readUV(Segment * dataDestination, std::streampos position)
|
||||
for (unsigned int i = 0; i < tmp_size * 2; i++)
|
||||
m_fsMesh.read(F2V(dataDestination->uv[i]), sizeof(float));
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// public getter
|
||||
|
||||
std::vector<Model*>* MshFile::getModels() const
|
||||
{
|
||||
return m_vModels;
|
||||
}
|
||||
|
||||
std::vector<std::string> MshFile::getTextureNames() const
|
||||
{
|
||||
return m_vTextureNames;
|
||||
}
|
||||
|
||||
BoundingBox MshFile::getBoundingBox() const
|
||||
{
|
||||
return m_sceneBbox;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user