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

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

#include "EBGeometry_Expr.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.

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.
 

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 lists them with what they change (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/6]

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() [2/6]

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() [3/6]

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() [4/6]

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() [5/6]

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() [6/6]

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.