MCPcopy Create free account
hub / github.com/demoth/jake2 / GL_FindImage

Method GL_FindImage

client/src/main/java/jake2/client/render/fast/Image.java:1454–1506  ·  view source on GitHub ↗
(String name, int type)

Source from the content-addressed store, hash-verified

1452 ===============
1453 */
1454 image_t GL_FindImage(String name, int type) {
1455
1456 if (name == null || name.length() < 1)
1457 return null;
1458
1459 // look for it
1460 image_t image = imageCache.get(name);
1461 if (image != null) {
1462 image.registration_sequence = registration_sequence;
1463 return image;
1464 }
1465
1466 //
1467 // load the pic from disk
1468 //
1469 image = null;
1470 byte[] pic = null;
1471 Dimension dim = new Dimension();
1472
1473 if (name.endsWith(".pcx")) {
1474
1475 pic = LoadPCX(name, null, dim);
1476 if (pic == null)
1477 return null;
1478 image = GL_LoadPic(name, pic, dim.width, dim.height, type, 8);
1479
1480 }
1481 else if (name.endsWith(".wal")) {
1482
1483 image = GL_LoadWal(name);
1484
1485 }
1486 else if (name.endsWith(".tga")) {
1487
1488 pic = LoadTGA(name, dim);
1489
1490 if (pic == null)
1491 return null;
1492
1493 image = GL_LoadPic(name, pic, dim.width, dim.height, type, 32);
1494
1495 } else {
1496
1497 pic = LoadPCX("pics/" + name + ".pcx", null, dim);
1498 if (pic == null)
1499 return null;
1500 image = GL_LoadPic(name, pic, dim.width, dim.height, type, 8);
1501
1502 }
1503
1504 imageCache.put(image.name, image);
1505 return image;
1506 }
1507
1508 /*
1509 ===============

Callers 8

R_RegisterSkinMethod · 0.95
Draw_InitLocalMethod · 0.80
Draw_FindPicMethod · 0.80
Mod_LoadTexinfoMethod · 0.80
Mod_LoadAliasModelMethod · 0.80
Mod_LoadSpriteModelMethod · 0.80
R_RegisterModelMethod · 0.80
R_SetSkyMethod · 0.80

Calls 5

LoadPCXMethod · 0.95
GL_LoadPicMethod · 0.95
GL_LoadWalMethod · 0.95
LoadTGAMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected