Renders shapes into images.
More...
#include <EBGeometry_Render.hpp>
|
| | Renderer (const Settings< T > &a_settings=Settings< T >()) noexcept |
| | Renderer with given settings.
|
| |
| Settings< T > & | settings () noexcept |
| | The settings.
|
| |
| const Settings< T > & | settings () const noexcept |
| | The settings.
|
| |
| template<class S > |
| Stats | render (const S &a_shape, const Camera< T > &a_camera, Image &a_image) const |
| | Render a shape on the host, on Settings::m_threads threads.
|
| |
| template<class S > |
| Stats | render (const S &a_shape, const Camera< T > &a_camera, Image &a_image, const std::atomic< bool > &a_cancel, std::atomic< uint32_t > *a_rowsDone=nullptr) const |
| | Render a shape on the host, stopping early when asked to (for an interactive viewer).
|
| |
| template<class S > |
| Stats | renderOnDevice (const S &a_deviceShape, const Camera< T > &a_camera, Image &a_image) const |
| | Render a shape through GPU::parallelFor(): in kernels in a CUDA or HIP build, in a host loop otherwise.
|
| |
| template<class S > |
| Stats | renderOnDevice (const S &a_deviceShape, const Camera< T > &a_camera, Image &a_image, const std::atomic< bool > &a_cancel, std::atomic< uint32_t > *a_rowsDone=nullptr) const |
| | Render a shape through GPU::parallelFor(), stopping early when asked to.
|
| |
| template<class S > |
| HitT< T > | pick (const S &a_shape, const Camera< T > &a_camera, T a_column, T a_row) const |
| | What the camera sees at a point of the image: the crossing of the ray through it with the shape, cut by the section plane as the render cuts it, so that it names what a render draws there.
|
| |
| template<class S > |
| std::vector< HitT< T > > | pickAll (const S &a_shape, const Camera< T > &a_camera, T a_column, T a_row) const |
| | Every crossing of the shape under a point of the image, front to back, cut by the section plane as the render cuts it: what a viewer steps through to pick a surface behind others.
|
| |
|
|
static constexpr uint32_t | MaxCrossings = 64 |
| | The most crossings one ray follows: in pickAll(), and in the views that look past the first surface (ViewMode::XRay, see-through primitives, a filled part).
|
| |
template<class T>
class EBGeometry::Render::Renderer< T >
Renders shapes into images.
Holds the settings; the shape and camera are given to each render. Use render() for a shape the host can evaluate and renderOnDevice() for a device view of one (see Tape::rebasedView()).
- Template Parameters
-
| T | Floating-point precision. |
◆ Renderer()
Renderer with given settings.
- Parameters
-
◆ pick()
template<class T >
template<class S >
What the camera sees at a point of the image: the crossing of the ray through it with the shape, cut by the section plane as the render cuts it, so that it names what a render draws there.
For picking in a viewer: HitT::m_primitive names the primitive (a tape's leaf, a mesh's face), and the point and normal where the ray meets it. The ray is the one through the point (a_column, a_row) of an image of the settings' size, with (0, 0) the top left corner of the top left pixel; a pixel's center is at half-integers. On the host.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_shape | Shape. |
| [in] | a_camera | Camera. |
| [in] | a_column | Distance from the image's left edge, in pixels. |
| [in] | a_row | Distance from its top edge, in pixels. |
- Returns
- The crossing, or a miss.
◆ pickAll()
template<class T >
template<class S >
Every crossing of the shape under a point of the image, front to back, cut by the section plane as the render cuts it: what a viewer steps through to pick a surface behind others.
The ray is pick()'s; hidden primitives (Settings::m_hidden) are listed too. At most MaxCrossings crossings are listed. On the host.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_shape | Shape. |
| [in] | a_camera | Camera. |
| [in] | a_column | Distance from the image's left edge, in pixels. |
| [in] | a_row | Distance from its top edge, in pixels. |
- Returns
- The crossings, nearest first; empty where the ray meets nothing.
◆ render() [1/2]
template<class T >
template<class S >
Render a shape on the host, on Settings::m_threads threads.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_shape | Shape. |
| [in] | a_camera | Camera. |
| [out] | a_image | The image, resized to the settings' size. |
- Returns
- What the render saw.
◆ render() [2/2]
template<class T >
template<class S >
Render a shape on the host, stopping early when asked to (for an interactive viewer).
As render(const S&, const Camera<T>&, Image&), but every thread checks a_cancel before each pixel, and the render returns as soon as the pixels being traced are done, with Stats::m_complete false and the pixels not reached left black. a_rowsDone, if given, counts the finished rows as they finish, so another thread can show the progress.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_shape | Shape. |
| [in] | a_camera | Camera. |
| [out] | a_image | The image, resized to the settings' size. |
| [in] | a_cancel | Set (from another thread) to stop the render. |
| [out] | a_rowsDone | Finished rows, or null. |
- Returns
- What the render saw.
◆ renderOnDevice() [1/2]
template<class T >
template<class S >
Render a shape through GPU::parallelFor(): in kernels in a CUDA or HIP build, in a host loop otherwise.
The image is rendered in one launch, into one buffer in device memory, which is copied back once at the end.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_deviceShape | The shape, as a view valid on the device. |
| [in] | a_camera | Camera. |
| [out] | a_image | The image, resized to the settings' size. |
- Returns
- What the render saw.
◆ renderOnDevice() [2/2]
template<class T >
template<class S >
| Stats EBGeometry::Render::Renderer< T >::renderOnDevice |
( |
const S & |
a_deviceShape, |
|
|
const Camera< T > & |
a_camera, |
|
|
Image & |
a_image, |
|
|
const std::atomic< bool > & |
a_cancel, |
|
|
std::atomic< uint32_t > * |
a_rowsDone = nullptr |
|
) |
| const |
|
inline |
Render a shape through GPU::parallelFor(), stopping early when asked to.
As renderOnDevice(const S&, const Camera<T>&, Image&), but the device's threads check a_cancel before each pixel, and the render returns soon after it is set, with Stats::m_complete false and the pixels not reached left black. a_rowsDone, if given, counts the rows as they finish, so another thread can show the progress (a row counts once its last pixel is done, possibly before some of its others). The flag reaches the device, and the count the host, through a thread the render starts, while the kernel runs.
- Template Parameters
-
| S | Shape type (see isShape). |
- Parameters
-
| [in] | a_deviceShape | The shape, as a view valid on the device. |
| [in] | a_camera | Camera. |
| [out] | a_image | The image, resized to the settings' size. |
| [in] | a_cancel | Set (from another thread) to stop the render. |
| [out] | a_rowsDone | Finished rows, or null. |
- Returns
- What the render saw.
◆ settings() [1/2]
The settings.
- Returns
- The settings.
◆ settings() [2/2]
The settings.
- Returns
- The settings, to change.
The documentation for this class was generated from the following file: