RecastNavigationDebugDraw.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <DebugDraw.h>
  10. #include <AzCore/Math/Aabb.h>
  11. #include <AzCore/std/containers/vector.h>
  12. #include <RecastNavigation/RecastHelpers.h>
  13. #include <RecastNavigation/RecastSmartPointer.h>
  14. namespace RecastNavigation
  15. {
  16. //! Recast library specific debug draw that captures and draws the various debug overlays.
  17. //! See @duDebugDraw for documentation of the methods.
  18. class RecastNavigationDebugDraw final : public duDebugDraw
  19. {
  20. public:
  21. explicit RecastNavigationDebugDraw(bool drawLines = false);
  22. //! duDebugDraw overrides...
  23. //! @{
  24. //! Not implemented
  25. void depthMask([[maybe_unused]] bool state) override {}
  26. //! Not implemented
  27. void texture([[maybe_unused]] bool state) override {}
  28. void begin(duDebugDrawPrimitives prim, float size = 1.0f) override;
  29. void vertex(const float* pos, unsigned int color) override;
  30. void vertex(float x, float y, float z, unsigned int color) override;
  31. void vertex(const float* pos, unsigned int color, const float* uv) override;
  32. void vertex(float x, float y, float z, unsigned int color, float u, float v) override;
  33. void end() override;
  34. //! @}
  35. //! Limit debug draw to a specified volume.
  36. void SetViewableAabb(const AZ::Aabb& viewAabb);
  37. protected:
  38. duDebugDrawPrimitives m_currentPrim = DU_DRAW_POINTS;
  39. //! Vertices with color information.
  40. AZStd::vector<AZStd::pair<AZ::Vector3, AZ::u32>> m_verticesToDraw;
  41. void AddVertex(float x, float y, float z, unsigned int color);
  42. //! Recast debug draw is quite noisy with lines, disabling them by default.
  43. bool m_drawLines = false;
  44. //! Only draw debug view within this volume.
  45. AZ::Aabb m_viewAabb = AZ::Aabb::CreateFromMinMax(
  46. -AZ::Vector3(AZ::Constants::FloatMax),
  47. AZ::Vector3(AZ::Constants::FloatMax));
  48. };
  49. } // namespace RecastNavigation