EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
EBGeometry_Viewer.hpp File Reference

Render::view(): look at a shape in an interactive window. More...

#include <cstdint>
#include <vector>
#include "EBGeometry_ExplodedView.hpp"
#include "EBGeometry_Expr.hpp"
#include "EBGeometry_RegionNames.hpp"
#include "EBGeometry_RegionView.hpp"
#include "EBGeometry_Render.hpp"
#include "EBGeometry_ViewerImplem.hpp"
Include dependency graph for EBGeometry_Viewer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EBGeometry::Render::DomainShape< S >
 One domain's own shape, for the viewer's cost views of the domain shown alone (see view(const S&, Pool&, const Camera&, const Settings&, const RegionNames&, const std::vector<DomainShape<S>>&, int, char**)). More...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 

Functions

template<class S >
void EBGeometry::Render::view (const S &a_shape, int a_argc, char **a_argv)
 Look at a shape in a window, from a camera fitted to its box, with default settings.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, int a_argc, char **a_argv)
 Look at a shape in a window, from a given camera with given settings.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, const S &a_deviceShape, int a_argc, char **a_argv)
 Look at a shape in a window, rendering on the GPU through a device view of the shape, from a camera fitted to its box, with default settings.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, const S &a_deviceShape, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, int a_argc, char **a_argv)
 Look at a shape in a window, rendering on the GPU through a device view of the shape.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, Pool &a_pool, int a_argc, char **a_argv)
 Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a camera fitted to its box, with default settings.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, Pool &a_pool, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, int a_argc, char **a_argv)
 Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a given camera with given settings.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, const RegionNames &a_names, int a_argc, char **a_argv)
 Look at a shape in a window, from a given camera with given settings, naming its regions, materials, surfaces and surface groups as a_names does.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, Pool &a_pool, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, const RegionNames &a_names, int a_argc, char **a_argv)
 Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a given camera with given settings, naming its regions, materials, surfaces and surface groups as a_names does.
 
template<class S >
void EBGeometry::Render::view (const S &a_shape, Pool &a_pool, const Camera< ShapePrecision< S > > &a_camera, const Settings< ShapePrecision< S > > &a_settings, const RegionNames &a_names, const std::vector< DomainShape< S > > &a_domains, int a_argc, char **a_argv)
 Look at a shape that lives in a pool in a window, as view(const S&, Pool&, const Camera&, const Settings&, const RegionNames&, int, char**) does, with each domain's own shape for the cost views.
 

Detailed Description

Render::view(): look at a shape in an interactive window.

The window needs SDL2 and is compiled only when EBGEOMETRY_VIEWER_SDL2 is defined (make VIEWER=SDL2, or CMake -DEBGEOMETRY_VIEWER=SDL2, which also link SDL2). Without it, and whenever no window can or should open (a –no-view argument, no display, SDL failing to start), view() prints one line saying why and returns at once, so a program that calls it still runs unattended.

In the window, drag to orbit, drag with Ctrl held to pan, drag with the right button to move the light, scroll to zoom, and click to pick the object under the cursor; keys change the camera, the shading and a section plane. An overlay shows one menu of them at a time, with what they change (Tab steps through the menus, F1 to F6 show one, H hides it), they are printed when the window opens, and the user guide's table of the viewer's keys (Sec:ViewerKeys) describes them. While the camera moves the view is drawn as a quick preview, at a resolution adapted to keep it at a few tens of milliseconds; once the camera rests it is refined on a background thread, canceled as soon as the camera moves again. The window can be resized, and renders at its size in pixels (on a high-DPI display, more pixels than its size in screen units).

Author
Robert Marskar

Function Documentation

