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

Method LoadTagged

engine/Poseidon/Graphics/Rendering/Shape/ShapeSetup.cpp:297–988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295};
296
297float Shape::LoadTagged(QIStream& f, bool reversed, int ver, bool geometryOnly, AutoArray<float>& massArray,
298 bool tagged)
299{
300 _loadWarning = false;
301 _face.Clear();
302
303 bool extended = false;
304 DataHeaderEx head;
305 f.read((char*)&head, sizeof(head));
306 if (f.fail() || strncmp(head.magic, "SP3X", 4))
307 {
308 // is not extended format, try old
309 f.seekg(-(int)sizeof(head), QIOS::cur);
310 DataHeader oHead;
311 f.read((char*)&oHead, sizeof(oHead));
312 if (f.fail() || strncmp(oHead.magic, "SP3D", 4))
313 {
314 char magicName[5];
315 strncpy(magicName, head.magic, 4);
316 magicName[4] = 0;
317 WarningMessage("Bad file format (%s).", magicName);
318 return 0; // file input error
319 }
320 head.version = 0;
321 head.nPos = oHead.nPos;
322 head.nNorm = oHead.nNorm;
323 head.nFace = oHead.nFace;
324 head.flags = 0;
325 head.headSize = sizeof(oHead);
326 }
327 else
328 {
329 extended = true;
330 // skip rest of header
331 f.seekg(head.headSize - sizeof(head), QIOS::cur);
332 }
333
334 _face.Realloc(head.nFace);
335
336 _pos.Realloc(head.nPos);
337 _clip.Realloc(head.nPos);
338 _norm.Realloc(head.nNorm);
339
340#define maxPoints 2048
341 AUTO_STATIC_ARRAY(Vector3, pos, maxPoints);
342 AUTO_STATIC_ARRAY(Vector3, norm, maxPoints);
343 AUTO_STATIC_ARRAY(ClipFlags, clip, maxPoints);
344 AUTO_STATIC_ARRAY(bool, hidden, maxPoints);
345 pos.Resize(head.nPos);
346 clip.Resize(head.nPos);
347 hidden.Resize(head.nPos);
348 norm.Resize(head.nNorm);
349 _pointToVertex.Resize(head.nPos);
350 _vertexToPoint.Realloc(head.nPos);
351 for (int i = 0; i < _pointToVertex.Size(); i++)
352 {
353 _pointToVertex[i] = -1;
354 }

Callers 1

LoadMethod · 0.80

Calls 15

WarningMessageFunction · 0.85
GlobLoadTextureFunction · 0.85
fabsFunction · 0.85
GetFileExtFunction · 0.85
LoadTagFunction · 0.85
SelInfoClass · 0.85
seekgMethod · 0.80
SetNMethod · 0.80
AccessMethod · 0.80
AUTO_STATIC_ARRAYFunction · 0.70
NamedPropertyClass · 0.70
Vector3Class · 0.50

Tested by

no test coverage detected