gwnavruntime/visualsystem/visualshapecolor.h Source File

visualshapecolor.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 
8 // primary contact: GUAL - secondary contact: MAMU
9 #ifndef Navigation_VisualShapeColor_H
10 #define Navigation_VisualShapeColor_H
11 
13 
14 namespace Kaim
15 {
16 
17 enum VisualShapePrimitive
18 {
19  VisualShapePrimitive_Triangle,
20  VisualShapePrimitive_Line,
21 };
22 
23 // Define the aspect of a shape: its color and the primitives used to render a shape
24 class VisualShapeColor
25 {
26 public:
27  KY_INLINE static VisualColor Inactive() { return VisualColor::Inactive(); }
28 
29  VisualShapeColor();
30  VisualShapeColor(const VisualColor& triangleColor, const VisualColor& lineColor);
31  VisualShapeColor(const VisualColor& color, const VisualShapePrimitive& primitive);
32 
33  ~VisualShapeColor();
34 
35  void SetOnlyTriangleColor(const VisualColor& triangleColor);
36  void SetOnlyLineColor(const VisualColor& lineColor);
37 
38  // DisplayShapeColor must have at least one valid color for triangles or lines
39  bool IsValid() const;
40 
41 public:
42  VisualColor m_triangleColor; // color for triangles, assign Inactive() is you don't want triangles
43  VisualColor m_lineColor; // color for lines, assign Inactive() is you don't want triangles
44 };
45 inline void SwapEndianness(Endianness::Target e, VisualShapeColor& self)
46 {
47  SwapEndianness(e, self.m_triangleColor);
48  SwapEndianness(e, self.m_lineColor);
49 }
50 
51 KY_INLINE VisualShapeColor::VisualShapeColor()
52  : m_triangleColor(Inactive())
53  , m_lineColor(Inactive())
54 {}
55 
56 KY_INLINE VisualShapeColor::VisualShapeColor(const VisualColor& triangleColor, const VisualColor& lineColor)
57  : m_triangleColor(triangleColor)
58  , m_lineColor(lineColor)
59 {}
60 
61 KY_INLINE VisualShapeColor::VisualShapeColor(const VisualColor& color, const VisualShapePrimitive& primitive)
62  : m_triangleColor(Inactive())
63  , m_lineColor(Inactive())
64 {
65  if (primitive == VisualShapePrimitive_Triangle)
66  m_triangleColor = color;
67  else
68  m_lineColor = color;
69 }
70 
71 KY_INLINE VisualShapeColor::~VisualShapeColor() {}
72 
73 KY_INLINE void VisualShapeColor::SetOnlyTriangleColor(const VisualColor& triangleColor)
74 {
75  m_triangleColor = triangleColor;
76  m_lineColor = Inactive();
77 }
78 
79 KY_INLINE void VisualShapeColor::SetOnlyLineColor(const VisualColor& lineColor)
80 {
81  m_lineColor = lineColor;
82  m_triangleColor = Inactive();
83 }
84 
85 KY_INLINE bool VisualShapeColor::IsValid() const { return m_triangleColor != Inactive() || m_lineColor != Inactive(); }
86 
87 }
88 
89 
90 #endif //Navigation_VisualShapeColor_H
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
Definition: gamekitcrowddispersion.h:20