Chira Engine
A customizable MIT-licensed game engine.
Vertex.h
1 #pragma once
2 
3 #include <glm/glm.hpp>
4 
5 #include "Color.h"
6 
7 namespace chira {
8 
9 struct Vertex {
10  glm::vec3 position;
11  ColorRGB normal;
12  ColorRGB color;
13  ColorRG uv;
14 
15  Vertex()
16  : position()
17  , normal()
18  , color(1, 1, 1)
19  , uv() {}
20  explicit Vertex(glm::vec3 pos)
21  : position(pos)
22  , normal()
23  , color(1, 1, 1)
24  , uv() {}
25  Vertex(glm::vec3 pos, ColorRGB norm)
26  : position(pos)
27  , normal(norm)
28  , color(1, 1, 1)
29  , uv() {}
30  Vertex(glm::vec3 pos, ColorRGB norm, ColorRGB col)
31  : position(pos)
32  , normal(norm)
33  , color(col)
34  , uv() {}
35  Vertex(glm::vec3 pos, ColorRGB norm, ColorRGB col, ColorRG tex)
36  : position(pos)
37  , normal(norm)
38  , color(col)
39  , uv(tex) {}
40  Vertex(glm::vec3 pos, ColorRGB norm, ColorRG tex)
41  : position(pos)
42  , normal(norm)
43  , color(1, 1, 1)
44  , uv(tex) {}
45  Vertex(glm::vec3 pos, ColorRG tex)
46  : position(pos)
47  , normal()
48  , color(1, 1, 1)
49  , uv(tex) {}
50 
51  bool operator==(const Vertex& other) const {
52  return this->position == other.position &&
53  this->normal == other.normal &&
54  this->color == other.color &&
55  this->uv == other.uv;
56  }
57 
58  bool operator!=(const Vertex& other) const {
59  return !this->operator==(other);
60  }
61 };
62 
63 using Index = unsigned int;
64 
65 } // namespace chira