MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / MakeDefaultModel

Method MakeDefaultModel

neo/renderer/Model.cpp:232–263  ·  view source on GitHub ↗

================ idRenderModelStatic::MakeDefaultModel ================ */

Source from the content-addressed store, hash-verified

230================
231*/
232void idRenderModelStatic::MakeDefaultModel() {
233
234 defaulted = true;
235
236 // throw out any surfaces we already have
237 PurgeModel();
238
239 // create one new surface
240 modelSurface_t surf;
241
242 srfTriangles_t *tri = R_AllocStaticTriSurf();
243
244 surf.shader = tr.defaultMaterial;
245 surf.geometry = tri;
246
247 R_AllocStaticTriSurfVerts( tri, 24 );
248 R_AllocStaticTriSurfIndexes( tri, 36 );
249
250 AddCubeFace( tri, idVec3(-1, 1, 1), idVec3(1, 1, 1), idVec3(1, -1, 1), idVec3(-1, -1, 1) );
251 AddCubeFace( tri, idVec3(-1, 1, -1), idVec3(-1, -1, -1), idVec3(1, -1, -1), idVec3(1, 1, -1) );
252
253 AddCubeFace( tri, idVec3(1, -1, 1), idVec3(1, 1, 1), idVec3(1, 1, -1), idVec3(1, -1, -1) );
254 AddCubeFace( tri, idVec3(-1, -1, 1), idVec3(-1, -1, -1), idVec3(-1, 1, -1), idVec3(-1, 1, 1) );
255
256 AddCubeFace( tri, idVec3(-1, -1, 1), idVec3(1, -1, 1), idVec3(1, -1, -1), idVec3(-1, -1, -1) );
257 AddCubeFace( tri, idVec3(-1, 1, 1), idVec3(-1, 1, -1), idVec3(1, 1, -1), idVec3(1, 1, 1) );
258
259 tri->generateNormals = true;
260
261 AddSurface( surf );
262 FinishSurfaces();
263}
264
265/*
266================

Callers 2

InitMethod · 0.80
GetModelMethod · 0.80

Calls 5

R_AllocStaticTriSurfFunction · 0.85
AddCubeFaceFunction · 0.85
idVec3Class · 0.50

Tested by

no test coverage detected