EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_Render.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
22#ifndef EBGEOMETRY_RENDER_HPP
23#define EBGEOMETRY_RENDER_HPP
24
25// Std includes
26#include <atomic>
27#include <cstdint>
28#include <string>
29#include <vector>
30
31// Our includes
32#include "EBGeometry_Array.hpp"
34#include "EBGeometry_Expr.hpp"
35#include "EBGeometry_GPU.hpp"
36#include "EBGeometry_Ray.hpp"
38#include "EBGeometry_Vec.hpp"
39
40namespace EBGeometry {
41
42template <class T>
43class FlatMeshSDF;
44
45template <class T, size_t K>
46class MeshSDF;
47
48template <class T, size_t K, size_t W>
49class TriMeshSDF;
50
51} // namespace EBGeometry
52
53namespace EBGeometry::Render {
54
62template <class S>
63inline constexpr bool primitivesAreFaces = false;
64
69template <class T>
70inline constexpr bool primitivesAreFaces<FlatMeshSDF<T>> = true;
71
77template <class T, size_t K>
78inline constexpr bool primitivesAreFaces<MeshSDF<T, K>> = true;
79
86template <class T, size_t K, size_t W>
87inline constexpr bool primitivesAreFaces<TriMeshSDF<T, K, W>> = true;
88
92enum class ColorBy : uint8_t
93{
94 Uniform,
95 Primitive,
97 Normal
98};
99
103enum class ViewMode : uint8_t
104{
105 Shaded,
106 Depth,
108 XRay,
109 CostHit,
113};
114
118enum class CostUnit : uint8_t
119{
120 None,
122 Cycles
125};
126
130enum class Backdrop : uint8_t
131{
132 Sky,
133 Plain,
134 Gradient,
135 Vignette
136};
137
141enum class FloorStyle : uint8_t
142{
143 Checker,
144 Grid,
146 Plain,
147 ShadowOnly,
148 Mirror
150};
151
155enum class Look : uint8_t
156{
157 Sky,
158 Dark,
159 Gradient,
160 ShadowOnly,
161 LightGrid,
162 Studio,
163 Mirror,
164 DarkGrid,
165 Blueprint
166};
167
171inline constexpr uint8_t NumLooks = 9;
172
180inline const char*
181lookName(Look a_look) noexcept;
182
187enum class View : uint8_t
188{
189 Front,
190 Back,
191 Right,
192 Left,
193 Top,
194 Bottom,
195 Default
196};
197
206template <class T>
207struct Camera
208{
213
217 T m_yaw = T(35);
218
222 T m_pitch = T(25);
223
227 T m_distance = T(4);
228
232 T m_fieldOfView = T(40);
233
237 Vec3T<T> m_up = Vec3T<T>(T(0), T(1), T(0));
238
246 bool m_orthographic = false;
247
251 T m_nearClip = T(0);
252
261 [[nodiscard]] EBGEOMETRY_HOST
262 static inline Camera
263 fit(const BoundingVolumes::AABBT<T>& a_box, const Vec3T<T>& a_up = Vec3T<T>(T(0), T(1), T(0)));
264
273 [[nodiscard]] EBGEOMETRY_HOST
274 static inline Camera
275 fit(const BoundingVolumes::AABBT<T>& a_box, View a_view, const Vec3T<T>& a_up = Vec3T<T>(T(0), T(1), T(0)));
276
285 [[nodiscard]] EBGEOMETRY_HOST
286 static inline Camera
287 lookAt(const Vec3T<T>& a_eye,
288 const Vec3T<T>& a_target,
289 const Vec3T<T>& a_up = Vec3T<T>(T(0), T(1), T(0)),
290 const T a_fieldOfView = T(40));
291
296 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
297 inline Vec3T<T>
298 eye() const noexcept;
299
307 inline void
308 frame(Vec3T<T>& a_forward, Vec3T<T>& a_right, Vec3T<T>& a_up) const noexcept;
309
317 inline void
318 horizontal(Vec3T<T>& a_first, Vec3T<T>& a_second) const noexcept;
319};
320
325template <class T>
327{
331 uint32_t m_width = 960;
332
336 uint32_t m_height = 960;
337
341 uint32_t m_supersampling = 2;
342
346 uint32_t m_threads = 0;
347
351 bool m_shadows = true;
352
356 bool m_occlusion = true;
357
362 bool m_floor = true;
363
367 Backdrop m_backdrop = Backdrop::Sky;
368
372 ColorBy m_colorBy = ColorBy::Normal;
373
377 Vec3T<T> m_color = Vec3T<T>(T(0.80), T(0.42), T(0.18));
378
382 static constexpr uint32_t PrimitiveColors = 16;
383
389 Array<Vec3T<T>, PrimitiveColors> m_primitiveColors = unsetColors();
390
396 Array<Vec3T<T>, PrimitiveColors> m_materialColors = unsetColors();
397
402 bool m_recordPrimitives = false;
403
407 static constexpr uint32_t NoPrimitive = 0xFFFFFFFFU;
408
412 static constexpr uint32_t AllPrimitives = 0xFFFFFFFEU;
413
418 uint32_t m_highlightPrimitive = NoPrimitive;
419
424 uint32_t m_highlightCount = 1U;
425
431 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
432 inline bool
433 isHighlighted(const uint32_t a_primitive) const noexcept
434 {
435 // A surface with no key is never the highlighted one, whatever the range.
436 return a_primitive != NoPrimitive &&
437 ((a_primitive - m_highlightPrimitive < m_highlightCount && m_highlightPrimitive != NoPrimitive) ||
438 m_highlightPrimitive == AllPrimitives);
439 }
440
444 Vec3T<T> m_highlightColor = Vec3T<T>(T(1.0), T(0.72), T(0.10));
445
449 Vec3T<T> m_insideColor = Vec3T<T>(T(0.90), T(0.08), T(0.08));
450
455 Vec3T<T> m_cutColor = Vec3T<T>(T(0.95), T(0.86), T(0.50));
456
461 T m_cutOpacity = T(1);
462
469 T m_seenThroughOpacity = T(0.3);
470
477 T m_ghostOpacity = T(0);
478
482 Vec3T<T> m_floorColor = Vec3T<T>(T(0.58), T(0.59), T(0.61));
483
489 bool m_lightFromCamera = true;
490
495 Vec3T<T> m_light = Vec3T<T>(T(-0.45), T(0.75), T(0.55));
496
500 T m_lightIntensity = T(1.05);
501
505 T m_ambient = T(0.35);
506
515 T m_fillIntensity = T(0.35);
516
525 T m_shoulder = T(0.8);
526
530 T m_specular = T(0.45);
531
536 T m_shininess = T(32);
537
541 Vec3T<T> m_skyHorizon = Vec3T<T>(T(0.82), T(0.84), T(0.88));
542
546 Vec3T<T> m_skyZenith = Vec3T<T>(T(0.32), T(0.45), T(0.66));
547
551 Vec3T<T> m_background = Vec3T<T>(T(0.16), T(0.17), T(0.19));
552
556 Vec3T<T> m_gradientFrom = Vec3T<T>(T(0.40), T(0.50), T(0.68));
557
561 Vec3T<T> m_gradientTo = Vec3T<T>(T(0.93), T(0.95), T(0.97));
562
566 FloorStyle m_floorStyle = FloorStyle::Checker;
567
572 T m_floorCellSize = T(0);
573
577 Vec3T<T> m_floorLineColor = Vec3T<T>(T(0.40), T(0.43), T(0.49));
578
582 uint32_t m_floorMajorEvery = 4;
583
588 T m_floorFade = T(6);
589
594 T m_floorReflectance = T(0.5);
595
601 T m_lightSize = T(0.04);
602
606 bool m_section = false;
607
611 Vec3T<T> m_sectionPoint = Vec3T<T>::zeros();
612
616 Vec3T<T> m_sectionNormal = Vec3T<T>(T(0), T(0), T(1));
617
622 T m_contourWidth = T(3.5);
623
627 Vec3T<T> m_contourColor = Vec3T<T>(T(0.04), T(0.04), T(0.05));
628
635 T m_isoSpacing = T(0);
636
641 Vec3T<T> m_isoColor = Vec3T<T>(T(0.10), T(0.11), T(0.13));
642
647 Vec3T<T> m_isoSecondaryColor = Vec3T<T>(T(0.60), T(0.12), T(0.10));
648
653 bool m_isoSecondary = false;
654
659 T m_sheetOpacity = T(0.35);
660
668 T m_sectionFill = T(1);
669
674 bool m_sectionFillOutside = true;
675
680 Vec3T<T> m_fillSecondaryColor = Vec3T<T>(T(0.45), T(0.45), T(0.47));
681
685 Vec3T<T> m_sheetColor = Vec3T<T>(T(0.95), T(0.96), T(0.97));
686
690 Vec3T<T> m_sheetEdgeColor = Vec3T<T>(T(0.45), T(0.47), T(0.50));
691
697
701 ViewMode m_viewMode = ViewMode::Shaded;
702
707 T m_xrayOpacity = T(0.25);
708
712 static constexpr uint32_t HiddenPrimitives = 8;
713
719 Array<uint32_t, HiddenPrimitives> m_hidden = noneHidden();
720
729 uint32_t m_peel = 0;
730
736 uint32_t m_volumePrimitive = NoPrimitive;
737
741 Vec3T<T> m_volumeColor = Vec3T<T>(T(0.10), T(0.75), T(1.0));
742
749
753 T m_volumeOpacity = T(0.7);
754
759 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
760 static inline Array<Vec3T<T>, PrimitiveColors>
761 unsetColors() noexcept;
762
767 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
768 static inline Array<uint32_t, HiddenPrimitives>
769 noneHidden() noexcept;
770
776 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
777 inline bool
778 hides(uint32_t a_primitive) const noexcept;
779
784 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
785 inline bool
786 hidesAny() const noexcept;
787};
788
799template <class T>
801inline void
802setLook(Settings<T>& a_settings, Look a_look) noexcept;
803
814template <class T>
815[[nodiscard]] EBGEOMETRY_HOST
816inline std::string
817toCode(const Camera<T>& a_camera, const Settings<T>& a_settings);
818
822struct Image
823{
827 uint32_t m_width = 0;
828
832 uint32_t m_height = 0;
833
837 std::vector<uint32_t> m_pixels;
838
844 std::vector<uint32_t> m_primitives;
845
852 [[nodiscard]] inline uint32_t
853 at(const uint32_t a_column, const uint32_t a_row) const noexcept;
854};
855
863[[nodiscard]] inline bool
864writeImage(const Image& a_image, const std::string& a_filename);
865
869struct Stats
870{
874 uint64_t m_rays = 0;
875
879 uint64_t m_hits = 0;
880
884 uint64_t m_insideHits = 0;
885
889 uint64_t m_unresolved = 0;
890
894 bool m_cameraInside = false;
895
899 bool m_complete = true;
900
905 CostUnit m_costUnit = CostUnit::None;
906
917 double m_costLow = 0.0;
918
923 double m_costHigh = 0.0;
924
932 double m_raysPerSecond = 0.0;
933};
934
943[[nodiscard]] inline double
944costPlace(const Stats& a_stats, double a_cost) noexcept;
945
951[[nodiscard]] inline uint32_t
952costColor(double a_place) noexcept;
953
958{
962 uint32_t m_rgba = 0;
963
967 uint8_t m_hits = 0;
968
972 uint8_t m_insideHits = 0;
973
977 uint8_t m_unresolved = 0;
978
982 uint8_t m_cameraInside = 0;
983
987 uint32_t m_primitive = 0xFFFFFFFFU;
988};
989
990namespace RenderDetail {
991
998{
1002 uint32_t m_rgba = 0;
1003
1007 uint8_t m_hits = 0;
1008
1012 uint8_t m_insideHits = 0;
1013
1017 uint8_t m_unresolved = 0;
1018
1022 uint8_t m_cameraInside = 0;
1023
1029 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
1030 static inline StoredPixel
1031 of(const PixelResult& a_result) noexcept
1032 {
1033 return StoredPixel{
1034 a_result.m_rgba, a_result.m_hits, a_result.m_insideHits, a_result.m_unresolved, a_result.m_cameraInside};
1035 }
1036};
1037
1046template <class T>
1110
1111} // namespace RenderDetail
1112
1123template <class T, class S>
1125{
1130
1135
1140
1145
1153 inline PixelQuery(const S& a_shape, const Camera<T>& a_camera, const Settings<T>& a_settings) noexcept;
1154
1160 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
1161 inline PixelResult
1162 operator()(const uint32_t& a_index) const noexcept;
1163};
1164
1171template <class T>
1173{
1174public:
1179 explicit Renderer(const Settings<T>& a_settings = Settings<T>()) noexcept;
1180
1185 [[nodiscard]] inline Settings<T>&
1186 settings() noexcept;
1187
1192 [[nodiscard]] inline const Settings<T>&
1193 settings() const noexcept;
1194
1203 template <class S>
1204 inline Stats
1205 render(const S& a_shape, const Camera<T>& a_camera, Image& a_image) const;
1206
1221 template <class S>
1222 inline Stats
1223 render(const S& a_shape,
1224 const Camera<T>& a_camera,
1225 Image& a_image,
1226 const std::atomic<bool>& a_cancel,
1227 std::atomic<uint32_t>* a_rowsDone = nullptr) const;
1228
1240 template <class S>
1241 inline Stats
1242 renderOnDevice(const S& a_deviceShape, const Camera<T>& a_camera, Image& a_image) const;
1243
1259 template <class S>
1260 inline Stats
1261 renderOnDevice(const S& a_deviceShape,
1262 const Camera<T>& a_camera,
1263 Image& a_image,
1264 const std::atomic<bool>& a_cancel,
1265 std::atomic<uint32_t>* a_rowsDone = nullptr) const;
1266
1281 template <class S>
1282 [[nodiscard]] inline HitT<T>
1283 pick(const S& a_shape, const Camera<T>& a_camera, T a_column, T a_row) const;
1284
1297 template <class S>
1298 [[nodiscard]] inline std::vector<HitT<T>>
1299 pickAll(const S& a_shape, const Camera<T>& a_camera, T a_column, T a_row) const;
1300
1305 static constexpr uint32_t MaxCrossings = 64;
1306
1307private:
1311 Settings<T> m_settings;
1312
1317 inline void
1318 check(const Camera<T>& a_camera) const;
1319
1325 [[nodiscard]] inline bool
1326 inspecting() const noexcept;
1327
1338 inline Stats
1339 collect(const std::vector<RenderDetail::StoredPixel>& a_results,
1340 std::vector<uint32_t>& a_primitives,
1341 Image& a_image,
1342 CostUnit a_unit,
1343 double a_seconds) const;
1344
1354 template <class Q>
1355 inline Stats
1356 renderOnHost(const Q& a_query,
1357 Image& a_image,
1358 const std::atomic<bool>& a_cancel,
1359 std::atomic<uint32_t>* a_rowsDone) const;
1360
1371 template <class S>
1372 inline Stats
1373 renderFrameOnDevice(const S& a_deviceShape,
1374 const Camera<T>& a_camera,
1375 Image& a_image,
1376 const std::atomic<bool>* a_cancel,
1377 std::atomic<uint32_t>* a_rowsDone) const;
1378
1388 template <class Q>
1389 inline Stats
1390 renderFrameWith(const Q& a_query,
1391 Image& a_image,
1392 const std::atomic<bool>* a_cancel,
1393 std::atomic<uint32_t>* a_rowsDone) const;
1394};
1395
1396} // namespace EBGeometry::Render
1397
1398#include "EBGeometry_RenderImplem.hpp"
1399
1400#endif
A fixed-size array that compiles for both host and device.
Declarations of bounding volume types used in bounding volume hierarchies.
The tape's front end: Expr, a host-side value that describes a composed object, and the free function...
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
Ray queries on any shape: where a ray, or the segment between two points, first crosses its surface (...
RegionSettings: how the regions of an object are shown (visibility, coloring, a domain's surface grou...
uint32_t costColor(double a_place) noexcept
The color a cost view gives a place on its scale, dark (0) to bright (1), as it colors the pixels.
const char * lookName(Look a_look) noexcept
A look's name, as the .ebg view block writes it: "sky", "dark", "gradient", "shadow_only",...
double costPlace(const Stats &a_stats, double a_cost) noexcept
Where a cost sits on a cost view's color scale: 0 at a_stats.m_costLow, 1 at a_stats....
Backdrop
What is drawn behind the shape, where a camera ray hits nothing (Settings::m_backdrop).
Definition EBGeometry_Render.hpp:131
@ Sky
Settings::m_skyHorizon to Settings::m_skyZenith by the ray's elevation above the horizon.
@ Plain
Settings::m_background.
@ Gradient
Settings::m_gradientFrom at the top of the view to Settings::m_gradientTo at its bottom.
@ Vignette
Settings::m_gradientFrom at the center of the view to Settings::m_gradientTo at its corners.
bool 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...
CostUnit
What the costs of a cost view count (Stats::m_costLow, Stats::m_costHigh).
Definition EBGeometry_Render.hpp:119
@ Nanoseconds
On the host: each pixel's own ray, timed with the steady clock.
ViewMode
What a render shows at each pixel.
Definition EBGeometry_Render.hpp:104
@ CostCrossing
What each pixel's firstCrossing() cost, as CostHit.
@ Shaded
Lit surfaces, colored by Settings::m_colorBy.
@ XRay
On black, every surface a ray crosses glows faintly (more seen edge-on), with modest highlights.
constexpr uint8_t NumLooks
How many looks there are (Look's values are 0 to NumLooks - 1).
Definition EBGeometry_Render.hpp:171
constexpr bool primitivesAreFaces
Whether a shape's primitives (HitT::m_primitive) are the faces of one object rather than objects: tru...
Definition EBGeometry_Render.hpp:63
Look
Named combinations of the backdrop and the floor (see setLook()).
Definition EBGeometry_Render.hpp:156
@ Studio
A seamless white backdrop with a very soft shadow, as in product renderings.
@ Dark
A plain dark background and the checkered floor.
@ DarkGrid
A dark gray gradient and a faint grid.
@ LightGrid
A light gradient and a pale floor with a grid.
@ Blueprint
Navy, with light grid lines.
FloorStyle
How the floor under the shape is drawn, when there is one (Settings::m_floor, Settings::m_floorStyle)...
Definition EBGeometry_Render.hpp:142
@ Checker
Squares of side Settings::m_floorCellSize in Settings::m_floorColor, every second a little darker.
@ ShadowOnly
The backdrop, darkened where the shape shadows it: no floor is seen, only the shape's shadow.
View
A direction to look at a box from, for Camera::fit(): along the axes of the plane perpendicular to th...
Definition EBGeometry_Render.hpp:188
@ Back
Yaw 180, pitch 0.
@ Bottom
Pitch -90: straight up the up axis.
@ Front
Yaw 0, pitch 0.
@ Default
The default yaw (35) and pitch (25), from above at an angle.
@ Right
Yaw 90, pitch 0.
@ Left
Yaw -90, pitch 0.
@ Top
Pitch 90: straight down the up axis.
ColorBy
How surfaces are colored.
Definition EBGeometry_Render.hpp:93
@ Normal
The surface normal's direction as a color (each component from -1 to 1 mapped to 0 to 1).
@ Uniform
One color (Settings::m_color) everywhere.
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:37
Renders shapes into images.
Definition EBGeometry_Render.hpp:1173
Renderer(const Settings< T > &a_settings=Settings< T >()) noexcept
Renderer with given settings.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
static constexpr Vec3T< T > zeros() noexcept
Return a vector with x = y = z = 0.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
@ None
As written: the tape evaluates every operand, however many there are.
Fixed-size array with host- and device-callable members.
Definition EBGeometry_Array.hpp:33
Where a ray first crosses a surface.
Definition EBGeometry_Ray.hpp:98
How a query marches, where a shape has no ray form.
Definition EBGeometry_Ray.hpp:203
How the regions of an object are shown (see RegionView): which regions are visible,...
Definition EBGeometry_RegionSettings.hpp:66
A camera orbiting a target point.
Definition EBGeometry_Render.hpp:208
T m_fieldOfView
Vertical field of view, in degrees.
Definition EBGeometry_Render.hpp:232
void frame(Vec3T< T > &a_forward, Vec3T< T > &a_right, Vec3T< T > &a_up) const noexcept
The camera's frame: unit vectors forward (towards the target), right and up on the screen.
T m_distance
Distance from the eye to the target.
Definition EBGeometry_Render.hpp:227
bool m_orthographic
Parallel rays instead of rays from the eye: no perspective, so sizes do not shrink with distance.
Definition EBGeometry_Render.hpp:246
Vec3T< T > m_target
The point the camera looks at.
Definition EBGeometry_Render.hpp:212
static Camera fit(const BoundingVolumes::AABBT< T > &a_box, const Vec3T< T > &a_up=Vec3T< T >(T(0), T(1), T(0)))
A camera that sees the whole of a box, from the default direction.
T m_nearClip
How far along each camera ray it starts (0: at the eye): anything nearer is not seen.
Definition EBGeometry_Render.hpp:251
Vec3T< T > m_up
The up axis (need not be of unit length).
Definition EBGeometry_Render.hpp:237
static Camera lookAt(const Vec3T< T > &a_eye, const Vec3T< T > &a_target, const Vec3T< T > &a_up=Vec3T< T >(T(0), T(1), T(0)), const T a_fieldOfView=T(40))
A camera at a given eye, looking at a given point.
Vec3T< T > eye() const noexcept
Where the eye is.
void horizontal(Vec3T< T > &a_first, Vec3T< T > &a_second) const noexcept
Two unit vectors that span the plane perpendicular to the up axis: yaw 90 looks from the first,...
static Camera fit(const BoundingVolumes::AABBT< T > &a_box, View a_view, const Vec3T< T > &a_up=Vec3T< T >(T(0), T(1), T(0)))
A camera that sees the whole of a box, from a given direction.
T m_pitch
Degrees above the plane perpendicular to the up axis, from -90 to 90.
Definition EBGeometry_Render.hpp:222
T m_yaw
Degrees about the up axis.
Definition EBGeometry_Render.hpp:217
An image: width x height pixels, row by row from the top, each 0xRRGGBBAA.
Definition EBGeometry_Render.hpp:823
std::vector< uint32_t > m_primitives
With Settings::m_recordPrimitives, for each pixel the primitive its first ray hit (HitT::m_primitive)...
Definition EBGeometry_Render.hpp:844
std::vector< uint32_t > m_pixels
The pixels, row by row from the top.
Definition EBGeometry_Render.hpp:837
uint32_t at(const uint32_t a_column, const uint32_t a_row) const noexcept
One pixel.
One pixel of a rendered image in the shaded view: the functor that Renderer runs once per pixel index...
Definition EBGeometry_Render.hpp:1125
RenderDetail::CameraView< T > m_view
The camera's eye and axes, worked out once rather than per pixel.
Definition EBGeometry_Render.hpp:1144
PixelQuery(const S &a_shape, const Camera< T > &a_camera, const Settings< T > &a_settings) noexcept
The pixel functor for a shape, a camera and settings.
Settings< T > m_settings
The settings.
Definition EBGeometry_Render.hpp:1139
S m_shape
The shape.
Definition EBGeometry_Render.hpp:1129
PixelResult operator()(const uint32_t &a_index) const noexcept
Shade pixel a_index (row a_index / width, column a_index % width).
Camera< T > m_camera
The camera.
Definition EBGeometry_Render.hpp:1134
What PixelQuery computes for one pixel.
Definition EBGeometry_Render.hpp:958
What every pixel needs from the camera, worked out once per frame: the eye, the view's axes and the f...
Definition EBGeometry_Render.hpp:1048
Vec3T< T > m_up
Unit up of the image.
Definition EBGeometry_Render.hpp:1067
T m_distance
Distance from the eye to the target.
Definition EBGeometry_Render.hpp:1092
Vec3T< T > m_second
Horizontal unit vectors (see Camera::horizontal()).
Definition EBGeometry_Render.hpp:1082
Vec3T< T > m_right
Unit right of the image.
Definition EBGeometry_Render.hpp:1062
Vec3T< T > m_eye
The eye.
Definition EBGeometry_Render.hpp:1052
bool m_orthographic
Whether the camera is orthographic.
Definition EBGeometry_Render.hpp:1108
Vec3T< T > m_forward
Unit direction the camera looks in.
Definition EBGeometry_Render.hpp:1057
T m_footprint
How wide a pixel is at distance t along a camera ray: m_footprint + m_footprintPerLength t (the first...
Definition EBGeometry_Render.hpp:1098
Vec3T< T > m_axis
Unit up axis of the scene.
Definition EBGeometry_Render.hpp:1072
T m_tanHalf
Tangent of half the vertical field of view.
Definition EBGeometry_Render.hpp:1087
Vec3T< T > m_first
Horizontal unit vectors (see Camera::horizontal()).
Definition EBGeometry_Render.hpp:1077
T m_footprintPerLength
See m_footprint.
Definition EBGeometry_Render.hpp:1103
A pixel as a render stores it: PixelResult without the object, which is stored apart and only when as...
Definition EBGeometry_Render.hpp:998
static StoredPixel of(const PixelResult &a_result) noexcept
The stored part of a pixel's result.
Definition EBGeometry_Render.hpp:1031
uint32_t m_rgba
The pixel, 0xRRGGBBAA.
Definition EBGeometry_Render.hpp:1002
What to render and how. A plain value; every field has a default.
Definition EBGeometry_Render.hpp:327
bool isHighlighted(const uint32_t a_primitive) const noexcept
Whether a primitive is highlighted.
Definition EBGeometry_Render.hpp:433
RayOptions< T > m_rays
How rays march (see firstHit()). A scale of 0 takes the shape's box diagonal, or the camera distance ...
Definition EBGeometry_Render.hpp:696
static Array< Vec3T< T >, PrimitiveColors > unsetColors() noexcept
Every entry of m_primitiveColors unset.
RegionSettings m_regions
How a view of regions (RegionView) is shown: the visible regions, what a surface is colored by,...
Definition EBGeometry_Render.hpp:748
What a render saw.
Definition EBGeometry_Render.hpp:870