|
Infinity Engine v0.6.20
C++ API Documentation
|
Complete 3D geometry definition with vertices, indices, and material partitioning. More...
#include <Mesh.hpp>
Public Member Functions | |
| Mesh () | |
| Default constructor. | |
| Mesh (const VertexBuffer &vertexBuffer, const IndexBuffer &indexBuffer, const Containers::Array< SubMesh > &subMeshes) | |
| Constructs a mesh from pre-built buffers and submeshes. | |
| Mesh (const Containers::Array< Math::Vector3 > &vertices, const Containers::Array< uint16_t > &indices, const Containers::Array< Math::Vector2 > &uvs, const Containers::Array< Math::Vector3 > &normals) | |
| Constructs a simple mesh from vertex/index arrays (16-bit indices). | |
| Mesh (const Containers::Array< Math::Vector3 > &vertices, const Containers::Array< uint32_t > &indices, const Containers::Array< Math::Vector2 > &uvs, const Containers::Array< Math::Vector3 > &normals) | |
| Constructs a simple mesh from vertex/index arrays (32-bit indices). | |
| Mesh (size_t nVertices, size_t n16bitIndices, size_t nUVs, size_t nNormals) | |
| Constructs a mesh with pre-allocated buffers. | |
| virtual | ~Mesh () |
| Destructor. | |
| std::unique_ptr< Core::Base > | clone () const override |
| const Infinity::Types::TypeID & | typeId () const override |
| Gets the TypeID for Mesh. | |
Public Member Functions inherited from Infinity::Types::Core::Data | |
| Data () | |
| Data (const Data &other) | |
| Data (Data &&other) | |
| Data & | operator= (const Data &other) |
| Data & | operator= (Data &&other) |
| virtual | ~Data () |
| Virtual destructor. | |
| bool | hasProperty (const std::string &key) const |
| template<typename T > | |
| void | setProperty (const std::string &key, T &&value) |
| Sets a typed property value. | |
| template<typename T > | |
| void | setProperty (const std::string &key, const T &value) |
| Sets a typed property value. | |
| void | setProperty (const std::string &key, PropertyValue &&value) |
| Sets a typed property value. | |
| const PropertyValue & | getProperty (const std::string &key) const |
| Gets a property value without type checking. | |
| template<typename T > | |
| const T & | getProperty (const std::string &key) const |
| Gets a typed property value. | |
| void | removeProperty (const std::string &key) |
Public Member Functions inherited from Infinity::Types::Core::Base | |
| virtual | ~Base () |
| Virtual destructor. | |
| virtual std::istream & | legibleDataRead (std::istream &in) override |
| Deserializes the object from a single-line text representation. | |
| virtual std::ostream & | legibleDataWrite (std::ostream &out) const override |
| Serializes the object to a single-line text representation. | |
Public Attributes | |
| VertexBuffer | vertexBuffer |
| Vertex attribute data for the mesh. | |
| IndexBuffer | indexBuffer |
| Index data defining primitive connectivity. | |
| Containers::Array< SubMesh > | subMeshes |
| Optional array of submeshes for multi-material rendering. | |
Public Attributes inherited from Infinity::Types::Core::Data | |
| std::unordered_map< std::string, PropertyValue > | properties |
| Property storage for arbitrary metadata. | |
Complete 3D geometry definition with vertices, indices, and material partitioning.
Mesh combines a VertexBuffer, IndexBuffer, and optional SubMesh array to represent complete 3D geometry ready for rendering. It serves as the fundamental geometric primitive in the Infinity Engine, supporting both simple single-material meshes and complex multi-material objects.
The mesh structure consists of:
Mesh provides several convenience constructors for common scenarios:
If no submeshes are specified, the entire mesh is treated as a single submesh using material index 0.
Common use cases:
Example usage:
| Infinity::Types::Rendering::Mesh::Mesh | ( | ) |
Default constructor.
Creates an empty mesh with no geometry.
| Infinity::Types::Rendering::Mesh::Mesh | ( | const VertexBuffer & | vertexBuffer, |
| const IndexBuffer & | indexBuffer, | ||
| const Containers::Array< SubMesh > & | subMeshes | ||
| ) |
Constructs a mesh from pre-built buffers and submeshes.
| vertexBuffer | Vertex attribute data. |
| indexBuffer | Index connectivity data. |
| subMeshes | Material partitioning (can be empty for single-material). |
| Infinity::Types::Rendering::Mesh::Mesh | ( | const Containers::Array< Math::Vector3 > & | vertices, |
| const Containers::Array< uint16_t > & | indices, | ||
| const Containers::Array< Math::Vector2 > & | uvs, | ||
| const Containers::Array< Math::Vector3 > & | normals | ||
| ) |
Constructs a simple mesh from vertex/index arrays (16-bit indices).
Convenience constructor for basic meshes. Creates a single-material mesh with positions, UVs, and normals.
| vertices | Vertex positions. |
| indices | 16-bit index array. |
| uvs | Texture coordinates. |
| normals | Normal vectors. |
| Infinity::Types::Rendering::Mesh::Mesh | ( | const Containers::Array< Math::Vector3 > & | vertices, |
| const Containers::Array< uint32_t > & | indices, | ||
| const Containers::Array< Math::Vector2 > & | uvs, | ||
| const Containers::Array< Math::Vector3 > & | normals | ||
| ) |
Constructs a simple mesh from vertex/index arrays (32-bit indices).
Convenience constructor for basic meshes with more than 65,535 vertices.
| vertices | Vertex positions. |
| indices | 32-bit index array. |
| uvs | Texture coordinates. |
| normals | Normal vectors. |
| Infinity::Types::Rendering::Mesh::Mesh | ( | size_t | nVertices, |
| size_t | n16bitIndices, | ||
| size_t | nUVs, | ||
| size_t | nNormals | ||
| ) |
Constructs a mesh with pre-allocated buffers.
Pre-allocates memory for procedural generation without initializing data. Useful for avoiding reallocations during mesh construction.
| nVertices | Number of vertices to allocate. |
| n16bitIndices | Number of 16-bit indices to allocate. |
| nUVs | Number of UV coordinates to allocate. |
| nNormals | Number of normals to allocate. |
|
virtual |
Destructor.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Data.
| IndexBuffer Infinity::Types::Rendering::Mesh::indexBuffer |
Index data defining primitive connectivity.
Defines how vertices are connected to form triangles, lines, or other primitives. Enables vertex sharing for memory efficiency.
| Containers::Array<SubMesh> Infinity::Types::Rendering::Mesh::subMeshes |
Optional array of submeshes for multi-material rendering.
Partitions the mesh into material-specific sections. If empty, the entire mesh uses material index 0 from the parent Renderable.
| VertexBuffer Infinity::Types::Rendering::Mesh::vertexBuffer |
Vertex attribute data for the mesh.
Contains positions, normals, UVs, colors, and tangents for all vertices. Not all attributes are required - populate only those needed for rendering.