Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Context not available. | |||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "GPU_basic_shader.h" | #include "GPU_basic_shader.h" | ||||
| #include "GPU_immediate.h" | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| Context not available. | |||||
| RNA_property_float_get_array(fill_ptr, fill_prop, col); | RNA_property_float_get_array(fill_ptr, fill_prop, col); | ||||
| } | } | ||||
| glColor4f(col[0], col[1], col[2], alpha); | |||||
| VertexFormat *format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| if (rc->gltex) { | if (rc->gltex) { | ||||
| unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| glBindTexture(GL_TEXTURE_2D, rc->gltex); | glBindTexture(GL_TEXTURE_2D, rc->gltex); | ||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |||||
| glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA); | ||||
| glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | immUniform1i("image", GL_TEXTURE0); | ||||
| immUniform1f("alpha", alpha); | |||||
| /* set up rotation if available */ | /* set up rotation if available */ | ||||
| if (rc->rot_prop) { | if (rc->rot_prop) { | ||||
| Context not available. | |||||
| } | } | ||||
| /* draw textured quad */ | /* draw textured quad */ | ||||
| GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); | immBegin(GL_QUADS, 4); | ||||
| glBegin(GL_QUADS); | |||||
| glTexCoord2f(0, 0); | immAttrib2f(texCoord, 0, 0); | ||||
| glVertex2f(-radius, -radius); | immVertex2f(pos, -radius, -radius); | ||||
| glTexCoord2f(1, 0); | |||||
| glVertex2f(radius, -radius); | immAttrib2f(texCoord, 1, 0); | ||||
| glTexCoord2f(1, 1); | immVertex2f(pos, radius, -radius); | ||||
| glVertex2f(radius, radius); | |||||
| glTexCoord2f(0, 1); | immAttrib2f(texCoord, 1, 1); | ||||
| glVertex2f(-radius, radius); | immVertex2f(pos, radius, radius); | ||||
| glEnd(); | |||||
| GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); | immAttrib2f(texCoord, 0, 1); | ||||
| immVertex2f(pos, -radius, radius); | |||||
| immEnd(); | |||||
| /* undo rotation */ | /* undo rotation */ | ||||
| if (rc->rot_prop) | if (rc->rot_prop) | ||||
| Context not available. | |||||
| } | } | ||||
| else { | else { | ||||
| /* flat color if no texture available */ | /* flat color if no texture available */ | ||||
| glutil_draw_filled_arc(0, M_PI * 2, radius, 40); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformColor3fvAlpha(col, alpha); | |||||
| imm_draw_filled_circle(pos, 0.0f, 0.0f, radius, 40); | |||||
| } | } | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| static void radial_control_paint_cursor(bContext *C, int x, int y, void *customdata) | static void radial_control_paint_cursor(bContext *C, int x, int y, void *customdata) | ||||
| Context not available. | |||||
| /* set line color */ | /* set line color */ | ||||
| if (rc->col_prop) | if (rc->col_prop) | ||||
| RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col); | RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col); | ||||
| glColor4f(col[0], col[1], col[2], 0.5); | |||||
| VertexFormat *format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformColor3fvAlpha(col, 0.5); | |||||
| if (rc->subtype == PROP_ANGLE) { | if (rc->subtype == PROP_ANGLE) { | ||||
| glPushMatrix(); | glPushMatrix(); | ||||
| /* draw original angle line */ | /* draw original angle line */ | ||||
| glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1); | glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1); | ||||
| fdrawline((float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); | immBegin(GL_LINES, 2); | ||||
| immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); | |||||
| immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); | |||||
| immEnd(); | |||||
| /* draw new angle line */ | /* draw new angle line */ | ||||
| glRotatef(RAD2DEGF(rc->current_value - rc->initial_value), 0, 0, 1); | glRotatef(RAD2DEGF(rc->current_value - rc->initial_value), 0, 0, 1); | ||||
| fdrawline((float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); | immBegin(GL_LINES, 2); | ||||
| immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); | |||||
| immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); | |||||
| immEnd(); | |||||
| glPopMatrix(); | glPopMatrix(); | ||||
| } | } | ||||
| /* draw circles on top */ | /* draw circles on top */ | ||||
| glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), r1, 40); | imm_draw_lined_circle(pos, 0.0f, 0.0f, r1, 40); | ||||
| glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), r2, 40); | imm_draw_lined_circle(pos, 0.0f, 0.0f, r2, 40); | ||||
| if (rmin > 0.0f) | if (rmin > 0.0f) | ||||
| glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), rmin, 40); | imm_draw_lined_circle(pos, 0.0, 0.0f, rmin, 40); | ||||
| BLF_size(fontid, 1.5 * fstyle_points * U.pixelsize, U.dpi); | BLF_size(fontid, 1.5 * fstyle_points * U.pixelsize, U.dpi); | ||||
| BLF_enable(fontid, BLF_SHADOW); | BLF_enable(fontid, BLF_SHADOW); | ||||
| Context not available. | |||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| glDisable(GL_LINE_SMOOTH); | glDisable(GL_LINE_SMOOTH); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| typedef enum { | typedef enum { | ||||
| Context not available. | |||||