diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-09-09 07:55:22 +0100 |
commit | 60072c1d8089ffd3294e76636198d14710be95b8 (patch) | |
tree | 511d459e9afe69ca58d05880eb53ce44a9a183c6 /yage/base/vertex.h | |
parent | 660996bd750dbb5fcdce85845ee6b260f3ed23eb (diff) | |
download | YAGE-60072c1d8089ffd3294e76636198d14710be95b8.tar.gz YAGE-60072c1d8089ffd3294e76636198d14710be95b8.zip |
Restructuring
Diffstat (limited to 'yage/base/vertex.h')
-rw-r--r-- | yage/base/vertex.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/yage/base/vertex.h b/yage/base/vertex.h new file mode 100644 index 00000000..15b46ed9 --- /dev/null +++ b/yage/base/vertex.h @@ -0,0 +1,84 @@ +/* ---------------------------------------------------------------------------- + * vertex.h + * + * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License + * See file LICENSE for more details + * ---------------------------------------------------------------------------- + */ + +#ifndef VERTEX_H +#define VERTEX_H + +#include <GL/glew.h> + +namespace yage +{ + +struct Position { + float x; + float y; + + Position() = default; + + Position(float x_, float y_) : x(x_), y(y_) {} +}; + +struct Color { + GLubyte r; + GLubyte g; + GLubyte b; + GLubyte a; + + Color() = default; + + Color(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; + Color color; + UV uv; + + Vertex() = default; + + Vertex(const Position &position_, const Color &color_, const UV &uv_) + : position(position_), color(color_), uv(uv_) + { + } + + void setPosition(float x, float y) + { + position.x = x; + position.y = y; + } + + void setColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a) + { + color.r = r; + color.g = g; + color.b = b; + color.a = a; + } + + void setUv(float u, float v) + { + uv.u = u; + uv.v = v; + } +}; + +} // namespace yage + +#endif |