5 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
7 #include <Inventor/nodes/SoUnits.h>
8 #include <Inventor/nodes/SoTransform.h>
9 #include <Inventor/nodes/SoMaterial.h>
16 units =
new SoUnits();
17 units->units = SoUnits::MILLIMETERS;
23 switch_->whichChild = SO_SWITCH_ALL;
34 auto& p = element.pose;
35 transform->translation.setValue(p.x, p.y, p.z);
36 transform->rotation.setValue(p.qx, p.qy, p.qz, p.qw);
37 transform->scaleFactor.setValue(element.scale.e0, element.scale.e1, element.scale.e2);
39 auto color = element.color;
40 const float conv = 1.0f / 255.0f;
41 SbColor coinColor(conv * color.r, conv * color.g, conv * color.b);
42 material->ambientColor.setValue(coinColor);
43 material->diffuseColor.setValue(coinColor);
44 material->transparency.setValue(1.0f - conv * color.a);
47 bool overrideMaterial = (element.flags & data::ElementFlags::OVERRIDE_MATERIAL);
48 material->setOverride(overrideMaterial);
53 std::unique_ptr<ElementVisualization> result(
createDerived());
54 update(element, result.get());