MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Load

Method Load

engine/Poseidon/Graphics/Rendering/Shape/ShapeLOD.cpp:727–1250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725bool GReplaceProxies = true;
726
727void LODShape::Load(QIStream& f, bool reversed)
728{
729 DoClear();
730
731#if VERBOSE
732 LOG_DEBUG(Graphics, "Load {}, {}", (const char*)_name, reversed ? "Reversed" : "");
733#endif
734
735 // check optimized load
736 int seekStart = f.tellg();
737 if (LoadOptimized(f))
738 {
739 // reverse all vector data if necessary
740 if (reversed)
741 {
742 Reverse();
743 _remarks |= REM_REVERSED;
744 }
745 if (!CheckLegalCreator())
746 {
747 RptF("Bad file format (%s).", Name());
748 }
749 return;
750 }
751 f.seekg(seekStart, QIOS::beg);
752 // check magic
753
754 _special = 0;
755 _remarks = 0;
756
757 if (reversed)
758 {
759 _remarks |= REM_REVERSED;
760 }
761
762 // load all LODs and their setups respectivelly
763 // check for LOD header
764 char magic[4];
765 int nLods = 1;
766 bool tagged = false;
767 int ver = 0;
768
769 _mass = 0;
770 _invMass = 1e10;
771 _invInertia.SetZero();
772 _centerOfMass = Vector3(VZero);
773
774 f.read(magic, sizeof(magic));
775 if (f.fail() || f.eof())
776 {
777 WarningMessage("Error loading %s (Magic)", (const char*)_name);
778 goto Error;
779 }
780 if (!strncmp(magic, "NLOD", sizeof(magic)))
781 {
782 // LOD header - we will load multiple LODs
783 Log("Warning: NLOD format in object %s", (const char*)_name);
784 tagged = true;

Callers

nothing calls this directly

Calls 15

WarningMessageFunction · 0.85
ErrorMessageFunction · 0.85
ResolGeometryOnlyFunction · 0.85
LevelNameFunction · 0.85
ReplacesCharsFunction · 0.85
GetShapeNameFunction · 0.85
NewProxyObjectFunction · 0.85
swapFunction · 0.85
GetFilenameFunction · 0.85
saturateMinFunction · 0.85
tellgMethod · 0.80
seekgMethod · 0.80

Tested by

no test coverage detected