Esempio n. 1
0
 Assets::Texture* Md2Parser::loadTexture(const Md2Skin& skin) {
     const Path skinPath(String(skin.name));
     MappedFile::Ptr file = m_fs.openFile(skinPath);
     
     Color avgColor;
     const ImageLoader image(ImageLoader::PCX, file->begin(), file->end());
     
     const Buffer<unsigned char>& indices = image.indices();
     Buffer<unsigned char> rgbImage(indices.size() * 3);
     m_palette.indexedToRgb(indices, indices.size(), rgbImage, avgColor);
     
     return new Assets::Texture(skin.name, image.width(), image.height(), avgColor, rgbImage);
 }