gwnavruntime/queries/blobs/trianglefromposquerydisplaylistbuilder.h Source File

trianglefromposquerydisplaylistbuilder.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_TriangleFromPosQuery_DisplayListBuilder_H
9 #define Navigation_TriangleFromPosQuery_DisplayListBuilder_H
10 
13 
14 namespace Kaim
15 {
16 
17 class TriangleFromPosQueryDisplayListBuilder : public IDisplayListBuilder
18 {
19 private:
20  virtual void DoBuild(ScopedDisplayList* displayList, char* blob, KyUInt32 /*deepBlobSize*/ = 0)
21  {
22  const TriangleFromPosQueryBlob* queryBlob = (TriangleFromPosQueryBlob*) blob;
23  KyFloat32 triangleZOffset = 0.1f;
24 
25  TriangleFromPosQueryOutputBlob* queryOutputBlob = queryBlob->m_queryOutput.Ptr();
26  if (queryOutputBlob != NULL)
27  {
28  Vec3f offsetVector = Vec3f::UnitZ();
29 
30  VisualShapeColor shapeColor;
31  switch((TriangleFromPosQueryResult)queryOutputBlob->m_result)
32  {
35  {
36  shapeColor.m_lineColor = VisualColor::Orange;
37  displayList->PushPoint(queryBlob->m_inputPos3f, shapeColor);
38  }
39  break;
41  {
42  shapeColor.m_lineColor = VisualColor::Red;
43  displayList->PushPoint(queryBlob->m_inputPos3f, shapeColor);
44  displayList->PushText(queryBlob->m_inputPos3f + offsetVector, shapeColor.m_lineColor, "No triangle found!");
45  }
46  break;
48  {
49  shapeColor.m_lineColor = VisualColor::Red;
50  displayList->PushText(queryBlob->m_inputPos3f + offsetVector, shapeColor.m_lineColor, "Lack of working memory!");
51  displayList->PushPoint(queryBlob->m_inputPos3f, shapeColor);
52  }
53  break;
55  {
56  shapeColor.m_lineColor = VisualColor::Lime;
57  displayList->PushPoint(queryBlob->m_inputPos3f, shapeColor);
58  Triangle3f triangle = queryOutputBlob->m_resultTrianglePtr.m_triangle;
59  triangle.A.z += triangleZOffset;
60  triangle.B.z += triangleZOffset;
61  triangle.C.z += triangleZOffset;
62  displayList->PushTriangle(triangle, shapeColor);
63  }
64  break;
65  }
66 
67  shapeColor.m_lineColor = VisualColor::Cyan;
68  const KyFloat32 spatializationRangeAbovePosition = queryBlob->m_positionSpatializationRange.m_rangeAbovePosition;
69  const KyFloat32 spatializationRangeBelowPosition = queryBlob->m_positionSpatializationRange.m_rangeBelowPosition;
70  const Vec3f rangeTop = queryBlob->m_inputPos3f + Vec3f(0.0f, 0.0f, spatializationRangeAbovePosition);
71  const Vec3f rangeBottom = queryBlob->m_inputPos3f - Vec3f(0.0f, 0.0f, spatializationRangeBelowPosition);
72  displayList->PushLine(rangeBottom, rangeTop, shapeColor.m_lineColor);
73  }
74  }
75 };
76 
77 }
78 
79 #endif
Indicates the query has not yet been initialized.
Definition: trianglefromposquery.h:31
TriangleFromPosQueryResult
Enumerates the possible results of a TriangleFromPosQuery.
Definition: trianglefromposquery.h:29
Indicates that insufficient working memory caused the query to stop.
Definition: trianglefromposquery.h:35
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
static const VisualColor Red
Represents the color with RGBA values (255, 0, 0, 255).  
Definition: visualcolor.h:209
static Vec3f UnitZ()
Returns the normalized orientation of the Z axis.
Definition: vec3f.h:218
Definition: gamekitcrowddispersion.h:20
static const VisualColor Cyan
Represents the color with RGBA values ( 0, 255, 255, 255).  
Definition: visualcolor.h:116
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Indicates that the point provided is outside the navigable boundaries of the NavMesh.
Definition: trianglefromposquery.h:34
Indicates that the query was completed successfully; a triangle was found.
Definition: trianglefromposquery.h:37
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
Indicates the query has not yet been launched.
Definition: trianglefromposquery.h:32