debugdraw.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright 2011-2017 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef DEBUGDRAW_H_HEADER_GUARD
  6. #define DEBUGDRAW_H_HEADER_GUARD
  7. #include <bx/allocator.h>
  8. #include "../bounds.h"
  9. struct Axis
  10. {
  11. enum Enum
  12. {
  13. X,
  14. Y,
  15. Z,
  16. Count
  17. };
  18. };
  19. struct SpriteHandle { uint16_t idx; };
  20. inline bool isValid(SpriteHandle _handle) { return _handle.idx != UINT16_MAX; }
  21. ///
  22. void ddInit(bool _depthTestLess = true, bx::AllocatorI* _allocator = NULL);
  23. ///
  24. void ddShutdown();
  25. ///
  26. SpriteHandle ddCreateSprite(uint16_t _width, uint16_t _height, const void* _data);
  27. ///
  28. void ddDestroy(SpriteHandle _handle);
  29. ///
  30. void ddBegin(uint8_t _viewId);
  31. ///
  32. void ddEnd();
  33. ///
  34. void ddPush();
  35. ///
  36. void ddPop();
  37. ///
  38. void ddSetState(bool _depthTest, bool _depthWrite, bool _clockwise);
  39. ///
  40. void ddSetColor(uint32_t _abgr);
  41. ///
  42. void ddSetLod(uint8_t _lod);
  43. ///
  44. void ddSetWireframe(bool _wireframe);
  45. ///
  46. void ddSetStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f);
  47. ///
  48. void ddSetSpin(float _spin);
  49. ///
  50. void ddSetTransform(const void* _mtx);
  51. ///
  52. void ddSetTranslate(float _x, float _y, float _z);
  53. ///
  54. void ddMoveTo(float _x, float _y, float _z = 0.0f);
  55. ///
  56. void ddMoveTo(const void* _pos);
  57. ///
  58. void ddLineTo(float _x, float _y, float _z = 0.0f);
  59. ///
  60. void ddLineTo(const void* _pos);
  61. ///
  62. void ddClose();
  63. ///
  64. void ddDraw(const Aabb& _aabb);
  65. ///
  66. void ddDraw(const Cylinder& _cylinder, bool _capsule = false);
  67. ///
  68. void ddDraw(const Disk& _disk);
  69. ///
  70. void ddDraw(const Obb& _obb);
  71. ///
  72. void ddDraw(const Sphere& _sphere);
  73. ///
  74. void ddDrawFrustum(const void* _viewProj);
  75. ///
  76. void ddDrawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees);
  77. ///
  78. void ddDrawCircle(const void* _normal, const void* _center, float _radius, float _weight = 0.0f);
  79. ///
  80. void ddDrawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight = 0.0f);
  81. ///
  82. void ddDrawQuad(const float* _normal, const float* _center, float _size);
  83. ///
  84. void ddDrawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size);
  85. ///
  86. void ddDrawQuad(bgfx::TextureHandle _handle, const float* _normal, const float* _center, float _size);
  87. ///
  88. void ddDrawCone(const void* _from, const void* _to, float _radius);
  89. ///
  90. void ddDrawCylinder(const void* _from, const void* _to, float _radius, bool _capsule = false);
  91. ///
  92. void ddDrawCapsule(const void* _from, const void* _to, float _radius);
  93. ///
  94. void ddDrawAxis(float _x, float _y, float _z, float _len = 1.0f, Axis::Enum _highlight = Axis::Count, float _thickness = 0.0f);
  95. ///
  96. void ddDrawGrid(const void* _normal, const void* _center, uint32_t _size = 20, float _step = 1.0f);
  97. ///
  98. void ddDrawGrid(Axis::Enum _axis, const void* _center, uint32_t _size = 20, float _step = 1.0f);
  99. ///
  100. void ddDrawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _highlight = Axis::Count);
  101. #endif // DEBUGDRAW_H_HEADER_GUARD