Blender V5.0
overlay_private.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BKE_context.hh"
12#include "BKE_movieclip.h"
13#include "BKE_object.hh"
14
15#include "BLI_function_ref.hh"
16
17#include "DNA_space_types.h"
18#include "DNA_world_types.h"
19
20#include "GPU_matrix.hh"
21
22#include "DRW_gpu_wrapper.hh"
23#include "DRW_render.hh"
24#include "UI_resources.hh"
25#include "draw_manager.hh"
26#include "draw_pass.hh"
27#include "draw_view_data.hh"
29
32
33#include "draw_common.hh"
34
36 static constexpr VertAttrType type = VertAttrType::SINT_32;
37};
39 static constexpr VertAttrType type = VertAttrType::SINT_32;
40};
41
42namespace blender::draw::overlay {
43
45 /* Keep sync with bone instance vertex format (OVERLAY_InstanceFormats) */
46 union {
48 float mat[4][4];
49 struct {
52 float _pad2[3], color_a;
53 float _pad3[3], color_b;
54 };
55 struct {
56 float _pad00[3], amin_a;
57 float _pad01[3], amin_b;
58 float _pad02[3], amax_a;
59 float _pad03[3], amax_b;
60 };
61 };
62
63 BoneInstanceData() = default;
64
70 const float3 &pos,
71 const float radius,
72 const float color[4])
73
74 {
75 mat44[0] = ob_mat[0] * radius;
76 mat44[1] = ob_mat[1] * radius;
77 mat44[2] = ob_mat[2] * radius;
80 }
81
82 BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color, const float4 &hint_color)
83 : mat44(bone_mat)
84 {
85 set_color(bone_color);
86 set_hint_color(hint_color);
87 };
88
89 BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color) : mat44(bone_mat)
90 {
91 set_color(bone_color);
92 };
93
94 void set_color(const float4 &bone_color)
95 {
96 /* Encoded color into 2 floats to be able to use the matrix to color the custom bones. */
97 color_a = encode_2f_to_float(bone_color[0], bone_color[1]);
98 color_b = encode_2f_to_float(bone_color[2], bone_color[3]);
99 }
100
101 void set_hint_color(const float4 &hint_color)
102 {
103 /* Encoded color into 2 floats to be able to use the matrix to color the custom bones. */
104 color_hint_a = encode_2f_to_float(hint_color[0], hint_color[1]);
105 color_hint_b = encode_2f_to_float(hint_color[2], hint_color[3]);
106 }
107
108 private:
109 /* Encode 2 units float with byte precision into a float. */
110 float encode_2f_to_float(float a, float b) const
111 {
112 /* NOTE: `b` can go up to 2. Needed to encode wire size. */
113 return float(int(clamp_f(a, 0.0f, 1.0f) * 255) | (int(clamp_f(b, 0.0f, 2.0f) * 255) << 8));
114 }
115};
116
118
124
125struct State {
126 Depsgraph *depsgraph = nullptr;
127 const ViewLayer *view_layer = nullptr;
128 const Scene *scene = nullptr;
129 const View3D *v3d = nullptr;
130 const SpaceLink *space_data = nullptr;
131 const ARegion *region = nullptr;
132 const RegionView3D *rv3d = nullptr;
133 DRWTextStore *dt = nullptr;
138 const Object *object_active = nullptr;
139 bool clear_in_front = false;
140 bool use_in_front = false;
141 bool is_wireframe_mode = false;
145 bool is_image_render = false;
149 bool skip_particles = false;
151 bool is_material_select = false;
153 bool draw_background = false;
157 bool vignette_enabled = false;
159 bool show_text = false;
160 bool hide_overlays = false;
161 bool xray_enabled = false;
164 bool xray_flag_enabled = false;
166 bool do_pose_xray = false;
168 bool do_pose_fade_geom = false;
169 float xray_opacity = 0.0f;
170 short v3d_flag = 0; /* TODO: move to #View3DOverlay. */
171 short v3d_gridflag = 0; /* TODO: move to #View3DOverlay. */
172 int cfra = 0;
176
178 bool is_image_valid = false;
182
184 {
185 if (rv3d == nullptr) {
186 return View::OffsetData();
187 }
188 return View::OffsetData(*rv3d);
189 }
190
191 /* Factor to use for wireframe offset.
192 * Result of GPU_polygon_offset_calc for the current view.
193 * Only valid at draw time, so use push constant reference instead of copy. */
194 float ndc_offset_factor = 0.0f;
195
197
199 bool is_solid() const
200 {
201 return xray_opacity == 1.0f;
202 }
203
204 bool is_xray() const
205 {
206 return (xray_opacity < 1.0f) && (xray_opacity > 0.0f);
207 }
208
209 bool is_wire() const
210 {
211 return xray_opacity == 0.0f;
212 }
213
214 bool is_space_v3d() const
215 {
216 return this->space_type == SPACE_VIEW3D;
217 }
218 bool is_space_image() const
219 {
220 return this->space_type == SPACE_IMAGE;
221 }
222 bool is_space_node() const
223 {
224 return this->space_type == SPACE_NODE;
225 }
226
227 bool show_extras() const
228 {
229 return (this->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) == 0;
230 }
232 {
233 return (this->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION);
234 }
236 {
237 return (this->overlay.flag & V3D_OVERLAY_BONE_SELECT);
238 }
239 bool show_wireframes() const
240 {
241 return (this->overlay.flag & V3D_OVERLAY_WIREFRAMES);
242 }
243 bool show_motion_paths() const
244 {
245 return (this->overlay.flag & V3D_OVERLAY_HIDE_MOTION_PATHS) == 0;
246 }
247 bool show_bones() const
248 {
249 return (this->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0;
250 }
252 {
253 return (this->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_ORIGINS) == 0;
254 }
256 {
257 return (this->overlay.flag & V3D_OVERLAY_FADE_INACTIVE);
258 }
260 {
261 return (this->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE);
262 }
264 {
265 return (this->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT);
266 }
267 bool show_sculpt_mask() const
268 {
269 return (this->overlay.flag & V3D_OVERLAY_SCULPT_SHOW_MASK);
270 }
272 {
273 return (this->overlay.flag & V3D_OVERLAY_SCULPT_SHOW_FACE_SETS);
274 }
276 {
277 return (this->overlay.flag & V3D_OVERLAY_SCULPT_CURVES_CAGE);
278 }
279 bool show_light_colors() const
280 {
281 return (this->overlay.flag & V3D_OVERLAY_SHOW_LIGHT_COLORS);
282 }
283};
284
285/* Matches Vertex Format. */
292
299
306
314
315/* TODO(fclem): Might be good to remove for simplicity. */
323
328 private:
329 struct BatchDeleter {
330 void operator()(gpu::Batch *shader)
331 {
333 }
334 };
335 using BatchPtr = std::unique_ptr<gpu::Batch, BatchDeleter>;
336
337 public:
338 BatchPtr bone_box;
344 BatchPtr bone_sphere;
346 BatchPtr bone_stick;
347
350
351 BatchPtr grid;
352 BatchPtr cube_solid;
353
355 BatchPtr cursor_lines;
356
357 BatchPtr quad_wire;
358 BatchPtr quad_solid;
359 BatchPtr plain_axes;
360 BatchPtr single_arrow;
361 BatchPtr cube;
362 BatchPtr circle;
363 BatchPtr empty_sphere;
364 BatchPtr empty_cone;
365 BatchPtr cylinder;
366 BatchPtr capsule_body;
367 BatchPtr capsule_cap;
368 BatchPtr arrows;
370
371 BatchPtr speaker;
372
374 BatchPtr camera_frame;
376 BatchPtr camera_tria;
377
380
382
383 BatchPtr ground_line;
384
385 /* Batch drawing a quad with coordinate [0..1] at 0.75 depth. */
386 BatchPtr image_quad;
387
397
398 BatchPtr field_force;
399 BatchPtr field_wind;
400 BatchPtr field_vortex;
401 BatchPtr field_curve;
405
409
410 ShapeCache();
411
412 private:
413 /* Caller gets ownership of the #gpu::VertBuf. */
414 template<typename T> gpu::VertBuf *vbo_from_vector(const Vector<T> &vector)
415 {
417 GPU_vertbuf_data_alloc(*vbo, vector.size());
418 vbo->data<T>().copy_from(vector);
419 return vbo;
420 }
421};
422
424
428class ShaderModule {
429 private:
430 /* Allow StaticShaderCache access to the constructor. */
432
433 using StaticCache =
434 gpu::StaticShaderCache<ShaderModule>[2 /* Selection Instance. */][2 /* Clipping Enabled. */];
435
436 static StaticCache &get_static_cache()
437 {
439 static StaticCache static_cache;
440 return static_cache;
441 }
442
443 const SelectionType selection_type_;
446 const bool clipping_enabled_;
447
448 public:
450 StaticShader anti_aliasing = {"overlay_antialiasing"};
451 StaticShader armature_degrees_of_freedom = shader_clippable("overlay_armature_dof");
452 StaticShader attribute_viewer_mesh = shader_clippable("overlay_viewer_attribute_mesh");
454 "overlay_viewer_attribute_pointcloud");
455 StaticShader attribute_viewer_curve = shader_clippable("overlay_viewer_attribute_curve");
456 StaticShader attribute_viewer_curves = shader_clippable("overlay_viewer_attribute_curves");
457 StaticShader background_fill = {"overlay_background"};
458 StaticShader background_clip_bound = {"overlay_clipbound"};
459 StaticShader curve_edit_points = shader_clippable("overlay_edit_curves_point");
460 StaticShader curve_edit_line = shader_clippable("overlay_edit_particle_strand");
461 StaticShader curve_edit_handles = shader_clippable("overlay_edit_curves_handle");
462 StaticShader facing = shader_clippable("overlay_facing");
463 StaticShader grid = {"overlay_grid_next"};
464 StaticShader grid_background = {"overlay_grid_background"};
465 StaticShader grid_grease_pencil = shader_clippable("overlay_gpencil_canvas");
466 StaticShader grid_image = {"overlay_grid_image"};
467 StaticShader lattice_points = shader_clippable("overlay_edit_lattice_point");
468 StaticShader lattice_wire = shader_clippable("overlay_edit_lattice_wire");
469 StaticShader legacy_curve_edit_handles = shader_clippable("overlay_edit_curve_handle");
470 StaticShader legacy_curve_edit_normals = shader_clippable("overlay_edit_curve_normals");
471 StaticShader legacy_curve_edit_points = shader_clippable("overlay_edit_curve_point");
472 StaticShader legacy_curve_edit_wires = shader_clippable("overlay_edit_curve_wire");
473 StaticShader light_spot_cone = shader_clippable("overlay_extra_spot_cone");
474 StaticShader mesh_analysis = shader_clippable("overlay_edit_mesh_analysis");
475 StaticShader mesh_edit_depth = shader_clippable("overlay_edit_mesh_depth");
476 StaticShader mesh_edit_edge = shader_clippable("overlay_edit_mesh_edge");
477 StaticShader mesh_edit_face = shader_clippable("overlay_edit_mesh_face");
478 StaticShader mesh_edit_facedot = shader_clippable("overlay_edit_mesh_facedot");
479 StaticShader mesh_edit_vert = shader_clippable("overlay_edit_mesh_vert");
480 StaticShader mesh_edit_skin_root = shader_clippable("overlay_edit_mesh_skin_root");
481 StaticShader mesh_face_normal = shader_clippable("overlay_mesh_face_normal");
482 StaticShader mesh_face_normal_subdiv = shader_clippable("overlay_mesh_face_normal_subdiv");
483 StaticShader mesh_loop_normal = shader_clippable("overlay_mesh_loop_normal");
484 StaticShader mesh_loop_normal_subdiv = shader_clippable("overlay_mesh_loop_normal_subdiv");
485 StaticShader mesh_vert_normal = shader_clippable("overlay_mesh_vert_normal");
486 StaticShader mesh_vert_normal_subdiv = shader_clippable("overlay_mesh_vert_normal_subdiv");
487 StaticShader motion_path_line = shader_clippable("overlay_motion_path_line");
488 StaticShader motion_path_vert = shader_clippable("overlay_motion_path_point");
489 StaticShader outline_detect = {"overlay_outline_detect"};
490 StaticShader outline_prepass_curves = shader_clippable("overlay_outline_prepass_curves");
491 StaticShader outline_prepass_gpencil = shader_clippable("overlay_outline_prepass_gpencil");
492 StaticShader outline_prepass_mesh = shader_clippable("overlay_outline_prepass_mesh");
493 StaticShader outline_prepass_pointcloud = shader_clippable("overlay_outline_prepass_pointcloud");
494 StaticShader outline_prepass_wire = shader_clippable("overlay_outline_prepass_wire");
495 StaticShader paint_region_edge = shader_clippable("overlay_paint_wire");
496 StaticShader paint_region_face = shader_clippable("overlay_paint_face");
497 StaticShader paint_region_vert = shader_clippable("overlay_paint_point");
498 StaticShader paint_texture = shader_clippable("overlay_paint_texture");
499 StaticShader paint_weight = shader_clippable("overlay_paint_weight");
500 /* TODO(fclem): Specialization constant. */
501 StaticShader paint_weight_fake_shading = shader_clippable("overlay_paint_weight_fake_shading");
502 StaticShader particle_edit_vert = shader_clippable("overlay_edit_particle_point");
503 StaticShader particle_edit_edge = shader_clippable("overlay_edit_particle_strand");
504 StaticShader pointcloud_points = shader_clippable("overlay_edit_pointcloud");
505 StaticShader sculpt_curves = shader_clippable("overlay_sculpt_curves_selection");
506 StaticShader sculpt_curves_cage = shader_clippable("overlay_sculpt_curves_cage");
507 StaticShader sculpt_mesh = shader_clippable("overlay_sculpt_mask");
508 StaticShader uniform_color = shader_clippable("overlay_uniform_color");
509 StaticShader uv_analysis_stretch_angle = {"overlay_edit_uv_stretching_angle"};
510 StaticShader uv_analysis_stretch_area = {"overlay_edit_uv_stretching_area"};
511 StaticShader uv_brush_stencil = {"overlay_edit_uv_stencil_image"};
512 StaticShader uv_edit_edge = {"overlay_edit_uv_edges"};
513 StaticShader uv_edit_face = {"overlay_edit_uv_faces"};
514 StaticShader uv_edit_facedot = {"overlay_edit_uv_face_dots"};
515 StaticShader uv_edit_vert = {"overlay_edit_uv_verts"};
516 StaticShader uv_image_borders = {"overlay_edit_uv_tiled_image_borders"};
517 StaticShader uv_paint_mask = {"overlay_edit_uv_mask_image"};
518 StaticShader uv_wireframe = {"overlay_wireframe_uv"};
519 StaticShader xray_fade = {"overlay_xray_fade"};
520
522 StaticShader armature_envelope_fill = shader_selectable("overlay_armature_envelope_solid");
523 StaticShader armature_envelope_outline = shader_selectable("overlay_armature_envelope_outline");
524 StaticShader armature_shape_outline = shader_selectable("overlay_armature_shape_outline");
525 StaticShader armature_shape_fill = shader_selectable("overlay_armature_shape_solid");
526 StaticShader armature_shape_wire = shader_selectable("overlay_armature_shape_wire");
527 StaticShader armature_shape_wire_strip = shader_selectable("overlay_armature_shape_wire_strip");
528 StaticShader armature_sphere_outline = shader_selectable("overlay_armature_sphere_outline");
529 StaticShader armature_sphere_fill = shader_selectable("overlay_armature_sphere_solid");
530 StaticShader armature_stick = shader_selectable("overlay_armature_stick");
531 StaticShader armature_wire = shader_selectable("overlay_armature_wire");
532 StaticShader depth_curves = shader_selectable("overlay_depth_curves");
533 StaticShader depth_grease_pencil = shader_selectable("overlay_depth_gpencil");
534 StaticShader depth_mesh = shader_selectable("overlay_depth_mesh");
535 StaticShader depth_mesh_conservative = shader_selectable("overlay_depth_mesh_conservative");
536 StaticShader depth_pointcloud = shader_selectable("overlay_depth_pointcloud");
537 StaticShader extra_shape = shader_selectable("overlay_extra");
538 StaticShader extra_point = shader_selectable("overlay_extra_point");
539 StaticShader extra_wire = shader_selectable("overlay_extra_wire");
540 StaticShader extra_wire_object = shader_selectable("overlay_extra_wire_object");
541 StaticShader extra_loose_points = shader_selectable("overlay_extra_loose_point");
542 StaticShader extra_grid = shader_selectable("overlay_extra_grid");
543 StaticShader extra_ground_line = shader_selectable("overlay_extra_groundline");
544 StaticShader image_plane = shader_selectable("overlay_image");
545 StaticShader image_plane_depth_bias = shader_selectable("overlay_image_depth_bias");
546 StaticShader particle_dot = shader_selectable("overlay_particle_dot");
547 StaticShader particle_shape = shader_selectable("overlay_particle_shape");
548 StaticShader particle_hair = shader_selectable("overlay_particle_hair");
549 StaticShader wireframe_mesh = shader_selectable("overlay_wireframe");
550 /* Draw objects without edges for the wireframe overlay. */
551 StaticShader wireframe_points = shader_selectable("overlay_wireframe_points");
552 StaticShader wireframe_curve = shader_selectable("overlay_wireframe_curve");
553
554 StaticShader fluid_grid_lines_flags = shader_selectable_no_clip(
555 "overlay_volume_gridlines_flags");
556 StaticShader fluid_grid_lines_flat = shader_selectable_no_clip("overlay_volume_gridlines_flat");
557 StaticShader fluid_grid_lines_range = shader_selectable_no_clip(
558 "overlay_volume_gridlines_range");
559 StaticShader fluid_velocity_streamline = shader_selectable_no_clip(
560 "overlay_volume_velocity_streamline");
561 StaticShader fluid_velocity_mac = shader_selectable_no_clip("overlay_volume_velocity_mac");
562 StaticShader fluid_velocity_needle = shader_selectable_no_clip("overlay_volume_velocity_needle");
563
566 static ShaderModule &module_get(SelectionType selection_type, bool clipping_enabled);
567 static void module_free();
568
569 private:
570 ShaderModule(const SelectionType selection_type, const bool clipping_enabled)
571 : selection_type_(selection_type), clipping_enabled_(clipping_enabled) {};
572
573 StaticShader shader_clippable(const char *create_info_name);
574 StaticShader shader_selectable(const char *create_info_name);
575 StaticShader shader_selectable_no_clip(const char *create_info_name);
576};
577
579 /* Plane data to reference as push constant.
580 * Will be computed just before drawing. */
582 /* Center and size of the bounding box of the Grease Pencil object. */
584 /* Grease-pencil object resource handle. */
586};
587
590
591 /* Overlay Color. */
592 Framebuffer overlay_color_only_fb = {"overlay_color_only_fb"};
593 /* Overlay Color, Line Data. */
594 Framebuffer overlay_line_only_fb = {"overlay_line_only_fb"};
595 /* Depth, Overlay Color. */
596 Framebuffer overlay_fb = {"overlay_fb"};
597 /* Depth, Overlay Color, Line Data. */
598 Framebuffer overlay_line_fb = {"overlay_line_fb"};
599 /* Depth In-Front, Overlay Color. */
600 Framebuffer overlay_in_front_fb = {"overlay_in_front_fb"};
601 /* Depth In-Front, Overlay Color, Line Data. */
602 Framebuffer overlay_line_in_front_fb = {"overlay_line_in_front_fb"};
603
604 /* Output Color. */
605 Framebuffer overlay_output_color_only_fb = {"overlay_output_color_only_fb"};
606 /* Depth, Output Color. */
607 Framebuffer overlay_output_fb = {"overlay_output_fb"};
608
609 /* Render Frame-buffers. Only used for multiplicative blending on top of the render. */
610 /* TODO(fclem): Remove the usage of these somehow. This is against design. */
613
614 /* Target containing line direction and data for line expansion and anti-aliasing. */
616 /* Target containing overlay color before anti-aliasing. */
617 TextureFromPool overlay_tx = {"overlay_tx"};
618 /* Target containing depth of overlays when xray is enabled. */
619 TextureFromPool xray_depth_tx = {"xray_depth_tx"};
620 TextureFromPool xray_depth_in_front_tx = {"xray_depth_in_front_tx"};
621
622 /* Texture that are usually allocated inside. These are fallback when they aren't.
623 * They are then wrapped inside the #TextureRefs below. */
624 TextureFromPool depth_in_front_alloc_tx = {"overlay_depth_in_front_tx"};
625 TextureFromPool color_overlay_alloc_tx = {"overlay_color_overlay_alloc_tx"};
626 TextureFromPool color_render_alloc_tx = {"overlay_color_render_alloc_tx"};
627
628 /* 1px texture containing only maximum depth. To be used for fulfilling bindings when depth
629 * texture is not available or not needed. */
630 Texture dummy_depth_tx = {"dummy_depth_tx"};
631
632 /* Global vector for all grease pencil depth planes.
633 * Managed by the grease pencil overlay module.
634 * This is to avoid passing the grease pencil overlay class to other overlay and
635 * keep draw_grease_pencil as a static function.
636 * Memory is reference, so we have to use a container with fixed memory. */
639
643 /* Wrappers around #DefaultTextureList members. */
662
664 bool weight_ramp_custom = false;
667 Texture weight_ramp_tx = {"weight_ramp"};
668
670
672
673 Resources(const SelectionType selection_type_, const ShapeCache &shapes_)
674 : select::SelectMap(selection_type_), shapes(shapes_) {};
675
680
681 void update_theme_settings(const DRWContext *ctx, const State &state);
682 void update_clip_planes(const State &state);
683
684 void init(bool clipping_enabled)
685 {
687 shaders->anti_aliasing.ensure_compile_async();
688 shaders->armature_degrees_of_freedom.ensure_compile_async();
689 shaders->armature_envelope_fill.ensure_compile_async();
690 shaders->armature_envelope_outline.ensure_compile_async();
691 shaders->armature_shape_fill.ensure_compile_async();
692 shaders->armature_shape_outline.ensure_compile_async();
693 shaders->armature_shape_wire_strip.ensure_compile_async();
694 shaders->armature_shape_wire.ensure_compile_async();
695 shaders->armature_sphere_fill.ensure_compile_async();
696 shaders->armature_sphere_outline.ensure_compile_async();
697 shaders->armature_stick.ensure_compile_async();
698 shaders->armature_wire.ensure_compile_async();
699 shaders->attribute_viewer_curve.ensure_compile_async();
700 shaders->attribute_viewer_curves.ensure_compile_async();
701 shaders->attribute_viewer_mesh.ensure_compile_async();
702 shaders->attribute_viewer_pointcloud.ensure_compile_async();
703 shaders->background_fill.ensure_compile_async();
704 shaders->curve_edit_handles.ensure_compile_async();
705 shaders->curve_edit_line.ensure_compile_async();
706 shaders->curve_edit_points.ensure_compile_async();
707 shaders->depth_curves.ensure_compile_async();
708 shaders->depth_grease_pencil.ensure_compile_async();
709 shaders->depth_mesh.ensure_compile_async();
710 shaders->depth_pointcloud.ensure_compile_async();
711 shaders->extra_grid.ensure_compile_async();
712 shaders->extra_ground_line.ensure_compile_async();
713 shaders->extra_loose_points.ensure_compile_async();
714 shaders->extra_point.ensure_compile_async();
715 shaders->extra_shape.ensure_compile_async();
716 shaders->extra_wire_object.ensure_compile_async();
717 shaders->extra_wire.ensure_compile_async();
718 shaders->fluid_grid_lines_flags.ensure_compile_async();
719 shaders->fluid_grid_lines_flat.ensure_compile_async();
720 shaders->fluid_grid_lines_range.ensure_compile_async();
721 shaders->fluid_velocity_mac.ensure_compile_async();
722 shaders->fluid_velocity_needle.ensure_compile_async();
723 shaders->fluid_velocity_streamline.ensure_compile_async();
724 shaders->grid.ensure_compile_async();
725 shaders->image_plane_depth_bias.ensure_compile_async();
726 shaders->lattice_points.ensure_compile_async();
727 shaders->lattice_wire.ensure_compile_async();
728 shaders->legacy_curve_edit_handles.ensure_compile_async();
729 shaders->legacy_curve_edit_points.ensure_compile_async();
730 shaders->legacy_curve_edit_wires.ensure_compile_async();
731 shaders->light_spot_cone.ensure_compile_async();
732 shaders->mesh_analysis.ensure_compile_async();
733 shaders->mesh_edit_depth.ensure_compile_async();
734 shaders->mesh_edit_edge.ensure_compile_async();
735 shaders->mesh_edit_face.ensure_compile_async();
736 shaders->mesh_edit_facedot.ensure_compile_async();
737 shaders->mesh_edit_skin_root.ensure_compile_async();
738 shaders->mesh_edit_vert.ensure_compile_async();
739 shaders->motion_path_line.ensure_compile_async();
740 shaders->motion_path_vert.ensure_compile_async();
741 shaders->outline_detect.ensure_compile_async();
742 shaders->outline_prepass_curves.ensure_compile_async();
743 shaders->outline_prepass_gpencil.ensure_compile_async();
744 shaders->outline_prepass_mesh.ensure_compile_async();
745 shaders->outline_prepass_pointcloud.ensure_compile_async();
746 shaders->outline_prepass_wire.ensure_compile_async();
747 shaders->paint_weight_fake_shading.ensure_compile_async();
748 shaders->particle_dot.ensure_compile_async();
749 shaders->particle_edit_edge.ensure_compile_async();
750 shaders->particle_edit_vert.ensure_compile_async();
751 shaders->particle_hair.ensure_compile_async();
752 shaders->particle_shape.ensure_compile_async();
753 shaders->pointcloud_points.ensure_compile_async();
754 shaders->uniform_color.ensure_compile_async();
755 shaders->wireframe_curve.ensure_compile_async();
756 shaders->wireframe_mesh.ensure_compile_async();
757 shaders->wireframe_points.ensure_compile_async();
758 }
759
761 {
762 SelectMap::begin_sync(clipping_plane_count);
764 }
765
766 void acquire(const DRWContext *draw_ctx, const State &state)
767 {
768 DefaultTextureList &viewport_textures = *draw_ctx->viewport_texture_list_get();
769 DefaultFramebufferList &viewport_framebuffers = *draw_ctx->viewport_framebuffer_list_get();
770 this->depth_tx.wrap(viewport_textures.depth);
771 this->depth_in_front_tx.wrap(viewport_textures.depth_in_front);
772 this->color_overlay_tx.wrap(viewport_textures.color_overlay);
773 this->color_render_tx.wrap(viewport_textures.color);
774
775 this->render_fb = viewport_framebuffers.default_fb;
776 this->render_in_front_fb = viewport_framebuffers.in_front_fb;
777
778 int2 render_size = int2(this->depth_tx.size());
779
780 if (state.xray_enabled) {
781 /* For X-ray we render the scene to a separate depth buffer. */
782 this->xray_depth_tx.acquire(render_size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
783 this->depth_target_tx.wrap(this->xray_depth_tx);
784 /* TODO(fclem): Remove mandatory allocation. */
785 this->xray_depth_in_front_tx.acquire(render_size,
786 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
787 this->depth_target_in_front_tx.wrap(this->xray_depth_in_front_tx);
788 }
789 else {
790 /* TODO(fclem): Remove mandatory allocation. */
791 if (!this->depth_in_front_tx.is_valid()) {
792 this->depth_in_front_alloc_tx.acquire(render_size,
793 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
794 this->depth_in_front_tx.wrap(this->depth_in_front_alloc_tx);
795 }
796 this->depth_target_tx.wrap(this->depth_tx);
797 this->depth_target_in_front_tx.wrap(this->depth_in_front_tx);
798 }
799
800 /* TODO: Better semantics using a switch? */
801 if (!this->color_overlay_tx.is_valid()) {
802 /* Likely to be the selection case. Allocate dummy texture and bind only depth buffer. */
803 this->color_overlay_alloc_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
804 this->color_render_alloc_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
805
806 this->color_overlay_tx.wrap(this->color_overlay_alloc_tx);
807 this->color_render_tx.wrap(this->color_render_alloc_tx);
808
809 this->line_tx.acquire(int2(1, 1), gpu::TextureFormat::UNORM_8_8_8_8);
810 this->overlay_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
811
812 this->overlay_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx));
813 this->overlay_line_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx));
814 this->overlay_in_front_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx));
815 this->overlay_line_in_front_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx));
816 }
817 else {
820 this->line_tx.acquire(render_size, gpu::TextureFormat::UNORM_8_8_8_8, usage);
821 this->overlay_tx.acquire(render_size, gpu::TextureFormat::SRGBA_8_8_8_8, usage);
822
823 this->overlay_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx),
824 GPU_ATTACHMENT_TEXTURE(this->overlay_tx));
825 this->overlay_line_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx),
826 GPU_ATTACHMENT_TEXTURE(this->overlay_tx),
827 GPU_ATTACHMENT_TEXTURE(this->line_tx));
828 this->overlay_in_front_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_in_front_tx),
829 GPU_ATTACHMENT_TEXTURE(this->overlay_tx));
830 this->overlay_line_in_front_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_in_front_tx),
831 GPU_ATTACHMENT_TEXTURE(this->overlay_tx),
832 GPU_ATTACHMENT_TEXTURE(this->line_tx));
833 }
834
835 this->overlay_line_only_fb.ensure(GPU_ATTACHMENT_NONE,
836 GPU_ATTACHMENT_TEXTURE(this->overlay_tx),
837 GPU_ATTACHMENT_TEXTURE(this->line_tx));
838 this->overlay_color_only_fb.ensure(GPU_ATTACHMENT_NONE,
839 GPU_ATTACHMENT_TEXTURE(this->overlay_tx));
840
841 this->overlay_output_color_only_fb.ensure(GPU_ATTACHMENT_NONE,
842 GPU_ATTACHMENT_TEXTURE(this->color_overlay_tx));
843 this->overlay_output_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_tx),
844 GPU_ATTACHMENT_TEXTURE(this->color_overlay_tx));
845 }
846
847 void release()
848 {
849 this->line_tx.release();
850 this->overlay_tx.release();
851 this->xray_depth_tx.release();
852 this->xray_depth_in_front_tx.release();
853 this->depth_in_front_alloc_tx.release();
854 this->color_overlay_alloc_tx.release();
855 this->color_render_alloc_tx.release();
857 }
858
860 {
861 const bool is_edit = (state.object_mode & OB_MODE_EDIT) &&
862 (ob_ref.object->mode & OB_MODE_EDIT);
863 const bool active = ob_ref.is_active(state.object_active);
864 const bool is_selected = ((ob_ref.object->base_flag & BASE_SELECTED) != 0);
865
866 /* Object in edit mode. */
867 if (is_edit) {
868 return TH_WIRE_EDIT;
869 }
870 /* Transformed object during operators. */
871 if (((G.moving & G_TRANSFORM_OBJ) != 0) && is_selected) {
872 return TH_TRANSFORM;
873 }
874 /* Sets the 'theme_id' or fall back to wire */
875 if ((ob_ref.object->base_flag & BASE_SELECTED) != 0) {
876 return (active) ? TH_ACTIVE : TH_SELECT;
877 }
878
879 switch (ob_ref.object->type) {
880 case OB_LAMP:
881 return TH_LIGHT;
882 case OB_SPEAKER:
883 return TH_SPEAKER;
884 case OB_CAMERA:
885 return TH_CAMERA;
886 case OB_LIGHTPROBE:
887 /* TODO: add light-probe color. Use empty color for now. */
888 case OB_EMPTY:
889 return TH_EMPTY;
890 default:
891 return (is_edit) ? TH_WIRE_EDIT : TH_WIRE;
892 }
893 }
894
895 const float4 &object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
896 {
897 if (UNLIKELY(ob_ref.object->base_flag & BASE_FROM_SET)) {
898 return theme.colors.wire;
899 }
900 switch (theme_id) {
901 case TH_WIRE_EDIT:
902 return theme.colors.wire_edit;
903 case TH_ACTIVE:
904 return theme.colors.active_object;
905 case TH_SELECT:
906 return theme.colors.object_select;
907 case TH_TRANSFORM:
908 return theme.colors.transform;
909 case TH_SPEAKER:
910 return theme.colors.speaker;
911 case TH_CAMERA:
912 return theme.colors.camera;
913 case TH_EMPTY:
914 return theme.colors.empty;
915 case TH_LIGHT:
916 return theme.colors.light;
917 default:
918 return theme.colors.wire;
919 }
920 }
921
922 const float4 &object_wire_color(const ObjectRef &ob_ref, const State &state) const
923 {
924 ThemeColorID theme_id = object_wire_theme_id(ob_ref, state);
925 return object_wire_color(ob_ref, theme_id);
926 }
927
929 {
931 UI_GetThemeColorBlendShade4fv(theme_id, TH_BACK, 0.5, 0, color);
932 return color;
933 }
934
936 {
937 ThemeColorID theme_id = object_wire_theme_id(ob_ref, state);
938 return background_blend_color(theme_id);
939 }
940
942 {
943 if (state.v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) {
944 if (state.scene->world) {
945 return float4(float3(&state.scene->world->horr), 0.0f);
946 }
947 }
948 else if (state.v3d->shading.background_type == V3D_SHADING_BACKGROUND_VIEWPORT) {
949 return state.v3d->shading.background_color;
950 }
953 return color;
954 }
955
957 {
958 /* Free Movie clip textures after rendering */
959 for (MovieClip *clip : bg_movie_clips) {
961 }
962 bg_movie_clips.clear();
963 }
964
965 static float vertex_size_get()
966 {
967 /* M_SQRT2 to be at least the same size of the old square */
968 return max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * float(M_SQRT2) / 2.0f);
969 }
970
972
973 /* Returns true if drawing for any selection mode. */
974 bool is_selection() const
975 {
976 return this->selection_type != SelectionType::DISABLED;
977 }
978};
979
980/* List of flat objects draw-calls.
981 * In order to not loose selection display of flat objects view from the side,
982 * we store them in a list and add them to the pass just in time if their flat side is
983 * perpendicular to the view. */
984/* Reference to a flat object.
985 * Allow deferred rendering condition of flat object for special purpose. */
987 gpu::Batch *geom;
990
991 /* Returns flat axis index if only one axis is flat. Returns -1 otherwise. */
992 static int flat_axis_index_get(const Object *ob)
993 {
994 BLI_assert(ELEM(ob->type,
995 OB_MESH,
997 OB_SURF,
998 OB_FONT,
999 OB_CURVES,
1001 OB_VOLUME));
1002
1003 float dim[3];
1005 if (dim[0] == 0.0f) {
1006 return 0;
1007 }
1008 if (dim[1] == 0.0f) {
1009 return 1;
1010 }
1011 if (dim[2] == 0.0f) {
1012 return 2;
1013 }
1014 return -1;
1015 }
1016
1017 using Callback = FunctionRef<void(gpu::Batch *geom, ResourceIndex handle)>;
1018
1019 /* Execute callback for every handles that is orthogonal to the view.
1020 * Note: Only works in orthogonal view. */
1021 void if_flat_axis_orthogonal_to_view(Manager &manager, const View &view, Callback callback) const
1022 {
1023 for (ResourceIndex resource_index : handle.index_range()) {
1024 const float4x4 &object_to_world =
1025 manager.matrix_buf.current().get_or_resize(resource_index.resource_index()).model;
1026
1027 float3 view_forward = view.forward();
1028 float3 axis_not_flat_a = (flattened_axis_id == 0) ? object_to_world.y_axis() :
1029 object_to_world.x_axis();
1030 float3 axis_not_flat_b = (flattened_axis_id == 1) ? object_to_world.z_axis() :
1031 object_to_world.y_axis();
1032 float3 axis_flat = math::cross(axis_not_flat_a, axis_not_flat_b);
1033
1034 if (math::abs(math::dot(view_forward, axis_flat)) < 1e-3f) {
1035 callback(geom, resource_index);
1036 }
1037 }
1038 }
1039};
1040
1044template<typename InstanceDataT> struct ShapeInstanceBuf : private select::SelectBuf {
1045
1047
1050
1051 void clear()
1052 {
1053 this->select_clear();
1054 data_buf.clear();
1055 }
1056
1057 void append(const InstanceDataT &data, select::ID select_id)
1058 {
1059 this->select_append(select_id);
1060 data_buf.append(data);
1061 }
1062
1063 void end_sync(PassSimple::Sub &pass, gpu::Batch *shape)
1064 {
1065 if (data_buf.is_empty()) {
1066 return;
1067 }
1068 this->select_bind(pass);
1069 data_buf.push_update();
1070 pass.bind_ssbo("data_buf", &data_buf);
1071 pass.draw(shape, data_buf.size());
1072 }
1073
1075 gpu::Batch *shape,
1076 GPUPrimType primitive_type,
1077 uint primitive_len)
1078 {
1079 if (data_buf.is_empty()) {
1080 return;
1081 }
1082 this->select_bind(pass);
1083 data_buf.push_update();
1084 pass.bind_ssbo("data_buf", &data_buf);
1085 pass.draw_expand(shape, primitive_type, primitive_len, data_buf.size());
1086 }
1087};
1088
1090 protected:
1093 int color_id = 0;
1094
1095 VertexPrimitiveBuf(const SelectionType selection_type, const char *name = nullptr)
1096 : select_buf(selection_type), data_buf(name) {};
1097
1098 void append(const float3 &position, const float4 &color)
1099 {
1100 data_buf.append({float4(position, 0.0f), color});
1101 }
1102
1103 void end_sync(PassSimple::Sub &pass, GPUPrimType primitive)
1104 {
1105 if (data_buf.is_empty()) {
1106 return;
1107 }
1108 select_buf.select_bind(pass);
1109 data_buf.push_update();
1110 pass.bind_ssbo("data_buf", &data_buf);
1111 pass.push_constant("colorid", color_id);
1112 pass.draw_procedural(primitive, 1, data_buf.size());
1113 }
1114
1115 public:
1116 void clear()
1117 {
1118 select_buf.select_clear();
1119 data_buf.clear();
1120 color_id = 0;
1121 }
1122};
1123
1125
1126 public:
1127 PointPrimitiveBuf(const SelectionType selection_type, const char *name = nullptr)
1128 : VertexPrimitiveBuf(selection_type, name)
1129 {
1130 }
1131
1132 void append(const float3 &position,
1133 const float4 &color,
1135 {
1136 select_buf.select_append(select_id);
1138 }
1139
1140 void append(const float3 &position, const int color_id, select::ID select_id)
1141 {
1142 this->color_id = color_id;
1143 append(position, float4(), select_id);
1144 }
1145
1150};
1151
1153
1154 public:
1155 LinePrimitiveBuf(const SelectionType selection_type, const char *name = nullptr)
1156 : VertexPrimitiveBuf(selection_type, name)
1157 {
1158 }
1159
1160 void append(const float3 &start,
1161 const float3 &end,
1162 const float4 &color,
1164 {
1165 select_buf.select_append(select_id);
1168 }
1169
1170 void append(const float3 &start,
1171 const float3 &end,
1172 const int color_id,
1174 {
1175 this->color_id = color_id;
1176 append(start, end, float4(), select_id);
1177 }
1178
1183};
1184
1185/* Consider instance any object form a set or a dupli system.
1186 * This hides some overlay to avoid making the viewport unreadable. */
1187static inline bool is_from_dupli_or_set(const Object *ob)
1188{
1189 return ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI);
1190}
1191
1192/* Consider instance any object form a set or a dupli system.
1193 * This hides some overlay to avoid making the viewport unreadable. */
1194static inline bool is_from_dupli_or_set(const ObjectRef &ob_ref)
1195{
1196 return is_from_dupli_or_set(ob_ref.object);
1197}
1198
1199} // namespace blender::draw::overlay
eContextObjectMode
@ CTX_MODE_EDIT_MESH
@ G_TRANSFORM_OBJ
void BKE_movieclip_free_gputexture(struct MovieClip *clip)
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_get(const Object *ob, float r_vec[3])
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE float max_ff(float a, float b)
MINLINE float clamp_f(float value, float min, float max)
#define M_SQRT2
unsigned int uint
#define UNLIKELY(x)
#define ELEM(...)
@ BASE_FROM_DUPLI
@ BASE_FROM_SET
eObjectMode
@ OB_MODE_EDIT
@ OB_MODE_OBJECT
@ OB_SPEAKER
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
@ OB_LIGHTPROBE
#define BASE_SELECTED(v3d, base)
eSpace_Type
@ SPACE_NODE
@ SPACE_EMPTY
@ SPACE_IMAGE
@ SPACE_VIEW3D
@ V3D_SHADING_BACKGROUND_VIEWPORT
@ V3D_SHADING_BACKGROUND_WORLD
@ V3D_OVERLAY_SCULPT_SHOW_FACE_SETS
@ V3D_OVERLAY_FACE_ORIENTATION
@ V3D_OVERLAY_VIEWER_ATTRIBUTE
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_BONES
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_WIREFRAMES
@ V3D_OVERLAY_SHOW_LIGHT_COLORS
@ V3D_OVERLAY_SCULPT_SHOW_MASK
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_FADE_INACTIVE
@ V3D_OVERLAY_SCULPT_CURVES_CAGE
@ V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT
@ V3D_OVERLAY_BONE_SELECT
static AppView * view
#define GPU_BATCH_DISCARD_SAFE(batch)
Definition GPU_batch.hh:197
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
GPUPrimType
@ GPU_PRIM_LINES
@ GPU_PRIM_POINTS
eGPUTextureUsage
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_ATTACHMENT
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void UI_GetThemeColor3fv(int colorid, float col[3])
ThemeColorID
@ TH_LIGHT
@ TH_BACK
@ TH_WIRE
@ TH_CAMERA
@ TH_TRANSFORM
@ TH_SPEAKER
@ TH_VERTEX_SIZE
@ TH_EMPTY
@ TH_SELECT
@ TH_WIRE_EDIT
@ TH_ACTIVE
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
float UI_GetThemeValuef(int colorid)
BMesh const char void * data
long long int int64_t
SIMD_FORCE_INLINE btVector3 operator()(const btVector3 &x) const
Return the transform of the vector.
Definition btTransform.h:90
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
SwapChain< ObjectMatricesBuf, 2 > matrix_buf
bool is_active(const Object *active_object) const
void acquire(int2 extent, blender::gpu::TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL)
void wrap(gpu::Texture *tex)
int3 size(int miplvl=0) const
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
Definition draw_pass.hh:964
void draw_expand(gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, uint vertex_len, uint vertex_first, ResourceIndexRange res_index={}, uint custom_id=0)
Definition draw_pass.hh:925
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
Definition draw_pass.hh:893
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, gpu::StorageBuf *buffer)
detail::PassBase< command::DrawCommandBuf > Sub
Definition draw_pass.hh:499
static ShaderModule & module_get(SelectionType selection_type, bool clipping_enabled)
MutableSpan< T > data()
nullptr float
uint pos
#define active
static ulong state[N]
#define T
#define G(x, y, z)
gpu::StaticShader StaticShader
select::SelectionType SelectionType
static bool is_from_dupli_or_set(const Object *ob)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
T abs(const T &a)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3
const char * name
DefaultFramebufferList * viewport_framebuffer_list_get() const
DefaultTextureList * viewport_texture_list_get() const
blender::gpu::FrameBuffer * default_fb
blender::gpu::FrameBuffer * in_front_fb
blender::gpu::Texture * depth
blender::gpu::Texture * color
blender::gpu::Texture * color_overlay
blender::gpu::Texture * depth_in_front
short base_flag
void set_color(const float4 &bone_color)
BoneInstanceData(const float4x4 &ob_mat, const float3 &pos, const float radius, const float color[4])
void set_hint_color(const float4 &hint_color)
BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color, const float4 &hint_color)
BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color)
void if_flat_axis_orthogonal_to_view(Manager &manager, const View &view, Callback callback) const
FunctionRef< void(gpu::Batch *geom, ResourceIndex handle)> Callback
static int flat_axis_index_get(const Object *ob)
void append(const float3 &start, const float3 &end, const float4 &color, select::ID select_id=select::SelectMap::select_invalid_id())
void append(const float3 &start, const float3 &end, const int color_id, select::ID select_id=select::SelectMap::select_invalid_id())
LinePrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
PointPrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
void append(const float3 &position, const int color_id, select::ID select_id)
void append(const float3 &position, const float4 &color, select::ID select_id=select::SelectMap::select_invalid_id())
float4 background_color_get(const State &state)
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
const float4 & object_wire_color(const ObjectRef &ob_ref, const State &state) const
void begin_sync(int clipping_plane_count)
void acquire(const DRWContext *draw_ctx, const State &state)
void update_theme_settings(const DRWContext *ctx, const State &state)
detail::SubPassVector< GreasePencilDepthPlane, 16 > depth_planes
float4 object_background_blend_color(const ObjectRef &ob_ref, const State &state) const
draw::UniformArrayBuffer< float4, 6 > clip_planes_buf
void init(bool clipping_enabled)
float4 background_blend_color(ThemeColorID theme_id) const
ThemeColorID object_wire_theme_id(const ObjectRef &ob_ref, const State &state) const
draw::UniformBuffer< UniformData > globals_buf
Resources(const SelectionType selection_type_, const ShapeCache &shapes_)
void update_clip_planes(const State &state)
ShapeInstanceBuf(const SelectionType selection_type, const char *name=nullptr)
void end_sync(PassSimple::Sub &pass, gpu::Batch *shape)
void append(const InstanceDataT &data, select::ID select_id)
void end_sync(PassSimple::Sub &pass, gpu::Batch *shape, GPUPrimType primitive_type, uint primitive_len)
View::OffsetData offset_data_get() const
GPU_VERTEX_FORMAT_FUNC(VertShaded, pos, vclass, nor)
GPU_VERTEX_FORMAT_FUNC(VertexBone, pos, vclass)
void end_sync(PassSimple::Sub &pass, GPUPrimType primitive)
void append(const float3 &position, const float4 &color)
VertexPrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
StorageVectorBuffer< VertexData > data_buf
GPU_VERTEX_FORMAT_FUNC(VertexTriple, pos0, pos1, pos2)
GPU_VERTEX_FORMAT_FUNC(VertexWithColor, pos, color)
GPU_VERTEX_FORMAT_FUNC(Vertex, pos, vclass)
void select_bind(PassSimple::Sub &pass)
SelectBuf(const SelectionType selection_type)
SelectMap(const SelectionType selection_type)
static constexpr VertAttrType type
static constexpr VertAttrType type