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

Method updateTiles

Engine/source/navigation/navMesh.cpp:736–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734}
735
736void NavMesh::updateTiles(bool dirty)
737{
738 PROFILE_SCOPE(NavMesh_updateTiles);
739 if(!isProperlyAdded())
740 return;
741
742 mTiles.clear();
743 mTileData.clear();
744 mDirtyTiles.clear();
745
746 const Box3F &box = DTStoRC(getWorldBox());
747 if(box.isEmpty())
748 return;
749
750 updateConfig();
751
752 // Calculate tile dimensions.
753 const U32 ts = cfg.tileSize;
754 const U32 tw = (cfg.width + ts-1) / ts;
755 const U32 th = (cfg.height + ts-1) / ts;
756 const F32 tcs = cfg.tileSize * cfg.cs;
757
758 // Iterate over tiles.
759 F32 tileBmin[3], tileBmax[3];
760 for(U32 y = 0; y < th; ++y)
761 {
762 for(U32 x = 0; x < tw; ++x)
763 {
764 tileBmin[0] = cfg.bmin[0] + x*tcs;
765 tileBmin[1] = cfg.bmin[1];
766 tileBmin[2] = cfg.bmin[2] + y*tcs;
767
768 tileBmax[0] = cfg.bmin[0] + (x+1)*tcs;
769 tileBmax[1] = cfg.bmax[1];
770 tileBmax[2] = cfg.bmin[2] + (y+1)*tcs;
771
772 mTiles.push_back(
773 Tile(RCtoDTS(tileBmin, tileBmax),
774 x, y,
775 tileBmin, tileBmax));
776
777 if(dirty)
778 mDirtyTiles.push_back_unique(mTiles.size() - 1);
779
780 if(mSaveIntermediates)
781 mTileData.increment();
782 }
783 }
784}
785
786void NavMesh::processTick(const Move *move)
787{

Callers

nothing calls this directly

Calls 9

DTStoRCFunction · 0.85
TileClass · 0.85
RCtoDTSFunction · 0.85
push_back_uniqueMethod · 0.80
incrementMethod · 0.80
clearMethod · 0.45
isEmptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected