Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/clip_draw.c
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip, Scene *scene) | ||||
| ED_region_cache_draw_background(region); | ED_region_cache_draw_background(region); | ||||
| /* cached segments -- could be useful to debug caching strategies */ | /* cached segments -- could be useful to debug caching strategies */ | ||||
| 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(region, totseg, points, sfra, efra); | ED_region_cache_draw_cached_segments(region, totseg, points, sfra, efra); | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* track */ | /* track */ | ||||
| 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++) { | ||||
| int framenr; | int framenr; | ||||
| int markersnr = generic_track_get_markersnr(act_track, act_plane_track); | int markersnr = generic_track_get_markersnr(act_track, act_plane_track); | ||||
| while (a < markersnr) { | while (a < markersnr) { | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip, Scene *scene) | ||||
| immUniformThemeColor(TH_CFRAME); | immUniformThemeColor(TH_CFRAME); | ||||
| immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); | immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| 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); | ||||
| pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* solver keyframes */ | /* solver keyframes */ | ||||
| immUniformColor4ub(175, 255, 0, 255); | immUniformColor4ub(175, 255, 0, 255); | ||||
| draw_keyframe( | draw_keyframe( | ||||
| act_object->keyframe1 + clip->start_frame - 1, scene->r.cfra, sfra, framelen, 2, pos); | act_object->keyframe1 + clip->start_frame - 1, scene->r.cfra, sfra, framelen, 2, pos); | ||||
| draw_keyframe( | draw_keyframe( | ||||
| act_object->keyframe2 + clip->start_frame - 1, scene->r.cfra, sfra, framelen, 2, pos); | act_object->keyframe2 + clip->start_frame - 1, scene->r.cfra, sfra, framelen, 2, pos); | ||||
| Show All 28 Lines | static void draw_movieclip_notes(SpaceClip *sc, ARegion *region) | ||||
| } | } | ||||
| } | } | ||||
| static void draw_movieclip_muted(ARegion *region, int width, int height, float zoomx, float zoomy) | static void draw_movieclip_muted(ARegion *region, int width, int height, float zoomx, float zoomy) | ||||
| { | { | ||||
| int x, y; | int x, y; | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* find window pixel coordinates of origin */ | /* find window pixel coordinates of origin */ | ||||
| UI_view2d_view_to_region(®ion->v2d, 0.0f, 0.0f, &x, &y); | UI_view2d_view_to_region(®ion->v2d, 0.0f, 0.0f, &x, &y); | ||||
| immUniformColor3f(0.0f, 0.0f, 0.0f); | immUniformColor3f(0.0f, 0.0f, 0.0f); | ||||
| immRectf(pos, x, y, x + zoomx * width, y + zoomy * height); | immRectf(pos, x, y, x + zoomx * width, y + zoomy * height); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | if (num_points_before != 0 && num_points_after != 0) { | ||||
| num_all_points -= 1; | num_all_points -= 1; | ||||
| } | } | ||||
| const int path_start_index = count - num_points_before + 1; | const int path_start_index = count - num_points_before + 1; | ||||
| const int path_center_index = count; | const int path_center_index = count; | ||||
| const uint position_attribute = GPU_vertformat_attr_add( | const uint position_attribute = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* Draw path outline. */ | /* Draw path outline. */ | ||||
| if (!tiny) { | if (!tiny) { | ||||
| immUniformThemeColor(TH_MARKER_OUTLINE); | immUniformThemeColor(TH_MARKER_OUTLINE); | ||||
| if (TRACK_VIEW_SELECTED(sc, track)) { | if (TRACK_VIEW_SELECTED(sc, track)) { | ||||
| GPU_point_size(5.0f); | GPU_point_size(5.0f); | ||||
| draw_track_path_points(path, position_attribute, path_start_index, num_all_points); | draw_track_path_points(path, position_attribute, path_start_index, num_all_points); | ||||
| GPU_point_size(7.0f); | GPU_point_size(7.0f); | ||||
| ▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | static void draw_marker_areas(SpaceClip *sc, | ||||
| /* Restore default shader */ | /* Restore default shader */ | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| const uint pos = GPU_vertformat_attr_add( | const uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| BLI_assert(pos == shdr_pos); | BLI_assert(pos == shdr_pos); | ||||
| UNUSED_VARS_NDEBUG(pos); | UNUSED_VARS_NDEBUG(pos); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| } | } | ||||
| static float get_shortest_pattern_side(MovieTrackingMarker *marker) | static float get_shortest_pattern_side(MovieTrackingMarker *marker) | ||||
| { | { | ||||
| float len_sq = FLT_MAX; | float len_sq = FLT_MAX; | ||||
| for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
| int next = (i + 1) % 4; | int next = (i + 1) % 4; | ||||
| ▲ Show 20 Lines • Show All 476 Lines • ▼ Show 20 Lines | if (draw_plane_quad) { | ||||
| immEnd(); | immEnd(); | ||||
| } | } | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| /* Draw sliders. */ | /* Draw sliders. */ | ||||
| if (is_selected_track) { | if (is_selected_track) { | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| if (draw_outline) { | if (draw_outline) { | ||||
| immUniformThemeColor(TH_MARKER_OUTLINE); | immUniformThemeColor(TH_MARKER_OUTLINE); | ||||
| } | } | ||||
| else { | else { | ||||
| immUniformColor3fv(selected_color); | immUniformColor3fv(selected_color); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | while (track) { | ||||
| track = track->next; | track = track->next; | ||||
| } | } | ||||
| } | } | ||||
| uint position = GPU_vertformat_attr_add( | uint position = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* markers outline and non-selected areas */ | /* markers outline and non-selected areas */ | ||||
| track = tracksbase->first; | track = tracksbase->first; | ||||
| fp = marker_pos; | fp = marker_pos; | ||||
| while (track) { | while (track) { | ||||
| if ((track->flag & TRACK_HIDDEN) == 0) { | if ((track->flag & TRACK_HIDDEN) == 0) { | ||||
| marker = BKE_tracking_marker_get(track, framenr); | marker = BKE_tracking_marker_get(track, framenr); | ||||
| ▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | static void draw_distortion(SpaceClip *sc, | ||||
| GPU_matrix_translate_2f(x, y); | GPU_matrix_translate_2f(x, y); | ||||
| GPU_matrix_scale_2f(zoomx, zoomy); | GPU_matrix_scale_2f(zoomx, zoomy); | ||||
| GPU_matrix_mul(sc->stabmat); | GPU_matrix_mul(sc->stabmat); | ||||
| GPU_matrix_scale_2f(width, height); | GPU_matrix_scale_2f(width, height); | ||||
| uint position = GPU_vertformat_attr_add( | uint position = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* grid */ | /* grid */ | ||||
| if (sc->flag & SC_SHOW_GRID) { | if (sc->flag & SC_SHOW_GRID) { | ||||
| float val[4][2], idx[4][2]; | float val[4][2], idx[4][2]; | ||||
| float min[2], max[2]; | float min[2], max[2]; | ||||
| for (int a = 0; a < 4; a++) { | for (int a = 0; a < 4; a++) { | ||||
| if (a < 2) { | if (a < 2) { | ||||
| ▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines | |||||