Easy3D 3.0.0
Loading...
Searching...
No Matches
render_device.h
1
27#ifndef EASY3D_RENDERER_RENDER_DEVICE_H
28#define EASY3D_RENDERER_RENDER_DEVICE_H
29
30#include <easy3d/core/types.h>
31#include <cstdint>
32#include <memory>
33#include <string>
34#include <vector>
35
36namespace easy3d {
37 namespace graphics {
38
40 enum class Backend { opengl, vulkan };
41
43 enum class Topology { triangles, lines, points };
44
52 class PointData {
53 public:
61 explicit PointData(std::vector<vec3> positions,
62 std::vector<std::uint32_t> source_ids = {},
63 std::uint32_t source_count = 0);
65 virtual ~PointData() = default;
67 PointData &operator=(const PointData &) = delete;
70 const std::vector<vec3> &positions() const {
71 return positions_;
72 }
75 const std::vector<std::uint32_t> &source_ids() const {
76 return source_ids_;
77 }
80 std::uint32_t source_count() const {
81 return source_count_;
82 }
83
84 private:
85 std::vector<vec3> positions_;
86 std::vector<std::uint32_t> source_ids_;
87 std::uint32_t source_count_;
88 };
89
91 struct Vertex {
95 vec3 normal = vec3(0, 0, 1);
97 vec4 color = vec4(1, 1, 1, 1);
105 };
106
112 class Geometry {
113 public:
122 Geometry(std::vector<Vertex> vertices,
123 std::vector<std::uint32_t> indices = {},
124 Topology topology = Topology::triangles,
125 std::vector<std::uint32_t> primitive_ids = {},
126 std::shared_ptr<const PointData> point_data = {});
129 const std::vector<Vertex> &vertices() const {
130 return vertices_;
131 }
134 const std::vector<std::uint32_t> &indices() const {
135 return indices_;
136 }
139 const std::vector<std::uint32_t> &primitive_ids() const {
140 return primitive_ids_;
141 }
144 Topology topology() const {
145 return topology_;
146 }
149 const std::shared_ptr<const PointData> &point_data() const {
150 return point_data_;
151 }
152
153 private:
154 const std::vector<Vertex> vertices_;
155 const std::vector<std::uint32_t> indices_;
156 const Topology topology_;
157 const std::vector<std::uint32_t> primitive_ids_;
158 std::shared_ptr<const PointData> point_data_;
159 };
160
161 enum class TextureWrap { clamp_to_edge, repeat };
162 enum class TextureFilter { nearest, linear };
163
165 struct Sampler {
167 TextureWrap wrap = TextureWrap::clamp_to_edge;
169 TextureFilter filter = TextureFilter::nearest;
170 };
171
173 class Image {
174 public:
183 Image(std::uint32_t width, std::uint32_t height, std::vector<unsigned char> rgba, Sampler sampler = {});
186 std::uint32_t width() const {
187 return width_;
188 }
191 std::uint32_t height() const {
192 return height_;
193 }
196 const std::vector<unsigned char> &rgba() const {
197 return rgba_;
198 }
201 const Sampler &sampler() const {
202 return sampler_;
203 }
204
205 private:
206 const std::uint32_t width_, height_;
207 const std::vector<unsigned char> rgba_;
208 const Sampler sampler_;
209 };
210
211 enum class PointStyle { plain, sphere, surfel };
212 enum class LineStyle { plain, cylinder, cone };
213
219 struct DrawCommand {
220 std::shared_ptr<const Geometry> geometry;
221 std::shared_ptr<const Image> texture;
222 // Existing Easy3D/OpenGL camera convention: Y up, clip depth [-w, w].
223 // Backend conversion to Vulkan is applied exactly once in the vertex shader.
226 vec4 color = vec4(1, 1, 1, 1);
227 std::uint32_t object_id = 0;
228 // Top-left framebuffer pixels. All zeros select the complete render target.
229 // The backend uses this same rectangle for rasterization and clipping.
231 bool lighting = false;
232 // Renderer material state. Low-level commands retain basic diffuse lighting
233 // unless this is enabled; drawable adapters forward the shared State here.
234 bool material_lighting = false;
235 bool lighting_two_sides = false;
236 bool distinct_back_color = false;
238 vec3 eye = vec3(0);
239 vec3 light = vec3(0, 0, 1);
240 vec4 ambient = vec4(.05f);
242 vec4 back_color = vec4(.8f, .4f, .4f, 1);
243 float shininess = 64;
244 // Straight-alpha triangle annotations composite after the 3D scene.
245 // They never write scene depth or picking IDs; depth testing is opt-in below.
246 // Flat/scene-depth annotations are unlit unless lighting is enabled; the
247 // lit material state below shades them like scene triangles.
248 bool overlay =
249 false;
250 // Depth-tested alpha annotations render after the opaque scene and before
251 // screen overlays. They test scene depth (<=), but never write depth or IDs.
252 // Supply these in back-to-front order when they overlap; triangles only.
253 // Lighting uses the material state below, and normals come from the geometry.
255 false;
256 // 3D HUD triangles share a separately cleared depth attachment, testing and
257 // writing their own depth without touching scene depth or IDs. They render
258 // after scene annotations and before flat HUD overlays. Mutually exclusive
259 // with overlay_depth_test; requires overlay=true. Lighting is supported.
261 false;
262 // Flat triangle HUD samples the current frame's center-sample scene depth
263 // as grayscale through its UVs. Requires overlay=true, no texture and no
264 // overlay depth flags. Sampling never changes scene depth or picking IDs.
266 false;
267 // Straight-alpha scene triangles composite over the opaque scene, tested and
268 // written against the shared scene depth and IDs. They draw after opaque
269 // geometry in this vector, ordered far to near by the backend. color.w is
270 // the opacity. Triangle geometry only; overlays have their own blending.
272 false;
273 // Full-screen multiplicative shading from this frame's scene depth. Requires
274 // overlay=true, no texture, no overlay depth flags. Geometry must be a quad
275 // covering the viewport with the depth-texture UV convention; color carries
276 // (near plane, far plane, scene size, unused). Background pixels keep their
277 // color because their neighbor depth difference is zero.
279 false;
280 // Full-screen multiplicative ambient occlusion from this frame's scene depth.
281 // Requires overlay=true, no texture, no overlay depth flags. Geometry must be
282 // a quad covering the viewport with the depth-texture UV convention; color
283 // carries (view-space radius, bias, unused, unused) and projection must be the
284 // scene's OpenGL-convention projection matrix. Background pixels keep their
285 // color, and the pass never changes scene depth or picking IDs.
287 false;
288 // Scene triangles that are additionally rasterized into this frame's shadow
289 // map before the scene. Requires triangles, a finite shadow_matrix and a
290 // positive, power-of-two shadow_map_size. They render normally as well.
291 bool shadow_caster = false;
292 // Scene triangles that only receive this frame's shadow: they keep the
293 // background ID (object_id must be UINT32_MAX) and are lit normally, so the
294 // virtual background plane can occlude without appearing in picking.
295 bool shadow_background = false;
296 // Full-screen multiplicative shadow overlay. Requires overlay=true, no
297 // texture, no overlay depth flags. Geometry must cover the viewport with the
298 // depth-texture UV convention. Samples the frame's shadow map through the
299 // shadow matrix; color carries (darkness, softness, light near, light far).
300 // Softness zero compares depths directly; positive values filter blockers.
301 // Never changes scene depth or picking IDs.
302 bool shadow =
303 false;
304 // Camera clip space -> shadow texture coordinates. Scene casters also use
305 // it to map their vertices into the light view.
307 unsigned shadow_map_size = 1024;
308 // Up to two view-space halfspaces: dot(plane, vec4(view_position,1)) >= 0.
309 // When clipping is active, model_view must map the geometry into view space
310 // and be affine for every topology, consistently with model_view_projection.
311 // Triangles/line centerlines clip geometrically; plain points test centers;
312 // analytic impostors clip their actual front surface. Overlays ignore planes.
313 std::vector<vec4>
315 // Optional camera-free form of the planes above, already pulled back into the
316 // geometry's own space by the scene host. When non-empty the geometric CPU clip
317 // uses them, so moving the camera no longer changes the clip and its cache
318 // survives an orbit. Left empty by low-level callers that only set view-space
319 // planes, which are then pulled back through model_view as before.
320 std::vector<vec4>
323 // Plain points use framebuffer-pixel diameters. Spheres and surfels use view-space radii,
324 // after transforming their centers; model scaling does not scale the radius. Both point
325 // and line sizes below are framebuffer pixels at this level: screen-space overlay
326 // commands from graphics::shape already arrive that way, while drawable sizes are
327 // logical and scaled by the host before submission.
328 PointStyle point_style = PointStyle::plain;
329 float point_size = 1;
330 // Plain points are sized in pixels and never read this field, so it stays unused for them.
331 float sphere_radius = 1;
332 vec3 sphere_light = vec3(0.3f, 0.5f, 1);
333 // Surfels orient their disc by the inverse-transpose of this affine matrix's
334 // linear part, using Vertex::normal (nonzero). Radius stays independent of scale.
337 // Line impostors transform both endpoints with model_view. Their radius is
338 // in view-space units, independent of model scale. Cones taper from the
339 // first endpoint (base) to the second (tip); cylinders have two flat caps.
340 LineStyle line_style = LineStyle::plain;
341 // Cylinder/cone impostors always read this radius; camera-space plain lines expand
342 // by it, and screen-space plain lines never do (then it stays unused).
343 float line_radius = 1;
344 // Plain lines use framebuffer-pixel widths. Width one retains native line
345 // rasterization; other widths use butt-capped triangle ribbons, without joins.
346 float line_width = 1;
347 // A plain line is expanded either in camera space (a world-space half-width, so its
348 // width on screen changes with the distance to the camera) or in screen space (a
349 // constant framebuffer-pixel width). Screen space is the default; the scene adapter
350 // follows setting::lines_drawable_screen_space_width.
352 // Filled triangles are pushed away from the camera, as the OpenGL viewer
353 // does with glPolygonOffset, so coplanar line drawables stay visible.
354 // Ignored for other topologies and overlays.
355 bool depth_bias = false;
360 void set_depth_range(const vec2 &range);
364 vec2 depth_range() const;
365
366 // Packed into the 2.8 tail padding; 0x8000 marks an invalid endpoint.
367 // Public storage preserves aggregate initialization and standard-layout compatibility.
368 std::uint16_t depth_range_min = 0;
369 std::uint16_t depth_range_max = 0x7fff;
370 };
371
372 // Validates and normalizes finite plane equations with nonzero normals.
373 std::vector<vec4> normalize_clipping_planes(const std::vector<vec4> &planes);
374
375 // Top-left framebuffer-pixel coordinates to the shared OpenGL clip convention.
376 mat4 screen_space_projection(std::uint32_t width, std::uint32_t height);
377
381 struct FrameImage {
383 std::uint32_t width = 0;
385 std::uint32_t height = 0;
387 std::vector<unsigned char> rgba;
389 std::vector<float> depth;
391 struct Id {
393 std::uint32_t object;
395 std::uint32_t primitive;
396 };
397 // UINT32_MAX object denotes background. A UINT32_MAX primitive on a foreground
398 // object denotes unavailable primitive provenance (e.g. OpenGL Viewer capture).
400 std::vector<Id> ids;
401 };
402
403 // Scene data a render() call copies back. Color-only capture skips the
404 // depth and ID readbacks, which cost a full-frame copy each even when the
405 // caller only needs an image (snapshots and video frames).
409 enum class FrameReadback {
411 color,
413 color_depth_ids
414 };
415
419 bool validation = false;
421 bool sync_validation = false;
423 bool profiling = false;
425 std::string device_name;
428 };
429
431 struct ScenePixel {
433 FrameImage::Id id{UINT32_MAX, UINT32_MAX};
435 float depth = 1.0f;
436 };
437
438 // How the frame composites commands marked DrawCommand::transparent over the
439 // opaque scene. All methods leave screen overlays and picking IDs unchanged.
440 enum class TransparencyMethod {
441 // Straight alpha, ordered far to near per drawable and per triangle. Writes
442 // scene depth and IDs, so the nearest transparent surface is pickable.
443 sorted,
444 // Order-independent average color accumulation, matching the depth-free
445 // legacy average-color composite. Ignores opaque scene depth.
446 average,
447 // Order-independent front-to-back depth peeling, matching the depth-free
448 // legacy effect without its min-max (front and back) pairing.
449 peeling,
450 // Order-independent per-pixel linked lists (Yang et al., NVIDIA 2010).
451 // Stores all fragments per pixel in GPU buffers, sorts by depth, and blends.
452 // Provides perfect transparency quality regardless of surface intersections.
453 // Requires more memory and is slower than peeling, but produces correct results.
454 linked_lists
455 };
456
462 unsigned samples = 1;
464 TransparencyMethod transparency = TransparencyMethod::sorted;
466 unsigned peel_layers = 4;
468 FrameReadback readback = FrameReadback::color_depth_ids;
469 };
470
474 bool shadow = false;
476 bool ambient_occlusion = false;
478 bool eye_dome_lighting = false;
480 std::vector<TransparencyMethod> transparency_methods;
483 };
484
485 // GPU through-selection of projected point centers in a top-left framebuffer
486 // polygon. Polygon crossings use the even-odd rule (boundary included). It is
487 // independent of rasterization/occlusion, point style, MSAA and scene readback.
488 // PointData source IDs address bits; empty words start from zero, otherwise supply
489 // ceil(source_count/32) words. Unmatched/padding bits are preserved. Nonfinite
490 // points are skipped (usable for deleted vertex slots). Camera MVP uses [-w,w]
491 // depth; centers outside its frustum or local halfspaces are skipped.
502 std::shared_ptr<const PointData> points;
504 std::vector<vec2> polygon;
506 std::vector<std::uint32_t> words;
510 std::uint32_t width = 0;
512 std::uint32_t height = 0;
514 bool deselect = false;
516 std::vector<vec4> local_clipping_planes; // up to two, keep dot(plane,[point,1])>=0
517 };
518
525 public:
527 virtual ~RenderDevice() = default;
530 virtual Backend backend() const = 0;
533 virtual const std::string &name() const = 0;
536 virtual DeviceCapabilities capabilities() const = 0;
539 virtual const std::string &driver_version() const = 0;
540 // Bit mask using the numeric sample counts (1, 2, 4, ...). Color MSAA uses
541 // supported RGBA8/D32 counts; integer IDs/depth picking stay single-sampled.
542 // The mask always contains 1, which is this API's "no MSAA" count: Vulkan has
543 // no zero sample count, so VK_SAMPLE_COUNT_1_BIT is what disables multisampling
544 // and a count of 2 or more selects the multisampled color pass.
545 // No backend pipeline shades per sample, so the counts do not vary by style: an
546 // analytic impostor silhouette takes part in MSAA only through the coverage of the
547 // pixels it rasterizes, and a discard that is evaluated per pixel is all-or-nothing.
553 virtual std::uint32_t supported_sample_counts(PointStyle style = PointStyle::plain) const = 0;
559 virtual std::uint32_t supported_sample_counts(LineStyle style) const = 0;
560 // Synchronous offscreen capture. No window, GL context, surface or swapchain.
561 // Instances are externally synchronized; separate instances are independent.
562 // peel_layers bounds the front-to-back layers of TransparencyMethod::peeling;
563 // zero asks for all layers, capped by the backend.
573 virtual FrameImage render(std::uint32_t width,
574 std::uint32_t height,
575 const std::vector<DrawCommand> &commands,
576 const RenderOptions &options = {}) = 0;
577 // Render scene IDs and depth at one top-left framebuffer pixel center.
578 // The full viewport and draw order are preserved. Overlays are excluded.
588 virtual ScenePixel sample_pixel(std::uint32_t width,
589 std::uint32_t height,
590 const std::vector<DrawCommand> &commands,
591 std::uint32_t x,
592 std::uint32_t y) = 0;
593 // Render scene IDs over a top-left framebuffer rectangle. The frame is
594 // rasterized once; only the requested rows are copied back.
610 virtual std::vector<FrameImage::Id> sample_ids(std::uint32_t width,
611 std::uint32_t height,
612 const std::vector<DrawCommand> &commands,
613 std::uint32_t x,
614 std::uint32_t y,
615 std::uint32_t region_width,
616 std::uint32_t region_height) = 0;
619 virtual unsigned validation_errors() const = 0;
620 // Synchronous GPU polygon upload, compute dispatch and selection readback.
621 // Externally synchronized like render(); no render targets are modified.
630 virtual std::vector<std::uint32_t> select_points(const PointSelectionRequest &request) = 0;
631 // Cumulative position-resource realizations, useful for transfer diagnostics.
632 // Rendering and selection share these uploads; attribute uploads are separate.
635 virtual std::uint64_t point_upload_count() const = 0;
644 virtual std::uint32_t oit_dropped_fragments() const = 0;
645 };
646
648 std::unique_ptr<RenderDevice> create_device(const DeviceOptions &options = {});
649
650 } // namespace graphics
651} // namespace easy3d
652#endif
static Mat< N, M, T > identity()
Returns an identity matrix.
Definition mat.h:702
Immutable geometry snapshot submitted to a RenderDevice.
Definition render_device.h:112
const std::vector< Vertex > & vertices() const
Definition render_device.h:129
const std::vector< std::uint32_t > & primitive_ids() const
Definition render_device.h:139
const std::shared_ptr< const PointData > & point_data() const
Definition render_device.h:149
Topology topology() const
Definition render_device.h:144
const std::vector< std::uint32_t > & indices() const
Definition render_device.h:134
Immutable RGBA8 image with explicit sampler state.
Definition render_device.h:173
const Sampler & sampler() const
Definition render_device.h:201
std::uint32_t width() const
Definition render_device.h:186
std::uint32_t height() const
Definition render_device.h:191
const std::vector< unsigned char > & rgba() const
Definition render_device.h:196
Immutable point positions in draw order, mapped to original source slots.
Definition render_device.h:52
PointData & operator=(const PointData &)=delete
Copy assignment is disabled; snapshots are shared by const ownership.
std::uint32_t source_count() const
Definition render_device.h:80
virtual ~PointData()=default
Destroy the point-data snapshot.
const std::vector< vec3 > & positions() const
Definition render_device.h:70
const std::vector< std::uint32_t > & source_ids() const
Definition render_device.h:75
Backend-independent rendering, capture, and selection interface.
Definition render_device.h:524
virtual ScenePixel sample_pixel(std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, std::uint32_t x, std::uint32_t y)=0
Sample scene depth and IDs at a top-left framebuffer pixel.
virtual unsigned validation_errors() const =0
virtual DeviceCapabilities capabilities() const =0
virtual std::vector< std::uint32_t > select_points(const PointSelectionRequest &request)=0
Select point source slots inside a framebuffer polygon.
virtual const std::string & driver_version() const =0
virtual const std::string & name() const =0
virtual std::uint32_t supported_sample_counts(PointStyle style=PointStyle::plain) const =0
Query supported MSAA sample counts for a point style.
virtual std::uint64_t point_upload_count() const =0
virtual Backend backend() const =0
virtual std::vector< FrameImage::Id > sample_ids(std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, std::uint32_t x, std::uint32_t y, std::uint32_t region_width, std::uint32_t region_height)=0
Sample scene picking IDs over a top-left framebuffer rectangle.
virtual FrameImage render(std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, const RenderOptions &options={})=0
Render commands into an offscreen framebuffer and read back results.
virtual std::uint32_t supported_sample_counts(LineStyle style) const =0
Query supported MSAA sample counts for a line style.
virtual ~RenderDevice()=default
Destroy the backend device.
virtual std::uint32_t oit_dropped_fragments() const =0
Definition collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44
Vec< 4, int32_t > ivec4
A 4D point/vector of int32_t type.
Definition types.h:60
Vec< 4, float > vec4
A 4D point/vector of float type.
Definition types.h:46
Vec< 2, float > vec2
A 2D point/vector of float type.
Definition types.h:42
Optional effects and implementation choices reported by a device.
Definition render_device.h:472
bool eye_dome_lighting
Eye-dome lighting is available.
Definition render_device.h:478
bool native_large_points
Native large-point rasterization is enabled.
Definition render_device.h:482
std::vector< TransparencyMethod > transparency_methods
Supported transparency methods.
Definition render_device.h:480
bool ambient_occlusion
Screen-space ambient occlusion is available.
Definition render_device.h:476
bool shadow
Shadow mapping is available.
Definition render_device.h:474
Common diagnostics and physical-device selection parameters.
Definition render_device.h:417
bool validation
Enable backend validation diagnostics when supported.
Definition render_device.h:419
bool profiling
Enable backend profiling output when supported.
Definition render_device.h:423
bool use_native_large_points
Prefer native large points when supported; false forces portable expansion.
Definition render_device.h:427
bool sync_validation
Enable synchronization validation; implies validation.
Definition render_device.h:421
std::string device_name
Required physical-device name substring; empty accepts any compatible device.
Definition render_device.h:425
Complete backend-independent description of a draw operation.
Definition render_device.h:219
std::shared_ptr< const Geometry > geometry
Geometry snapshot to draw.
Definition render_device.h:220
bool eye_dome_lighting
Apply eye-dome lighting from scene depth; requires a full-viewport untextured overlay quad.
Definition render_device.h:278
mat4 model_view_projection
Model-to-clip transform in Easy3D/OpenGL convention.
Definition render_device.h:224
bool overlay_depth_test
Test triangle overlays against scene depth without writing depth or IDs; submit overlapping annotatio...
Definition render_device.h:254
mat4 model_view
Model-to-view transform for impostor geometry.
Definition render_device.h:335
mat4 projection
OpenGL-convention projection for impostor geometry.
Definition render_device.h:336
std::vector< vec4 > clipping_planes
Up to two view-space halfspaces retaining dot(plane, [position,1]) >= 0; overlays ignore them.
Definition render_device.h:314
mat4 shadow_matrix
Camera-clip to shadow-texture transform.
Definition render_device.h:306
bool shadow_background
Receive shadows while retaining the background picking ID.
Definition render_device.h:295
vec4 back_color
Back-face color when enabled.
Definition render_device.h:242
LineStyle line_style
Line rendering style.
Definition render_device.h:340
std::uint16_t depth_range_max
Encoded far endpoint; 0x8000 marks an invalid value.
Definition render_device.h:369
mat4 model
Model-to-world transform.
Definition render_device.h:237
vec3 eye
Eye position for material lighting.
Definition render_device.h:238
bool lighting_two_sides
Apply material lighting to both triangle sides.
Definition render_device.h:235
vec4 specular
Specular material color.
Definition render_device.h:241
bool ambient_occlusion
Apply screen-space ambient occlusion; color carries view-space radius and bias.
Definition render_device.h:286
bool overlay
Composite triangle annotations after the scene; overlays do not write scene depth or IDs.
Definition render_device.h:248
std::uint32_t object_id
Object ID written for picking.
Definition render_device.h:227
std::vector< vec4 > object_clipping_planes
Up to two halfspaces in the geometry's local space; empty means derive them from clipping_planes and ...
Definition render_device.h:321
vec4 color
Uniform RGBA multiplier.
Definition render_device.h:226
bool line_screen_space_width
Expand plain lines in screen space.
Definition render_device.h:351
float line_width
Plain-line width in framebuffer pixels.
Definition render_device.h:346
bool lighting
Enable fixed directional diffuse lighting.
Definition render_device.h:231
bool transparent
Blend scene triangles using color.w opacity; writes scene depth and picking IDs.
Definition render_device.h:271
bool overlay_independent_depth
Use an independent depth buffer for 3D HUD triangles; requires overlay and excludes overlay_depth_tes...
Definition render_device.h:260
unsigned shadow_map_size
Shadow-map side length in pixels.
Definition render_device.h:307
float sphere_radius
View-space radius for sphere/surfel impostors, independent of model scale.
Definition render_device.h:331
std::shared_ptr< const Image > texture
Optional texture; null selects white.
Definition render_device.h:221
bool shadow_caster
Rasterize scene triangles into the shadow map as well as the scene.
Definition render_device.h:291
bool shadow
Apply a full-viewport multiplicative shadow overlay; color carries darkness, softness,...
Definition render_device.h:302
float shininess
Specular exponent.
Definition render_device.h:243
bool depth_bias
Definition render_device.h:355
PointStyle point_style
Point rendering style.
Definition render_device.h:328
ivec4 viewport
Top-left framebuffer viewport; zero selects the full target.
Definition render_device.h:230
void set_depth_range(const vec2 &range)
Definition render_device.cpp:35
float point_size
Plain-point diameter in framebuffer pixels.
Definition render_device.h:329
std::uint16_t depth_range_min
Encoded near endpoint; 0x8000 marks an invalid value.
Definition render_device.h:368
bool discard_clipped_primitives
Reject a primitive if any control vertex is outside.
Definition render_device.h:322
mat3 normal_matrix
Inverse-transpose normal transform.
Definition render_device.h:225
bool distinct_back_color
Use back_color for back-facing triangles.
Definition render_device.h:236
vec3 light
Directional light for material lighting.
Definition render_device.h:239
vec2 depth_range() const
Definition render_device.cpp:45
bool material_lighting
Enable Renderer material lighting.
Definition render_device.h:234
vec3 sphere_light
View-space directional light for point impostors.
Definition render_device.h:332
bool scene_depth_texture
Sample center-sample scene depth as grayscale through UVs; requires an untextured overlay without ove...
Definition render_device.h:265
vec4 ambient
Ambient material color.
Definition render_device.h:240
float line_radius
View-space radius for cylinder/cone impostors, independent of model scale.
Definition render_device.h:343
Object and primitive IDs associated with one pixel.
Definition render_device.h:391
std::uint32_t primitive
Primitive ID, or UINT32_MAX when provenance is unavailable.
Definition render_device.h:395
std::uint32_t object
Object ID, or UINT32_MAX for the background.
Definition render_device.h:393
CPU-readable color, depth, and picking data captured from a frame.
Definition render_device.h:381
std::vector< unsigned char > rgba
Tightly packed RGBA8 color pixels, top row first.
Definition render_device.h:387
std::vector< float > depth
Per-pixel depth in [0,1]; clear depth is 1.
Definition render_device.h:389
std::vector< Id > ids
Per-pixel picking IDs; background objects use UINT32_MAX.
Definition render_device.h:400
std::uint32_t height
Captured framebuffer height in pixels.
Definition render_device.h:385
std::uint32_t width
Captured framebuffer width in pixels.
Definition render_device.h:383
Inputs for selection of point centers inside a screen polygon.
Definition render_device.h:500
mat4 model_view_projection
Transform from point-local coordinates to OpenGL clip coordinates.
Definition render_device.h:508
std::vector< std::uint32_t > words
Selection bitset, one bit per source slot.
Definition render_device.h:506
bool deselect
Clear bits inside the polygon instead of setting them.
Definition render_device.h:514
std::shared_ptr< const PointData > points
Immutable point positions and source-slot mapping.
Definition render_device.h:502
std::vector< vec4 > local_clipping_planes
Up to two local-space halfspaces that points must satisfy.
Definition render_device.h:516
std::uint32_t height
Framebuffer height in pixels.
Definition render_device.h:512
std::vector< vec2 > polygon
Polygon in top-left framebuffer pixel coordinates.
Definition render_device.h:504
std::uint32_t width
Framebuffer width in pixels.
Definition render_device.h:510
Common frame-rendering parameters.
Definition render_device.h:458
TransparencyMethod transparency
Composite method for transparent commands.
Definition render_device.h:464
unsigned peel_layers
Depth-peeling layer limit; zero requests the backend's maximum.
Definition render_device.h:466
FrameReadback readback
Scene data copied back from the rendered frame.
Definition render_device.h:468
unsigned samples
Requested MSAA sample count; one disables MSAA.
Definition render_device.h:462
vec4 background
RGBA clear color.
Definition render_device.h:460
Texture addressing and filtering configuration.
Definition render_device.h:165
TextureFilter filter
Interpolation used when sampling between texels.
Definition render_device.h:169
TextureWrap wrap
Addressing mode for texture coordinates outside the image.
Definition render_device.h:167
Color/depth/ID result for one scene pixel.
Definition render_device.h:431
float depth
Scene depth in [0,1], defaulting to the clear value.
Definition render_device.h:435
Per-vertex data consumed by a draw command.
Definition render_device.h:91
vec3 position
Position in geometry-local coordinates.
Definition render_device.h:93
vec3 normal
Surface normal.
Definition render_device.h:95
vec2 texcoord
Texture coordinate.
Definition render_device.h:99
vec4 color
RGBA vertex color.
Definition render_device.h:97
vec4 highlight
Definition render_device.h:104