MCPcopy Create free account
hub / github.com/ZDoom/Raze / Load

Method Load

source/common/models/models_iqm.cpp:22–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22bool IQMModel::Load(const char* path, int lumpnum, const char* buffer, int length)
23{
24 mLumpNum = lumpnum;
25
26 try
27 {
28 IQMFileReader reader(buffer, length);
29
30 char magic[16];
31 reader.Read(magic, 16);
32 if (memcmp(magic, "INTERQUAKEMODEL\0", 16) != 0)
33 return false;
34
35 uint32_t version = reader.ReadUInt32();
36 if (version != 2)
37 return false;
38
39 uint32_t filesize = reader.ReadUInt32();
40 uint32_t flags = reader.ReadUInt32();
41 uint32_t num_text = reader.ReadUInt32();
42 uint32_t ofs_text = reader.ReadUInt32();
43 uint32_t num_meshes = reader.ReadUInt32();
44 uint32_t ofs_meshes = reader.ReadUInt32();
45 uint32_t num_vertexarrays = reader.ReadUInt32();
46 uint32_t num_vertices = reader.ReadUInt32();
47 uint32_t ofs_vertexarrays = reader.ReadUInt32();
48 uint32_t num_triangles = reader.ReadUInt32();
49 uint32_t ofs_triangles = reader.ReadUInt32();
50 uint32_t ofs_adjacency = reader.ReadUInt32();
51 uint32_t num_joints = reader.ReadUInt32();
52 uint32_t ofs_joints = reader.ReadUInt32();
53 uint32_t num_poses = reader.ReadUInt32();
54 uint32_t ofs_poses = reader.ReadUInt32();
55 uint32_t num_anims = reader.ReadUInt32();
56 uint32_t ofs_anims = reader.ReadUInt32();
57 uint32_t num_frames = reader.ReadUInt32();
58 uint32_t num_framechannels = reader.ReadUInt32();
59 uint32_t ofs_frames = reader.ReadUInt32();
60 uint32_t ofs_bounds = reader.ReadUInt32();
61 uint32_t num_comment = reader.ReadUInt32();
62 uint32_t ofs_comment = reader.ReadUInt32();
63 uint32_t num_extensions = reader.ReadUInt32();
64 uint32_t ofs_extensions = reader.ReadUInt32();
65
66 if (num_text == 0)
67 return false;
68
69 TArray<char> text(num_text, true);
70 reader.SeekTo(ofs_text);
71 reader.Read(text.Data(), text.Size());
72 text[text.Size() - 1] = 0;
73
74 Meshes.Resize(num_meshes);
75 Triangles.Resize(num_triangles);
76 Adjacency.Resize(num_triangles);
77 Joints.Resize(num_joints);
78 Poses.Resize(num_poses);
79 Anims.Resize(num_anims);

Callers

nothing calls this directly

Calls 15

LoadSkinFunction · 0.85
SeekToMethod · 0.80
ReadNameMethod · 0.80
ReadFloatMethod · 0.80
loadIdentityMethod · 0.80
multQuaternionMethod · 0.80
inverseMatrixMethod · 0.80
ReadMethod · 0.45
ReadUInt32Method · 0.45
DataMethod · 0.45
SizeMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected