Made bundles in 3D viewport have constant size

This means bundles' size is not affected by camera scale.
This way it's more useful to work with -- bundles never
becomes too small or too large (depending on reconstructed
scene scale).
This commit is contained in:
Sergey Sharybin
2013-05-09 16:38:47 +00:00
parent 4f5f97254c
commit 2e96e41da3

View File

@@ -1482,12 +1482,20 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
unsigned char col_unsel[4], col_sel[4];
int tracknr = *global_track_index;
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
float camera_size[3];
UI_GetThemeColor4ubv(TH_TEXT, col_unsel);
UI_GetThemeColor4ubv(TH_SELECT, col_sel);
BKE_tracking_get_camera_object_matrix(scene, base->object, mat);
/* we're compensating camera size for bundles size,
* to make it so bundles are always displayed with the same size
*/
copy_v3_v3(camera_size, base->object->size);
if ((tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0)
mul_v3_fl(camera_size, tracking_object->scale);
glPushMatrix();
if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
@@ -1522,7 +1530,9 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glPushMatrix();
glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
glScalef(v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f);
glScalef(v3d->bundle_size / 0.05f / camera_size[0],
v3d->bundle_size / 0.05f / camera_size[1],
v3d->bundle_size / 0.05f / camera_size[2]);
if (v3d->drawtype == OB_WIRE) {
glDisable(GL_LIGHTING);