Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
A point associated with a color and a texture coordinate. More...
#include <gf/Vertex.h>
Public Attributes | |
Vector2f | position |
Position of the vertex in world coordinates. More... | |
Color4f | color = Color::White |
Color of the vertex (default: white) More... | |
Vector2f | texCoords = Vector2f{ 0.0f, 0.0f } |
Coordinates of the texture. More... | |
A point associated with a color and a texture coordinate.
gf::Vertex represents the association between a position in the world, a color and texture coordinates.
A vertex is the building block for drawing. Everything which is visible on screen is made of vertices. They are grouped as 2D primitives (triangles, etc), and these primitives are grouped to create even more complex 2D entities such as sprites, shapes, etc.
If you use the graphical entities of gf (sprite, shape), you won't have to deal with vertices directly. But if you want to define your own 2D entities, using vertices will allow you to get maximum performances.
The texture coordinates are in the \( [0, 1] \) range. \( (0,0) \) is the top-left of the texture while \( (1,1) \) is the bottom right of the texture. If a coordinate is outside the \( [0, 1] \) range, the texture is clamped or repeated (see Texture::setRepeated).
Example:
Color4f gf::Vertex::color = Color::White |
Color of the vertex (default: white)
Vector2f gf::Vertex::position |
Position of the vertex in world coordinates.