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

Method init

Engine/source/navigation/navPath.cpp:283–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283bool NavPath::init()
284{
285 mStatus = DT_FAILURE;
286
287 // Check that all the right data is provided.
288 if(!mMesh || !mMesh->getNavMesh())
289 return false;
290 if(!(mFromSet && mToSet) && !(mWaypoints && mWaypoints->size()))
291 return false;
292
293 // Initialise our query.
294 if(dtStatusFailed(mQuery->init(mMesh->getNavMesh(), MaxPathLen)))
295 return false;
296
297 mPoints.clear();
298 mFlags.clear();
299 mVisitPoints.clear();
300 mLength = 0.0f;
301
302 if(isServerObject())
303 setMaskBits(PathMask);
304
305 // Add points we need to visit in reverse order.
306 if(mWaypoints && mWaypoints->size())
307 {
308 if(mIsLooping && mFromSet)
309 mVisitPoints.push_back(mFrom);
310 if(mToSet)
311 mVisitPoints.push_front(mTo);
312 for(S32 i = mWaypoints->size() - 1; i >= 0; i--)
313 {
314 SceneObject *s = dynamic_cast<SceneObject*>(mWaypoints->at(i));
315 if(s)
316 {
317 mVisitPoints.push_back(s->getPosition());
318 // This is potentially slow, but safe.
319 if(!i && mIsLooping && !mFromSet)
320 mVisitPoints.push_front(s->getPosition());
321 }
322 }
323 if(mFromSet)
324 mVisitPoints.push_back(mFrom);
325 }
326 else
327 {
328 if(mIsLooping)
329 mVisitPoints.push_back(mFrom);
330 mVisitPoints.push_back(mTo);
331 mVisitPoints.push_back(mFrom);
332 }
333
334 return true;
335}
336
337void NavPath::resize()
338{

Callers 3

buildMethod · 0.45
createCoverPointsMethod · 0.45
loadMethod · 0.45

Calls 8

dtStatusFailedFunction · 0.85
getNavMeshMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
push_frontMethod · 0.45
atMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected