MathFu
An open source project by
FPL.
|
Packed N-dimensional vector. More...
#include "mathfu/vector.h"
Packed N-dimensional vector.
Some Vector classes are padded so that it's possible to use the data structures with SIMD instructions. This structure can be used in conjunction with unpacked Vector classes to pack data into flat arrays suitable for sending to a GPU (e.g vertex buffers).
For example, to pack (store) an unpacked to packed vector:
VectorPacked<float, 3> packed; Vector<float, 3> vector(3, 2, 1); vector.Pack(&packed);
or
Vector<float, 3> vector(3, 2, 1); VectorPacked<float, 3> packed = vector;
To initialize a vector from a packed vector:
VectorPacked<float, 3> packed = { 3, 2, 1 }; Vector<float, 3> vector(packed);
T | type of VectorPacked elements. |
d | dimensions (number of elements) in the VectorPacked structure. |
Public Member Functions | |
VectorPacked () | |
Create an uninitialized VectorPacked. | |
VectorPacked (const Vector< T, d > &vector) | |
VectorPacked & | operator= (const Vector< T, d > &vector) |
Public Attributes | |
T | data [d] |
Elements of the packed vector one per dimension. | |
|
inlineexplicit |
Create a VectorPacked from a Vector.
Both VectorPacked and Vector must have the same number of dimensions.
vector | Vector to create the VectorPacked from. |
|
inline |
Copy a Vector to a VectorPacked.
Both VectorPacked and Vector must have the same number of dimensions.
vector | Vector to copy to the VectorPacked. |