Manual_Navigation.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #ifdef URHO3D_NAVIGATION
  5. #include "../Navigation/CrowdAgent.h"
  6. #include "../Navigation/CrowdManager.h"
  7. #include "../Navigation/DynamicNavigationMesh.h"
  8. #include "../Navigation/NavigationMesh.h"
  9. namespace Urho3D
  10. {
  11. // virtual Vector<unsigned char> NavigationMesh::GetTileData(const IntVector2& tile) const | File: ../Navigation/NavigationMesh.h
  12. template <class T> VectorBuffer NavigationMesh_GetTileData(const IntVector2& tile, const T* ptr)
  13. {
  14. VectorBuffer buffer;
  15. buffer.SetData(ptr->GetTileData(tile));
  16. return buffer;
  17. }
  18. // virtual bool NavigationMesh::AddTile(const Vector<unsigned char>& tileData) | File: ../Navigation/NavigationMesh.h
  19. template <class T> bool NavigationMesh_AddTile(const VectorBuffer& tileData, T* ptr)
  20. {
  21. return ptr->AddTile(tileData.GetBuffer());
  22. }
  23. // Vector3 NavigationMesh::FindNearestPoint(const Vector3& point, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, dtPolyRef* nearestRef = nullptr) | File: ../Navigation/NavigationMesh.h
  24. template <class T> Vector3 NavigationMesh_FindNearestPoint(const Vector3& point, const Vector3& extents, T* ptr)
  25. {
  26. return ptr->FindNearestPoint(point, extents);
  27. }
  28. // Vector3 NavigationMesh::GetRandomPoint(const dtQueryFilter* filter = nullptr, dtPolyRef* randomRef = nullptr) | File: ../Navigation/NavigationMesh.h
  29. template <class T> Vector3 NavigationMesh_GetRandomPoint(T* ptr)
  30. {
  31. return ptr->GetRandomPoint();
  32. }
  33. // Vector3 NavigationMesh::GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, dtPolyRef* randomRef = nullptr) | File: ../Navigation/NavigationMesh.h
  34. template <class T> Vector3 NavigationMesh_GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents, T* ptr)
  35. {
  36. return ptr->GetRandomPointInCircle(center, radius, extents);
  37. }
  38. // float NavigationMesh::GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, Vector3* hitPos = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/NavigationMesh.h
  39. template <class T> float NavigationMesh_GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents, T* ptr)
  40. {
  41. return ptr->GetDistanceToWall(point, radius, extents);
  42. }
  43. // Vector3 NavigationMesh::Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/NavigationMesh.h
  44. template <class T> Vector3 NavigationMesh_Raycast(const Vector3& start, const Vector3& end, const Vector3& extents, T* ptr)
  45. {
  46. return ptr->Raycast(start, end, extents);
  47. }
  48. // Vector3 NavigationMesh::MoveAlongSurface(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, int maxVisited = 3, const dtQueryFilter* filter = nullptr) | File: ../Navigation/NavigationMesh.h
  49. template <class T> Vector3 NavigationMesh_MoveAlongSurface(const Vector3& start, const Vector3& end, const Vector3& extents, int maxVisited, T* ptr)
  50. {
  51. return ptr->MoveAlongSurface(start, end, extents, maxVisited);
  52. }
  53. // void NavigationMesh::FindPath(Vector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr) | File: ../Navigation/NavigationMesh.h
  54. template <class T> CScriptArray* NavigationMesh_FindPath(const Vector3& start, const Vector3& end, const Vector3& extents, T* ptr)
  55. {
  56. Vector<Vector3> dest;
  57. ptr->FindPath(dest, start, end, extents);
  58. return VectorToArray<Vector3>(dest, "Array<Vector3>");
  59. }
  60. #define REGISTER_MEMBERS_MANUAL_PART_NavigationMesh() \
  61. /* virtual Vector<unsigned char> NavigationMesh::GetTileData(const IntVector2& tile) const | File: ../Navigation/NavigationMesh.h */ \
  62. engine->RegisterObjectMethod(className, "VectorBuffer GetTileData(const IntVector2&) const", AS_FUNCTION_OBJLAST(NavigationMesh_GetTileData<T>), AS_CALL_CDECL_OBJLAST); \
  63. \
  64. /* virtual bool NavigationMesh::AddTile(const Vector<unsigned char>& tileData) | File: ../Navigation/NavigationMesh.h */ \
  65. engine->RegisterObjectMethod(className, "bool AddTile(const VectorBuffer&in) const", AS_FUNCTION_OBJLAST(NavigationMesh_AddTile<T>), AS_CALL_CDECL_OBJLAST); \
  66. \
  67. /* Vector3 NavigationMesh::FindNearestPoint(const Vector3& point, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, dtPolyRef* nearestRef = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  68. engine->RegisterObjectMethod(className, "Vector3 FindNearestPoint(const Vector3&in, const Vector3&in = Vector3::ONE)", AS_FUNCTION_OBJLAST(NavigationMesh_FindNearestPoint<T>), AS_CALL_CDECL_OBJLAST); \
  69. \
  70. /* Vector3 NavigationMesh::GetRandomPoint(const dtQueryFilter* filter = nullptr, dtPolyRef* randomRef = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  71. engine->RegisterObjectMethod(className, "Vector3 GetRandomPoint()", AS_FUNCTION_OBJLAST(NavigationMesh_GetRandomPoint<T>), AS_CALL_CDECL_OBJLAST); \
  72. \
  73. /* Vector3 NavigationMesh::GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, dtPolyRef* randomRef = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  74. engine->RegisterObjectMethod(className, "Vector3 GetRandomPointInCircle(const Vector3&in, float, const Vector3&in = Vector3::ONE)", AS_FUNCTION_OBJLAST(NavigationMesh_GetRandomPointInCircle<T>), AS_CALL_CDECL_OBJLAST); \
  75. \
  76. /* float NavigationMesh::GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, Vector3* hitPos = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  77. engine->RegisterObjectMethod(className, "float GetDistanceToWall(const Vector3&in, float, const Vector3&in = Vector3::ONE)", AS_FUNCTION_OBJLAST(NavigationMesh_GetDistanceToWall<T>), AS_CALL_CDECL_OBJLAST); \
  78. \
  79. /* Vector3 NavigationMesh::Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  80. engine->RegisterObjectMethod(className, "Vector3 Raycast(const Vector3&in, const Vector3&in, const Vector3&in = Vector3::ONE)", AS_FUNCTION_OBJLAST(NavigationMesh_Raycast<T>), AS_CALL_CDECL_OBJLAST); \
  81. \
  82. /* Vector3 NavigationMesh::MoveAlongSurface(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, int maxVisited = 3, const dtQueryFilter* filter = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  83. engine->RegisterObjectMethod(className, "Vector3 MoveAlongSurface(const Vector3&in, const Vector3&in, const Vector3&in = Vector3::ONE, int = 3)", AS_FUNCTION_OBJLAST(NavigationMesh_MoveAlongSurface<T>), AS_CALL_CDECL_OBJLAST); \
  84. \
  85. /* void NavigationMesh::FindPath(Vector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE, const dtQueryFilter* filter = nullptr) | File: ../Navigation/NavigationMesh.h */ \
  86. engine->RegisterObjectMethod(className, "Array<Vector3>@ FindPath(const Vector3&in, const Vector3&in, const Vector3&in extents = Vector3::ONE)", AS_FUNCTION_OBJLAST(NavigationMesh_FindPath<T>), AS_CALL_CDECL_OBJLAST);
  87. // ========================================================================================
  88. // Vector3 CrowdManager::GetRandomPoint(int queryFilterType, dtPolyRef* randomRef = nullptr) | File: ../Navigation/CrowdManager.h
  89. template <class T> Vector3 CrowdManager_GetRandomPoint(int queryFilterType, T* crowdManager)
  90. {
  91. return crowdManager->GetRandomPoint(queryFilterType);
  92. }
  93. // Vector3 CrowdManager::GetRandomPointInCircle(const Vector3& center, float radius, int queryFilterType, dtPolyRef* randomRef = nullptr) | File: ../Navigation/CrowdManager.h
  94. template <class T> Vector3 CrowdManager_RandomPointInCircle(const Vector3& center, float radius, int queryFilterType, T* manager)
  95. {
  96. return manager->GetRandomPointInCircle(center, radius, queryFilterType);
  97. }
  98. // Vector3 CrowdManager::FindNearestPoint(const Vector3& point, int queryFilterType, dtPolyRef* nearestRef = nullptr) | File: ../Navigation/CrowdManager.h
  99. template <class T> Vector3 CrowdManager_FindNearestPoint(const Vector3& point, int queryFilterType, T* ptr)
  100. {
  101. return ptr->FindNearestPoint(point, queryFilterType);
  102. }
  103. // float CrowdManager::GetDistanceToWall(const Vector3& point, float radius, int queryFilterType, Vector3* hitPos = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/CrowdManager.h
  104. template <class T> float CrowdManager_GetDistanceToWall(const Vector3& point, float radius, int queryFilterType, T* ptr)
  105. {
  106. return ptr->GetDistanceToWall(point, radius, queryFilterType);
  107. }
  108. // Vector3 CrowdManager::Raycast(const Vector3& start, const Vector3& end, int queryFilterType, Vector3* hitNormal = nullptr) | File: ../Navigation/CrowdManager.h
  109. template <class T> Vector3 CrowdManager_Raycast(const Vector3& start, const Vector3& end, int queryFilterType, T* ptr)
  110. {
  111. return ptr->Raycast(start, end, queryFilterType);
  112. }
  113. #define REGISTER_MEMBERS_MANUAL_PART_CrowdManager() \
  114. /* Vector3 CrowdManager::GetRandomPoint(int queryFilterType, dtPolyRef* randomRef = nullptr) | File: ../Navigation/CrowdManager.h */ \
  115. engine->RegisterObjectMethod(className, "Vector3 GetRandomPoint(int)", AS_FUNCTION_OBJLAST(CrowdManager_GetRandomPoint<T>), AS_CALL_CDECL_OBJLAST); \
  116. \
  117. /* Vector3 CrowdManager::GetRandomPointInCircle(const Vector3& center, float radius, int queryFilterType, dtPolyRef* randomRef = nullptr) | File: ../Navigation/CrowdManager.h */ \
  118. engine->RegisterObjectMethod(className, "Vector3 GetRandomPointInCircle(const Vector3&in, float, int)", AS_FUNCTION_OBJLAST(CrowdManager_RandomPointInCircle<T>), AS_CALL_CDECL_OBJLAST); \
  119. \
  120. /* Vector3 CrowdManager::FindNearestPoint(const Vector3& point, int queryFilterType, dtPolyRef* nearestRef = nullptr) | File: ../Navigation/CrowdManager.h */ \
  121. engine->RegisterObjectMethod(className, "Vector3 FindNearestPoint(const Vector3&in, int)", AS_FUNCTION_OBJLAST(CrowdManager_FindNearestPoint<T>), AS_CALL_CDECL_OBJLAST); \
  122. \
  123. /* float CrowdManager::GetDistanceToWall(const Vector3& point, float radius, int queryFilterType, Vector3* hitPos = nullptr, Vector3* hitNormal = nullptr) | File: ../Navigation/CrowdManager.h */ \
  124. engine->RegisterObjectMethod(className, "float GetDistanceToWall(const Vector3&in, float, int)", AS_FUNCTION_OBJLAST(CrowdManager_GetDistanceToWall<T>), AS_CALL_CDECL_OBJLAST); \
  125. \
  126. /* Vector3 CrowdManager::Raycast(const Vector3& start, const Vector3& end, int queryFilterType, Vector3* hitNormal = nullptr) | File: ../Navigation/CrowdManager.h */ \
  127. engine->RegisterObjectMethod(className, "Vector3 Raycast(const Vector3&in, const Vector3&in, int)", AS_FUNCTION_OBJLAST(CrowdManager_Raycast<T>), AS_CALL_CDECL_OBJLAST);
  128. }
  129. #endif // def URHO3D_NAVIGATION