◆ view() [1/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
const RegionNames &  a_names,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape in a window, from a given camera with given settings, naming its regions, materials, surfaces and surface groups as a_names does.

See view(const S&, int, char**). For a view of regions (RegionView), the status lines name the picked piece of surface, and a panel at the top left, shown with every menu, lists the domains, the regions and the active domain's groups by these names.

Template Parameters
SShape type (see isShape).
Parameters
[in]a_shapeShape, valid on the host.
[in]a_cameraInitial camera.
[in]a_settingsSettings.
[in]a_namesThe names (RegionNames(index) of the expression's index).
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [2/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape in a window, from a given camera with given settings.

See view(const S&, int, char**). The settings' size is the window's when it opens; the window then renders at its own size in pixels, which a resize changes.

Template Parameters
SShape type (see isShape).
Parameters
[in]a_shapeShape, valid on the host.
[in]a_cameraInitial camera (R returns to it).
[in]a_settingsSettings.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [3/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
const S &  a_deviceShape,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape in a window, rendering on the GPU through a device view of the shape.

See view(const S&, int, char**). Renders through Renderer::renderOnDevice() when a device is present, and G switches to the host and back.

Template Parameters
SShape type (see isShape).
Parameters
[in]a_shapeShape, valid on the host.
[in]a_deviceShapeThe same shape, as a view valid on the device (see Tape::rebasedView()).
[in]a_cameraInitial camera.
[in]a_settingsSettings.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [4/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
const S &  a_deviceShape,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape in a window, rendering on the GPU through a device view of the shape, from a camera fitted to its box, with default settings.

See view(const S&, int, char**). Renders through Renderer::renderOnDevice() when a device is present, and G switches to the host and back.

Template Parameters
SShape type (see isShape).
Parameters
[in]a_shapeShape, valid on the host.
[in]a_deviceShapeThe same shape, as a view valid on the device (see Tape::rebasedView()).
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [5/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape in a window, from a camera fitted to its box, with default settings.

Opens no window (and returns at once, after printing why) when the program was built without EBGEOMETRY_VIEWER_SDL2, when a_argv holds "--no-view", when there is no display, or when SDL cannot start. A shape whose box is unbounded is looked at from the default camera. Returns when the window is closed.

Template Parameters
SShape type (see isShape).
Parameters
[in]a_shapeShape, valid on the host.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [6/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
Pool &  a_pool,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
const RegionNames &  a_names,
const std::vector< DomainShape< S > > &  a_domains,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape that lives in a pool in a window, as view(const S&, Pool&, const Camera&, const Settings&, const RegionNames&, int, char**) does, with each domain's own shape for the cost views.

With the active domain shown alone (its regions shown, every other hidden, as its Only button leaves them), the cost views trace that domain's own shape, showing its regions and passing through the regions kept around them: each pixel's ray stops at the first surface of one of the domain's regions, on the domain's own tape, as a solver of the domain finds a subdomain's surface (Tape::firstSurface()), so the cost shown is what that solver pays for it. Otherwise they time the whole object's tape, as without the domains' shapes. The window shows and hides regions 1 to 63 only: a domain is shown alone when those match its regions, and a domain whose own shape has more than 64 regions (the background included) is timed as the whole object.

Template Parameters
SShape type: a view of regions (RegionView), with rebasedView(const Pool&).
Parameters
[in]a_shapeThe shape, valid on the host.
[in,out]a_poolThe pool a_shape and the domains' shapes live in.
[in]a_cameraInitial camera.
[in]a_settingsSettings.
[in]a_namesThe names (RegionNames(index) of the expression's index).
[in]a_domainsEach domain's own shape, in the order of a_names' domains; fewer (or none) leave the rest without.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [7/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
Pool &  a_pool,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
const RegionNames &  a_names,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a given camera with given settings, naming its regions, materials, surfaces and surface groups as a_names does.

See view(const S&, Pool&, int, char**) and view(const S&, const Camera&, const Settings&, const RegionNames&, int, char**).

Template Parameters
SShape type (see isShape), with rebasedView(const Pool&).
Parameters
[in]a_shapeThe shape, valid on the host.
[in,out]a_poolThe pool a_shape lives in.
[in]a_cameraInitial camera.
[in]a_settingsSettings.
[in]a_namesThe names (RegionNames(index) of the expression's index).
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [8/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
Pool &  a_pool,
const Camera< ShapePrecision< S > > &  a_camera,
const Settings< ShapePrecision< S > > &  a_settings,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a given camera with given settings.

See view(const S&, Pool&, int, char**).

Template Parameters
SShape type (see isShape), with rebasedView(const Pool&).
Parameters
[in]a_shapeThe shape, valid on the host.
[in,out]a_poolThe pool a_shape lives in.
[in]a_cameraInitial camera.
[in]a_settingsSettings.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.

◆ view() [9/9]

template<class S >
void EBGeometry::Render::view ( const S &  a_shape,
Pool &  a_pool,
int  a_argc,
char **  a_argv 
)
inline

Look at a shape that lives in a pool in a window, rendering on the GPU in a GPU build, from a camera fitted to its box, with default settings.

See view(const S&, int, char**). In a CUDA or HIP build with a visible device, unless the window is not to open (built without EBGEOMETRY_VIEWER_SDL2, –no-view, no display), the pool is frozen (if it is not already) and mirrored into GPU::memoryResource() before the window opens, the mirror kept until it closes, and the window renders through a_shape.rebasedView() onto the mirror (G switches to the host and back); should SDL then fail to open the window, the pool stays frozen. Otherwise the window renders on the host, and the pool is left as it is.

Template Parameters
SShape type (see isShape), with rebasedView(const Pool&) (a Tape, a BVH union, a mesh SDF).
Parameters
[in]a_shapeThe shape, valid on the host.
[in,out]a_poolThe pool a_shape lives in.
[in]a_argcThe program's argument count.
[in]a_argvThe program's arguments.