From Marco Jez, "fixes a bug that prevented mipmaps in images from being read correctly (the call to

setImage() clears the previously filled _mipmapData vector)."
This commit is contained in:
Robert Osfield 2004-04-18 13:44:09 +00:00
parent cf8c4c6a97
commit 4df7836f65

View File

@ -107,13 +107,13 @@ void Image::read(DataInputStream* in)
// Read mipmapdata vector
int size = in->readInt();
_mipmapData.resize(size);
MipmapDataType mipmapData(size);
//if (size) std::cout<<"is mip mapped ";
for(int i=0;i<size;i++)
{
_mipmapData[i]=(unsigned int)in->readInt();
mipmapData[i]=(unsigned int)in->readInt();
//std::cout<<_mipmapData[i]<<"\t";
}
//std::cout<<std::endl;
@ -139,6 +139,8 @@ void Image::read(DataInputStream* in)
setImage(is, it, ir, internalTextureFormat, pixelFormat,
dataType, (unsigned char* ) data, osg::Image::USE_NEW_DELETE, packing);
}
_mipmapData.swap(mipmapData);
}
else{
throw Exception("Image::read(): Expected Image identification.");