|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
A 3D model loaded from a file, with an optional texture. More...
#include <headers/guillaume/entities/mesh.hpp>


Classes | |
| class | Builder |
| Configures Mesh widgets and registers them in the scene's entity registry. More... | |
Public Member Functions | |
| ~Mesh (void) | |
| Destructor. | |
| Mesh & | setMeshPath (const std::string &meshPath) |
| Change the model to draw. | |
| Mesh & | setTexturePath (const std::string &texturePath) |
| Change the texture applied to the model. | |
| Mesh & | setFitSize (std::optional< float > size) |
| Scale the model so its longest side has this length. | |
| Public Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Mesh > | |
| EntityFiller (ComponentRegistry &componentRegistry) | |
| Create the entity, its listed components and its components::Hierarchy. | |
| virtual | ~EntityFiller (void)=default |
| Destroy the entity object; its components stay in the registry (see EntityRegistry::removeEntity). | |
| Public Member Functions inherited from guillaume::ecs::Entity | |
| Entity (void) | |
| Create an entity with a fresh identifier, an empty signature, no parent and no component. | |
| virtual | ~Entity (void)=default |
| Destroy the entity object. | |
| Entity::Identifier | getIdentifier (void) const noexcept |
| Get the identifier of the entity. | |
| Entity::Signature | getSignature (void) const noexcept |
| Get the set of component types the entity declares. | |
| void | setSignature (const Signature &signature) |
| Replace the signature of the entity. | |
| std::int32_t | getLayer (void) const noexcept |
| Get the depth of the entity in the tree. | |
| Entity & | setParent (std::shared_ptr< Entity > parent) |
| Attach the entity under another one, or detach it. | |
| std::vector< Identifier > | releaseComponents (void) |
| Drop the entity's place in the tree and all its components. | |
| std::shared_ptr< Entity > | getParent (void) const noexcept |
| Get the parent entity. | |
Static Public Member Functions | |
| template<typename... Arguments> | |
| static std::shared_ptr< Mesh > | create (Arguments &&...arguments) |
| Build a mesh without registering it in an entity registry. | |
| Static Public Member Functions inherited from guillaume::ecs::Entity | |
| template<InheritFromComponent... ComponentTypes> | |
| static Signature | getSignatureFromTypes (void) |
| Build the signature that has exactly the bits of the given component types. | |
Additional Inherited Members | |
| Public Types inherited from guillaume::ecs::Entity | |
| using | Identifier = std::size_t |
| The key under which an entity's components are stored. Systems and components refer to entities by this value. | |
| using | Signature = std::bitset<128> |
| A set of component types, one bit per type (bit position given by ComponentTypeId, MaxComponentTypes bits). | |
| Static Public Attributes inherited from guillaume::ecs::Entity | |
| static constexpr Identifier | InvalidIdentifier |
| "No entity": never the identifier of a real entity | |
| Protected Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Mesh > | |
| ComponentRegistry & | getComponentRegistry (void) |
| Get the registry that stores this entity's components. | |
| Protected Member Functions inherited from guillaume::ecs::Entity | |
| void | attachHierarchy (ComponentRegistry &componentRegistry) |
| Give the entity a components::Hierarchy in a registry and add that component to its signature. | |
| template<InheritFromComponent... ComponentTypes> | |
| void | setSignature (void) |
| Replace the signature by the one made of the given component types. | |
A 3D model loaded from a file, with an optional texture.
Mesh is a leaf widget: it has no children. Its state lives in components::Mesh (model path, texture path) and components::Transform. Each frame systems::MeasureMesh writes the width and height of the model's bounding box into components::Bound, in the Measure phase, and systems::MeshRender draws the model at the Transform pose, in the Render phase. The class itself holds no field.
Mesh::create(registry, meshPath) builds the same widget without registering it in an entity registry; call setTexturePath() afterwards to give it a texture.
Watch out: the Bound is overwritten every frame with the size of the model, so a mesh cannot be resized through its Bound.
|
inlinestatic |
Build a mesh without registering it in an entity registry.
The arguments are forwarded to the private constructor: (registry, meshPath). A mesh has no children to build.
| Arguments | The constructor argument types. |
| arguments | The constructor arguments, as listed above. |
Definition at line 148 of file mesh.hpp.

| Mesh & guillaume::entities::Mesh::setFitSize | ( | std::optional< float > | size | ) |
Scale the model so its longest side has this length.
| size | The length, in dp, or nothing to draw the model in its file's own units. |
Definition at line 104 of file mesh.cpp.


| Mesh & guillaume::entities::Mesh::setMeshPath | ( | const std::string & | meshPath | ) |
Change the model to draw.
The Bound follows at the next Measure phase.
| meshPath | The path of the new model file, written to components::Mesh. |
Definition at line 86 of file mesh.cpp.


| Mesh & guillaume::entities::Mesh::setTexturePath | ( | const std::string & | texturePath | ) |
Change the texture applied to the model.
| texturePath | The path of the new texture file, written to components::Mesh, or an empty string for the default material. |
Definition at line 95 of file mesh.cpp.

