|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
A renderer for looking at shapes: Camera, Settings, Image and Renderer, in namespace Render. More...
#include <atomic>#include <cstdint>#include <string>#include <vector>#include "EBGeometry_Array.hpp"#include "EBGeometry_BoundingVolumes.hpp"#include "EBGeometry_Expr.hpp"#include "EBGeometry_GPU.hpp"#include "EBGeometry_Ray.hpp"#include "EBGeometry_Vec.hpp"#include "EBGeometry_RenderImplem.hpp"

Go to the source code of this file.
Classes | |
| struct | EBGeometry::Render::Camera< T > |
| A camera orbiting a target point. More... | |
| struct | EBGeometry::Render::Settings< T > |
| What to render and how. A plain value; every field has a default. More... | |
| struct | EBGeometry::Render::Image |
| An image: width x height pixels, row by row from the top, each 0xRRGGBBAA. More... | |
| struct | EBGeometry::Render::Stats |
| What a render saw. More... | |
| struct | EBGeometry::Render::PixelResult |
| What PixelQuery computes for one pixel. More... | |
| struct | EBGeometry::Render::RenderDetail::StoredPixel |
| A pixel as a render stores it: PixelResult without the object, which is stored apart and only when asked for (Settings::m_recordPrimitives), so that a frame writes and copies 8 bytes per pixel. More... | |
| struct | EBGeometry::Render::RenderDetail::CameraView< T > |
| What every pixel needs from the camera, worked out once per frame: the eye, the view's axes and the field of view's slope. More... | |
| struct | EBGeometry::Render::PixelQuery< T, S > |
| One pixel of a rendered image: the functor that Renderer runs once per pixel index, on the host or through GPU::parallelFor(). More... | |
| class | EBGeometry::Render::Renderer< T > |
| Renders shapes into images. More... | |
Namespaces | |
| namespace | EBGeometry |
| Namespace containing all of EBGeometry's functionality. | |
Enumerations | |
| enum class | EBGeometry::Render::ColorBy : uint8_t { Uniform , Primitive , Normal } |
| How surfaces are colored. More... | |
| enum class | EBGeometry::Render::View : uint8_t { Front , Back , Right , Left , Top , Bottom , Default } |
| A direction to look at a box from, for Camera::fit(): along the axes of the plane perpendicular to the up axis (with the default up axis +y, Front looks from +z and Right from +x), or along the up axis. More... | |
Functions | |
| template<class T > | |
| std::string | EBGeometry::Render::toCode (const Camera< T > &a_camera, const Settings< T > &a_settings) |
| A camera and settings as C++ statements that recreate them, for pasting a view found by hand (in Render::view(), key C prints them) into a program. | |
| bool | EBGeometry::Render::writeImage (const Image &a_image, const std::string &a_filename) |
| Write an image to a file, as binary PPM (P6: 8 bits per channel, no alpha), which most image programs read. | |
Variables | |
| template<class S > | |
| constexpr bool | EBGeometry::Render::primitivesAreFaces = false |
| Whether a shape's primitives (HitT::m_primitive) are the faces of one object rather than objects: true for the mesh SDFs, whose primitive is a face of the mesh; false for every other shape: a Tape (whose primitives are its leaves), a fused composition and an analytic shape (one object, primitive 0), and a BVH union (a BVHUnion names its members, a BVHSmoothUnion 0). | |
| template<class T > | |
| constexpr bool | EBGeometry::Render::primitivesAreFaces< FlatMeshSDF< T > > = true |
| See primitivesAreFaces. | |
| template<class T , size_t K> | |
| constexpr bool | EBGeometry::Render::primitivesAreFaces< MeshSDF< T, K > > = true |
| See primitivesAreFaces. | |
| template<class T , size_t K, size_t W> | |
| constexpr bool | EBGeometry::Render::primitivesAreFaces< TriMeshSDF< T, K, W > > = true |
| See primitivesAreFaces. | |
A renderer for looking at shapes: Camera, Settings, Image and Renderer, in namespace Render.
Renders any shape (see isShape) into an image held in memory, by finding where each camera ray first crosses the surface (firstHit()) and shading it: diffuse and specular light from one direction, light from the sky, soft shadows and ambient occlusion, a floor under the shape, and a section plane that cuts the shape open. A surface the camera sees from inside the solid (a hole seen from within the material, or a mesh whose orientation is inverted) is tinted, so that it cannot be mistaken for an outside. Each pixel is computed by PixelQuery, a trivially copyable functor callable on a device, so Renderer::render() runs it on the host's threads and Renderer::renderOnDevice() runs the same functor through GPU::parallelFor(). Render::view() (EBGeometry_Viewer.hpp) shows a shape in an interactive window, rendered this way.
|
strong |
How surfaces are colored.
| Enumerator | |
|---|---|
| Uniform | One color (Settings::m_color) everywhere. |
| Primitive | A color per primitive: per leaf of a Tape, per face of a mesh SDF (see HitT::m_primitive); Settings::m_primitiveColors, then a built-in palette. |
| Normal | The surface normal's direction as a color (each component from -1 to 1 mapped to 0 to 1). |
|
strong |
A direction to look at a box from, for Camera::fit(): along the axes of the plane perpendicular to the up axis (with the default up axis +y, Front looks from +z and Right from +x), or along the up axis.
|
inline |
A camera and settings as C++ statements that recreate them, for pasting a view found by hand (in Render::view(), key C prints them) into a program.
Writes camera.m_... = ...; and settings.m_... = ...; for every field that differs from its default, after declarations of camera and settings; T is the precision's name in the code.
| T | Floating-point precision. |
| [in] | a_camera | Camera. |
| [in] | a_settings | Settings. |
|
inline |
Write an image to a file, as binary PPM (P6: 8 bits per channel, no alpha), which most image programs read.
| [in] | a_image | Image. |
| [in] | a_filename | File to write. |
|
inlineconstexpr |
Whether a shape's primitives (HitT::m_primitive) are the faces of one object rather than objects: true for the mesh SDFs, whose primitive is a face of the mesh; false for every other shape: a Tape (whose primitives are its leaves), a fused composition and an analytic shape (one object, primitive 0), and a BVH union (a BVHUnion names its members, a BVHSmoothUnion 0).
| S | Shape type. |
|
inlineconstexpr |
See primitivesAreFaces.
| T | Floating-point precision. |
|
inlineconstexpr |
See primitivesAreFaces.
| T | Floating-point precision. |
| K | Branching factor. |
|
inlineconstexpr |
See primitivesAreFaces.
| T | Floating-point precision. |
| K | Branching factor. |
| W | SIMD width. |