src/gl/common.h

changeset 80
764381756899
parent 73
97df974b5ed5
child 92
c438a7db7c52
equal deleted inserted replaced
79:5fe2dd4e161a 80:764381756899
71 { 71 {
72 EdgeLine, 72 EdgeLine,
73 Triangle, 73 Triangle,
74 Quadrilateral, 74 Quadrilateral,
75 ConditionalEdge 75 ConditionalEdge
76 }; 76 } type;
77 Type type;
78 glm::vec3 vertices[4]; 77 glm::vec3 vertices[4];
79 ldraw::Color color; 78 ldraw::Color color;
80 ldraw::id_t id; 79 ldraw::id_t id;
81 80
82 /** 81 /**
111 110
112 Q_DECLARE_METATYPE(gl::Polygon) 111 Q_DECLARE_METATYPE(gl::Polygon)
113 112
114 namespace gl 113 namespace gl
115 { 114 {
115 constexpr Polygon::Type POLYGON_TYPES[] =
116 {
117 Polygon::Type::EdgeLine,
118 Polygon::Type::Triangle,
119 Polygon::Type::Quadrilateral,
120 Polygon::Type::ConditionalEdge
121 };
122
123 constexpr int NUM_POLYGON_TYPES = countof(POLYGON_TYPES);
124
116 inline Polygon edgeLine(const glm::vec3& v_1, const glm::vec3& v_2, ldraw::Color color, ldraw::id_t id) 125 inline Polygon edgeLine(const glm::vec3& v_1, const glm::vec3& v_2, ldraw::Color color, ldraw::id_t id)
117 { 126 {
118 return {Polygon::EdgeLine, {v_1, v_2}, color, id}; 127 return {Polygon::EdgeLine, {v_1, v_2}, color, id};
119 } 128 }
120 129
157 Triangles, 166 Triangles,
158 Quads, 167 Quads,
159 ConditionalLines 168 ConditionalLines
160 }; 169 };
161 170
162 constexpr ArrayClass ARRAY_CLASSES[] = {ArrayClass::Lines, ArrayClass::Triangles, ArrayClass::Quads, ArrayClass::ConditionalLines};
163 constexpr int NUM_ARRAY_CLASSES = countof(ARRAY_CLASSES);
164
165 enum class RenderStyle 171 enum class RenderStyle
166 { 172 {
167 Normal, 173 Normal,
168 Wireframe, 174 Wireframe,
169 BfcRedGreen, 175 BfcRedGreen,

mercurial