Easy3D 3.0.0
Loading...
Searching...
No Matches
DrawCommand Struct Reference

Complete backend-independent description of a draw operation. More...

#include <render_device.h>

Public Member Functions

void set_depth_range (const vec2 &range)
 
vec2 depth_range () const
 

Public Attributes

std::shared_ptr< const Geometry > geometry
 Geometry snapshot to draw.
 
std::shared_ptr< const Image > texture
 Optional texture; null selects white.
 
mat4 model_view_projection = mat4::identity()
 Model-to-clip transform in Easy3D/OpenGL convention.
 
mat3 normal_matrix = mat3::identity()
 Inverse-transpose normal transform.
 
vec4 color = vec4(1, 1, 1, 1)
 Uniform RGBA multiplier.
 
std::uint32_t object_id = 0
 Object ID written for picking.
 
ivec4 viewport = ivec4(0)
 Top-left framebuffer viewport; zero selects the full target.
 
bool lighting = false
 Enable fixed directional diffuse lighting.
 
bool material_lighting = false
 Enable Renderer material lighting.
 
bool lighting_two_sides = false
 Apply material lighting to both triangle sides.
 
bool distinct_back_color = false
 Use back_color for back-facing triangles.
 
mat4 model = mat4::identity()
 Model-to-world transform.
 
vec3 eye = vec3(0)
 Eye position for material lighting.
 
vec3 light = vec3(0, 0, 1)
 Directional light for material lighting.
 
vec4 ambient = vec4(.05f)
 Ambient material color.
 
vec4 specular = vec4(.4f)
 Specular material color.
 
vec4 back_color = vec4(.8f, .4f, .4f, 1)
 Back-face color when enabled.
 
float shininess = 64
 Specular exponent.
 
bool overlay
 Composite triangle annotations after the scene; overlays do not write scene depth or IDs.
 
bool overlay_depth_test
 Test triangle overlays against scene depth without writing depth or IDs; submit overlapping annotations back-to-front.
 
bool overlay_independent_depth
 Use an independent depth buffer for 3D HUD triangles; requires overlay and excludes overlay_depth_test.
 
bool scene_depth_texture
 Sample center-sample scene depth as grayscale through UVs; requires an untextured overlay without overlay depth flags.
 
bool transparent
 Blend scene triangles using color.w opacity; writes scene depth and picking IDs.
 
bool eye_dome_lighting
 Apply eye-dome lighting from scene depth; requires a full-viewport untextured overlay quad.
 
bool ambient_occlusion
 Apply screen-space ambient occlusion; color carries view-space radius and bias.
 
bool shadow_caster = false
 Rasterize scene triangles into the shadow map as well as the scene.
 
bool shadow_background = false
 Receive shadows while retaining the background picking ID.
 
bool shadow
 Apply a full-viewport multiplicative shadow overlay; color carries darkness, softness, light near, and light far.
 
mat4 shadow_matrix = mat4::identity()
 Camera-clip to shadow-texture transform.
 
unsigned shadow_map_size = 1024
 Shadow-map side length in pixels.
 
std::vector< vec4 > clipping_planes
 Up to two view-space halfspaces retaining dot(plane, [position,1]) >= 0; overlays ignore them.
 
std::vector< vec4 > object_clipping_planes
 Up to two halfspaces in the geometry's local space; empty means derive them from clipping_planes and model_view.
 
bool discard_clipped_primitives = false
 Reject a primitive if any control vertex is outside.
 
PointStyle point_style = PointStyle::plain
 Point rendering style.
 
float point_size = 1
 Plain-point diameter in framebuffer pixels.
 
float sphere_radius = 1
 View-space radius for sphere/surfel impostors, independent of model scale.
 
vec3 sphere_light = vec3(0.3f, 0.5f, 1)
 View-space directional light for point impostors.
 
mat4 model_view = mat4::identity()
 Model-to-view transform for impostor geometry.
 
mat4 projection = mat4::identity()
 OpenGL-convention projection for impostor geometry.
 
LineStyle line_style = LineStyle::plain
 Line rendering style.
 
float line_radius = 1
 View-space radius for cylinder/cone impostors, independent of model scale.
 
float line_width = 1
 Plain-line width in framebuffer pixels.
 
bool line_screen_space_width = true
 Expand plain lines in screen space.
 
bool depth_bias = false
 
std::uint16_t depth_range_min = 0
 Encoded near endpoint; 0x8000 marks an invalid value.
 
std::uint16_t depth_range_max = 0x7fff
 Encoded far endpoint; 0x8000 marks an invalid value.
 

Detailed Description

Complete backend-independent description of a draw operation.

Draw commands carry immutable geometry and explicit rendering state. Backends interpret matrices using the documented Easy3D/OpenGL convention.

Examples
Tutorial_202_Viewer_imgui, Tutorial_204_Offscreen, Tutorial_205_RealCamera, Tutorial_306_ImageViewer, and Tutorial_403_PointSelection.

Member Function Documentation

◆ depth_range()

vec2 depth_range ( ) const

Return the window-space depth interval mapped to [0, 1].

Returns
(near, far) window-space depth endpoints; a component is NaN when its stored endpoint is invalid.

◆ set_depth_range()

void set_depth_range ( const vec2 &  range)

Set the window-space depth interval mapped to [0, 1].

Parameters
range(near, far) window-space depth endpoints, normally in [0, 1]. Invalid values are retained for backend validation at render time.

Endpoints use 15-bit normalized precision to preserve the 2.8 layout.

Member Data Documentation

◆ ambient_occlusion

bool ambient_occlusion
Initial value:
=
false

Apply screen-space ambient occlusion; color carries view-space radius and bias.

◆ depth_bias

bool depth_bias = false

Offset filled triangles to expose coplanar lines.

◆ eye_dome_lighting

bool eye_dome_lighting
Initial value:
=
false

Apply eye-dome lighting from scene depth; requires a full-viewport untextured overlay quad.

◆ overlay

bool overlay
Initial value:
=
false

Composite triangle annotations after the scene; overlays do not write scene depth or IDs.

◆ overlay_depth_test

bool overlay_depth_test
Initial value:
=
false

Test triangle overlays against scene depth without writing depth or IDs; submit overlapping annotations back-to-front.

◆ overlay_independent_depth

bool overlay_independent_depth
Initial value:
=
false

Use an independent depth buffer for 3D HUD triangles; requires overlay and excludes overlay_depth_test.

◆ scene_depth_texture

bool scene_depth_texture
Initial value:
=
false

Sample center-sample scene depth as grayscale through UVs; requires an untextured overlay without overlay depth flags.

◆ shadow

bool shadow
Initial value:
=
false

Apply a full-viewport multiplicative shadow overlay; color carries darkness, softness, light near, and light far.

◆ transparent

bool transparent
Initial value:
=
false

Blend scene triangles using color.w opacity; writes scene depth and picking IDs.


The documentation for this struct was generated from the following files: