FIX: multiple LWO layers referencing a single texture won't anymore cause all layers except the first to have no proper uv coordinates.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@389 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2009-04-15 16:24:58 +00:00
parent acdbf77c6e
commit 00729f83f7
1 changed files with 14 additions and 13 deletions

View File

@ -375,29 +375,30 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,MaterialHelper* pcMat
// ------------------------------------------------------------------------------------------------
void LWOImporter::FindUVChannels(LWO::TextureList& list, LWO::Layer& layer,
unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS], unsigned int& next)
unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS],
unsigned int& next)
{
for (TextureList::iterator it = list.begin(), end = list.end();
it != end;++it)
{
for (TextureList::iterator it = list.begin(), end = list.end();it != end;++it) {
// Ignore textures with non-UV mappings for the moment.
if (!(*it).enabled || !(*it).bCanUse || 0xffffffff != (*it).mRealUVIndex || (*it).mapMode != LWO::Texture::UV) {
if (!(*it).enabled || !(*it).bCanUse || (*it).mapMode != LWO::Texture::UV) {
continue;
}
for (unsigned int i = 0; i < layer.mUVChannels.size();++i)
{
if ((*it).mUVChannelIndex == layer.mUVChannels[i].name)
{
for (unsigned int i = 0; i < layer.mUVChannels.size();++i) {
bool found = false;
if ((*it).mUVChannelIndex == layer.mUVChannels[i].name) {
// check whether we have this channel already
for (unsigned int m = 0; m < next;++m)
{
for (unsigned int m = 0; m < next;++m) {
if (i == out[m]) {
(*it).mRealUVIndex = m;
found = true;
break;
}
}
if (0xffffffff == (*it).mRealUVIndex)
{
if (!found) {
(*it).mRealUVIndex = next;
out[next++] = i;
if (AI_MAX_NUMBER_OF_TEXTURECOORDS != next)