MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / AddPatch

Method AddPatch

Source/Engine/Terrain/Terrain.cpp:479–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void Terrain::AddPatch(const Int2& patchCoord)
480{
481 auto patch = GetPatch(patchCoord);
482 if (patch != nullptr)
483 {
484 LOG(Warning, "Cannot add patch at {0}x{1}. The patch at the given location already exists.", patchCoord.X, patchCoord.Y);
485 return;
486 }
487 PROFILE_MEM(LevelTerrain);
488 if (_chunkSize == 0)
489 Setup();
490
491 patch = ::New<TerrainPatch>();
492 patch->Init(this, patchCoord.X, patchCoord.Y);
493 _patches.Add(patch);
494
495 CacheNeighbors();
496
497 if (IsDuringPlay())
498 {
499 patch->UpdateTransform();
500 patch->CreateCollision();
501 UpdateLayerBits();
502 }
503
504 UpdateBounds();
505}
506
507void Terrain::RemovePatch(const Int2& patchCoord)
508{

Callers

nothing calls this directly

Calls 5

CreateCollisionMethod · 0.80
GetPatchFunction · 0.70
InitMethod · 0.45
AddMethod · 0.45
UpdateTransformMethod · 0.45

Tested by

no test coverage detected