Sparkle 0.0.1
Loading...
Searching...
No Matches
spk_collision_mesh_renderer_2d.hpp
1#pragma once
2
3#include "structure/engine/2d/spk_collision_mesh_2d.hpp"
4#include "structure/engine/2d/spk_component_2d.hpp"
5#include "structure/engine/2d/spk_entity_2d.hpp"
6#include "structure/graphics/painter/spk_mesh_painter.hpp"
7#include "structure/opengl/spk_uniform_buffer_object.hpp"
8
9namespace spk
10{
16 {
17 private:
21 struct Painter : public spk::MeshPainter<CollisionMesh2D>
22 {
23 private:
24 static spk::Lumina::Pipeline &_pipeline();
26 spk::OpenGL::UBO &_modelData;
27
28 public:
29 Painter();
30
31 void setTransform(const Transform2D &p_transform);
32 };
33
34 Transform2D::EditionContract _onOwnerTransformEditionContract;
35 Painter _painter;
36
37 void _onPaintEvent(spk::PaintEvent &p_event) override;
38
39 public:
44 explicit CollisionMeshRenderer2D(const std::wstring &p_name);
45
47 void start() override;
52 void setMesh(const CollisionMesh2D *p_mesh);
57 const CollisionMesh2D *mesh() const;
58 };
59}
Convex collision mesh built from 2D points.
Definition spk_collision_mesh_2d.hpp:21
const CollisionMesh2D * mesh() const
Returns the currently assigned collision mesh.
Definition spk_collision_mesh_renderer_2d.cpp:49
void start() override
Initializes the renderer and allocates GPU resources.
Definition spk_collision_mesh_renderer_2d.cpp:36
CollisionMeshRenderer2D(const std::wstring &p_name)
Creates a collision mesh renderer component.
Definition spk_collision_mesh_renderer_2d.cpp:31
void setMesh(const CollisionMesh2D *p_mesh)
Sets the collision mesh to render.
Definition spk_collision_mesh_renderer_2d.cpp:44
Component2D(const std::wstring &p_name)
Builds a 2D component with a name.
Definition spk_component_2d.cpp:9
Represents a drawable entity configured with pipeline attributes.
Definition spk_pipeline.hpp:324
Loads shader artifacts and orchestrates draw calls with strongly typed constants and attributes.
Definition spk_pipeline.hpp:38
Base painter that renders a mesh through a Lumina pipeline.
Definition spk_mesh_painter.hpp:24
Position, rotation, and scale component for 2D entities.
Definition spk_transform_2d.hpp:20
spk::ContractProvider::Contract EditionContract
Subscription contract type for transform edits.
Definition spk_transform_2d.hpp:23
Event emitted when a drawable region needs repainting.
Definition spk_paint_event.hpp:19