NavBuildData.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // Copyright (c) 2008-2017 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../Container/Vector.h"
  24. #include "../Math/BoundingBox.h"
  25. #include "../Math/Vector3.h"
  26. class rcContext;
  27. struct dtTileCacheContourSet;
  28. struct dtTileCachePolyMesh;
  29. struct dtTileCacheAlloc;
  30. struct rcCompactHeightfield;
  31. struct rcContourSet;
  32. struct rcHeightfield;
  33. struct rcHeightfieldLayerSet;
  34. struct rcPolyMesh;
  35. struct rcPolyMeshDetail;
  36. namespace Atomic
  37. {
  38. /// Navigation area stub.
  39. struct ATOMIC_API NavAreaStub
  40. {
  41. /// Area bounding box.
  42. BoundingBox bounds_;
  43. /// Area ID.
  44. unsigned char areaID_;
  45. };
  46. /// Navigation build data.
  47. struct ATOMIC_API NavBuildData
  48. {
  49. /// Constructor.
  50. NavBuildData();
  51. /// Destructor.
  52. virtual ~NavBuildData();
  53. /// World-space bounding box of the navigation mesh tile.
  54. BoundingBox worldBoundingBox_;
  55. /// Vertices from geometries.
  56. PODVector<Vector3> vertices_;
  57. /// Triangle indices from geometries.
  58. PODVector<int> indices_;
  59. /// Offmesh connection vertices.
  60. PODVector<Vector3> offMeshVertices_;
  61. /// Offmesh connection radii.
  62. PODVector<float> offMeshRadii_;
  63. /// Offmesh connection flags.
  64. PODVector<unsigned short> offMeshFlags_;
  65. /// Offmesh connection areas.
  66. PODVector<unsigned char> offMeshAreas_;
  67. /// Offmesh connection direction.
  68. PODVector<unsigned char> offMeshDir_;
  69. /// Recast context.
  70. rcContext* ctx_;
  71. /// Recast heightfield.
  72. rcHeightfield* heightField_;
  73. /// Recast compact heightfield.
  74. rcCompactHeightfield* compactHeightField_;
  75. /// Pretransformed navigation areas, no correlation to the geometry above.
  76. PODVector<NavAreaStub> navAreas_;
  77. };
  78. struct SimpleNavBuildData : public NavBuildData
  79. {
  80. /// Constructor.
  81. SimpleNavBuildData();
  82. /// Descturctor.
  83. virtual ~SimpleNavBuildData();
  84. /// Recast contour set.
  85. rcContourSet* contourSet_;
  86. /// Recast poly mesh.
  87. rcPolyMesh* polyMesh_;
  88. /// Recast detail poly mesh.
  89. rcPolyMeshDetail* polyMeshDetail_;
  90. };
  91. struct DynamicNavBuildData : public NavBuildData
  92. {
  93. /// Constructor.
  94. DynamicNavBuildData(dtTileCacheAlloc* alloc);
  95. /// Destructor.
  96. virtual ~DynamicNavBuildData();
  97. /// TileCache specific recast contour set.
  98. dtTileCacheContourSet* contourSet_;
  99. /// TileCache specific recast poly mesh.
  100. dtTileCachePolyMesh* polyMesh_;
  101. /// Recast heightfield layer set.
  102. rcHeightfieldLayerSet* heightFieldLayers_;
  103. /// Allocator from DynamicNavigationMesh instance.
  104. dtTileCacheAlloc* alloc_;
  105. };
  106. }