aboutsummaryrefslogtreecommitdiffstats
path: root/yage/data/vertex.h
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-25 13:54:09 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-25 13:54:09 +0000
commitf949692714e72a0e2d45ebb6a5d698424ab71dee (patch)
treecfab638d8c4d35c297e981773cfee1a9af3490ee /yage/data/vertex.h
parent022a4bdd81332ce67d799be6a06afb42ae45ac2e (diff)
downloadYAGE-f949692714e72a0e2d45ebb6a5d698424ab71dee.tar.gz
YAGE-f949692714e72a0e2d45ebb6a5d698424ab71dee.zip
[Broken] Reorganising and fixing.
Diffstat (limited to 'yage/data/vertex.h')
-rw-r--r--yage/data/vertex.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/yage/data/vertex.h b/yage/data/vertex.h
new file mode 100644
index 00000000..4cd095a9
--- /dev/null
+++ b/yage/data/vertex.h
@@ -0,0 +1,84 @@
+/** ---------------------------------------------------------------------------
+ * @file: vertex.h
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
+ * MIT License, see LICENSE file for more details.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef VERTEX_H
+#define VERTEX_H
+
+#include <glad/glad.h>
+
+namespace yage
+{
+
+struct Position {
+ float x;
+ float y;
+
+ Position() = default;
+
+ Position(float x_, float y_) : x(x_), y(y_) {}
+};
+
+struct Colour {
+ GLubyte r;
+ GLubyte g;
+ GLubyte b;
+ GLubyte a;
+
+ Colour() : r(0), g(0), b(0), a(0) {}
+
+ Colour(GLubyte r_, GLubyte g_, GLubyte b_, GLubyte a_)
+ : r(r_), g(g_), b(b_), a(a_)
+ {
+ }
+};
+
+struct UV {
+ float u;
+ float v;
+
+ UV() = default;
+
+ UV(float u_, float v_) : u(u_), v(v_) {}
+};
+
+struct Vertex {
+ Position position;
+ Colour colour;
+ UV uv;
+
+ Vertex() = default;
+
+ Vertex(const Position &position_, const Colour &colour_, const UV &uv_)
+ : position(position_), colour(colour_), uv(uv_)
+ {
+ }
+
+ void setPosition(float x, float y)
+ {
+ position.x = x;
+ position.y = y;
+ }
+
+ void setColour(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
+ {
+ colour.r = r;
+ colour.g = g;
+ colour.b = b;
+ colour.a = a;
+ }
+
+ void setUv(float u, float v)
+ {
+ uv.u = u;
+ uv.v = v;
+ }
+};
+
+} // namespace yage
+
+#endif