Visualization

The Ark visualization system allows you to send ark::gui::RendererLayer objects out to the renderer. This allows your pipeline to construct objects to be visualized, and these can then be rendered at a variety of destinations (C++ GUIs, web GUIs, videos, images, etc).

Please see the ark/gui/renderer_layer.rbuf for a full listing of all supported renderer layer objects.

The most common object is a ark::gui::Mesh3 object. This allows you to render triangles, quads, lines, or point clouds. The position_data and color_data fields map to GPU buffers. position_data can contain 2D or 3D data (depending on your needs) and color_data can contain a single color to apply to all points, or per-point color information.

Publishing Renderer Layers

You can publish renderer layers on any channel within the /gui/renderer_layers namespace and they will be picked up and displayed in all of the visualizers. Separating out renderer layers to different channels can allow you to enable/disable visualizations at the channel layer more easily.

If you need a number of layers to all be rendered as a set (ie, either all of them or none of them), you can publish them in an ark::gui::RendererLayerSet object within the /gui/renderer_layers namespace.

Rendering to Images

In addition to live rendering, it can be useful to take a RendererLayer and output it to an image. Use the ark::gui::render_to_image API contained within ark/gui/render_image .hh:

ark::gui::Mesh3 mesh;
mesh.type = ark::gui::MeshType::Points;
mesh.position_data = { 0, 0, 0, 
                      -5, 5, 0, 
                       5, 5, 0, 
                       -5, -5, 0,
                       5, -5, 0 };
mesh.color_data = {255, 0, 0, 255};

ark::gui::RendererLayer layer{.objects={mesh}};

ark::gui::render_to_jpeg("my_image.jpg", {layer});

This will produce a 1280x1280 image with five points (one in the center, and then in the four corners). The camera position can be customized; by default, it will be adjusted such that your scene fits entirely within the image.