class
#include <Magnum/Trade/MeshData2D.h>
MeshData2D Two-dimensional mesh data.
Provides access to mesh data and additional information, such as primitive type.
It's possible to use MeshTools::
Matrix3 transformation = Matrix3::translation({3.0f, -2.0f})* Matrix3::scaling(Vector2{2.0f})* Matrix3::rotation(45.0_degf); MeshTools::transformPointsInPlace(transformation, data.positions(0));
Constructors, destructors, conversion operators
-
MeshData2D(MeshPrimitive primitive,
std::
vector<UnsignedInt> indices, std:: vector<std:: vector<Vector2>> positions, std:: vector<std:: vector<Vector2>> textureCoords2D, std:: vector<std:: vector<Color4>> colors, const void* importerState = nullptr) explicit - Constructor.
- MeshData2D(const MeshData& other) deprecated in 2020.06
- Construct from MeshData.
- MeshData2D(const MeshData2D&) deleted
- Copying is not allowed.
- MeshData2D(MeshData2D&&) noexcept
- Move constructor.
Public functions
- auto operator=(const MeshData2D&) -> MeshData2D& deleted
- Copying is not allowed.
- auto operator=(MeshData2D&&) -> MeshData2D& noexcept
- Move assignment.
- auto primitive() const -> MeshPrimitive
- Primitive.
- auto isIndexed() const -> bool
- Whether the mesh is indexed.
-
auto indices() -> std::
vector<UnsignedInt>& - Indices.
-
auto indices() const -> const std::
vector<UnsignedInt>& - auto positionArrayCount() const -> UnsignedInt
- Count of position arrays.
-
auto positions(UnsignedInt id) -> std::
vector<Vector2>& - Positions.
-
auto positions(UnsignedInt id) const -> const std::
vector<Vector2>& - auto hasTextureCoords2D() const -> bool
- Whether the data contain any 2D texture coordinates.
- auto textureCoords2DArrayCount() const -> UnsignedInt
- Count of 2D texture coordinate arrays.
-
auto textureCoords2D(UnsignedInt id) -> std::
vector<Vector2>& - 2D texture coordinates
-
auto textureCoords2D(UnsignedInt id) const -> const std::
vector<Vector2>& - auto hasColors() const -> bool
- Whether the data contain any vertex colors.
- auto colorArrayCount() const -> UnsignedInt
- Count of color arrays.
-
auto colors(UnsignedInt id) -> std::
vector<Color4>& - Vertex colors.
-
auto colors(UnsignedInt id) const -> const std::
vector<Color4>& - auto importerState() const -> const void*
- Importer-specific state.
Function documentation
Magnum:: Trade:: MeshData2D:: MeshData2D(MeshPrimitive primitive,
std:: vector<UnsignedInt> indices,
std:: vector<std:: vector<Vector2>> positions,
std:: vector<std:: vector<Vector2>> textureCoords2D,
std:: vector<std:: vector<Color4>> colors,
const void* importerState = nullptr) explicit
Constructor.
Parameters | |
---|---|
primitive | Primitive |
indices | Index array or empty array, if the mesh is not indexed |
positions | Position arrays. At least one position array should be present. |
textureCoords2D | Two-dimensional texture coordinate arrays, if present |
colors | Vertex color arrays, if present |
importerState | Importer-specific state |
Magnum:: Trade:: MeshData2D:: MeshData2D(const MeshData& other)
Construct from MeshData.
std:: vector<UnsignedInt>& Magnum:: Trade:: MeshData2D:: indices()
Indices.
const std:: vector<UnsignedInt>& Magnum:: Trade:: MeshData2D:: indices() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MeshData2D:: positionArrayCount() const
Count of position arrays.
There is always at least one.
std:: vector<Vector2>& Magnum:: Trade:: MeshData2D:: positions(UnsignedInt id)
Positions.
Parameters | |
---|---|
id | Position array ID |
const std:: vector<Vector2>& Magnum:: Trade:: MeshData2D:: positions(UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std:: vector<Vector2>& Magnum:: Trade:: MeshData2D:: textureCoords2D(UnsignedInt id)
2D texture coordinates
Parameters | |
---|---|
id | Texture coordinate array ID |
const std:: vector<Vector2>& Magnum:: Trade:: MeshData2D:: textureCoords2D(UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std:: vector<Color4>& Magnum:: Trade:: MeshData2D:: colors(UnsignedInt id)
Vertex colors.
Parameters | |
---|---|
id | Vertex color array ID |
const std:: vector<Color4>& Magnum:: Trade:: MeshData2D:: colors(UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MeshData2D:: importerState() const
Importer-specific state.
See AbstractImporter::