MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / LoadTextures

Function LoadTextures

TombEngine/Specific/level.cpp:632–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632void LoadTextures()
633{
634 TENLog("Loading textures... ", LogLevel::Info);
635
636 int size;
637
638 int textureCount = ReadCount();
639 TENLog("Room texture count: " + std::to_string(textureCount), LogLevel::Info);
640
641 g_Level.RoomTextures.reserve(textureCount);
642 for (int i = 0; i < textureCount; i++)
643 {
644 auto texture = TEXTURE{};
645
646 texture.width = ReadInt32();
647 texture.height = ReadInt32();
648
649 size = ReadInt32();
650 texture.colorMapData.resize(size);
651 ReadBytes(texture.colorMapData.data(), size);
652
653 bool hasNormalMap = ReadBool();
654 if (hasNormalMap)
655 {
656 size = ReadInt32();
657 texture.normalMapData.resize(size);
658 ReadBytes(texture.normalMapData.data(), size);
659 }
660
661 bool hasORSHMap = ReadBool();
662 if (hasORSHMap)
663 {
664 size = ReadInt32();
665 texture.ORSHMapData.resize(size);
666 ReadBytes(texture.ORSHMapData.data(), size);
667 }
668
669 bool hasEmissiveMap = ReadBool();
670 if (hasEmissiveMap)
671 {
672 size = ReadInt32();
673 texture.emissiveMapData.resize(size);
674 ReadBytes(texture.emissiveMapData.data(), size);
675 }
676
677 g_Level.RoomTextures.push_back(texture);
678 }
679
680 textureCount = ReadCount();
681 TENLog("Object texture count: " + std::to_string(textureCount), LogLevel::Info);
682
683 g_Level.MoveablesTextures.reserve(textureCount);
684 for (int i = 0; i < textureCount; i++)
685 {
686 auto texture = TEXTURE{};
687
688 texture.width = ReadInt32();
689 texture.height = ReadInt32();

Callers 1

LoadLevelFunction · 0.85

Calls 10

TENLogFunction · 0.85
ReadCountFunction · 0.85
to_stringFunction · 0.85
ReadInt32Function · 0.85
ReadBytesFunction · 0.85
ReadBoolFunction · 0.85
reserveMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected