Blender V5.0
GPU_immediate_util.hh File Reference
#include "BLI_sys_types.h"

Go to the source code of this file.

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_with_texco (uint pos, uint tex_coord, const rctf &p, const rctf &uv)
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)
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)
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_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)
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)
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, bool clear_alpha=false)
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], 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)
void imm_drawcircball (const float cent[3], float radius, const float tmat[4][4], uint pos)

Detailed Description

Utility drawing functions (rough equivalent to OpenGL's GLU)

Definition in file GPU_immediate_util.hh.

Function Documentation

◆ imm_cpack()

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!

Note
BGR format (i.e. 0xBBGGRR)...
Parameters
xcolor.

Definition at line 153 of file gpu_immediate_util.cc.

References immUniformColor3ub(), and x.

Referenced by blender::ed::curves::curve_draw_stroke_3d(), and curve_draw_stroke_3d().

◆ imm_draw_box_checker_2d()

◆ imm_draw_box_checker_2d_ex()

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 )

◆ imm_draw_box_wire_2d()

◆ imm_draw_box_wire_3d()

void imm_draw_box_wire_3d ( uint pos,
float x1,
float y1,
float x2,
float y2 )

◆ imm_draw_circle_dashed_3d()

void imm_draw_circle_dashed_3d ( uint pos,
float x,
float y,
float radius,
int nsegments )

◆ imm_draw_circle_fill_2d()

void imm_draw_circle_fill_2d ( uint shdr_pos,
float x,
float y,
float radius,
int nsegments )

Draw a filled circle with the given radius. The circle is centered at x, y and drawn in the XY plane.

Parameters
shdr_posThe vertex attribute number for position.
xHorizontal center.
yVertical center.
radiusThe circle's radius.
nsegmentsThe number of segments to use in drawing (more = smoother).

Definition at line 194 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_FAN, imm_draw_circle(), x, and y.

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().

◆ imm_draw_circle_fill_3d()

◆ imm_draw_circle_fill_aspect_2d()

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 205 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_FAN, imm_draw_circle(), x, and y.

Referenced by cage2d_draw_rect_rotate_handle().

◆ imm_draw_circle_fill_aspect_3d()

void imm_draw_circle_fill_aspect_3d ( uint pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments )

Definition at line 423 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_FAN, imm_draw_circle_3D(), pos, x, and y.

◆ imm_draw_circle_partial_wire_2d()

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 258 of file gpu_immediate_util.cc.

References GPU_PRIM_LINE_STRIP, imm_draw_circle_partial(), pos, x, and y.

◆ imm_draw_circle_partial_wire_3d()

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 264 of file gpu_immediate_util.cc.

References GPU_PRIM_LINE_STRIP, imm_draw_circle_partial_3d(), pos, x, y, and z().

Referenced by dial_geom_draw().

◆ imm_draw_circle_wire_2d()

void imm_draw_circle_wire_2d ( uint shdr_pos,
float x,
float y,
float radius,
int nsegments )

◆ imm_draw_circle_wire_3d()

◆ imm_draw_circle_wire_aspect_2d()

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 199 of file gpu_immediate_util.cc.

References GPU_PRIM_LINE_LOOP, imm_draw_circle(), x, and y.

Referenced by cage2d_draw_rect_rotate_handle().

◆ imm_draw_circle_wire_aspect_3d()

void imm_draw_circle_wire_aspect_3d ( uint pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments )

Definition at line 407 of file gpu_immediate_util.cc.

References GPU_PRIM_LINE_LOOP, imm_draw_circle_3D(), pos, x, and y.

Referenced by cage2d_draw_circle_wire().

◆ imm_draw_cube_corners_3d()

void imm_draw_cube_corners_3d ( uint pos,
const float center[3],
const float aspect[3],
float factor )

◆ imm_draw_cube_fill_3d()

void imm_draw_cube_fill_3d ( uint pos,
const float center[3],
const float aspect[3] )

◆ imm_draw_cube_wire_3d()

void imm_draw_cube_wire_3d ( uint pos,
const float center[3],
const float aspect[3] )

◆ imm_draw_cylinder_fill_3d()

void imm_draw_cylinder_fill_3d ( uint pos,
float base,
float top,
float height,
int slices,
int stacks )

Definition at line 660 of file gpu_immediate_util.cc.

References cosf, float, GPU_PRIM_TRIS, i, immBegin(), immEnd(), immVertex3fv(), M_PI, pos, sinf, top, and v2.

Referenced by arrow_draw_geom().

◆ imm_draw_cylinder_fill_normal_3d()

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.

Warning
Slow, better use it only if you no other choices.
Parameters
posThe vertex attribute number for position.
norThe vertex attribute number for normal.
baseSpecifies the radius of the cylinder at z = 0.
topSpecifies the radius of the cylinder at z = height.
heightSpecifies the height of the cylinder.
slicesSpecifies the number of subdivisions around the z axis.
stacksSpecifies the number of subdivisions along the z axis.

