|
| | Vector ()=default |
| | Default constructor. More...
|
| |
| | Vector (T val) |
| | Constructor that fills the vector with a value. More...
|
| |
| | Vector (T *array) |
| | Constructor that takes an array. More...
|
| |
| constexpr | Vector (T x, T y) |
| | Constructor that takes 2 components. More...
|
| |
| | Vector (const Vector &other)=default |
| | Default copy constructor. More...
|
| |
| template<typename U > |
| | Vector (const Vector< U, 2 > &other) |
| | Converting copy constructor. More...
|
| |
| T | operator[] (std::size_t i) const |
| | Access to the \( i \)-th coordinate. More...
|
| |
| T & | operator[] (std::size_t i) |
| | Access to the \( i \)-th coordinate. More...
|
| |
| T * | begin (void) |
| | Iterator.to the first element. More...
|
| |
| T * | end (void) |
| | Iterator to the element after the last one. More...
|
| |
| T const * | begin (void) const |
| | Iterator.to the first element (const version). More...
|
| |
| T const * | end (void) const |
| | Iterator on the element after the last one (const version). More...
|
| |
| T const * | cbegin (void) const |
| | Iterator.on the first element (const version). More...
|
| |
| T const * | cend (void) const |
| | Iterator on the element after the last one (const version). More...
|
| |
|
| union gf::Vector< T, 2 >:: { ... } | |
| |
| T | data [2] |
| | Generic representation. More...
|
| |
| T | x |
| | First coordinate in the (x,y) representation. More...
|
| |
| T | y |
| | Second coordinate in the (x,y) representation. More...
|
| |
| T | u |
| | First coordinate in the (u,v) representation. More...
|
| |
| T | v |
| | Second coordinate in the (u,v) representation. More...
|
| |
| T | s |
| | First coordinate in the (s,t) representation. More...
|
| |
| T | t |
| | Second coordinate in the (s,t) representation. More...
|
| |
| T | width |
| | First coordinate in the size representation. More...
|
| |
| T | height |
| | Second coordinate in the size representation. More...
|
| |
| T | col |
| | First coordinate in the indices representation. More...
|
| |
| T | row |
| | Second coordinate in the indices representation. More...
|
| |
template<typename T>
struct gf::Vector< T, 2 >
A 2D vector.
This specialization of gf::Vector handles the 2-dimension spaces. It can be accessed with various representations:
- the generic representation with the
data member
- the
(x,y) representation, used for generic coordinates in the 2D space
- the
(u,v) representation, used for texture coordinates (see UV mapping)
- the
(s,t) representation, used for texture coordinates
- the size representation with a
width member and a height member, used to represent a 2-dimensional size
- the indices representation with a
col member and a row member, used to access a 2-dimensional array (gf::Array2D)
Several common typedef are defined:
Usage example:
v1.x = 18.2f;
bool different = (v2 != v3);
size.width = 1920;
size.height = 1080;
texCoords.u = 0.0f;
texCoords.v = 0.3f;