34 PassMain images_ps_ = {
"images_ps_"};
37 PassSortable images_blend_ps_ = {
"images_blend_ps_"};
43 EmptyInstanceBuf plain_axes_buf = {selection_type_,
"plain_axes_buf"};
44 EmptyInstanceBuf single_arrow_buf = {selection_type_,
"single_arrow_buf"};
45 EmptyInstanceBuf cube_buf = {selection_type_,
"cube_buf"};
46 EmptyInstanceBuf circle_buf = {selection_type_,
"circle_buf"};
47 EmptyInstanceBuf sphere_buf = {selection_type_,
"sphere_buf"};
48 EmptyInstanceBuf cone_buf = {selection_type_,
"cone_buf"};
49 EmptyInstanceBuf arrows_buf = {selection_type_,
"arrows_buf"};
50 EmptyInstanceBuf image_buf = {selection_type_,
"image_buf"};
53 View::OffsetData offset_data_;
67 offset_data_ =
state.offset_data_get();
72 pass.
shader_set(res.shaders->image_plane_depth_bias.get());
76 res.select_bind(pass);
83 res.select_bind(pass, sub);
89 init_pass(images_ps_, draw_state);
92 init_sortable(images_back_ps_, draw_state);
93 init_sortable(images_blend_ps_, draw_state);
96 init_sortable(images_front_ps_, draw_state);
103 call_buffers.plain_axes_buf.clear();
104 call_buffers.single_arrow_buf.clear();
105 call_buffers.cube_buf.clear();
106 call_buffers.circle_buf.clear();
107 call_buffers.sphere_buf.clear();
108 call_buffers.cone_buf.clear();
109 call_buffers.arrows_buf.clear();
110 call_buffers.image_buf.clear();
123 const select::ID select_id = res.select_id(ob_ref);
125 image_sync(ob_ref, select_id, manager, res,
state, call_buffers_.image_buf);
129 ob_ref.object->object_to_world(),
130 ob_ref.object->empty_drawsize,
131 ob_ref.object->empty_drawtype,
138 const float draw_size,
139 const char empty_drawtype,
141 CallBuffers &call_buffers)
145 switch (empty_drawtype) {
147 call_buffers.plain_axes_buf.append(
data, select_id);
150 call_buffers.single_arrow_buf.append(
data, select_id);
153 call_buffers.cube_buf.append(
data, select_id);
156 call_buffers.circle_buf.append(
data, select_id);
159 call_buffers.sphere_buf.append(
data, select_id);
162 call_buffers.cone_buf.append(
data, select_id);
165 call_buffers.arrows_buf.append(
data, select_id);
177 res.select_bind(ps_);
184 CallBuffers &call_buffers)
187 state.clipping_plane_count);
194 call_buffers.cube_buf.end_sync(ps, res.
shapes.
cube.get());
195 call_buffers.circle_buf.end_sync(ps, res.
shapes.
circle.get());
198 call_buffers.arrows_buf.end_sync(ps, res.
shapes.
arrows.get());
208 manager.generate_commands(images_back_ps_,
view);
209 manager.generate_commands(images_ps_,
view);
210 manager.generate_commands(images_blend_ps_,
view);
211 manager.generate_commands(images_front_ps_,
view);
213 depth_bias_winmat_ = offset_data_.winmat_polygon_offset(
view.winmat(), -1.0f);
223 manager.submit(ps_,
view);
265 EmptyInstanceBuf &empty_image_buf)
273 const bool show_image = show_frame &&
287 if (ima !=
nullptr) {
299 calc_image_aspect(ima,
size, image_aspect);
301 mat = ob->object_to_world();
310 empty_image_buf.append(ExtraInstanceData(mat, color, 1.0f), select_id);
313 if (show_image && tex && ((ob->
color[3] > 0.0f) || !use_alpha_blend)) {
317 ob->empty_image_depth;
319 pass.bind_texture(
"img_tx", tex);
320 pass.push_constant(
"img_premultiplied", use_alpha_premult);
321 pass.push_constant(
"img_alpha_blend", use_alpha_blend);
322 pass.push_constant(
"is_camera_background",
false);
332 const bool use_alpha_blend,
338 return create_subpass(
state, mat, res, images_front_ps_,
true);
341 ob.empty_image_depth;
342 switch (depth_mode) {
344 return create_subpass(
state, mat, res, images_back_ps_,
false);
346 return create_subpass(
state, mat, res, images_front_ps_,
true);
349 return use_alpha_blend ? create_subpass(
state, mat, res, images_blend_ps_,
true) :
357 PassSortable &parent,
364 sub.shader_set(res.shaders->image_plane_depth_bias.get());
365 sub.push_constant(
"depth_bias_winmat", &depth_bias_winmat_);
368 sub.shader_set(res.shaders->image_plane.get());
391 const float2 scale_inv(ima_dim.
x * sca.x, ima_dim.
y * sca.y);
392 r_image_aspect = (scale_inv.x > scale_inv.y) ?
float2(1.0f, scale_inv.y / scale_inv.x) :
393 float2(scale_inv.x / scale_inv.y, 1.0f);
blender::gpu::Texture * BKE_image_get_gpu_texture(Image *image, ImageUser *iuser)
bool BKE_object_empty_image_frame_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_EMPTY_IMAGE_DEPTH_DEFAULT
@ OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_EMPTY_IMAGE_DEPTH_BACK
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
int GPU_texture_original_height(const blender::gpu::Texture *texture)
int GPU_texture_original_width(const blender::gpu::Texture *texture)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
void submit_only(PassMain &pass, View &view)
ResourceHandleRange resource_handle(const ObjectRef &ref, float inflate_bounds=0.0f)
void shader_set(gpu::Shader *shader)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
void push_constant(const char *name, const float &data)
detail::PassBase< command::DrawMultiBuf > Sub
void pre_draw(Manager &manager, View &view) final
static void object_sync(const select::ID select_id, const float4x4 &matrix, const float draw_size, const char empty_drawtype, const float4 &color, CallBuffers &call_buffers)
void draw_in_front_images(Framebuffer &framebuffer, Manager &manager, View &view)
void draw_images(Framebuffer &framebuffer, Manager &manager, View &view)
void begin_sync(Resources &res, const State &state) final
void end_sync(Resources &res, const State &state) final
Empties(const SelectionType selection_type)
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
static void begin_sync(CallBuffers &call_buffers)
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
static void end_sync(Resources &res, const State &state, PassSimple::Sub &ps, CallBuffers &call_buffers)
void draw_background_images(Framebuffer &framebuffer, Manager &manager, View &view)
static void stereo_setup(const Scene *scene, const View3D *v3d, ::Image *ima, ImageUser *iuser)
blender::gpu::Shader * get()
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
@ DRW_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_BLEND_ALPHA_PREMUL
select::SelectionType SelectionType
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
draw::UniformArrayBuffer< float4, 6 > clip_planes_buf
const ShapeCache & shapes
draw::UniformBuffer< UniformData > globals_buf