1 #ifndef NTA_VERTEX_H_INCLUDED
2 #define NTA_VERTEX_H_INCLUDED
6 #include "nta/MyEngine.h"
8 #define NUM_VERTEX_ATTRIBS 4
15 glVertexAttribPointer(index, size, type, normalized, stride, pointer);
31 Vertex2D(crvec2 p) :
pos(p), color(glm::vec4(1)), uv(glm::vec2(0)), hasTexture(0.0) {
34 Vertex2D(crvec2 p, crvec4 c) :
pos(p), color(c), uv(glm::vec2(0)), hasTexture(0.0) {
37 Vertex2D(crvec2 p, crvec4 c, crvec2 u,
float t = 1.0) :
pos(p), color(c), uv(u), hasTexture(t) {
40 Vertex2D(crvec4 c, crvec2 u,
float t = 1.0) :
pos(0), color(c), uv(u), hasTexture(t) {
48 void setColor(
float r,
float g,
float b,
float a) {
75 #endif // NTA_VERTEX_H_INCLUDED
Vertex2D()
Initializes an "empty" vertex.
Vertex2D(crvec2 p)
Initializes a white, textureless vertex with given position.
Vertex2D(crvec2 p, crvec4 c)
Initializes textureless, colorful vertex.
represents an attribute of a vertex (e.g. a call to glVertexAttribPointer)
Vertex2D(crvec4 c, crvec2 u, float t=1.0)
Initializes vertex with everything except position.
void setColor(float r, float g, float b, float a)
sets the color of the vertex
represents a vertex in 2 dimensions
glm::vec2 pos
the vertex's position, color, and uv coordinates, respectively
Vertex2D(crvec2 p, crvec4 c, crvec2 u, float t=1.0)
Initializes a vertex with everything.
void setPosition(float x, float y)
sets the position of the vertex
void setUV(float u, float v)
sets the uv coordinates of the vertex