Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Engine::Graphics::Vertex Struct Reference

A structure used to store mesh vertices. More...

#include <Mesh.hpp>

Public Member Functions

void CalculateNormals (Vertex &v2, Vertex &v3)
 Calculates the normal vector of the vertices.
 
bool operator== (const Vertex &rhs)
 Checks if two vertices are equal.
 

Public Attributes

float x
 
float y
 
float z
 
float u
 
float v
 
float nx = 0.0f
 
float ny = 0.0f
 
float nz = 1.0f
 

Detailed Description

A structure used to store mesh vertices.

Each vertex has a position, texture coordinate, and normal vector which can be processed in shaders. Positions and coordinates are required. However, normal vectors are optional. If you don't provide a normal vector, the engine will compute one for you in respect to the triangle you create.

Parameters
xThe x position of the vertex
yThe y position of the vertex
zThe z position of the vertex
uThe u texture coordinate of the vertex
vThe v texture coordinate of the vertex
nxThe x component of the normal vector *(optional)*
nyThe y component of the normal vector *(optional)*
nzThe z component of the normal vector *(optional)*
Authors
  • Roberto Selles/Henderythmix

Member Function Documentation

◆ CalculateNormals()

void Engine::Graphics::Vertex::CalculateNormals ( Vertex v2,
Vertex v3 
)

Calculates the normal vector of the vertices.

takes this vector this method is associated with and two other vertices to calculate the normal of the triangle. The normal vector is then stored in the three vertex structs.

Parameters
v2The second vertex of the triangle
v3The third vertex of the triangle

◆ operator==()

bool Engine::Graphics::Vertex::operator== ( const Vertex rhs)

Checks if two vertices are equal.

Returns
True if the vertices are completely identical

The documentation for this struct was generated from the following files: