NavBuildData.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Container/Vector.h"
  5. #include "../Math/BoundingBox.h"
  6. #include "../Math/Vector3.h"
  7. class rcContext;
  8. struct dtTileCacheContourSet;
  9. struct dtTileCachePolyMesh;
  10. struct dtTileCacheAlloc;
  11. struct rcCompactHeightfield;
  12. struct rcContourSet;
  13. struct rcHeightfield;
  14. struct rcHeightfieldLayerSet;
  15. struct rcPolyMesh;
  16. struct rcPolyMeshDetail;
  17. namespace Urho3D
  18. {
  19. /// Navigation area stub.
  20. struct URHO3D_API NavAreaStub
  21. {
  22. /// Area bounding box.
  23. BoundingBox bounds_;
  24. /// Area ID.
  25. unsigned char areaID_;
  26. };
  27. /// Navigation build data.
  28. struct URHO3D_API NavBuildData
  29. {
  30. /// Constructor.
  31. NavBuildData();
  32. /// Destructor.
  33. virtual ~NavBuildData();
  34. /// World-space bounding box of the navigation mesh tile.
  35. BoundingBox worldBoundingBox_;
  36. /// Vertices from geometries.
  37. Vector<Vector3> vertices_;
  38. /// Triangle indices from geometries.
  39. Vector<int> indices_;
  40. /// Offmesh connection vertices.
  41. Vector<Vector3> offMeshVertices_;
  42. /// Offmesh connection radii.
  43. Vector<float> offMeshRadii_;
  44. /// Offmesh connection flags.
  45. Vector<unsigned short> offMeshFlags_;
  46. /// Offmesh connection areas.
  47. Vector<unsigned char> offMeshAreas_;
  48. /// Offmesh connection direction.
  49. Vector<unsigned char> offMeshDir_;
  50. /// Recast context.
  51. rcContext* ctx_;
  52. /// Recast heightfield.
  53. rcHeightfield* heightField_;
  54. /// Recast compact heightfield.
  55. rcCompactHeightfield* compactHeightField_;
  56. /// Pretransformed navigation areas, no correlation to the geometry above.
  57. Vector<NavAreaStub> navAreas_;
  58. };
  59. struct SimpleNavBuildData : public NavBuildData
  60. {
  61. /// Constructor.
  62. SimpleNavBuildData();
  63. /// Descturctor.
  64. ~SimpleNavBuildData() override;
  65. /// Recast contour set.
  66. rcContourSet* contourSet_;
  67. /// Recast poly mesh.
  68. rcPolyMesh* polyMesh_;
  69. /// Recast detail poly mesh.
  70. rcPolyMeshDetail* polyMeshDetail_;
  71. };
  72. /// @nobind
  73. struct DynamicNavBuildData : public NavBuildData
  74. {
  75. /// Constructor.
  76. explicit DynamicNavBuildData(dtTileCacheAlloc* allocator);
  77. /// Destructor.
  78. ~DynamicNavBuildData() override;
  79. /// TileCache specific recast contour set.
  80. dtTileCacheContourSet* contourSet_;
  81. /// TileCache specific recast poly mesh.
  82. dtTileCachePolyMesh* polyMesh_;
  83. /// Recast heightfield layer set.
  84. rcHeightfieldLayerSet* heightFieldLayers_;
  85. /// Allocator from DynamicNavigationMesh instance.
  86. dtTileCacheAlloc* alloc_;
  87. };
  88. }