23#include "guillaume/systems/arc_render.hpp"
28#include "guillaume/mesh_renderable.hpp"
67 const utility::graphic::PositionF center(
68 pose.getPosition().x + bound.getWidth() / 2.0f,
69 pose.getPosition().y - bound.getHeight() / 2.0f,
70 pose.getPosition().z);
72 utility::graphic::Mesh mesh(std::vector<utility::graphic::VertexF> {},
73 std::vector<uint32_t> {});
76 mesh, center, pose.getOrientation(), bound.getWidth() / 2.0f,
77 bound.getHeight() / 2.0f, arc.getThickness(), arc.getStartAngle(),
78 arc.getSweepAngle(), arc.getSegments(),
false, color);
82 if (mesh.getVertices().empty()) {
86 auto renderable = std::make_shared<MeshRenderable>(
87 std::vector<utility::graphic::Mesh> { mesh },
"mesh_material");
90 if (handle ==
nullptr) {
92 RenderHandle { _engine.createObject(renderable), renderable,
95 if (!_engine.updateObject(renderable, handle->objectId)) {
96 handle->objectId = _engine.createObject(renderable);
98 handle->renderable = renderable;
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
SystemFiller(Phase phase)
ComponentType & getComponent(const ecs::Entity::Identifier &entityIdentifier)
Get a component of an entity from the bound registry, to read or modify it.
bool requireComponent(const ecs::Entity::Identifier &entityIdentifier)
Tell whether an entity has a component, and log a warning naming the entity and the component when it...
void cleanup(void) override
Remove the engine objects of the entities that were not drawn this frame. Called once per frame after...
ArcRender(utility::Engine &engine)
Create the system in the Render phase.
void update(const ecs::Entity::Identifier &entityIdentifier) override
Rebuild the mesh of one arc and upload it, creating the engine object on the first frame.
void prepare(void) override
Mark every engine object as not drawn yet. Called once per frame before the entities are visited.
void insert(const ecs::Entity::Identifier &identifier, RenderHandle handle)
Store the handle of an entity, replacing the one it had.
void markAllUnused(void)
Clear the used flag of every handle. Call it from the system's prepare(), before any entity is drawn.
void removeUnused(utility::Engine &engine)
Remove from the engine, then from the map, every handle whose used flag is still false....
RenderHandle * find(const ecs::Entity::Identifier &identifier)
Look up the handle of an entity.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Rules. Every class here runs each frame on the entities that have the components it declares.
Mesh builders shared by the shape render systems.
void buildRingMesh(utility::graphic::Mesh &mesh, const utility::graphic::PositionF ¢er, const utility::graphic::OrientationF &orientation, float outerHalfWidth, float outerHalfHeight, float thickness, float startAngle, float sweepAngle, int segments, bool closed, const utility::graphic::Color32Bit &color)
Build a ring, or a part of one, as a strip of triangles.
What a render system remembers about the engine object it created for one entity.