1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef QTPFS_PATHDRAWER_HDR
4 #define QTPFS_PATHDRAWER_HDR
5 
6 #include <list>
7 #include "IPathDrawer.h"
8 
9 struct MoveDef;
10 class CVertexArray;
11 
12 namespace QTPFS {
13 	class PathManager;
14 
15 	struct QTNode;
16 	struct IPath;
17 	struct PathSearch;
18 
19 	namespace PathSearchTrace {
20 		struct Execution;
21 	}
22 }
23 
24 struct QTPFSPathDrawer: public IPathDrawer {
25 public:
26 	QTPFSPathDrawer();
27 
28 	void DrawAll() const;
29 	void UpdateExtraTexture(int, int, int, int, unsigned char*) const;
30 
31 private:
32 	enum {
33 		COLOR_BIT_R = 1,
34 		COLOR_BIT_G = 2,
35 		COLOR_BIT_B = 4,
36 	};
37 
38 	void DrawNodeTree(const MoveDef* md) const;
39 	void DrawNodeTreeRec(
40 		const QTPFS::QTNode* nt,
41 		const MoveDef* md,
42 		CVertexArray* va
43 	) const;
44 
45 	void GetVisibleNodes(const QTPFS::QTNode* nt, std::list<const QTPFS::QTNode*>& nodes) const;
46 
47 	void DrawPaths(const MoveDef* md) const;
48 	void DrawPath(const QTPFS::IPath* path, CVertexArray* va) const;
49 	void DrawSearchExecution(unsigned int pathType, const QTPFS::PathSearchTrace::Execution* searchExec) const;
50 	void DrawSearchIteration(unsigned int pathType, const std::list<unsigned int>& nodeIndices, CVertexArray* va) const;
51 	void DrawNode(
52 		const QTPFS::QTNode* node,
53 		const MoveDef* md,
54 		CVertexArray* va,
55 		bool fillQuad,
56 		bool showCost,
57 		bool batchDraw
58 	) const;
59 	void DrawNodeLink(const QTPFS::QTNode* pushedNode, const QTPFS::QTNode* poppedNode, CVertexArray* va) const;
60 
61 private:
62 	QTPFS::PathManager* pm;
63 };
64 
65 #endif
66 
67