MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / build

Method build

Engine/source/navigation/navMesh.cpp:601–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601bool NavMesh::build(bool background, bool saveIntermediates)
602{
603 if(mBuilding)
604 cancelBuild();
605 else
606 {
607 if(getEventManager())
608 getEventManager()->postEvent("NavMeshStartUpdate", getIdString());
609 }
610
611 mBuilding = true;
612
613 ctx->startTimer(RC_TIMER_TOTAL);
614
615 dtFreeNavMesh(nm);
616 // Allocate a new navmesh.
617 nm = dtAllocNavMesh();
618 if(!nm)
619 {
620 Con::errorf("Could not allocate dtNavMesh for NavMesh %s", getIdString());
621 return false;
622 }
623
624 updateConfig();
625
626 // Build navmesh parameters from console members.
627 dtNavMeshParams params;
628 rcVcopy(params.orig, cfg.bmin);
629 params.tileWidth = cfg.tileSize * mCellSize;
630 params.tileHeight = cfg.tileSize * mCellSize;
631 params.maxTiles = mCeil(getWorldBox().len_x() / params.tileWidth) * mCeil(getWorldBox().len_y() / params.tileHeight);
632 params.maxPolys = mMaxPolysPerTile;
633
634 // Initialise our navmesh.
635 if(dtStatusFailed(nm->init(&params)))
636 {
637 Con::errorf("Could not init dtNavMesh for NavMesh %s", getIdString());
638 return false;
639 }
640
641 // Update links to be deleted.
642 for(U32 i = 0; i < mLinkIDs.size();)
643 {
644 if(mDeleteLinks[i])
645 eraseLink(i);
646 else
647 i++;
648 }
649 mLinksUnsynced.fill(false);
650 mCurLinkID = 0;
651
652 mSaveIntermediates = saveIntermediates;
653
654 updateTiles(true);
655
656 if(!background)
657 {
658 while(!mDirtyTiles.empty())

Callers 1

navMesh.cppFile · 0.45

Calls 14

dtFreeNavMeshFunction · 0.85
dtAllocNavMeshFunction · 0.85
rcVcopyFunction · 0.85
mCeilFunction · 0.85
dtStatusFailedFunction · 0.85
errorfFunction · 0.50
postEventMethod · 0.45
startTimerMethod · 0.45
len_xMethod · 0.45
len_yMethod · 0.45
initMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected