MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / load_model

Function load_model

src/SB/Core/x/xFont.cpp:486–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484 }
485
486 xModelInstance* load_model(U32 id)
487 {
488 static U32 next_order = 0;
489 U32 oldest = 0;
490
491 next_order++;
492
493 for (U32 i = 0; i < MODEL_CACHE_SIZE; i++)
494 {
495 model_cache_entry& e = model_cache[i];
496
497 if (e.id == id)
498 {
499 e.order = next_order;
500 return e.model;
501 }
502
503 if (e.order < model_cache[oldest].order)
504 {
505 oldest = i;
506 }
507 }
508
509 RpAtomic* mf = (RpAtomic*)xSTFindAsset(id, NULL);
510
511 if (!mf)
512 {
513 return NULL;
514 }
515
516 // non-matching: instruction order
517
518 model_cache_entry& e = model_cache[oldest];
519
520 e.id = id;
521 e.order = next_order;
522
523 xModelInstance& model = *e.model;
524
525 xMat4x3Identity((xMat4x3*)model.Mat);
526
527 model.Data = mf;
528 model.Bucket = xModelBucket_GetBuckets(model.Data);
529 model.PipeFlags =
530 (model.Bucket) ? model.Bucket[0]->PipeFlags : xModelGetPipeFlags(model.Data);
531
532 return &model;
533 }
534} // namespace
535
536void xfont::init()

Callers 1

load_model_argsFunction · 0.70

Calls 4

xMat4x3IdentityFunction · 0.85
xSTFindAssetFunction · 0.70
xModelBucket_GetBucketsFunction · 0.70
xModelGetPipeFlagsFunction · 0.70

Tested by

no test coverage detected