35 float *camera_z_axis = viewinv[2];
36 float *camera_pos = viewinv[3];
95 {GPU_ATTACHMENT_TEXTURE(txl->temp_depth_tx), GPU_ATTACHMENT_TEXTURE(txl->outlines_id_tx)});
101 GPU_ATTACHMENT_TEXTURE(txl->overlay_color_tx),
102 GPU_ATTACHMENT_TEXTURE(txl->overlay_line_tx),
109 GPU_ATTACHMENT_TEXTURE(dtxl->color_overlay),
124 const bool do_expand = (
U.pixelsize > 1.0) || (outline_width > 2.0f);
199 float plane[4] = {0.0f, 0.0f, 0.0f, 0.0f};
205 const Vector<DrawingInfo> drawings = retrieve_visible_drawings(*scene, grease_pencil,
true);
209 const float object_scale =
mat4_to_scale(ob->object_to_world().ptr());
210 const float thickness_scale = bke::greasepencil::LEGACY_RADIUS_CONVERSION_FACTOR;
212 gpu::VertBuf *position_tx = draw::DRW_cache_grease_pencil_position_buffer_get(scene, ob);
227 const VArray<int> stroke_materials = *attributes.lookup_or_default<
int>(
228 "material_index", bke::AttrDomain::Curve, 0);
229 const VArray<bool> cyclic = *attributes.lookup_or_default<
bool>(
230 "cyclic", bke::AttrDomain::Curve,
false);
232 IndexMaskMemory memory;
233 const IndexMask visible_strokes = ed::greasepencil::retrieve_visible_strokes(
234 *ob, info.drawing, memory);
236 visible_strokes.foreach_index([&](
const int stroke_i) {
237 const IndexRange points = points_by_curve[stroke_i];
238 const int material_index = stroke_materials[stroke_i];
241 const bool hide_onion = info.onion_id != 0;
244 const int num_stroke_triangles = (points.size() >= 3) ? (points.size() - 2) : 0;
245 const int num_stroke_vertices = (points.size() +
246 int(cyclic[stroke_i] && (points.size() >= 3)));
248 if (hide_material || hide_onion) {
249 t_offset += num_stroke_triangles;
250 t_offset += num_stroke_vertices * 2;
254 blender::gpu::Batch *geom = draw::DRW_cache_grease_pencil_get(scene, ob);
260 int v_first = t_offset * 3;
261 int v_count = num_stroke_triangles * 3;
265 t_offset += num_stroke_triangles;
268 int v_first = t_offset * 3;
269 int v_count = num_stroke_vertices * 2 * 3;
272 t_offset += num_stroke_vertices * 2;
280 blender::gpu::Batch *geom = DRW_cache_volume_selection_surface_get(ob);
281 if (geom ==
nullptr) {
293 DRW_shgroup_curves_create_sub(ob, shgroup,
nullptr);
306 DRW_shgroup_pointcloud_create_sub(ob, shgroup,
nullptr);
316 blender::gpu::Batch *geom;
345 if (dupli && !init_dupli) {
368 if (shgroup && geom) {
382 const float clearcol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
Low-level operations for curves.
Low-level operations for grease pencil.
struct MaterialGPencilStyle * BKE_gpencil_material_settings(struct Object *ob, short act)
General operations, lookup, etc. for blender objects.
std::optional< blender::Bounds< blender::float3 > > BKE_object_boundbox_get(const Object *ob)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
float mat4_to_scale(const float mat[4][4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
void rescale_m4(float mat[4][4], const float scale[3])
bool invert_m4(float mat[4][4])
void transpose_m4(float R[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
@ GREASE_PENCIL_STROKE_ORDER_3D
@ GP_MATERIAL_STROKE_SHOW
#define DRW_PASS_CREATE(pass, state)
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
#define DRW_shgroup_call(shgroup, geom, ob)
void GPU_framebuffer_clear_color_depth_stencil(GPUFrameBuffer *fb, const float clear_col[4], float clear_depth, uint clear_stencil)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
#define GPU_framebuffer_ensure_config(_fb,...)
float UI_GetThemeValuef(int colorid)
struct GPUShader GPUShader
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
OffsetIndices< int > evaluated_points_by_curve() const
blender::gpu::Batch * DRW_cache_object_surface_get(Object *ob)
blender::gpu::Batch * DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold)
bool DRW_object_is_flat(Object *ob, int *r_axis)
bool DRW_object_axis_orthogonal_to_view(Object *ob, int axis)
DefaultTextureList * DRW_viewport_texture_list_get()
const DRWContextState * DRW_context_state_get()
DRWShadingGroup * DRW_shgroup_create(GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_buffer_texture(DRWShadingGroup *shgroup, const char *name, blender::gpu::VertBuf *vertex_buffer)
bool DRW_view_is_persp_get(const DRWView *view)
DRWShadingGroup * DRW_shgroup_create_sub(DRWShadingGroup *shgroup)
bool DRW_pass_is_empty(DRWPass *pass)
void DRW_shgroup_call_range(DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *geom, uint v_sta, uint v_num)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, const Object *ob, uint tri_count)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_draw_pass(DRWPass *pass)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end()
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
@ DRW_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_BLEND_ALPHA_PREMUL
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
T midpoint(const T &a, const T &b)
static void gpencil_depth_plane(Object *ob, float r_plane[4])
static void OVERLAY_outline_curves(OVERLAY_PrivateData *pd, Object *ob)
void OVERLAY_outline_cache_populate(OVERLAY_Data *vedata, Object *ob, OVERLAY_DupliData *dupli, bool init_dupli)
void OVERLAY_outline_draw(OVERLAY_Data *vedata)
void OVERLAY_outline_init(OVERLAY_Data *vedata)
void OVERLAY_outline_cache_init(OVERLAY_Data *vedata)
static void OVERLAY_outline_pointcloud(OVERLAY_PrivateData *pd, Object *ob)
static void OVERLAY_outline_grease_pencil(OVERLAY_PrivateData *pd, Scene *scene, Object *ob)
static void OVERLAY_outline_volume(OVERLAY_PrivateData *pd, Object *ob)
GPUShader * OVERLAY_shader_outline_prepass(bool use_wire)
GPUShader * OVERLAY_shader_outline_prepass_pointcloud()
GPUShader * OVERLAY_shader_outline_detect()
GPUShader * OVERLAY_shader_outline_prepass_gpencil()
GPUShader * OVERLAY_shader_outline_prepass_curves()
GPUUniformBuf * block_ubo
OVERLAY_StorageList * stl
OVERLAY_FramebufferList * fbl
OVERLAY_TextureList * txl
DRWShadingGroup * outline_shgrp
blender::gpu::Batch * outline_geom
GPUFrameBuffer * outlines_prepass_fb
GPUFrameBuffer * outlines_resolve_fb
DRWPass * outlines_detect_ps
DRWPass * outlines_prepass_ps
DRWShadingGroup * outlines_gpencil_grp
bool xray_enabled_and_not_wire
DRWShadingGroup * outlines_grp
DRWShadingGroup * outlines_curves_grp
DRWShadingGroup * outlines_ptcloud_grp
struct OVERLAY_PrivateData::@227 antialiasing
GPUTexture * outlines_id_tx
GPUTexture * temp_depth_tx
DRWShadingGroup * stroke_grp