use immUniformColor instead of immUniform("color"
The specialized color functions are better in every way: - faster lookup (don't have to match "color" string) - flexible inputs (RGB with separate alpha) - automatic alpha = 1.0 if not specified Sort of related to T49043
This commit is contained in:
parent
bf441fcfac
commit
7041b99b5a
|
@ -115,7 +115,7 @@ static void gp_set_point_uniform_color(const bGPDspoint *pt, const float ink[4])
|
|||
{
|
||||
float alpha = ink[3] * pt->strength;
|
||||
CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
|
||||
immUniform4f("color", ink[0], ink[1], ink[2], alpha);
|
||||
immUniformColor3fvAlpha(ink, alpha);
|
||||
}
|
||||
|
||||
static void gp_set_point_varying_color(const bGPDspoint *pt, const float ink[4], unsigned attrib_id)
|
||||
|
|
|
@ -303,7 +303,7 @@ static void region_draw_azone_icon(AZone *az)
|
|||
/* outlined circle */
|
||||
GPU_enable_program_point_size(); /* TODO: make a fixed-size shader to avoid this */
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, 0.8f);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.8f);
|
||||
immUniform4f("outlineColor", 0.2f, 0.2f, 0.2f, 0.9f);
|
||||
immUniform1f("outlineWidth", 1.0f);
|
||||
immUniform1f("size", 9.5f);
|
||||
|
@ -315,7 +315,7 @@ static void region_draw_azone_icon(AZone *az)
|
|||
|
||||
/* + */
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniform4f("color", 0.2f, 0.2f, 0.2f, 0.9f);
|
||||
immUniformColor4f(0.2f, 0.2f, 0.2f, 0.9f);
|
||||
immBegin(PRIM_LINES, 4);
|
||||
immVertex2f(pos, midx, midy - 2);
|
||||
immVertex2f(pos, midx, midy + 3);
|
||||
|
|
|
@ -675,10 +675,10 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
|
|||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
|
||||
if (col) {
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, overlay_alpha / 100.0f);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, overlay_alpha * 0.01f);
|
||||
}
|
||||
else {
|
||||
immUniform4f("color", UNPACK3(U.sculpt_paint_overlay_col), overlay_alpha / 100.0f);
|
||||
immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, overlay_alpha * 0.01f);
|
||||
}
|
||||
|
||||
/* draw textured quad */
|
||||
|
@ -762,11 +762,7 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
|
|||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
|
||||
immUniform4f("color",
|
||||
U.sculpt_paint_overlay_col[0],
|
||||
U.sculpt_paint_overlay_col[1],
|
||||
U.sculpt_paint_overlay_col[2],
|
||||
brush->cursor_overlay_alpha / 100.0f);
|
||||
immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, brush->cursor_overlay_alpha * 0.01f);
|
||||
|
||||
/* draw textured quad */
|
||||
|
||||
|
@ -825,12 +821,8 @@ BLI_INLINE void draw_tri_point(
|
|||
unsigned int pos, float sel_col[4], float pivot_col[4],
|
||||
float *co, float width, bool selected)
|
||||
{
|
||||
if (selected) {
|
||||
immUniformColor4fv(sel_col);
|
||||
}
|
||||
else {
|
||||
immUniformColor4fv(pivot_col);
|
||||
}
|
||||
immUniformColor4fv(selected ? sel_col : pivot_col);
|
||||
|
||||
glLineWidth(3.0f);
|
||||
|
||||
float w = width / 2.0f;
|
||||
|
@ -860,12 +852,8 @@ BLI_INLINE void draw_rect_point(
|
|||
unsigned int pos, float sel_col[4], float handle_col[4],
|
||||
float *co, float width, bool selected)
|
||||
{
|
||||
if (selected) {
|
||||
immUniformColor4fv(sel_col);
|
||||
}
|
||||
else {
|
||||
immUniformColor4fv(handle_col);
|
||||
}
|
||||
immUniformColor4fv(selected ? sel_col : handle_col);
|
||||
|
||||
glLineWidth(3.0f);
|
||||
|
||||
float w = width / 2.0f;
|
||||
|
|
|
@ -1105,7 +1105,7 @@ static void draw_plane_marker_image(Scene *scene,
|
|||
unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, plane_track->image_opacity);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity);
|
||||
immUniform1i("image", GL_TEXTURE0);
|
||||
|
||||
immBegin(PRIM_TRIANGLE_FAN, 4);
|
||||
|
|
|
@ -1310,7 +1310,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
|
|||
unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
immUniform1i("image", GL_TEXTURE0);
|
||||
|
||||
immBegin(PRIM_TRIANGLE_FAN, 4);
|
||||
|
|
|
@ -226,7 +226,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
|
|||
glEnable(GL_BLEND);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniform4f("color", 1.0f, 1.0f, 1.0f, 0.05f);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
|
||||
|
||||
immRecti(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
|
||||
|
|
|
@ -3089,7 +3089,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
|
|||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR);
|
||||
|
||||
immUniform4f("color", col[0], col[1], col[2], alpha);
|
||||
immUniformColor3fvAlpha(col, alpha);
|
||||
immUniform1i("image", GL_TEXTURE0);
|
||||
|
||||
/* set up rotation if available */
|
||||
|
@ -3208,7 +3208,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
|
|||
unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformColor3fvAlpha(col, 0.5);
|
||||
immUniformColor3fvAlpha(col, 0.5f);
|
||||
|
||||
if (rc->subtype == PROP_ANGLE) {
|
||||
gpuPushMatrix();
|
||||
|
|
Loading…
Reference in New Issue