llpathfindinglinkset.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. * @file llpathfindinglinkset.h
  3. * @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
  4. *
  5. * $LicenseInfo:firstyear=2012&license=viewergpl$
  6. *
  7. * Copyright (c) 2012, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLPATHFINDINGLINKSET_H
  33. #define LL_LLPATHFINDINGLINKSET_H
  34. #include "llpathfindingobject.h"
  35. class LLSD;
  36. constexpr S32 MIN_WALKABILITY_VALUE = 0;
  37. constexpr S32 MAX_WALKABILITY_VALUE = 100;
  38. class LLPathfindingLinkset : public LLPathfindingObject
  39. {
  40. protected:
  41. LOG_CLASS(LLPathfindingLinkset);
  42. public:
  43. typedef enum
  44. {
  45. kUnknown,
  46. kWalkable,
  47. kStaticObstacle,
  48. kDynamicObstacle,
  49. kMaterialVolume,
  50. kExclusionVolume,
  51. kDynamicPhantom
  52. } ELinksetUse;
  53. LLPathfindingLinkset(const LLSD& terrain_data);
  54. LLPathfindingLinkset(const LLUUID& id, const LLSD& data);
  55. LLPathfindingLinkset(const LLPathfindingLinkset& obj);
  56. LLPathfindingLinkset& operator=(const LLPathfindingLinkset& obj);
  57. LL_INLINE LLPathfindingLinkset* asLinkset() override
  58. {
  59. return this;
  60. }
  61. LL_INLINE const LLPathfindingLinkset* asLinkset() const override
  62. {
  63. return this;
  64. }
  65. LL_INLINE U32 getLandImpact() const { return mLandImpact; }
  66. LL_INLINE bool isTerrain() const { return mIsTerrain; }
  67. LL_INLINE bool isModifiable() const { return mIsModifiable; }
  68. LL_INLINE bool canBeVolume() const { return mCanBeVolume; }
  69. bool isPhantom() const;
  70. static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse use);
  71. LL_INLINE ELinksetUse getLinksetUse() const { return mLinksetUse; }
  72. LL_INLINE bool isScripted() const { return mIsScripted; }
  73. LL_INLINE bool hasIsScripted() const { return mHasIsScripted; }
  74. LL_INLINE S32 getWalkabilityCoefficientA() const { return mWalkabilityCoefficientA; }
  75. LL_INLINE S32 getWalkabilityCoefficientB() const { return mWalkabilityCoefficientB; }
  76. LL_INLINE S32 getWalkabilityCoefficientC() const { return mWalkabilityCoefficientC; }
  77. LL_INLINE S32 getWalkabilityCoefficientD() const { return mWalkabilityCoefficientD; }
  78. bool showUnmodifiablePhantomWarning(ELinksetUse use) const;
  79. bool showPhantomToggleWarning(ELinksetUse use) const;
  80. bool showCannotBeVolumeWarning(ELinksetUse use) const;
  81. LLSD encodeAlteredFields(ELinksetUse use, S32 a, S32 b, S32 c,
  82. S32 d) const;
  83. private:
  84. typedef enum
  85. {
  86. kNavMeshGenerationIgnore,
  87. kNavMeshGenerationInclude,
  88. kNavMeshGenerationExclude
  89. } ENavMeshGenerationCategory;
  90. void parseLinksetData(const LLSD& data);
  91. void parsePathfindingData(const LLSD& data);
  92. static bool isPhantom(ELinksetUse use);
  93. static ELinksetUse getLinksetUse(bool phantom, ENavMeshGenerationCategory category);
  94. static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse use);
  95. static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory category);
  96. static ENavMeshGenerationCategory convertCategoryFromLLSD(const LLSD& llsd);
  97. private:
  98. S32 mWalkabilityCoefficientA;
  99. S32 mWalkabilityCoefficientB;
  100. S32 mWalkabilityCoefficientC;
  101. S32 mWalkabilityCoefficientD;
  102. U32 mLandImpact;
  103. ELinksetUse mLinksetUse;
  104. bool mIsTerrain;
  105. bool mIsModifiable;
  106. bool mCanBeVolume;
  107. bool mIsScripted;
  108. bool mHasIsScripted;
  109. };
  110. #endif // LL_LLPATHFINDINGLINKSET_H