gwnavruntime/queries/blobs/diskcollisionquerydisplaylistbuilder.h Source File

diskcollisionquerydisplaylistbuilder.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 // Primary contact: MAMU - secondary contact: NOBODY
8 #ifndef Navigation_DiskCollisionQuery_DisplayListBuilder_H
9 #define Navigation_DiskCollisionQuery_DisplayListBuilder_H
10 
15 
16 namespace Kaim
17 {
18 
19 class DiskCollisionQueryDisplayListBuilder : public IDisplayListBuilder
20 {
21 private:
22  virtual void DoBuild(ScopedDisplayList* displayList, char* blob, KyUInt32 /*deepBlobSize*/ = 0)
23  {
24  const DiskCollisionQueryBlob* queryBlob = (DiskCollisionQueryBlob*) blob;
25  KyUInt32 subdivisionCount = 24;
26  KyFloat32 triangleZOffset = 0.1f;
27 
28  DiskCollisionQueryOutputBlob* queryOutputBlob = queryBlob->m_queryOutput.Ptr();
29  if (queryOutputBlob != NULL)
30  {
31  Vec3f offsetVector = Vec3f::UnitZ();
32 
33  VisualShapeColor shapeColor;
34  switch((DiskCollisionQueryResult)queryOutputBlob->m_result)
35  {
38  {
39  shapeColor.m_lineColor = VisualColor::Orange;
40  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
41  }
42  break;
44  {
45  shapeColor.m_lineColor = VisualColor::Red;
46  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
47  }
48  break;
50  {
51  shapeColor.m_lineColor = VisualColor::Red;
52 
53  Triangle3f triangle = queryOutputBlob->m_centerTriangle.m_triangle;
54 
55  triangle.A.z += triangleZOffset;
56  triangle.B.z += triangleZOffset;
57  triangle.C.z += triangleZOffset;
58  displayList->PushTriangle(triangle, shapeColor);
59 
60  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
61  }
62  break;
64  {
65  shapeColor.m_lineColor = VisualColor::Lime;
66 
67  Triangle3f triangle = queryOutputBlob->m_centerTriangle.m_triangle;
68 
69  triangle.A.z += triangleZOffset;
70  triangle.B.z += triangleZOffset;
71  triangle.C.z += triangleZOffset;
72  displayList->PushTriangle(triangle, shapeColor);
73 
74  shapeColor.m_lineColor = VisualColor::Red;
75  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
76  }
77  break;
79  {
80  shapeColor.m_lineColor = VisualColor::Lime;
81 
82  Triangle3f triangle = queryOutputBlob->m_centerTriangle.m_triangle;
83 
84  triangle.A.z += triangleZOffset;
85  triangle.B.z += triangleZOffset;
86  triangle.C.z += triangleZOffset;
87  displayList->PushTriangle(triangle, shapeColor);
88 
89  shapeColor.m_lineColor = VisualColor::Red;
90  displayList->PushText(queryBlob->m_centerPos3f + offsetVector, shapeColor.m_lineColor, "Lack of working memory!");
91  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
92  }
93  break;
95  {
96  shapeColor.m_lineColor = VisualColor::Red;
97  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
98  }
99  break;
101  {
102  shapeColor.m_lineColor = VisualColor::Lime;
103 
104  Triangle3f triangle = queryOutputBlob->m_centerTriangle.m_triangle;
105 
106  triangle.A.z += triangleZOffset;
107  triangle.B.z += triangleZOffset;
108  triangle.C.z += triangleZOffset;
109  displayList->PushTriangle(triangle, shapeColor);
110 
111  displayList->PushDisk(queryBlob->m_centerPos3f, queryBlob->m_radius, subdivisionCount, shapeColor);
112  }
113  break;
114  }
115 
116  QueryDynamicOutputBlob* queryDynamicOutputBlob = queryOutputBlob->m_queryDynamicOutputBlobRef.Ptr();
117  if (queryDynamicOutputBlob != NULL)
118  {
119  QueryDynamicOutputDisplayListBuilder dynamicOutputDLBuilder;
120  dynamicOutputDLBuilder.Build(displayList, (char*)queryDynamicOutputBlob, 0);
121  }
122  }
123  }
124 };
125 
126 }
127 
128 #endif
Indicates that an unknown error occurred during the query processing.
Definition: basediskcollisionquery.h:30
Indicates that the center point lies inside the NavMesh, but that the radius collides with a border o...
Definition: basediskcollisionquery.h:28
Definition: SF_RefCount.h:377
static const VisualColor Lime
Represents the color with RGBA values ( 0, 255, 0, 255).  
Definition: visualcolor.h:172
static const VisualColor Orange
Represents the color with RGBA values (255, 165, 0, 255).  
Definition: visualcolor.h:195
Indicates that the center point lies outside the navigable area of the NavMesh.
Definition: basediskcollisionquery.h:26
Indicates that the disk fits inside the navigable area of the NavMesh.
Definition: basediskcollisionquery.h:32
static const VisualColor Red
Represents the color with RGBA values (255, 0, 0, 255).  
Definition: visualcolor.h:209
DiskCollisionQueryResult
Enumerates the possible results of a DiskCollisionQuery.
Definition: basediskcollisionquery.h:21
static Vec3f UnitZ()
Returns the normalized orientation of the Z axis.
Definition: vec3f.h:218
Indicates that insufficient working memory caused the query to stop.
Definition: basediskcollisionquery.h:29
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Indicates that the query has not yet been launched.
Definition: basediskcollisionquery.h:24
Indicates that the NavTag at the center point was forbidden.
Definition: basediskcollisionquery.h:27
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
Indicates that the query has not yet been initialized.
Definition: basediskcollisionquery.h:23