Recast Navigation
Navigation-mesh Toolset for Games
Loading...
Searching...
No Matches
TestCase.h
Go to the documentation of this file.
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
19#ifndef TESTCASE_H
20#define TESTCASE_H
21
22#include <string>
23#include "DetourNavMesh.h"
24
26{
27 enum TestType
28 {
29 TEST_PATHFIND,
30 TEST_RAYCAST
31 };
32
33 struct Test
34 {
35 Test() :
36 type(),
37 spos(),
38 epos(),
39 nspos(),
40 nepos(),
41 radius(0),
42 includeFlags(0),
43 excludeFlags(0),
44 expand(false),
45 straight(0),
46 nstraight(0),
47 polys(0),
48 npolys(0),
49 findNearestPolyTime(0),
50 findPathTime(0),
51 findStraightPathTime(0),
52 next(0)
53 {
54 }
55
56 ~Test()
57 {
58 delete [] straight;
59 delete [] polys;
60 }
61
62 TestType type;
63 float spos[3];
64 float epos[3];
65 float nspos[3];
66 float nepos[3];
67 float radius;
68 unsigned short includeFlags;
69 unsigned short excludeFlags;
70 bool expand;
71
72 float* straight;
73 int nstraight;
74 dtPolyRef* polys;
75 int npolys;
76
77 int findNearestPolyTime;
78 int findPathTime;
79 int findStraightPathTime;
80
81 Test* next;
82 private:
83 // Explicitly disabled copy constructor and copy assignment operator.
84 Test(const Test&);
85 Test& operator=(const Test&);
86 };
87
88 std::string m_sampleName;
89 std::string m_geomFileName;
90 Test* m_tests;
91
92 void resetTimes();
93
94public:
95 TestCase();
96 ~TestCase();
97
98 bool load(const std::string& filePath);
99
100 const std::string& getSampleName() const { return m_sampleName; }
101 const std::string& getGeomFileName() const { return m_geomFileName; }
102
103 void doTests(class dtNavMesh* navmesh, class dtNavMeshQuery* navquery);
104
105 void handleRender();
106 bool handleRenderOverlay(double* proj, double* model, int* view);
107
108private:
109 // Explicitly disabled copy constructor and copy assignment operator.
110 TestCase(const TestCase&);
111 TestCase& operator=(const TestCase&);
112};
113
114#endif // TESTCASE_H
int next(int i, int n)
Definition DetourTileCacheBuilder.cpp:1080
Definition TestCase.h:26
void doTests(class dtNavMesh *navmesh, class dtNavMeshQuery *navquery)
Definition TestCase.cpp:197
bool handleRenderOverlay(double *proj, double *model, int *view)
Definition TestCase.cpp:387
void handleRender()
Definition TestCase.cpp:328
const std::string & getSampleName() const
Definition TestCase.h:100
TestCase()
Definition TestCase.cpp:41
const std::string & getGeomFileName() const
Definition TestCase.h:101
bool load(const std::string &filePath)
Definition TestCase.cpp:100
~TestCase()
Definition TestCase.cpp:46
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition DetourNavMeshQuery.h:166
A navigation mesh based on tiles of convex polygons.
Definition DetourNavMesh.h:339
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition DetourNavMesh.h:48