Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/CMakeLists.txt3
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c49
-rw-r--r--source/blender/editors/animation/anim_draw.c46
-rw-r--r--source/blender/editors/animation/anim_markers.c39
-rw-r--r--source/blender/editors/animation/keyframes_draw.c75
5 files changed, 99 insertions, 113 deletions
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 9e1e44e411d..0de1e201b85 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
../../blenkernel
../../blenlib
../../blenloader
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
@@ -58,4 +59,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(-DGLEW_STATIC)
+
blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 9ceecd60bef..027ff1a08e8 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -69,8 +69,8 @@
#include "ED_anim_api.h"
#include "ED_keyframing.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
+#include "GPU_colors.h"
+#include "GPU_primitives.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -110,14 +110,14 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
-
+
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
-
+ gpuCurrentColor3fv(color);
+
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
uiSetRoundBox((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
- uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_TRIANGLE_FAN, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
@@ -138,10 +138,10 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
+ gpuCurrentColor3fv(color);
/* no rounded corner - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
+ gpuSingleFilledRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
/* helper method to test if group colors should be drawn */
@@ -219,10 +219,10 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
+ gpuCurrentColor3fv(color);
/* no rounded corners - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
+ gpuSingleFilledRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
/* Indention + Offset ------------------------------------------- */
@@ -406,14 +406,14 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
+ gpuCurrentColor3fv(color);
/* rounded corners on LHS only
* - top and bottom
* - special hack: make the top a bit higher, since we are first...
*/
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
- uiDrawBox(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_TRIANGLE_FAN, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
/* name for summary entries */
@@ -779,11 +779,11 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
/* set backdrop drawing color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
+ gpuCurrentColor3fv(color);
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
- uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_TRIANGLE_FAN, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
/* name for group entries */
@@ -2943,17 +2943,15 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
ymid = y - 7;
/* y-coordinates for text is only 4 down from middle */
ytext = y - 4;
-
+
/* check if channel is selected */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
selected = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
else
selected = 0;
-
- /* set blending again, as may not be set in previous step */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
glEnable(GL_BLEND);
-
+
/* step 1) draw backdrop ........................................... */
if (acf->draw_backdrop)
acf->draw_backdrop(ac, ale, yminc, ymaxc);
@@ -2986,13 +2984,13 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* F-Curve channels need to have a special 'color code' box drawn, which is colored with whatever
* color the curve has stored
*/
- glColor3fv(fcu->color);
+ gpuCurrentColor3fv(fcu->color);
/* just a solid color rect
* hardcoded 17 pixels width is slightly wider than icon width, so that
* there's a slight border around it
*/
- glRectf(offset, yminc, offset + 17, ymaxc);
+ gpuSingleFilledRectf(offset, yminc, offset + 17, ymaxc);
}
/* icon is drawn as widget now... */
@@ -3025,10 +3023,9 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* draw red underline if channel is disabled */
if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) {
/* FIXME: replace hardcoded color here, and check on extents! */
- glColor3f(1.0f, 0.0f, 0.0f);
+ gpuCurrentColor3x(CPACK_RED);
glLineWidth(2.0);
- fdrawline((float)(offset), yminc,
- (float)(v2d->cur.xmax), yminc);
+ gpuSingleLinef(offset, yminc, v2d->cur.xmax, yminc); // DOODLE: single thick colored line
glLineWidth(1.0);
}
}
@@ -3045,7 +3042,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* get and set backdrop color */
acf->get_backdrop_color(ac, ale, color);
- glColor3fv(color);
+ gpuCurrentColor3fv(color);
/* check if we need to show the sliders */
if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
@@ -3090,7 +3087,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
* - starts from the point where the first toggle/slider starts,
* - ends past the space that might be reserved for a scroller
*/
- glRectf(v2d->cur.xmax - (float)offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
+ gpuSingleFilledRectf(v2d->cur.xmax - offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
}
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 0f0584ad8fe..81db69f87dc 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -45,12 +45,17 @@
#include "RNA_access.h"
-#include "BIF_gl.h"
+#include "GPU_colors.h"
+#include "GPU_primitives.h"
+
+#include "BIF_glutil.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "GPU_compatibility.h"
+
/* *************************************************** */
/* TIME CODE FORMATTING */
@@ -182,7 +187,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, float cfra, short time)
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_getscale(v2d, &xscale, &yscale);
- glScalef(1.0f / xscale, 1.0f, 1.0f);
+ gpuScale(1.0f / xscale, 1.0f, 1.0f);
/* get timecode string
* - padding on str-buf passed so that it doesn't sit on the frame indicator
@@ -201,14 +206,14 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, float cfra, short time)
/* draw green box around/behind text */
UI_ThemeColorShade(TH_CFRAME, 0);
- glRectf(x, y, x + slen, y + 15);
+ gpuSingleFilledRectf(x, y, x + slen, y + 15);
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
UI_DrawString(x - 5, y + 3, numstr);
/* restore view transform */
- glScalef(xscale, 1.0, 1.0);
+ gpuScale(xscale, 1.0, 1.0);
}
/* General call for drawing current frame indicator in animation editor */
@@ -216,26 +221,30 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
Scene *scene = CTX_data_scene(C);
float vec[2];
-
+
/* Draw a light green line to indicate current frame */
vec[0] = (float)(scene->r.cfra * scene->r.framelen);
-
+
UI_ThemeColor(TH_CFRAME);
if (flag & DRAWCFRA_WIDE)
glLineWidth(3.0);
else
glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
+
+ gpuImmediateFormat_V2();
+
+ gpuBegin(GL_LINE_STRIP);
vec[1] = v2d->cur.ymin - 500.0f; /* XXX arbitrary... want it go to bottom */
- glVertex2fv(vec);
-
+ gpuVertex2fv(vec);
+
vec[1] = v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
+ gpuVertex2fv(vec);
+ gpuEnd();
+
+ gpuImmediateUnformat();
+
glLineWidth(1.0);
-
+
/* Draw current frame number in a little box */
if (flag & DRAWCFRA_SHOW_NUMBOX) {
UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
@@ -254,17 +263,16 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d)
/* only draw this if preview range is set */
if (PRVRANGEON) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+ gpuCurrentColor4x(CPACK_BLACK, 0.4f);
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA) {
- glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
- glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ gpuSingleFilledRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
+ gpuSingleFilledRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
else {
- glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ gpuSingleFilledRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
glDisable(GL_BLEND);
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 852f3fa5469..a29787cd8d7 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -53,7 +53,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_interface.h"
@@ -70,6 +69,9 @@
#include "ED_transform.h"
#include "ED_types.h"
+#include "GPU_colors.h"
+#include "GPU_primitives.h"
+
/* ************* Marker API **************** */
/* helper function for getting the list of markers to work on */
@@ -357,10 +359,9 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
ypixels = BLI_rcti_size_y(&v2d->mask);
UI_view2d_getscale(v2d, &xscale, &yscale);
- glScalef(1.0f / xscale, 1.0f, 1.0f);
+ gpuScale(1.0f / xscale, 1.0f, 1.0f);
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
@@ -370,17 +371,18 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
#endif
{
setlinestyle(3);
-
- if (marker->flag & SELECT)
- glColor4ub(255, 255, 255, 96);
- else
- glColor4ub(0, 0, 0, 96);
-
- glBegin(GL_LINES);
- glVertex2f((xpos * xscale) + 0.5f, 12.0f);
- glVertex2f((xpos * xscale) + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
- glEnd();
-
+
+ gpuCurrentColor4x(
+ (marker->flag & SELECT) ? CPACK_WHITE : CPACK_BLACK,
+ 0.376f);
+
+ // DOODLE single 2D line, stippled
+ gpuSingleLinef(
+ (xpos * xscale) + 0.5f,
+ 12.0f,
+ (xpos * xscale) + 0.5f,
+ (v2d->cur.ymax + 12.0f) * yscale);
+
setlinestyle(0);
}
@@ -422,17 +424,14 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
#ifdef DURIAN_CAMERA_SWITCH
if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
- float col[4];
- glGetFloatv(GL_CURRENT_COLOR, col);
- col[3] = 0.4;
- glColor4fv(col);
+ gpuCurrentAlpha(0.4f);
}
#endif
- UI_DrawString(x, y, marker->name);
+ UI_DrawString(x, y, marker->name); // DOODLE text label
}
- glScalef(xscale, 1.0f, 1.0f);
+ gpuScale(xscale, 1.0f, 1.0f);
}
/* Draw Scene-Markers in time window */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index e520a95aa95..c41c71c5fc7 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -66,8 +66,8 @@
#include "BKE_material.h"
#include "BKE_global.h" // XXX remove me!
-
-#include "BIF_gl.h"
+#include "GPU_colors.h"
+#include "GPU_primitives.h"
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -550,45 +550,14 @@ static const float _unit_diamond_shape[4][2] = {
/* draw a simple diamond shape with OpenGL */
void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
{
- static GLuint displist1 = 0;
- static GLuint displist2 = 0;
-
- /* initialize 2 display lists for diamond shape - one empty, one filled */
- if (displist1 == 0) {
- displist1 = glGenLists(1);
- glNewList(displist1, GL_COMPILE);
-
- glBegin(GL_LINE_LOOP);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
-
- glEndList();
- }
- if (displist2 == 0) {
- displist2 = glGenLists(1);
- glNewList(displist2, GL_COMPILE);
-
- glBegin(GL_QUADS);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
-
- glEndList();
- }
-
/* tweak size of keyframe shape according to type of keyframe
* - 'proper' keyframes have key_type = 0, so get drawn at full size
*/
hsize -= 0.5f * key_type;
/* adjust view transform before starting */
- glTranslatef(x, y, 0.0f);
- glScalef(1.0f / xscale * hsize, hsize, 1.0f);
+ gpuTranslate(x, y, 0.0f);
+ gpuScale(1.0f / xscale * hsize, hsize, 1.0f);
/* anti-aliased lines for more consistent appearance */
glEnable(GL_LINE_SMOOTH);
@@ -599,22 +568,22 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
switch (key_type) {
case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames for now */
{
- if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
- else glColor4f(0.70f, 0.86f, 0.91f, alpha);
+ if (sel) gpuCurrentColor4f(0.33f, 0.75f, 0.93f, alpha);
+ else gpuCurrentColor4f(0.70f, 0.86f, 0.91f, alpha);
}
break;
case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
{
- if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha);
- else glColor4f(0.91f, 0.70f, 0.80f, alpha);
+ if (sel) gpuCurrentColor4f(0.95f, 0.5f, 0.5f, alpha);
+ else gpuCurrentColor4f(0.91f, 0.70f, 0.80f, alpha);
}
break;
case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */
{
- if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha);
- else glColor4f(0.58f, 0.90f, 0.46f, alpha);
+ if (sel) gpuCurrentColor4f(0.38f, 0.75f, 0.26f, alpha);
+ else gpuCurrentColor4f(0.58f, 0.90f, 0.46f, alpha);
}
break;
@@ -622,26 +591,36 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
default:
{
if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
- else glColor4f(0.91f, 0.91f, 0.91f, alpha);
+ else gpuCurrentColor4f(0.91f, 0.91f, 0.91f, alpha);
}
break;
}
- glCallList(displist2);
+ gpuBegin(GL_QUADS);
+ gpuVertex2fv(_unit_diamond_shape[0]);
+ gpuVertex2fv(_unit_diamond_shape[1]);
+ gpuVertex2fv(_unit_diamond_shape[2]);
+ gpuVertex2fv(_unit_diamond_shape[3]);
+ gpuEnd();
}
if (ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH)) {
/* exterior - black frame */
- glColor4f(0.0f, 0.0f, 0.0f, alpha);
+ gpuCurrentColor4x(CPACK_BLACK, alpha);
- glCallList(displist1);
+ gpuBegin(GL_LINE_LOOP);
+ gpuVertex2fv(_unit_diamond_shape[0]);
+ gpuVertex2fv(_unit_diamond_shape[1]);
+ gpuVertex2fv(_unit_diamond_shape[2]);
+ gpuVertex2fv(_unit_diamond_shape[3]);
+ gpuEnd();
}
glDisable(GL_LINE_SMOOTH);
/* restore view transform */
- glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
- glTranslatef(-x, -y, 0.0f);
+ gpuScale(xscale / hsize, 1.0f / hsize, 1.0f);
+ gpuTranslate(-x, -y, 0.0f);
}
static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos, short channelLocked)
@@ -665,7 +644,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
else
UI_ThemeColor4(TH_STRIP);
- glRectf(ab->start, ypos - 5, ab->end, ypos + 5);
+ gpuSingleFilledRectf(ab->start, ypos - 5, ab->end, ypos + 5);
}
}
}