dynamical decide whether to use the given texture or solid red

This commit is contained in:
Anakin
2016-10-21 18:56:34 +02:00
parent c3d73895c7
commit 211b406c3d
3 changed files with 33 additions and 9 deletions

View File

@@ -148,9 +148,10 @@ void Object::analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*>& c
if (!strcmp("PRNT", (*it)->name))
{
fsMesh.seekg((*it)->position);
char tempName[33] = { 0 };
fsMesh.read(reinterpret_cast<char*>(&tempName[0]), (*it)->size > 32 ? 32 : (*it)->size);
dataDestination->parent = tempName;
char* buffer = new char[(*it)->size];
fsMesh.read(buffer, (*it)->size);
dataDestination->parent = buffer;
delete buffer;
continue;
}
@@ -160,6 +161,7 @@ void Object::analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*>& c
char* buffer = new char[(*it)->size];
fsMesh.read(buffer, (*it)->size);
dataDestination->name = buffer;
delete buffer;
continue;
}
@@ -373,6 +375,7 @@ void Object::analyseClthChunks(Modl * dataDestination, std::list<ChunkHeader*>&
char* buffer = new char[(*it)->size];
fsMesh.read(buffer, (*it)->size);
dataDestination->texture = buffer;
delete buffer;
continue;
}
@@ -491,6 +494,16 @@ std::vector<GLfloat> Object::getUV() const
return tempData;
}
std::list<std::string> Object::getTexture() const
{
std::list<std::string> tempData;
for (std::list<Modl*>::const_iterator it = lModls.begin(); it != lModls.end(); it++)
tempData.push_back((*it)->texture);
return tempData;
}
/////////////////////////////////////////////////////////////////////////
// public functions