This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/editors/space_clip/clip_utils.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

440 lines
14 KiB
C
Raw Normal View History

/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
*/
/** \file
* \ingroup spclip
*/
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_clip.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
2012-06-10 19:59:02 +00:00
#include "clip_intern.h" /* own include */
bool clip_graph_value_visible(SpaceClip *sc, eClipCurveValueSource value_source)
{
if (ELEM(value_source, CLIP_VALUE_SOURCE_SPEED_X, CLIP_VALUE_SOURCE_SPEED_Y)) {
if ((sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) == 0) {
return false;
}
}
else if (value_source == CLIP_VALUE_SOURCE_REPROJECTION_ERROR) {
if ((sc->flag & SC_SHOW_GRAPH_TRACKS_ERROR) == 0) {
return false;
}
}
return true;
}
static void clip_graph_tracking_values_iterate_track_speed_values(
SpaceClip *sc,
MovieTrackingTrack *track,
void *userdata,
ClipTrackValueCallback func,
ClipTrackValueSegmentStartCallback segment_start,
ClipTrackValueSegmentEndCallback segment_end)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
int width, height, coord;
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
for (coord = 0; coord < 2; coord++) {
eClipCurveValueSource value_source = (coord == 0) ? CLIP_VALUE_SOURCE_SPEED_X :
CLIP_VALUE_SOURCE_SPEED_Y;
int i, prevfra = track->markers[0].framenr;
bool open = false;
float prevval = 0.0f;
for (i = 0; i < track->markersnr; i++) {
MovieTrackingMarker *marker = &track->markers[i];
float val;
if (marker->flag & MARKER_DISABLED) {
if (open) {
2019-04-22 09:19:45 +10:00
if (segment_end) {
segment_end(userdata, value_source);
2019-04-22 09:19:45 +10:00
}
open = false;
}
continue;
}
if (!open) {
if (segment_start) {
if ((i + 1) == track->markersnr) {
segment_start(userdata, track, value_source, true);
}
else {
segment_start(
userdata, track, value_source, (track->markers[i + 1].flag & MARKER_DISABLED));
}
}
open = true;
prevval = marker->pos[coord];
}
/* value is a pixels per frame speed */
val = (marker->pos[coord] - prevval) * ((coord == 0) ? (width) : (height));
val /= marker->framenr - prevfra;
if (func) {
int scene_framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, marker->framenr);
func(userdata, track, marker, value_source, scene_framenr, val);
}
prevval = marker->pos[coord];
prevfra = marker->framenr;
}
if (open) {
2019-04-22 09:19:45 +10:00
if (segment_end) {
segment_end(userdata, value_source);
2019-04-22 09:19:45 +10:00
}
}
}
}
static float calculate_reprojection_error_at_marker(MovieClip *clip,
MovieTracking *tracking,
MovieTrackingObject *tracking_object,
MovieTrackingTrack *track,
MovieTrackingMarker *marker,
const int clip_width,
const int clip_height,
const int scene_framenr)
{
float reprojected_position[4], bundle_position[4], marker_position[2], delta[2];
float weight = BKE_tracking_track_get_weight_for_marker(clip, track, marker);
const float aspy = 1.0f / tracking->camera.pixel_aspect;
float projection_matrix[4][4];
BKE_tracking_get_projection_matrix(
tracking, tracking_object, scene_framenr, clip_width, clip_height, projection_matrix);
copy_v3_v3(bundle_position, track->bundle_pos);
bundle_position[3] = 1;
mul_v4_m4v4(reprojected_position, projection_matrix, bundle_position);
reprojected_position[0] = (reprojected_position[0] / (reprojected_position[3] * 2.0f) + 0.5f) *
clip_width;
reprojected_position[1] = (reprojected_position[1] / (reprojected_position[3] * 2.0f) + 0.5f) *
clip_height * aspy;
BKE_tracking_distort_v2(
tracking, clip_width, clip_height, reprojected_position, reprojected_position);
marker_position[0] = (marker->pos[0] + track->offset[0]) * clip_width;
marker_position[1] = (marker->pos[1] + track->offset[1]) * clip_height * aspy;
sub_v2_v2v2(delta, reprojected_position, marker_position);
return len_v2(delta) * weight;
}
static void clip_graph_tracking_values_iterate_track_reprojection_error_values(
SpaceClip *sc,
MovieTrackingTrack *track,
void *userdata,
ClipTrackValueCallback func,
ClipTrackValueSegmentStartCallback segment_start,
ClipTrackValueSegmentEndCallback segment_end)
{
/* Tracks without bundle can not have any reprojection error curve. */
if ((track->flag & TRACK_HAS_BUNDLE) == 0) {
return;
}
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking);
int clip_width, clip_height;
BKE_movieclip_get_size(clip, &sc->user, &clip_width, &clip_height);
/* Iterate over segments. */
bool is_segment_open = false;
for (int marker_index = 0; marker_index < track->markersnr; marker_index++) {
MovieTrackingMarker *marker = &track->markers[marker_index];
/* End of tracked segment, no reprojection error can be calculated here since the ground truth
* 2D position is not known. */
if (marker->flag & MARKER_DISABLED) {
if (is_segment_open) {
if (segment_end != NULL) {
segment_end(userdata, CLIP_VALUE_SOURCE_REPROJECTION_ERROR);
}
is_segment_open = false;
}
continue;
}
/* Begin new segment if it is not open yet. */
if (!is_segment_open) {
if (segment_start != NULL) {
if ((marker_index + 1) == track->markersnr) {
segment_start(userdata, track, CLIP_VALUE_SOURCE_REPROJECTION_ERROR, true);
}
else {
segment_start(userdata,
track,
CLIP_VALUE_SOURCE_REPROJECTION_ERROR,
(track->markers[marker_index + 1].flag & MARKER_DISABLED));
}
}
is_segment_open = true;
}
if (func != NULL) {
const int scene_framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, marker->framenr);
const float reprojection_error = calculate_reprojection_error_at_marker(
clip, tracking, tracking_object, track, marker, clip_width, clip_height, scene_framenr);
func(userdata,
track,
marker,
CLIP_VALUE_SOURCE_REPROJECTION_ERROR,
scene_framenr,
reprojection_error);
}
}
if (is_segment_open && segment_end != NULL) {
segment_end(userdata, CLIP_VALUE_SOURCE_REPROJECTION_ERROR);
}
}
void clip_graph_tracking_values_iterate_track(SpaceClip *sc,
MovieTrackingTrack *track,
void *userdata,
ClipTrackValueCallback func,
ClipTrackValueSegmentStartCallback segment_start,
ClipTrackValueSegmentEndCallback segment_end)
{
clip_graph_tracking_values_iterate_track_speed_values(
sc, track, userdata, func, segment_start, segment_end);
clip_graph_tracking_values_iterate_track_reprojection_error_values(
sc, track, userdata, func, segment_start, segment_end);
}
void clip_graph_tracking_values_iterate(SpaceClip *sc,
bool selected_only,
bool include_hidden,
void *userdata,
ClipTrackValueCallback func,
ClipTrackValueSegmentStartCallback segment_start,
ClipTrackValueSegmentEndCallback segment_end)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
MovieTrackingTrack *track;
for (track = tracksbase->first; track; track = track->next) {
2019-04-22 09:19:45 +10:00
if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
continue;
2019-04-22 09:19:45 +10:00
}
2019-04-22 09:19:45 +10:00
if (selected_only && !TRACK_SELECTED(track)) {
continue;
2019-04-22 09:19:45 +10:00
}
clip_graph_tracking_values_iterate_track(
sc, track, userdata, func, segment_start, segment_end);
}
}
void clip_graph_tracking_iterate(SpaceClip *sc,
bool selected_only,
bool include_hidden,
void *userdata,
2012-06-10 19:59:02 +00:00
void (*func)(void *userdata, MovieTrackingMarker *marker))
{
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
2020-09-09 18:41:07 +02:00
LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
2019-04-22 09:19:45 +10:00
if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
continue;
2019-04-22 09:19:45 +10:00
}
2019-04-22 09:19:45 +10:00
if (selected_only && !TRACK_SELECTED(track)) {
continue;
2019-04-22 09:19:45 +10:00
}
2020-09-09 18:41:07 +02:00
for (int i = 0; i < track->markersnr; i++) {
MovieTrackingMarker *marker = &track->markers[i];
2019-04-22 09:19:45 +10:00
if (marker->flag & MARKER_DISABLED) {
continue;
2019-04-22 09:19:45 +10:00
}
2019-04-22 09:19:45 +10:00
if (func) {
func(userdata, marker);
2019-04-22 09:19:45 +10:00
}
}
}
}
Merge plane track feature from tomato branch This commit includes all the changes made for plane tracker in tomato branch. Movie clip editor changes: - Artist might create a plane track out of multiple point tracks which belongs to the same track (minimum amount of point tracks is 4, maximum is not actually limited). When new plane track is added, it's getting "tracked" across all point tracks, which makes it stick to the same plane point tracks belong to. - After plane track was added, it need to be manually adjusted in a way it covers feature one might to mask/replace. General transform tools (G, R, S) or sliding corners with a mouse could be sued for this. Plane corner which corresponds to left bottom image corner has got X/Y axis on it (red is for X axis, green for Y). - Re-adjusting plane corners makes plane to be "re-tracked" for the frames sequence between current frame and next and previous keyframes. - Kayframes might be removed from the plane, using Shit-X (Marker Delete) operator. However, currently manual re-adjustment or "re-track" trigger is needed. Compositor changes: - Added new node called Plane Track Deform. - User selects which plane track to use (for this he need to select movie clip datablock, object and track names). - Node gets an image input, which need to be warped into the plane. - Node outputs: * Input image warped into the plane. * Plane, rasterized to a mask. Masking changes: - Mask points might be parented to a plane track, which makes this point deforming in a way as if it belongs to the tracked plane. Some video tutorials are available: - Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4 - Artist video: https://vimeo.com/71727578 This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
Merge plane track feature from tomato branch This commit includes all the changes made for plane tracker in tomato branch. Movie clip editor changes: - Artist might create a plane track out of multiple point tracks which belongs to the same track (minimum amount of point tracks is 4, maximum is not actually limited). When new plane track is added, it's getting "tracked" across all point tracks, which makes it stick to the same plane point tracks belong to. - After plane track was added, it need to be manually adjusted in a way it covers feature one might to mask/replace. General transform tools (G, R, S) or sliding corners with a mouse could be sued for this. Plane corner which corresponds to left bottom image corner has got X/Y axis on it (red is for X axis, green for Y). - Re-adjusting plane corners makes plane to be "re-tracked" for the frames sequence between current frame and next and previous keyframes. - Kayframes might be removed from the plane, using Shit-X (Marker Delete) operator. However, currently manual re-adjustment or "re-track" trigger is needed. Compositor changes: - Added new node called Plane Track Deform. - User selects which plane track to use (for this he need to select movie clip datablock, object and track names). - Node gets an image input, which need to be warped into the plane. - Node outputs: * Input image warped into the plane. * Plane, rasterized to a mask. Masking changes: - Mask points might be parented to a plane track, which makes this point deforming in a way as if it belongs to the tracked plane. Some video tutorials are available: - Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4 - Artist video: https://vimeo.com/71727578 This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
Rework 2D stabilizator See this page for motivation and description of concepts: https://github.com/Ichthyostega/blender/wiki See this video for UI explanation and demonstration of usage http://vimeo.com/blenderHack/stabilizerdemo This proposal attempts to improve usability of Blender's image stabilization feature for real-world footage esp. with moving and panning camera. It builds upon the feature tracking to get a measurement of 2D image movement. - Use a weighted average of movement contributions (instead of a median). - Allow for rotation compensation and zoom (image scale) compensation. - Allow to pick a different set of tracks for translation and for rotation/zoom. - Treat translation / rotation / zoom contributions systematically in a similar way. - Improve handling of partial tracking data with gaps and varying start / end points. - Have a user definable anchor frame and interpolate / extrapolate data to avoid jumping back to "neutral" position when no tracking data is available. - Support for travelling and panning shots by including an //intended// position/rotation/zoom ("target position"). The idea is for these parameters to be //animated// by the user, in order to supply an smooth, intended camera movement. This way, we can keep the image content roughly in frame even when moving completely away from the initial view. A known shortcoming is that the pivot point for rotation compensation is set to the translation compensated image center. This can produce spurious rotation on travelling shots, which needs to be compensated manually (by animating the target rotation parameter). There are several possible ways to address that problem, yet all of them are considered beyond the scope of this improvement proposal for now. Own modifications: - Restrict line length, it's really handy for split-view editing - In motion tracking we prefer fully human-readable comments, meaning we don't use doxygen with it's weird markup and comments are supposed to start with capital and end with a full stop, - Add explicit comparison of pointer to NULL. Reviewers: sergey Subscribers: kusi, kdawg, forest-house, mardy, Samoth, plasmasolutions, willolis, sebastian_k, hype, enetheru, sunboy, jta, leon_cheung Maniphest Tasks: T49036 Differential Revision: https://developer.blender.org/D583
2016-08-16 10:32:55 +02:00
bool has_bundle = false;
const bool used_for_stabilization = (track->flag &
(TRACK_USE_2D_STAB | TRACK_USE_2D_STAB_ROT)) != 0;
if (track == act_track) {
tracking->act_track = NULL;
}
/* Handle reconstruction display in 3d viewport. */
if (track->flag & TRACK_HAS_BUNDLE) {
has_bundle = true;
}
Merge plane track feature from tomato branch This commit includes all the changes made for plane tracker in tomato branch. Movie clip editor changes: - Artist might create a plane track out of multiple point tracks which belongs to the same track (minimum amount of point tracks is 4, maximum is not actually limited). When new plane track is added, it's getting "tracked" across all point tracks, which makes it stick to the same plane point tracks belong to. - After plane track was added, it need to be manually adjusted in a way it covers feature one might to mask/replace. General transform tools (G, R, S) or sliding corners with a mouse could be sued for this. Plane corner which corresponds to left bottom image corner has got X/Y axis on it (red is for X axis, green for Y). - Re-adjusting plane corners makes plane to be "re-tracked" for the frames sequence between current frame and next and previous keyframes. - Kayframes might be removed from the plane, using Shit-X (Marker Delete) operator. However, currently manual re-adjustment or "re-track" trigger is needed. Compositor changes: - Added new node called Plane Track Deform. - User selects which plane track to use (for this he need to select movie clip datablock, object and track names). - Node gets an image input, which need to be warped into the plane. - Node outputs: * Input image warped into the plane. * Plane, rasterized to a mask. Masking changes: - Mask points might be parented to a plane track, which makes this point deforming in a way as if it belongs to the tracked plane. Some video tutorials are available: - Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4 - Artist video: https://vimeo.com/71727578 This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
/* Make sure no plane will use freed track */
BKE_tracking_plane_tracks_remove_point_track(tracking, track);
/* Delete f-curves associated with the track (such as weight, i.e.) */
/* Escaped object name, escaped track name, rest of the path. */
char rna_path[MAX_NAME * 4 + 64];
BKE_tracking_get_rna_path_for_track(tracking, track, rna_path, sizeof(rna_path));
if (BKE_animdata_fix_paths_remove(&clip->id, rna_path)) {
DEG_relations_tag_update(CTX_data_main(C));
}
/* Delete track itself. */
BKE_tracking_track_free(track);
BLI_freelinkN(tracksbase, track);
/* Send notifiers. */
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
2017-04-10 16:01:58 +02:00
if (used_for_stabilization) {
WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
}
2017-12-19 13:42:01 +01:00
/* Inform dependency graph. */
DEG_id_tag_update(&clip->id, 0);
if (has_bundle) {
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
}
Merge plane track feature from tomato branch This commit includes all the changes made for plane tracker in tomato branch. Movie clip editor changes: - Artist might create a plane track out of multiple point tracks which belongs to the same track (minimum amount of point tracks is 4, maximum is not actually limited). When new plane track is added, it's getting "tracked" across all point tracks, which makes it stick to the same plane point tracks belong to. - After plane track was added, it need to be manually adjusted in a way it covers feature one might to mask/replace. General transform tools (G, R, S) or sliding corners with a mouse could be sued for this. Plane corner which corresponds to left bottom image corner has got X/Y axis on it (red is for X axis, green for Y). - Re-adjusting plane corners makes plane to be "re-tracked" for the frames sequence between current frame and next and previous keyframes. - Kayframes might be removed from the plane, using Shit-X (Marker Delete) operator. However, currently manual re-adjustment or "re-track" trigger is needed. Compositor changes: - Added new node called Plane Track Deform. - User selects which plane track to use (for this he need to select movie clip datablock, object and track names). - Node gets an image input, which need to be warped into the plane. - Node outputs: * Input image warped into the plane. * Plane, rasterized to a mask. Masking changes: - Mask points might be parented to a plane track, which makes this point deforming in a way as if it belongs to the tracked plane. Some video tutorials are available: - Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4 - Artist video: https://vimeo.com/71727578 This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
void clip_delete_marker(bContext *C,
MovieClip *clip,
MovieTrackingTrack *track,
MovieTrackingMarker *marker)
{
if (track->markersnr == 1) {
Merge plane track feature from tomato branch This commit includes all the changes made for plane tracker in tomato branch. Movie clip editor changes: - Artist might create a plane track out of multiple point tracks which belongs to the same track (minimum amount of point tracks is 4, maximum is not actually limited). When new plane track is added, it's getting "tracked" across all point tracks, which makes it stick to the same plane point tracks belong to. - After plane track was added, it need to be manually adjusted in a way it covers feature one might to mask/replace. General transform tools (G, R, S) or sliding corners with a mouse could be sued for this. Plane corner which corresponds to left bottom image corner has got X/Y axis on it (red is for X axis, green for Y). - Re-adjusting plane corners makes plane to be "re-tracked" for the frames sequence between current frame and next and previous keyframes. - Kayframes might be removed from the plane, using Shit-X (Marker Delete) operator. However, currently manual re-adjustment or "re-track" trigger is needed. Compositor changes: - Added new node called Plane Track Deform. - User selects which plane track to use (for this he need to select movie clip datablock, object and track names). - Node gets an image input, which need to be warped into the plane. - Node outputs: * Input image warped into the plane. * Plane, rasterized to a mask. Masking changes: - Mask points might be parented to a plane track, which makes this point deforming in a way as if it belongs to the tracked plane. Some video tutorials are available: - Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4 - Artist video: https://vimeo.com/71727578 This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
clip_delete_track(C, clip, track);
}
else {
BKE_tracking_marker_delete(track, marker->framenr);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
}
}
void clip_delete_plane_track(bContext *C, MovieClip *clip, MovieTrackingPlaneTrack *plane_track)
{
MovieTracking *tracking = &clip->tracking;
ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
/* Delete f-curves associated with the track (such as weight, i.e.) */
/* Escaped object name, escaped track name, rest of the path. */
char rna_path[MAX_NAME * 4 + 64];
BKE_tracking_get_rna_path_for_plane_track(tracking, plane_track, rna_path, sizeof(rna_path));
if (BKE_animdata_fix_paths_remove(&clip->id, rna_path)) {
DEG_relations_tag_update(CTX_data_main(C));
}
/* Delete the plane track itself. */
BKE_tracking_plane_track_free(plane_track);
BLI_freelinkN(plane_tracks_base, plane_track);
/* TODO(sergey): Any notifiers to be sent here? */
(void)C;
/* Inform dependency graph. */
2017-12-19 13:42:01 +01:00
DEG_id_tag_update(&clip->id, 0);
}
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
{
int width, height;
float aspx, aspy;
ED_space_clip_get_size(sc, &width, &height);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
}
void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
{
UI_view2d_view_ortho(v2d);
/* currently clip editor supposes that editing clip length is equal to scene frame range */
GPU_blend(GPU_BLEND_ALPHA);
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
GPU_blend(GPU_BLEND_NONE);
immUniformThemeColorShade(TH_BACK, -60);
/* thin lines where the actual frames are */
GPU_line_width(1.0f);
immBegin(GPU_PRIM_LINES, 4);
immVertex2f(pos, (float)SFRA, v2d->cur.ymin);
immVertex2f(pos, (float)SFRA, v2d->cur.ymax);
immVertex2f(pos, (float)EFRA, v2d->cur.ymin);
immVertex2f(pos, (float)EFRA, v2d->cur.ymax);
immEnd();
immUnbindProgram();
}