summaryrefslogtreecommitdiff
path: root/Runtime/NavMesh/NavMeshCarving.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/NavMesh/NavMeshCarving.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/NavMesh/NavMeshCarving.h')
-rw-r--r--Runtime/NavMesh/NavMeshCarving.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/Runtime/NavMesh/NavMeshCarving.h b/Runtime/NavMesh/NavMeshCarving.h
new file mode 100644
index 0000000..0cec244
--- /dev/null
+++ b/Runtime/NavMesh/NavMeshCarving.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "Runtime/Utilities/dynamic_array.h"
+#include "Runtime/NavMesh/NavMeshTypes.h"
+#include "Runtime/Geometry/AABB.h"
+
+class NavMeshObstacle;
+class NavMesh;
+
+class NavMeshCarving
+{
+ enum TileCarveStatus
+ {
+ kIgnore = 0,
+ kRestore = 1,
+ kCarve = 2
+ };
+
+ struct ObstacleCarveInfo
+ {
+ NavMeshCarveData carveData;
+ MinMaxAABB carveBounds;
+ NavMeshObstacle* obstacle;
+ };
+
+public:
+ NavMeshCarving ();
+ ~NavMeshCarving ();
+
+
+ void AddObstacle (NavMeshObstacle& obstacle, int& handle);
+ void RemoveObstacle (int& handle);
+ bool Carve ();
+
+private:
+
+ void UpdateCarveData (dynamic_array<NavMeshCarveData>& newCarveData);
+ bool UpdateTiles (NavMesh* navmesh, const dynamic_array<NavMeshCarveData>& newCarveData);
+
+ TileCarveStatus CollectCarveDataAndStatus (dynamic_array<Matrix4x4f>& transforms, dynamic_array<Vector3f>& sizes, dynamic_array<MinMaxAABB>& aabbs, const dynamic_array<NavMeshCarveData>& newCarveData, const MinMaxAABB& tileBounds) const;
+ void CollectOverlappingCarveData (dynamic_array<Matrix4x4f>& transforms, dynamic_array<Vector3f>& sizes, dynamic_array<MinMaxAABB>& aabbs, const MinMaxAABB& bounds) const;
+
+ dynamic_array<ObstacleCarveInfo> m_ObstacleInfo;
+ dynamic_array<MinMaxAABB> m_OldCarveBounds;
+};