16 template<
typename TQuery,
typename TOutput,
typename TSelf>
17 class QueryDisplayListBuilder :
public IDisplayListBuilder
20 QueryDisplayListBuilder() { Clear(); }
22 Color NotProcessedColor() {
return Color::Orange; }
25 const TQuery* m_query;
27 DisplayList* m_displayList;
31 void PushQueryShape(Color color) {
static_cast<TSelf*
>(
this)->DoPushQueryShape(color); }
32 const Vec3f& GetStartPos() {
return static_cast<TSelf*
>(
this)->DoGetStartPos(); }
33 void PushStartTriangle(Color color) {
return static_cast<TSelf*
>(
this)->DoPushStartTriangle(color); }
34 void PushShapeToArrival(Color color){
return static_cast<TSelf*
>(
this)->DoPushShapeToArrival(color); }
37 const Vec3f& DoGetStartPos()
39 return m_query->m_startPos3f;
42 void DoPushStartTriangle(Color color)
44 m_displayList->PushTriangle(m_output->m_startTriangle.m_triangle.OffsetZ(0.1f), color);
55 m_displayList =
nullptr;
58 bool Init(DisplayList* displayList,
char* blob)
60 m_query = (TQuery*)blob;
61 m_output = (TOutput*)m_query->m_queryOutput.Ptr();
62 m_displayList = displayList;
63 return m_output !=
nullptr;
66 void PushStartText(Color color,
const char* text)
68 m_displayList->PushText(GetStartPos().OffsetZ(1.0f), color, text);
71 void PushDestText(Color color,
const char* text)
73 m_displayList->PushText(m_query->m_destPos3f.OffsetZ(1.0f), color, text);
76 void PushArrivalTriangle(Color color)
78 m_displayList->PushTriangle(m_output->m_arrivalTriangle.m_triangle.OffsetZ(0.1f), color);
81 void PushDestTriangle(Color color)
83 m_displayList->PushTriangle(m_output->m_destTriangle.m_triangle.OffsetZ(0.1f), color);
86 void PushCollisionPoint(Color color,
const char* text)
88 m_displayList->PushVerticalTriangleCrossInv(m_output->m_collisionPos3f, 1.0f, 0.25f, color);
89 m_displayList->PushText(m_output->m_collisionPos3f.OffsetZ(1.0f), color, text);
92 void PushDynamicOutput()
94 QueryDynamicOutputBlob* dynOutput = m_output->m_queryDynamicOutputBlobRef.Ptr();
95 if (dynOutput !=
nullptr)
96 QueryDynamicOutputDisplayListBuilder().Build(m_displayList, (
char*)dynOutput, 0);
99 void PushStartError(
const char* text)
101 PushQueryShape(Color::Red);
102 PushStartText(Color::Red, text);
105 void Push_NOT_PROCESSED()
107 PushStartText(Color::Orange,
"Not processed...");
108 PushQueryShape(Color::Orange);
111 void Push_PROCESSING(
const char* text)
113 PushStartText(Color::Orange, text);
114 PushQueryShape(Color::Orange);
117 void Push_START_OUTSIDE()
119 PushStartText(Color::Red,
"Start outside!");
120 PushQueryShape(Color::Red);
123 void Push_DEST_OUTSIDE()
125 PushStartText(Color::Red,
"Destination outside!");
126 PushQueryShape(Color::Red);
129 void Push_START_NAVTAG_FORBIDDEN()
131 PushStartTriangle(Color::Red);
132 PushStartText(Color::Red,
"Start NavTag forbidden!");
133 PushQueryShape(Color::Red);
136 void Push_DEST_NAVTAG_FORBIDDEN()
138 PushDestTriangle(Color::Red);
139 PushDestText(Color::Red,
"Destination NavTag forbidden!");
140 PushQueryShape(Color::Red);
143 void Push_COLLISION_DETECTED()
145 PushStartTriangle(Color::Green);
146 PushQueryShape(Color::Red);
149 void Push_ARRIVAL_WRONG_FLOOR()
151 PushStartTriangle(Color::Green);
152 PushDestText(Color::Red,
"Arrival in wrong floor!");
153 PushQueryShape(Color::Red);
156 void Push_LACK_OF_WORKING_MEMORY()
158 PushStartTriangle(Color::Green);
159 PushStartText(Color::Red,
"Lack of working memory!");
160 PushQueryShape(Color::Red);
163 void Push_UNKNOWN_ERROR()
165 PushStartText(Color::Red,
"Unknown error!");
166 PushQueryShape(Color::Red);
171 PushStartTriangle(Color::Green);
172 PushDestTriangle(Color::Green);
173 PushQueryShape(Color::Green);
176 void Push_CANNOT_MOVE()
178 PushStartTriangle(Color::Green);
179 PushCollisionPoint(Color::Orange,
"Collision point (cannot move)");
180 PushQueryShape(Color::Orange);
183 void Push_ARRIVAL_ERROR()
185 PushStartTriangle(Color::Green);
186 PushCollisionPoint(Color::Red,
"Collision point (arrival error)");
187 PushQueryShape(Color::Red);
190 void Push_MAXDIST_REACHED()
192 PushStartTriangle(Color::Green);
193 PushArrivalTriangle(Color::Green);
194 PushShapeToArrival(Color::Green);
197 void Push_COLLISION()
199 PushStartTriangle(Color::Green);
200 PushArrivalTriangle(Color::Green);
201 PushCollisionPoint(Color::Orange,
"Collision");
202 PushShapeToArrival(Color::Green);
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17