Definition at line 566 of file gpu_immediate_util.cc.

References cosf, float, GPU_PRIM_TRIS, i, immAttr3fv(), immBegin(), immEnd(), immVertex3fv(), M_PI, nor, normalize_v3(), pos, sinf, sub_v3_v3v3(), top, and v2.

◆ imm_draw_cylinder_wire_3d()

void imm_draw_cylinder_wire_3d ( uint pos,
float base,
float top,
float height,
int slices,
int stacks )

Definition at line 622 of file gpu_immediate_util.cc.

References cosf, float, GPU_PRIM_LINES, i, immBegin(), immEnd(), immVertex3fv(), M_PI, pos, sinf, top, and v2.

◆ imm_draw_disk_partial_fill_2d()

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.

Note
Arguments are gluPartialDisk compatible.
Parameters
posThe vertex attribute number for position.
xHorizontal center.
yVertical center.
rad_innerThe inner circle's radius.
rad_outerThe outer circle's radius (can be zero).
nsegmentsThe number of segments to use in drawing (more = smoother).
startSpecifies the starting angle, in degrees, of the disk portion.
sweepSpecifies the sweep angle, in degrees, of the disk portion.

Definition at line 329 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_STRIP, imm_draw_disk_partial(), pos, x, and y.

Referenced by dial_ghostarc_draw(), and widget_progress_type_ring().

◆ imm_draw_disk_partial_fill_3d()

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 341 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_STRIP, imm_draw_disk_partial_3d(), pos, x, y, and z().

Referenced by dial_geom_draw(), and gizmo_primitive_draw_geom().

◆ imm_drawcircball()

void imm_drawcircball ( const float cent[3],
float radius,
const float tmat[4][4],
uint pos )

◆ immRectf()

void immRectf ( uint pos,
float x1,
float y1,
float x2,
float y2 )

Definition at line 57 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(), ANIM_draw_scene_strip_range(), clip_draw_dopesheet_background(), clip_draw_dopesheet_channels(), clip_draw_dopesheet_main(), console_textview_draw_cursor(), blender::ed::spreadsheet::draw_alternating_row_overlay(), draw_backdrops(), draw_background(), draw_background(), blender::ed::spreadsheet::draw_column_reorder_source(), draw_columnheader_background(), draw_image_cache(), blender::ed::spreadsheet::draw_index_column_background(), draw_keyframe(), draw_marker_slide_square(), draw_markers_background(), draw_movieclip_cache(), draw_movieclip_muted(), draw_nla_main_data(), draw_normalization_borders(), blender::ed::vse::draw_seq_timeline_channels(), draw_suggestion_list(), draw_text_decoration(), draw_text_main(), draw_textscroll(), blender::ed::vse::draw_timeline_sfra_efra(), blender::ed::spreadsheet::draw_top_row_background(), blender::ed::transform::drawSnapping(), drawviewborder(), ED_image_draw_info(), ED_region_cache_draw_background(), ED_region_cache_draw_cached_segments(), ED_region_do_draw(), ED_region_grid_draw(), ED_region_image_metadata_draw(), ED_region_image_render_region_draw(), ED_region_info_draw_multiline(), 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(), blender::ed::outliner::outliner_draw_struct_marks(), blender::ed::vse::sequencer_draw_scopes(), blender::ed::vse::sequencer_preview_draw_overlays(), textview_draw_sel(), textview_draw_string(), timeline_cache_draw_single(), ui_draw_but_COLORBAND(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), 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().

◆ immRectf_fast()

void immRectf_fast ( uint pos,
float x1,
float y1,
float x2,
float y2 )

Same as immRectf / immRecti but does not call immBegin / immEnd. To use with GPU_PRIM_TRIS.

Definition at line 77 of file gpu_immediate_util.cc.

References immVertex2f(), and pos.

Referenced by timeline_cache_draw_cached_segments(), and timeline_cache_draw_geometry_nodes().

◆ immRectf_fast_with_color()

void immRectf_fast_with_color ( uint pos,
uint col,
float x1,
float y1,
float x2,
float y2,
const float color[4] )

Definition at line 88 of file gpu_immediate_util.cc.

References col, immAttr4fv(), immVertex2f(), and pos.

◆ immRectf_with_texco()

◆ immRecti()

void immRecti ( uint pos,
int x1,
int y1,
int x2,
int y2 )

Definition at line 67 of file gpu_immediate_util.cc.

References GPU_PRIM_TRI_FAN, immBegin(), immEnd(), immVertex2i(), and pos.

◆ immRecti_fast_with_color()

void immRecti_fast_with_color ( uint pos,
uint col,
int x1,
int y1,
int x2,
int y2,
const float color[4] )

Definition at line 106 of file gpu_immediate_util.cc.

References col, immAttr4fv(), immVertex2i(), and pos.