Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/clip_draw.c
| Context not available. | |||||
| #include "clip_intern.h" // own include | #include "clip_intern.h" // own include | ||||
| #include "GPU_immediate.h" | |||||
| /*********************** main area drawing *************************/ | /*********************** main area drawing *************************/ | ||||
| static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int width) | static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int width) | ||||
| Context not available. | |||||
| int height = (frame == cfra) ? 22 : 10; | int height = (frame == cfra) ? 22 : 10; | ||||
| int x = (frame - sfra) * framelen; | int x = (frame - sfra) * framelen; | ||||
| if (width == 1) { | VertexFormat* format = immVertexFormat(); | ||||
| glBegin(GL_LINES); | unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | ||||
merwin: immVertex2i uses (COMP_I32, 2, CONVERT_INT_TO_FLOAT) so this needs to match. | |||||
| glVertex2i(x, 0); | |||||
| glVertex2i(x, height * UI_DPI_FAC); | immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); | ||||
| glEnd(); | |||||
| if ( width == 1 ) { | |||||
| immBegin(GL_LINES, 2); | |||||
| immVertex2i(pos, x, 0); | |||||
| immVertex2i(pos, x, height * UI_DPI_FAC); | |||||
| immEnd(); | |||||
| } | } | ||||
| else { | else { | ||||
| glRecti(x, 0, x + width, height * UI_DPI_FAC); | immRecti(pos, x, 0, x + width, height + UI_DPI_FAC); | ||||
Not Done Inline ActionsimmRect has its own Begin/End pair, and they can't be nested. Move Begin/End back inside the if (width == 1) merwin: immRect has its own Begin/End pair, and they can't be nested. Move Begin/End back inside the if… | |||||
| } | } | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| static int generic_track_get_markersnr(MovieTrackingTrack *track, MovieTrackingPlaneTrack *plane_track) | static int generic_track_get_markersnr(MovieTrackingTrack *track, MovieTrackingPlaneTrack *plane_track) | ||||
| Context not available. | |||||
| BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points); | BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points); | ||||
| ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra); | ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra); | ||||
| VertexFormat* format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| /* track */ | /* track */ | ||||
Not Done Inline ActionsSMOOTH_COLOR is for gradients. Probably use UNIFORM_COLOR here to give each Rect one solid color. Replace glColor4ub with immUniformColor4ub merwin: SMOOTH_COLOR is for gradients. Probably use UNIFORM_COLOR here to give each Rect one solid… | |||||
| if (act_track || act_plane_track) { | if (act_track || act_plane_track) { | ||||
| for (i = sfra - clip->start_frame + 1, a = 0; i <= efra - clip->start_frame + 1; i++) { | for (i = sfra - clip->start_frame + 1, a = 0; i <= efra - clip->start_frame + 1; i++) { | ||||
Not Done Inline ActionsWhat lines? merwin: What lines? | |||||
| Context not available. | |||||
| framenr = generic_track_get_marker_framenr(act_track, act_plane_track, a); | framenr = generic_track_get_marker_framenr(act_track, act_plane_track, a); | ||||
| if (framenr != i) | if (framenr != i) | ||||
| glColor4ub(128, 128, 0, 96); | immUniformColor4ub(128, 128, 0, 96); | ||||
| else if (generic_track_is_marker_keyframed(act_track, act_plane_track, a)) | else if (generic_track_is_marker_keyframed(act_track, act_plane_track, a)) | ||||
| glColor4ub(255, 255, 0, 196); | immUniformColor4ub(255, 255, 0, 196); | ||||
| else | else | ||||
| glColor4ub(255, 255, 0, 96); | immUniformColor4ub(255, 255, 0, 96); | ||||
| immRecti(pos, (i - sfra + clip->start_frame - 1) * framelen, 0, (i - sfra + clip->start_frame) * framelen, 4 * UI_DPI_FAC); | |||||
| glRecti((i - sfra + clip->start_frame - 1) * framelen, 0, (i - sfra + clip->start_frame) * framelen, 4 * UI_DPI_FAC); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| int n = reconstruction->camnr; | int n = reconstruction->camnr; | ||||
| MovieReconstructedCamera *cameras = reconstruction->cameras; | MovieReconstructedCamera *cameras = reconstruction->cameras; | ||||
| glColor4ub(255, 0, 0, 96); | immUniformColor4ub(255, 255, 0, 96); | ||||
| for (i = sfra, a = 0; i <= efra; i++) { | for (i = sfra, a = 0; i <= efra; i++) { | ||||
| bool ok = false; | bool ok = false; | ||||
| Context not available. | |||||
| } | } | ||||
| if (!ok) | if (!ok) | ||||
| glRecti((i - sfra + clip->start_frame - 1) * framelen, 0, (i - sfra + clip->start_frame) * framelen, 8 * UI_DPI_FAC); | immRecti(pos, (i - sfra + clip->start_frame - 1) * framelen, 0, (i - sfra + clip->start_frame) * framelen, 8 * UI_DPI_FAC); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx; | x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx; | ||||
| UI_ThemeColor(TH_CFRAME); | UI_ThemeColor(TH_CFRAME); | ||||
| glRecti(x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); | |||||
| immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); | |||||
| ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC); | ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC); | ||||
| /* solver keyframes */ | /* solver keyframes */ | ||||
| glColor4ub(175, 255, 0, 255); | immUniformColor4ub(175, 255, 0, 255); | ||||
| draw_keyframe(act_object->keyframe1 + clip->start_frame - 1, CFRA, sfra, framelen, 2); | draw_keyframe(act_object->keyframe1 + clip->start_frame - 1, CFRA, sfra, framelen, 2); | ||||
| draw_keyframe(act_object->keyframe2 + clip->start_frame - 1, CFRA, sfra, framelen, 2); | draw_keyframe(act_object->keyframe2 + clip->start_frame - 1, CFRA, sfra, framelen, 2); | ||||
| Context not available. | |||||
| if ((sc->mode == SC_MODE_MASKEDIT) && sc->mask_info.mask) { | if ((sc->mode == SC_MODE_MASKEDIT) && sc->mask_info.mask) { | ||||
| ED_mask_draw_frames(sc->mask_info.mask, ar, CFRA, sfra, efra); | ED_mask_draw_frames(sc->mask_info.mask, ar, CFRA, sfra, efra); | ||||
| } | } | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar) | static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar) | ||||
| Context not available. | |||||
| { | { | ||||
| int x, y; | int x, y; | ||||
| VertexFormat* format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| /* find window pixel coordinates of origin */ | /* find window pixel coordinates of origin */ | ||||
| UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y); | UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y); | ||||
| glColor3f(0.0f, 0.0f, 0.0f); | immUniformColor3f(0.0f, 0.0f, 0.0f); | ||||
| glRectf(x, y, x + zoomx * width, y + zoomy * height); | immRectf(pos, x, y, x + zoomx * width, y + zoomy * height); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar, ImBuf *ibuf, | static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar, ImBuf *ibuf, | ||||
| Context not available. | |||||
| /* draw boundary border for frame if stabilization is enabled */ | /* draw boundary border for frame if stabilization is enabled */ | ||||
| if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) { | if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) { | ||||
| glColor3f(0.0f, 0.0f, 0.0f); | VertexFormat* format = immVertexFormat(); | ||||
| unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immBegin(GL_LINE_LOOP, 4); | |||||
| immUniformColor3f(0.0f, 0.0f, 0.0f); | |||||
| GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); | GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); | ||||
| GPU_basic_shader_line_stipple(3, 0xAAAA); | GPU_basic_shader_line_stipple(3, 0xAAAA); | ||||
| Context not available. | |||||
| glScalef(zoomx, zoomy, 1.0f); | glScalef(zoomx, zoomy, 1.0f); | ||||
| glMultMatrixf(sc->stabmat); | glMultMatrixf(sc->stabmat); | ||||
| glBegin(GL_LINE_LOOP); | immVertex2f(pos, 0.0f, 0.0f); | ||||
| glVertex2f(0.0f, 0.0f); | immVertex2f(pos, width, 0.0f); | ||||
| glVertex2f(width, 0.0f); | immVertex2f(pos, width, height); | ||||
| glVertex2f(width, height); | immVertex2f(pos, 0.0f, height); | ||||
| glVertex2f(0.0f, height); | immEnd(); | ||||
| glEnd(); | |||||
| glPopMatrix(); | glPopMatrix(); | ||||
| glDisable(GL_COLOR_LOGIC_OP); | glDisable(GL_COLOR_LOGIC_OP); | ||||
| GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); | GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (!tiny) { | if (!tiny) { | ||||
| UI_ThemeColor(TH_MARKER_OUTLINE); | UI_ThemeColor(TH_MARKER_OUTLINE); | ||||
| VertexFormat* format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| if (TRACK_VIEW_SELECTED(sc, track)) { | if (TRACK_VIEW_SELECTED(sc, track)) { | ||||
| immBeginAtMost(GL_POINTS, b); | |||||
| glPointSize(5.0f); | glPointSize(5.0f); | ||||
| glBegin(GL_POINTS); | |||||
| for (i = a; i < b; i++) { | for (i = a; i < b; i++) { | ||||
| if (i != curindex) | if (i != curindex) | ||||
| glVertex2f(path[i][0], path[i][1]); | immVertex2f(pos, path[i][0], path[i][1]); | ||||
| } | } | ||||
| glEnd(); | |||||
| immEnd(); | |||||
| } | } | ||||
| glLineWidth(3.0f); | glLineWidth(3.0f); | ||||
| glBegin(GL_LINE_STRIP); | |||||
| immBegin(GL_LINE_STRIP, b); | |||||
| for (i = a; i < b; i++) | for (i = a; i < b; i++) | ||||
| glVertex2f(path[i][0], path[i][1]); | immVertex2f(pos, path[i][0], path[i][1]); | ||||
| glEnd(); | immEnd(); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| UI_ThemeColor(TH_PATH_BEFORE); | UI_ThemeColor(TH_PATH_BEFORE); | ||||
| Context not available. | |||||
immVertex2i uses (COMP_I32, 2, CONVERT_INT_TO_FLOAT) so this needs to match.