TAMSVIZ
Visualization and annotation tool for ROS
renderer.h
1 // TAMSVIZ
2 // (c) 2020 Philipp Ruppel
3 
4 #pragma once
5 
6 #include "renderlist.h"
7 #include "uniformbuffer.h"
8 
9 class RenderTarget;
10 class Shader;
11 
12 class Renderer {
13  std::shared_ptr<Shader> default_shader, blend_shader;
14  std::vector<uint8_t> aligned_material_buffer;
15  UniformBuffer<CameraBlock> camera_uniform_buffer;
16  UniformBuffer<MaterialBlock> material_buffer;
17  UniformBuffer<LightArrayBlock> light_buffer;
18  std::vector<RenderCommand> _transparent, _opaque;
19  int buffer_alignment = -1;
20  Renderer(const Renderer &) = delete;
21  Renderer &operator=(const Renderer &) = delete;
22  void render(const RenderList &render_list,
23  const std::vector<RenderCommand> &commands, bool picking = false);
24  std::shared_ptr<Mesh> screen_quad;
25  void prepare(const CameraBlock &camera_block, const RenderList &render_list);
26 
27 public:
28  Renderer();
29  void render(RenderTarget &render_target, const CameraBlock &camera_block,
30  const RenderList &render_list);
31  struct PickResult {
32  uint32_t id = 0;
33  double depth = 0;
34  };
35  PickResult pick(RenderTarget &render_target, const CameraBlock &camera_block,
36  const RenderList &render_list, int x, int y);
37 };
Definition: shader.h:39