9
3

TestCase.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
  3. //
  4. // This software is provided 'as-is', without any express or implied
  5. // warranty. In no event will the authors be held liable for any damages
  6. // arising from the use of this software.
  7. // Permission is granted to anyone to use this software for any purpose,
  8. // including commercial applications, and to alter it and redistribute it
  9. // freely, subject to the following restrictions:
  10. // 1. The origin of this software must not be misrepresented; you must not
  11. // claim that you wrote the original software. If you use this software
  12. // in a product, an acknowledgment in the product documentation would be
  13. // appreciated but is not required.
  14. // 2. Altered source versions must be plainly marked as such, and must not be
  15. // misrepresented as being the original software.
  16. // 3. This notice may not be removed or altered from any source distribution.
  17. //
  18. #ifndef TESTCASE_H
  19. #define TESTCASE_H
  20. #include <string>
  21. #include "DetourNavMesh.h"
  22. class TestCase
  23. {
  24. enum TestType
  25. {
  26. TEST_PATHFIND,
  27. TEST_RAYCAST,
  28. };
  29. struct Test
  30. {
  31. Test() :
  32. type(),
  33. radius(0),
  34. includeFlags(0),
  35. excludeFlags(0),
  36. expand(false),
  37. straight(0),
  38. nstraight(0),
  39. polys(0),
  40. npolys(0),
  41. findNearestPolyTime(0),
  42. findPathTime(0),
  43. findStraightPathTime(0),
  44. next(0)
  45. {
  46. }
  47. ~Test()
  48. {
  49. delete [] straight;
  50. delete [] polys;
  51. }
  52. TestType type;
  53. float spos[3];
  54. float epos[3];
  55. float nspos[3];
  56. float nepos[3];
  57. float radius;
  58. unsigned short includeFlags;
  59. unsigned short excludeFlags;
  60. bool expand;
  61. float* straight;
  62. int nstraight;
  63. dtPolyRef* polys;
  64. int npolys;
  65. int findNearestPolyTime;
  66. int findPathTime;
  67. int findStraightPathTime;
  68. Test* next;
  69. private:
  70. // Explicitly disabled copy constructor and copy assignment operator.
  71. Test(const Test&);
  72. Test& operator=(const Test&);
  73. };
  74. std::string m_sampleName;
  75. std::string m_geomFileName;
  76. Test* m_tests;
  77. void resetTimes();
  78. public:
  79. TestCase();
  80. ~TestCase();
  81. bool load(const std::string& filePath);
  82. const std::string& getSampleName() const { return m_sampleName; }
  83. const std::string& getGeomFileName() const { return m_geomFileName; }
  84. void doTests(class dtNavMesh* navmesh, class dtNavMeshQuery* navquery);
  85. void handleRender();
  86. bool handleRenderOverlay(double* proj, double* model, int* view);
  87. private:
  88. // Explicitly disabled copy constructor and copy assignment operator.
  89. TestCase(const TestCase&);
  90. TestCase& operator=(const TestCase&);
  91. };
  92. #endif // TESTCASE_H