30 PassMain images_ps_ = {
"images_ps_"};
33 PassSortable images_blend_ps_ = {
"images_blend_ps_"};
37 View view_reference_images = {
"view_reference_images"};
38 float view_dist = 0.0f;
42 EmptyInstanceBuf plain_axes_buf = {selection_type_,
"plain_axes_buf"};
43 EmptyInstanceBuf single_arrow_buf = {selection_type_,
"single_arrow_buf"};
44 EmptyInstanceBuf cube_buf = {selection_type_,
"cube_buf"};
45 EmptyInstanceBuf circle_buf = {selection_type_,
"circle_buf"};
46 EmptyInstanceBuf sphere_buf = {selection_type_,
"sphere_buf"};
47 EmptyInstanceBuf cone_buf = {selection_type_,
"cone_buf"};
48 EmptyInstanceBuf arrows_buf = {selection_type_,
"arrows_buf"};
49 EmptyInstanceBuf image_buf = {selection_type_,
"image_buf"};
52 bool enabled_ =
false;
65 view_dist =
state.view_dist_get(
view.winmat());
85 init_pass(images_ps_, draw_state);
88 init_sortable(images_back_ps_, draw_state);
89 init_sortable(images_blend_ps_, draw_state);
92 init_sortable(images_front_ps_, draw_state);
99 call_buffers.plain_axes_buf.clear();
100 call_buffers.single_arrow_buf.clear();
101 call_buffers.cube_buf.clear();
102 call_buffers.circle_buf.clear();
103 call_buffers.sphere_buf.clear();
104 call_buffers.cone_buf.clear();
105 call_buffers.arrows_buf.clear();
106 call_buffers.image_buf.clear();
122 image_sync(ob_ref, select_id, shapes, manager, res,
state, call_buffers_.image_buf);
126 ob_ref.
object->object_to_world(),
135 const float draw_size,
136 const char empty_drawtype,
138 CallBuffers &call_buffers)
142 switch (empty_drawtype) {
144 call_buffers.plain_axes_buf.append(
data, select_id);
147 call_buffers.single_arrow_buf.append(
data, select_id);
150 call_buffers.cube_buf.append(
data, select_id);
153 call_buffers.circle_buf.append(
data, select_id);
156 call_buffers.sphere_buf.append(
data, select_id);
159 call_buffers.cone_buf.append(
data, select_id);
162 call_buffers.arrows_buf.append(
data, select_id);
182 CallBuffers &call_buffers)
185 state.clipping_plane_count);
189 call_buffers.plain_axes_buf.end_sync(ps, shapes.
plain_axes.get());
190 call_buffers.single_arrow_buf.end_sync(ps, shapes.
single_arrow.get());
191 call_buffers.cube_buf.end_sync(ps, shapes.
cube.get());
192 call_buffers.circle_buf.end_sync(ps, shapes.
circle.get());
193 call_buffers.sphere_buf.end_sync(ps, shapes.
empty_sphere.get());
194 call_buffers.cone_buf.end_sync(ps, shapes.
empty_cone.get());
195 call_buffers.arrows_buf.end_sync(ps, shapes.
arrows.get());
196 call_buffers.image_buf.end_sync(ps, shapes.
quad_wire.get());
227 view_reference_images.sync(
view.viewmat(),
230 manager.
submit(images_ps_, view_reference_images);
231 manager.
submit(images_blend_ps_, view_reference_images);
242 view_reference_images.sync(
view.viewmat(),
245 manager.
submit(images_front_ps_, view_reference_images);
255 EmptyInstanceBuf &empty_image_buf)
258 GPUTexture *tex =
nullptr;
263 const bool show_image = show_frame &&
277 if (ima !=
nullptr) {
289 calc_image_aspect(ima,
size, image_aspect);
291 mat = ob->object_to_world();
303 if (show_image && tex && ((ob->
color[3] > 0.0f) || !use_alpha_blend)) {
307 ob->empty_image_depth;
309 pass.bind_texture(
"imgTexture", tex);
310 pass.push_constant(
"imgPremultiplied", use_alpha_premult);
311 pass.push_constant(
"imgAlphaBlend", use_alpha_blend);
312 pass.push_constant(
"isCameraBackground",
false);
316 pass.draw(shapes.
quad_solid.get(), res_handle, select_id.
get());
322 const bool use_alpha_blend,
328 return create_subpass(
state, mat, res, images_front_ps_);
331 ob.empty_image_depth;
332 switch (depth_mode) {
334 return create_subpass(
state, mat, res, images_back_ps_);
336 return create_subpass(
state, mat, res, images_front_ps_);
339 return use_alpha_blend ? create_subpass(
state, mat, res, images_blend_ps_) : images_ps_;
346 PassSortable &parent)
351 sub.shader_set(res.shaders.image_plane.get());
352 sub.bind_ubo(
"globalsBlock", &res.globals_buf);
372 const float2 scale_inv(ima_dim.
x * sca.x, ima_dim.
y * sca.y);
373 r_image_aspect = (scale_inv.x > scale_inv.y) ?
float2(1.0f, scale_inv.y / scale_inv.x) :
374 float2(scale_inv.x / scale_inv.y, 1.0f);
GPUTexture * 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_DEPTH_DEFAULT
@ OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_EMPTY_IMAGE_DEPTH_BACK
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
int GPU_texture_original_height(const GPUTexture *texture)
int GPU_texture_original_width(const GPUTexture *texture)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
void submit(PassSimple &pass, View &view)
ResourceHandle resource_handle(const ObjectRef &ref, float inflate_bounds=0.0f)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void shader_set(GPUShader *shader)
detail::PassBase< command::DrawMultiBuf > Sub
void end_sync(Resources &res, ShapeCache &shapes, const State &state)
void object_sync(const ObjectRef &ob_ref, ShapeCache &shapes, Manager &manager, Resources &res, const State &state)
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)
Empties(const SelectionType selection_type)
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
static void begin_sync(CallBuffers &call_buffers)
void begin_sync(Resources &res, const State &state, const View &view)
void draw_background_images(Framebuffer &framebuffer, Manager &manager, View &view)
static void end_sync(Resources &res, ShapeCache &shapes, const State &state, PassSimple::Sub &ps, CallBuffers &call_buffers)
static void stereo_setup(const Scene *scene, const View3D *v3d, ::Image *ima, ImageUser *iuser)
bool DRW_state_is_depth()
@ DRW_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_BLEND_ALPHA_PREMUL
static float4x4 winmat_polygon_offset(float4x4 winmat, float view_dist, float offset)
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
struct ExtraInstanceData ExtraInstanceData
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
GPUUniformBuf * globals_buf
void select_bind(PassSimple &pass)
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)