|
Blender V4.3
|
#include <cstdio>#include <cstring>#include "BLI_math_rotation.h"#include "BLI_utildefines.h"#include "GPU_immediate.hh"#include "UI_resources.hh"Go to the source code of this file.
Macros | |
| #define | CIRCLE_RESOL 32 |
Functions | |
| void | immRectf (uint pos, float x1, float y1, float x2, float y2) |
| void | immRecti (uint pos, int x1, int y1, int x2, int y2) |
| void | immRectf_fast (uint pos, float x1, float y1, float x2, float y2) |
| void | immRectf_fast_with_color (uint pos, uint col, float x1, float y1, float x2, float y2, const float color[4]) |
| void | immRecti_fast_with_color (uint pos, uint col, int x1, int y1, int x2, int y2, const float color[4]) |
| void | imm_cpack (uint x) |
| static void | imm_draw_circle (GPUPrimType prim_type, const uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| void | imm_draw_circle_wire_2d (uint shdr_pos, float x, float y, float radius, int nsegments) |
| void | imm_draw_circle_fill_2d (uint shdr_pos, float x, float y, float radius, int nsegments) |
| void | imm_draw_circle_wire_aspect_2d (uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| void | imm_draw_circle_fill_aspect_2d (uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| static void | imm_draw_circle_partial (GPUPrimType prim_type, uint pos, float x, float y, float radius, int nsegments, float start, float sweep) |
| static void | imm_draw_circle_partial_3d (GPUPrimType prim_type, uint pos, float x, float y, float z, float rad, int nsegments, float start, float sweep) |
| void | imm_draw_circle_partial_wire_2d (uint pos, float x, float y, float radius, int nsegments, float start, float sweep) |
| void | imm_draw_circle_partial_wire_3d (uint pos, float x, float y, float z, float radius, int nsegments, float start, float sweep) |
| static void | imm_draw_disk_partial (GPUPrimType prim_type, uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep) |
| static void | imm_draw_disk_partial_3d (GPUPrimType prim_type, uint pos, float x, float y, float z, float rad_inner, float rad_outer, int nsegments, float start, float sweep) |
| void | imm_draw_disk_partial_fill_2d (uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep) |
| void | imm_draw_disk_partial_fill_3d (uint pos, float x, float y, float z, float rad_inner, float rad_outer, int nsegments, float start, float sweep) |
| static void | imm_draw_circle_3D (GPUPrimType prim_type, uint pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| void | imm_draw_circle_wire_3d (uint pos, float x, float y, float radius, int nsegments) |
| void | imm_draw_circle_wire_aspect_3d (uint pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| void | imm_draw_circle_dashed_3d (uint pos, float x, float y, float radius, int nsegments) |
| void | imm_draw_circle_fill_3d (uint pos, float x, float y, float radius, int nsegments) |
| void | imm_draw_circle_fill_aspect_3d (uint pos, float x, float y, float radius_x, float radius_y, int nsegments) |
| void | imm_draw_box_wire_2d (uint pos, float x1, float y1, float x2, float y2) |
| void | imm_draw_box_wire_3d (uint pos, float x1, float y1, float x2, float y2) |
| void | imm_draw_box_checker_2d_ex (float x1, float y1, float x2, float y2, const float color_primary[4], const float color_secondary[4], int checker_size) |
| void | imm_draw_box_checker_2d (float x1, float y1, float x2, float y2) |
| void | imm_draw_cube_fill_3d (uint pos, const float center[3], const float aspect[3]) |
| void | imm_draw_cube_wire_3d (uint pos, const float center[3], const float aspect[3]) |
| void | imm_draw_cube_corners_3d (uint pos, const float center[3], const float aspect[3], const float factor) |
| void | imm_draw_cylinder_fill_normal_3d (uint pos, uint nor, float base, float top, float height, int slices, int stacks) |
| void | imm_draw_cylinder_wire_3d (uint pos, float base, float top, float height, int slices, int stacks) |
| void | imm_draw_cylinder_fill_3d (uint pos, float base, float top, float height, int slices, int stacks) |
| static void | circball_array_fill (const float verts[CIRCLE_RESOL][3], const float cent[3], const float radius, const float tmat[4][4]) |
| void | imm_drawcircball (const float cent[3], float radius, const float tmat[4][4], uint pos) |
Variables | |
| static const float | cube_coords [8][3] |
| static const int | cube_quad_index [6][4] |
| static const int | cube_line_index [12][2] |
GPU immediate mode drawing utilities
Definition in file gpu_immediate_util.cc.
| #define CIRCLE_RESOL 32 |
Definition at line 677 of file gpu_immediate_util.cc.
Referenced by circball_array_fill(), and imm_drawcircball().
|
static |
Definition at line 679 of file gpu_immediate_util.cc.
References CIRCLE_RESOL, mul_v3_v3fl(), and verts.
Referenced by imm_drawcircball().
| void imm_cpack | ( | uint | x | ) |
Pack color into 3 bytes
This define converts a numerical value to the equivalent 24-bit color, while not being endian-sensitive. On little-endian, this is the same as doing a 'naive' indexing, on big-endian, it is not!
| x | color. |
Definition at line 133 of file gpu_immediate_util.cc.
References immUniformColor3ub().
Referenced by blender::ed::curves::curve_draw_stroke_3d(), and curve_draw_stroke_3d().
Definition at line 466 of file gpu_immediate_util.cc.
References imm_draw_box_checker_2d_ex(), TH_TRANSPARENT_CHECKER_PRIMARY, TH_TRANSPARENT_CHECKER_SECONDARY, TH_TRANSPARENT_CHECKER_SIZE, UI_GetThemeColor4fv(), and UI_GetThemeValue().
Referenced by draw_movieclip_buffer(), file_draw_preview(), sequencer_draw_preview(), and ui_tooltip_region_draw_cb().
| void imm_draw_box_checker_2d_ex | ( | float | x1, |
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const float | color_primary[4], | ||
| const float | color_secondary[4], | ||
| int | checker_size ) |
Draw a standard checkerboard to indicate transparent backgrounds.
Definition at line 446 of file gpu_immediate_util.cc.
References GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_SHADER_2D_CHECKER, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immRectf(), immUnbindProgram(), immUniform1i(), immUniform4fv(), immVertexFormat(), and pos.
Referenced by imm_draw_box_checker_2d(), playanim_toscreen_ex(), and ui_tooltip_region_draw_cb().
Draw a lined box.
| pos | The vertex attribute number for position. |
| x1 | left. |
| y1 | bottom. |
| x2 | right. |
| y2 | top. |
Definition at line 409 of file gpu_immediate_util.cc.
References GPU_PRIM_LINES, immBegin(), immEnd(), immVertex2f(), and pos.
Referenced by draw_marker_areas(), draw_marker_outline(), blender::ed::sculpt_paint::draw_rect_point(), draw_stabilization_border(), drawrenderborder(), drawviewborder(), ED_image_draw_info(), ED_imbuf_sample_draw(), ED_region_do_draw(), file_draw_preview(), nla_draw_strip(), sequencer_draw_borders_overlay(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_but_HSVCUBE(), UI_draw_safe_areas(), ui_tooltip_region_draw_cb(), and wm_gesture_draw_rect().
Definition at line 427 of file gpu_immediate_util.cc.
References GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3f(), and pos.
Referenced by drawPropRange().
|
static |
Definition at line 138 of file gpu_immediate_util.cc.
References cosf, float, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINES, immBegin(), immEnd(), immVertex2f(), M_PI, and sinf.
Referenced by imm_draw_circle_fill_2d(), imm_draw_circle_fill_aspect_2d(), imm_draw_circle_wire_2d(), and imm_draw_circle_wire_aspect_2d().
|
static |
Definition at line 335 of file gpu_immediate_util.cc.
References cosf, float, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3f(), M_PI, pos, and sinf.
Referenced by imm_draw_circle_dashed_3d(), imm_draw_circle_fill_3d(), imm_draw_circle_fill_aspect_3d(), imm_draw_circle_wire_3d(), and imm_draw_circle_wire_aspect_3d().
Definition at line 393 of file gpu_immediate_util.cc.
References GPU_PRIM_LINES, imm_draw_circle_3D(), and pos.
Referenced by blender::ed::sculpt_paint::cloth::simulation_limits_draw().
Draw a filled circle with the given radius. The circle is centered at x, y and drawn in the XY plane.
| shdr_pos | The vertex attribute number for position. |
| x | Horizontal center. |
| y | Vertical center. |
| radius | The circle's radius. |
| nsegments | The number of segments to use in drawing (more = smoother). |
Definition at line 174 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, and imm_draw_circle().
Referenced by annotation_draw_eraser(), blender::ed::sculpt_paint::grease_pencil_eraser_draw(), radial_control_paint_cursor(), radial_control_paint_tex(), and wm_gesture_draw_circle().
Definition at line 398 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, imm_draw_circle_3D(), and pos.
Referenced by arrow_draw_geom(), button2d_geom_draw_backdrop(), blender::ed::sculpt_paint::cursor_draw_point_screen_space(), dial_geom_draw(), gizmo_primitive_draw_geom(), and move_geom_draw().
| void imm_draw_circle_fill_aspect_2d | ( | uint | shdr_pos, |
| float | x, | ||
| float | y, | ||
| float | radius_x, | ||
| float | radius_y, | ||
| int | nsegments ) |
Definition at line 185 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, and imm_draw_circle().
Referenced by cage2d_draw_rect_corner_handles().
| void imm_draw_circle_fill_aspect_3d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | radius_x, | ||
| float | radius_y, | ||
| int | nsegments ) |
Definition at line 403 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, imm_draw_circle_3D(), and pos.
|
static |
Definition at line 191 of file gpu_immediate_util.cc.
References cosf, DEG2RADF, float, immBegin(), immEnd(), immVertex2f(), interpf(), M_PI_2, pos, and sinf.
Referenced by imm_draw_circle_partial_wire_2d().
|
static |
Definition at line 214 of file gpu_immediate_util.cc.
References cosf, DEG2RADF, float, immBegin(), immEnd(), immVertex3f(), interpf(), M_PI, pos, sinf, and z().
Referenced by imm_draw_circle_partial_wire_3d().
| void imm_draw_circle_partial_wire_2d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | radius, | ||
| int | nsegments, | ||
| float | start, | ||
| float | sweep ) |
Same as 'imm_draw_disk_partial_fill_2d', except it draws a wire arc.
Definition at line 238 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_STRIP, imm_draw_circle_partial(), and pos.
| void imm_draw_circle_partial_wire_3d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | radius, | ||
| int | nsegments, | ||
| float | start, | ||
| float | sweep ) |
Definition at line 244 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_STRIP, imm_draw_circle_partial_3d(), pos, and z().
Referenced by dial_geom_draw().
Draw a circle outline with the given radius. The circle is centered at x, y and drawn in the XY plane.
| shdr_pos | The vertex attribute number for position. |
| x | Horizontal center. |
| y | Vertical center. |
| radius | The circle's radius. |
| nsegments | The number of segments to use in drawing (more = smoother). |
Definition at line 169 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_LOOP, and imm_draw_circle().
Referenced by annotation_draw_eraser(), annotation_draw_stabilizer(), brush_drawcursor(), draw_lasso_smooth_stroke_indicator(), draw_start_vertex_circle(), drawSnapping(), blender::ed::sculpt_paint::grease_pencil_brush_cursor_draw(), blender::ed::sculpt_paint::grease_pencil_eraser_draw(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_draw(), blender::ed::sculpt_paint::paint_draw_2D_view_brush_cursor_default(), radial_control_paint_cursor(), tracking_segment_knot_cb(), ui_draw_but_HSVCIRCLE(), ui_draw_but_UNITVEC(), ui_draw_pie_center(), and wm_gesture_draw_circle().
Use this version when GPUVertFormat has a vec3 position.
Definition at line 382 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_LOOP, imm_draw_circle_3D(), and pos.
Referenced by button2d_geom_draw_backdrop(), cursor_point_draw(), dial_geom_draw(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_draw(), gizmo_primitive_draw_geom(), move_geom_draw(), blender::ed::sculpt_paint::paint_cursor_draw_main_inactive_cursor(), blender::ed::sculpt_paint::paint_draw_3D_view_inactive_brush_cursor(), blender::ed::sculpt_paint::paint_draw_legacy_3D_view_brush_cursor(), blender::ed::sculpt_paint::SCULPT_layer_brush_height_preview_draw(), and blender::ed::sculpt_paint::cloth::simulation_limits_draw().
| void imm_draw_circle_wire_aspect_2d | ( | uint | shdr_pos, |
| float | x, | ||
| float | y, | ||
| float | radius_x, | ||
| float | radius_y, | ||
| int | nsegments ) |
Definition at line 179 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_LOOP, and imm_draw_circle().
Referenced by cage2d_draw_rect_corner_handles().
| void imm_draw_circle_wire_aspect_3d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | radius_x, | ||
| float | radius_y, | ||
| int | nsegments ) |
Definition at line 387 of file gpu_immediate_util.cc.
References GPU_PRIM_LINE_LOOP, imm_draw_circle_3D(), and pos.
Referenced by cage2d_draw_circle_wire().
| void imm_draw_cube_corners_3d | ( | uint | pos, |
| const float | center[3], | ||
| const float | aspect[3], | ||
| const float | factor ) |
Definition at line 513 of file gpu_immediate_util.cc.
References add_v3_v3(), ARRAY_SIZE, copy_v3_v3(), cube_coords, cube_line_index, GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3fv(), madd_v3_v3v3v3(), mul_v3_fl(), pos, sub_v3_v3(), and sub_v3_v3v3().
Referenced by cursor_box_draw().
Definition at line 476 of file gpu_immediate_util.cc.
References ARRAY_SIZE, cube_coords, cube_quad_index, GPU_PRIM_TRIS, immBegin(), immEnd(), immVertex3fv(), madd_v3_v3v3v3(), and pos.
Referenced by cage3d_draw_box_interaction(), and imm_draw_point_aspect_3d().
Definition at line 497 of file gpu_immediate_util.cc.
References ARRAY_SIZE, cube_coords, cube_line_index, GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3fv(), madd_v3_v3v3v3(), and pos.
Referenced by cage3d_draw_box_corners(), cage3d_draw_circle_wire(), and imm_draw_point_aspect_3d().
| void imm_draw_cylinder_fill_3d | ( | uint | pos, |
| float | base, | ||
| float | top, | ||
| float | height, | ||
| int | slices, | ||
| int | stacks ) |
Definition at line 637 of file gpu_immediate_util.cc.
References cosf, float, GPU_PRIM_TRIS, immBegin(), immEnd(), immVertex3fv(), M_PI, pos, sinf, and v2.
Referenced by arrow_draw_geom().
| void imm_draw_cylinder_fill_normal_3d | ( | uint | pos, |
| uint | nor, | ||
| float | base, | ||
| float | top, | ||
| float | height, | ||
| int | slices, | ||
| int | stacks ) |
Draw a cylinder. Replacement for #gluCylinder.
| pos | The vertex attribute number for position. |
| nor | The vertex attribute number for normal. |
| base | Specifies the radius of the cylinder at z = 0. |
| top | Specifies the radius of the cylinder at z = height. |
| height | Specifies the height of the cylinder. |
| slices | Specifies the number of subdivisions around the z axis. |
| stacks | Specifies the number of subdivisions along the z axis. |
Definition at line 543 of file gpu_immediate_util.cc.
References cosf, float, GPU_PRIM_TRIS, immAttr3fv(), immBegin(), immEnd(), immVertex3fv(), M_PI, nor, normalize_v3(), pos, sinf, sub_v3_v3v3(), and v2.
| void imm_draw_cylinder_wire_3d | ( | uint | pos, |
| float | base, | ||
| float | top, | ||
| float | height, | ||
| int | slices, | ||
| int | stacks ) |
Definition at line 599 of file gpu_immediate_util.cc.
References cosf, float, GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3fv(), M_PI, pos, sinf, and v2.
|
static |
Definition at line 250 of file gpu_immediate_util.cc.
References CLAMP, cosf, DEG2RADF, float, immBegin(), immEnd(), immVertex2f(), interpf(), M_PI_2, pos, and sinf.
Referenced by imm_draw_disk_partial_fill_2d().
|
static |
Definition at line 279 of file gpu_immediate_util.cc.
References CLAMP, cosf, DEG2RADF, float, immBegin(), immEnd(), immVertex3f(), interpf(), M_PI_2, pos, sinf, and z().
Referenced by imm_draw_disk_partial_fill_3d().
| void imm_draw_disk_partial_fill_2d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | rad_inner, | ||
| float | rad_outer, | ||
| int | nsegments, | ||
| float | start, | ||
| float | sweep ) |
Draw a filled arc with the given inner and outer radius. The circle is centered at x, y and drawn in the XY plane.
gluPartialDisk compatible.| pos | The vertex attribute number for position. |
| x | Horizontal center. |
| y | Vertical center. |
| rad_inner | The inner circle's radius. |
| rad_outer | The outer circle's radius (can be zero). |
| nsegments | The number of segments to use in drawing (more = smoother). |
| start | Specifies the starting angle, in degrees, of the disk portion. |
| sweep | Specifies the sweep angle, in degrees, of the disk portion. |
Definition at line 309 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_STRIP, imm_draw_disk_partial(), and pos.
Referenced by dial_ghostarc_draw(), and widget_progress_type_ring().
| void imm_draw_disk_partial_fill_3d | ( | uint | pos, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | rad_inner, | ||
| float | rad_outer, | ||
| int | nsegments, | ||
| float | start, | ||
| float | sweep ) |
Definition at line 321 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_STRIP, imm_draw_disk_partial_3d(), pos, and z().
Referenced by dial_geom_draw(), and gizmo_primitive_draw_geom().
Definition at line 715 of file gpu_immediate_util.cc.
References circball_array_fill(), CIRCLE_RESOL, GPU_PRIM_LINE_LOOP, immBegin(), immEnd(), immVertex3fv(), pos, and verts.
Referenced by drawPropCircle(), and drawSnapping().
Definition at line 54 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, immBegin(), immEnd(), immVertex2f(), and pos.
Referenced by acf_generic_channel_backdrop(), acf_generic_dataexpand_backdrop(), ANIM_channel_draw(), ANIM_channel_draw_widgets(), ANIM_draw_action_framerange(), ANIM_draw_framerange(), ANIM_draw_previewrange(), clip_draw_dopesheet_background(), clip_draw_dopesheet_channels(), clip_draw_dopesheet_main(), clip_draw_sfra_efra(), console_textview_draw_cursor(), draw_backdrops(), draw_background(), draw_background(), draw_columnheader_background(), draw_current_frame(), draw_marker_slide_square(), draw_markers_background(), draw_movieclip_muted(), draw_nla_main_data(), draw_normalization_borders(), draw_seq_timeline_channels(), draw_timeline_sfra_efra(), drawSnapping(), drawviewborder(), ED_region_do_draw(), ED_region_grid_draw(), ED_region_image_metadata_draw(), ED_time_scrub_channel_search_draw(), gizmo_cage2d_draw_intern(), gizmo_cage3d_draw_intern(), gizmo_ruler_draw(), imm_draw_box_checker_2d_ex(), knifetool_draw_angle(), knifetool_draw_visible_distances(), nla_action_draw_keyframes(), nla_draw_strip(), blender::ed::space_node::node_draw_preview_background(), sequencer_draw_scopes(), timeline_cache_draw_single(), ui_draw_but_COLORBAND(), ui_draw_but_CURVE(), and ui_draw_but_CURVEPROFILE().
Same as immRectf / immRecti but does not call immBegin / immEnd. To use with GPU_PRIM_TRIS.
Definition at line 74 of file gpu_immediate_util.cc.
References immVertex2f(), and pos.
Referenced by timeline_cache_draw_cached_segments(), and timeline_cache_draw_geometry_nodes().
| void immRectf_fast_with_color | ( | uint | pos, |
| uint | col, | ||
| float | x1, | ||
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const float | color[4] ) |
Definition at line 85 of file gpu_immediate_util.cc.
References col, immAttr4fv(), immVertex2f(), and pos.
Definition at line 64 of file gpu_immediate_util.cc.
References GPU_PRIM_TRI_FAN, immBegin(), immEnd(), immVertex2i(), and pos.
Referenced by blender::ed::spreadsheet::draw_alternating_row_overlay(), draw_image_cache(), blender::ed::spreadsheet::draw_index_column_background(), draw_keyframe(), draw_movieclip_cache(), blender::ed::spreadsheet::draw_top_row_background(), ED_image_draw_info(), ED_region_cache_draw_background(), ED_region_cache_draw_cached_segments(), ED_region_cache_draw_curfra_label(), ED_region_info_draw_multiline(), blender::ed::outliner::outliner_draw_highlights(), blender::ed::outliner::outliner_draw_struct_marks(), textview_draw_sel(), textview_draw_string(), ui_draw_button_sections_alignment_separator(), UI_draw_text_underline(), UI_panel_category_draw_all(), vicon_colorset_draw(), vicon_gplayer_color_draw(), widget_draw_text(), wm_gesture_draw_rect(), and wm_software_cursor_draw_crosshair().
| void immRecti_fast_with_color | ( | uint | pos, |
| uint | col, | ||
| int | x1, | ||
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| const float | color[4] ) |
Definition at line 103 of file gpu_immediate_util.cc.
References col, immAttr4fv(), immVertex2i(), and pos.
|
static |
Definition at line 21 of file gpu_immediate_util.cc.
Referenced by imm_draw_cube_corners_3d(), imm_draw_cube_fill_3d(), and imm_draw_cube_wire_3d().
|
static |
Definition at line 39 of file gpu_immediate_util.cc.
Referenced by imm_draw_cube_corners_3d(), and imm_draw_cube_wire_3d().
|
static |
Definition at line 31 of file gpu_immediate_util.cc.
Referenced by imm_draw_cube_fill_3d().