|
| | Vector ()=default |
| | Default constructor. More...
|
| |
| constexpr | Vector (ZeroType) noexcept |
| | Constructor that zero the vector out. More...
|
| |
| constexpr | Vector (T val) noexcept |
| | Constructor that fills the vector with a value. More...
|
| |
| constexpr | Vector (const T *array) |
| | Constructor that takes an array. More...
|
| |
| constexpr | Vector (T first, T second) noexcept |
| | Constructor that takes 2 components. More...
|
| |
| | Vector (const Vector &other)=default |
| | Default copy constructor. More...
|
| |
| template<typename U > |
| | Vector (const Vector< U, 2 > &other) noexcept |
| | Converting copy constructor. More...
|
| |
| Vector & | operator= (const Vector &other)=default |
| | Default copy assignment. More...
|
| |
| constexpr T | operator[] (std::size_t i) const |
| | Access to the \( i \)-th coordinate. More...
|
| |
| constexpr T & | operator[] (std::size_t i) |
| | Access to the \( i \)-th coordinate. More...
|
| |
| T * | begin () |
| | Iterator.to the first element. More...
|
| |
| T * | end () |
| | Iterator to the element after the last one. More...
|
| |
| const T * | begin () const |
| | Iterator.to the first element (const version). More...
|
| |
| const T * | end () const |
| | Iterator on the element after the last one (const version). More...
|
| |
| const T * | cbegin () const |
| | Iterator.on the first element (const version). More...
|
| |
| const T * | cend () const |
| | Iterator on the element after the last one (const version). More...
|
| |
| constexpr void | zero () noexcept |
| | Zero out the vector. More...
|
| |
|
| union gf::Vector< T, 2 >:: { ... } | |
| |
| union gf::Vector< T, 2 >:: { ... } | |
| |
| T | x |
| | First coordinate in the (x,y) representation. More...
|
| |
| T | u |
| | First coordinate in the (u,v) representation. More...
|
| |
| T | s |
| | First coordinate in the (s,t) representation. More...
|
| |
| T | width |
| | First coordinate in the size representation. More...
|
| |
| T | col |
| | First coordinate in the indices representation. More...
|
| |
| T | y |
| | Second coordinate in the (x,y) representation. More...
|
| |
| T | v |
| | Second coordinate in the (u,v) representation. More...
|
| |
| T | t |
| | Second coordinate in the (s,t) representation. More...
|
| |
| T | height |
| | Second coordinate in the size 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
(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;