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

Method build

Engine/source/navigation/navMesh.cpp:605–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

navMesh.cppFile · 0.45

Calls 14

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

Tested by

no test coverage detected