MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / LoadTexture

Method LoadTexture

src/Loaders/nfs2_loader.cpp:1214–1243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1212
1213template<typename Platform>
1214Texture
1215NFS2<Platform>::LoadTexture(TEXTURE_BLOCK track_texture, const std::string &track_name, NFSVer nfs_version) {
1216 std::stringstream filename;
1217 uint8_t alphaColour = 0;
1218 filename << TRACK_PATH << ToString(nfs_version) << "/";
1219
1220 switch (nfs_version) {
1221 case NFS_2:
1222 alphaColour = 0u;
1223 break;
1224 case NFS_2_SE:
1225 alphaColour = 248u;
1226 break;
1227 case NFS_3_PS1:
1228 break;
1229 case UNKNOWN:
1230 default:
1231 ASSERT(false, "Trying to load texture from unknown NFS version");
1232 break;
1233 }
1234 filename << track_name << "/textures/" << setfill('0') << setw(4) << track_texture.texNumber << ".BMP";;
1235
1236 GLubyte *data;
1237 GLsizei width;
1238 GLsizei height;
1239
1240 ASSERT(Utils::LoadBmpCustomAlpha(filename.str().c_str(), &data, &width, &height, alphaColour), "Texture " << filename.str() << " did not load succesfully!");
1241
1242 return Texture((unsigned int) track_texture.texNumber, data, static_cast<unsigned int>(width), static_cast<unsigned int>(height));
1243}
1244
1245
1246template class NFS2<PS1>;

Callers

nothing calls this directly

Calls 2

LoadBmpCustomAlphaFunction · 0.85
TextureClass · 0.85

Tested by

no test coverage detected