25#include "guillaume/entities/mesh.hpp"
26#include "guillaume/entities/builder_base.hpp"
31 Mesh::Mesh::Builder::Builder(ecs::ComponentRegistry &componentRegistry,
32 ecs::EntityRegistry &entityRegistry)
41 entity->setMeshPath(_meshPath);
42 entity->setTexturePath(_texturePath);
61 _texturePath = texturePath;
67 const std::string &meshPath,
68 const std::string &texturePath)
71 .withTexturePath(texturePath)
72 .registerEntity(parent);
A 3D model shown at the entity's pose: the model file and an optional texture.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
ComponentType & getComponent(const Entity::Identifier &entityIdentifier)
Get a component of an entity, to read or modify it.
ComponentRegistry & getComponentRegistry(void)
Get the registry in which the builder creates components.
EntityFiller(ComponentRegistry &componentRegistry)
ComponentRegistry & getComponentRegistry(void)
Entity::Identifier getIdentifier(void) const noexcept
Get the identifier of the entity.
Base of every widget Builder: turns a configuration into a widget that is attached to a parent and ow...
Configures Mesh widgets and registers them in the scene's entity registry.
std::shared_ptr< Mesh > makeMesh(std::shared_ptr< Entity > parent, const std::string &meshPath, const std::string &texturePath="")
Build a mesh, register it under parent and reset the builder.
void reset(void) override
Restore the defaults: empty model path and empty texture path.
Builder & withMeshPath(const std::string &meshPath)
Choose the model to draw.
std::shared_ptr< Mesh > buildEntity(void) override
Build a mesh from the current configuration, without registering it or giving it a parent.
Builder & withTexturePath(const std::string &texturePath)
Choose the texture applied to the model.
A 3D model loaded from a file, with an optional texture.
Mesh & setMeshPath(const std::string &meshPath)
Change the model to draw.
Mesh & setTexturePath(const std::string &texturePath)
Change the texture applied to the model.
static std::shared_ptr< Mesh > create(Arguments &&...arguments)
Build a mesh without registering it in an entity registry.
Mesh & setFitSize(std::optional< float > size)
Scale the model so its longest side has this length.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Widgets: the classes used to create entities with the right components and children.