|
|
|
@ -99,7 +99,8 @@ This function takes list of attribute arrays and returns them interleaved, so |
|
|
|
data for each attribute are in continuous place in memory. |
|
|
|
data for each attribute are in continuous place in memory. |
|
|
|
|
|
|
|
|
|
|
|
Example usage: |
|
|
|
Example usage: |
|
|
|
@code |
|
|
|
|
|
|
|
|
|
|
|
@code{.cpp} |
|
|
|
MeshPrimitive primitive; |
|
|
|
MeshPrimitive primitive; |
|
|
|
std::vector<Vector3> positions; |
|
|
|
std::vector<Vector3> positions; |
|
|
|
std::vector<Vector2> textureCoordinates; |
|
|
|
std::vector<Vector2> textureCoordinates; |
|
|
|
@ -115,13 +116,15 @@ mesh.setPrimitive(primitive) |
|
|
|
|
|
|
|
|
|
|
|
It's often desirable to align data for one vertex on 32bit boundaries. To |
|
|
|
It's often desirable to align data for one vertex on 32bit boundaries. To |
|
|
|
achieve that, you can specify gaps between the attributes: |
|
|
|
achieve that, you can specify gaps between the attributes: |
|
|
|
@code |
|
|
|
|
|
|
|
|
|
|
|
@code{.cpp} |
|
|
|
std::vector<Vector4> positions; |
|
|
|
std::vector<Vector4> positions; |
|
|
|
std::vector<UnsignedShort> weights; |
|
|
|
std::vector<UnsignedShort> weights; |
|
|
|
std::vector<Color3ub> vertexColors; |
|
|
|
std::vector<Color3ub> vertexColors; |
|
|
|
|
|
|
|
|
|
|
|
auto data = MeshTools::interleave(positions, weights, 2, textureCoordinates, 1); |
|
|
|
auto data = MeshTools::interleave(positions, weights, 2, textureCoordinates, 1); |
|
|
|
@endcode |
|
|
|
@endcode |
|
|
|
|
|
|
|
|
|
|
|
All gap bytes are set zero. This way vertex stride is 24 bytes, without gaps it |
|
|
|
All gap bytes are set zero. This way vertex stride is 24 bytes, without gaps it |
|
|
|
would be 21 bytes, causing possible performance loss. |
|
|
|
would be 21 bytes, causing possible performance loss. |
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +133,7 @@ would be 21 bytes, causing possible performance loss. |
|
|
|
@note The only requirements to attribute array type is that it must have |
|
|
|
@note The only requirements to attribute array type is that it must have |
|
|
|
typedef `T::value_type`, forward iterator (to be used with range-based |
|
|
|
typedef `T::value_type`, forward iterator (to be used with range-based |
|
|
|
for) and function `size()` returning count of elements. In most cases it |
|
|
|
for) and function `size()` returning count of elements. In most cases it |
|
|
|
will be `std::vector` or `std::array`. |
|
|
|
will be @ref std::vector or @ref std::array. |
|
|
|
|
|
|
|
|
|
|
|
@see @ref interleaveInto() |
|
|
|
@see @ref interleaveInto() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|