TAMSVIZ
Visualization and annotation tool for ROS
transform.cpp
1 // TAMSVIZ
2 // (c) 2020 Philipp Ruppel
3 
4 #include "transform.h"
5 
6 #include "../core/transformer.h"
7 #include "../core/workspace.h"
8 #include "axes.h"
9 #include "shapes.h"
10 
11 void TransformationsDisplay::renderSync(const RenderSyncContext &context) {
12  if (_watcher.changed(length(), radius())) {
13  _mesh_renderer = node()->create<InstancedMeshRenderer>(
14  std::make_shared<Mesh>(makeAxes(length(), radius(), 24)), material());
15  }
16  auto &transformer = LockScope()->document()->display()->transformer;
17  _mesh_renderer->clearInstances();
18  auto frames = transformer->list();
19  _frames.resize(frames.size());
20  for (size_t i = 0; i < frames.size(); i++) {
21  _frames[i].name(frames[i]);
22  if (auto frame = _frames[i].pose(transformer)) {
23  _mesh_renderer->addInstance(*frame);
24  }
25  }
26  MeshDisplayBase::renderSync(context);
27 }