Blender V5.0
blender::draw::overlay::Cursor Class Reference

#include <overlay_cursor.hh>

Inherits blender::draw::overlay::Overlay.

Public Member Functions

 Cursor ()
void begin_sync (Resources &res, const State &state) final
void draw_output (Framebuffer &framebuffer, Manager &manager, View &) final

Detailed Description

Draw the 2D/3D cursor. Controlled by (Overlay > 3D Cursor)

Definition at line 28 of file overlay_cursor.hh.

Constructor & Destructor Documentation

◆ Cursor()

blender::draw::overlay::Cursor::Cursor ( )
inline

Definition at line 35 of file overlay_cursor.hh.

Member Function Documentation

◆ begin_sync()

void blender::draw::overlay::Cursor::begin_sync ( Resources & ,
const State &  )
inlinefinalvirtual

Synchronization creates and fill render passes based on context state and scene state.

It runs for every scene update, so keep computation overhead low. If it is triggered, everything in the scene is considered updated. Note that this only concerns the render passes, the mesh batch caches are updated on a per object-data basis.

IMPORTANT: Synchronization must be view agnostic. That is, not rely on view position, projection matrix or frame-buffer size to do conditional pass creation. This is because, by design, syncing can happen once and rendered multiple time (multi view rendering, stereo rendering, orbiting view ...). Conditional pass creation, must be done in the drawing callbacks, but they should remain the exception. Also there will be no access to object data at this point. Creates passes used for object sync and enabling / disabling internal overlay types (e.g. vertices, edges, faces in edit mode). Runs once at the start of the sync cycle. Should also contain passes setup for overlays that are not per object overlays (e.g. Grid).

This method must be implemented.

Implements blender::draw::overlay::Overlay.

Definition at line 37 of file overlay_cursor.hh.

References SpaceImage::cursor, blender::draw::detail::PassBase< DrawCommandBufType >::draw_expand(), DRW_STATE_BLEND_ALPHA, DRW_STATE_WRITE_COLOR, ED_view3d_pixel_size_no_ui_scale(), ED_view3d_project_int_global(), blender::math::from_loc_rot_scale(), blender::math::from_rotation(), blender::math::from_scale(), GPU_PRIM_TRIS, GPU_SHADER_3D_POLYLINE_FLAT_COLOR, GPU_shader_get_builtin_shader(), blender::MatBase< float, 3, 3 >::identity(), blender::draw::detail::Pass< DrawCommandBufType >::init(), blender::MatBase< T, NumCol, NumRow, Alignment >::location(), View3DCursor::location, blender::math::projection::orthographic(), blender::draw::detail::PassBase< DrawCommandBufType >::push_constant(), blender::math::scale(), blender::draw::detail::PassBase< DrawCommandBufType >::shader_set(), state, blender::draw::detail::PassBase< DrawCommandBufType >::state_set(), status, U, UI_view2d_view_to_region(), V3D_PROJ_RET_OK, V3D_PROJ_TEST_CLIP_NEAR, and blender::MatBase< T, NumCol, NumRow, Alignment >::view().

◆ draw_output()

void blender::draw::overlay::Cursor::draw_output ( Framebuffer & framebuffer,
Manager & manager,
View &  )
inlinefinalvirtual

Reimplemented from blender::draw::overlay::Overlay.

Definition at line 129 of file overlay_cursor.hh.

References GPU_framebuffer_bind().


The documentation for this class was generated from the following file: