UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
path.hpp
1
2#ifndef UFO_VIZ_RENDERABLE_PATH_HPP
3#define UFO_VIZ_RENDERABLE_PATH_HPP
4
5// UFO
6#include <ufo/compute/compute.hpp>
7#include <ufo/plan/graph.hpp>
8#include <ufo/viz/renderable.hpp>
9#include <ufo/viz/renderable/renderable_trianglelist.hpp>
10#include <ufo/viz/renderable/triangulate.hpp>
11
12// STL
13#include <cstdio>
14
15namespace ufo
16{
18{
19 public:
20 RenderablePath(ufo::PlanPath<3, float> const& plan, ufo::Color color, float radius,
21 int segments, bool use_arrow = true, float arrow_head_height = 0.5f)
22 : triangle_list_(color), plan_(plan)
23 {
24 // TODO or should they all come with and load their own shader?
25
26 triangle_list_.triangles_ =
27 triangulate<Vertex>(plan_, radius, segments, use_arrow, arrow_head_height);
28 }
29
30 ~RenderablePath() override { release(); }
31
32 void init(WGPUDevice device, WGPUTextureFormat texture_format) override
33 {
34 triangle_list_.shader_module_ =
35 compute::loadShaderModule(device, UFOVIZ_SHADER_DIR "/render.wgsl");
36 if (nullptr == triangle_list_.shader_module_) {
37 std::printf("Could not load shader!\n");
38 exit(1);
39 }
40 triangle_list_.init(device);
41 }
42
43 void release() override
44 {
45 // TODO: Implement
46 }
47
48 void update(WGPUDevice device, WGPUCommandEncoder encoder,
49 WGPUTextureView render_texture, WGPUTextureView depth_texture,
50 Camera const& camera) override
51 {
52 triangle_list_.update(device, encoder, render_texture, depth_texture, camera);
53 }
54
55 void onGui() override
56 {
57 // TODO: Implement
58 }
59
60 [[nodiscard]] RenderablePath* clone() const override
61 {
62 return new RenderablePath(*this);
63 }
64
65 private:
66 RenderableTrianglelist triangle_list_;
67 ufo::PlanPath<3, float> plan_;
68};
69} // namespace ufo
70
71#endif // UFO_VIZ_RENDERABLE_PATH_HPP
Identifies any UFO color instantiation (Gray, Lab, Lch, Lrgb, Rgb).
Definition concepts.hpp:73
All vision-related classes and functions.
Definition cloud.hpp:49