Vertex

struct glen::Vertex

Individual vertex. Basic building block of a mesh. Contains various attributes which are useful for sending to the shader A vertex is structured in the following way:

Tuple location

Type

Name

0

Vec3

Position coordinates

1

Vec3

Color

2

Vec3

Normals

3

Vec2

UV Coordinates

4

Int

ID

5

Vec3

Tangent

6

Vec3

Bitangent

Public Functions

Vertex()

Constructor.

Vertex(glm::vec3 position, glm::vec3 normal, glm::vec2 uv)

Constructor.

Vertex(glm::vec3 position, glm::vec3 color, glm::vec3 normal, glm::vec2 uv)

Constructor.

Vertex(glm::vec3 position, glm::vec3 color, glm::vec3 normal, glm::vec2 uv, GLint id, glm::vec3 tangent, glm::vec3 bitangent)

Constructor.

bool operator<(const Vertex &other) const

Return

True if this vertex has a higher value in memory than other.

const vertexType &vertex_tuple() const

Return

Tuple containing all vertex information.

const glm::vec3 &position() const

Return

Position coordinate of vertex.

const glm::vec3 &color() const

Return

Color r, g, b vector of vertex.

const glm::vec3 &normal() const

Return

Normal vector of vertex.

const glm::vec2 &uv() const

Return

UV coordinates of vertex.

const GLint &id() const

Return

Unique ID of vertex.

const glm::vec3 &tangent() const

Return

Tangent vector of vertex.

const glm::vec3 &bitangent() const

Return

Bitangent vector of vertex.

void set_position(const glm::vec3 &position)

Set the position coordinate of vertex.

void set_color(const glm::vec3 &color)

Set the r, g, b color vector of vertex.

void set_normal(const glm::vec3 &normal)

Set the normal vector of the vertex.

void set_uv(const glm::vec2 &uv)

Set the UV coordinates of the vertex.

void set_id(const GLint id)

Set the ID of the vertex (should be unique to the corresponding mesh).

Parameters
  • id:

void set_tangent(const glm::vec3 &tangent)

Set the tangent vector of the vertex.

void set_bitangent(const glm::vec3 &bitangent)

Set the bitangent vector of the vertex.