Merging r38516 through r38561 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 21 Jul 2011 15:04:41 +0000 (15:04 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 21 Jul 2011 15:04:41 +0000 (15:04 +0000)
1  2 
build_files/scons/tools/Blender.py
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_intern.h

Simple merge
@@@ -1376,180 -1335,13 +1376,185 @@@ static void draw_focus_cross(float dist
        glEnd();
  }
  
 +/* ****************** draw clip data *************** */
 +
 +static void draw_bundle_sphere(void)
 +{
 +      static GLuint displist= 0;
 +
 +      if (displist == 0) {
 +              GLUquadricObj *qobj;
 +
 +              displist= glGenLists(1);
 +              glNewList(displist, GL_COMPILE);
 +
 +              qobj= gluNewQuadric();
 +              gluQuadricDrawStyle(qobj, GLU_FILL);
 +              glShadeModel(GL_SMOOTH);
 +              gluSphere(qobj, 0.05, 8, 8);
 +              glShadeModel(GL_FLAT);
 +              gluDeleteQuadric(qobj);
 +
 +              glEndList();
 +      }
 +
 +      glCallList(displist);
 +}
 +
 +static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip, int flag)
 +{
 +      MovieTracking *tracking= &clip->tracking;
 +      MovieTrackingTrack *track;
 +      float mat[4][4], imat[4][4], curcol[4];
 +      unsigned char col[4], scol[4];
 +      int bundlenr= 1;
 +
 +      if((v3d->flag2&V3D_SHOW_RECONSTRUCTION)==0)
 +              return;
 +
 +      if(v3d->flag2&V3D_RENDER_OVERRIDE)
 +              return;
 +
 +      glGetFloatv(GL_CURRENT_COLOR, curcol);
 +
 +      UI_GetThemeColor4ubv(TH_TEXT, col);
 +      UI_GetThemeColor4ubv(TH_SELECT, scol);
 +
 +      BKE_get_tracking_mat(scene, mat);
 +
 +      glEnable(GL_LIGHTING);
 +      glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 +      glEnable(GL_COLOR_MATERIAL);
 +      glShadeModel(GL_SMOOTH);
 +
 +      /* current ogl matrix is translated in camera space, bundles should
 +         be rendered in world space, so camera matrix should be "removed"
 +         from current ogl matrix */
 +      invert_m4_m4(imat, base->object->obmat);
 +
 +      glPushMatrix();
 +      glMultMatrixf(imat);
 +      glMultMatrixf(mat);
 +
 +      for ( track= tracking->tracks.first; track; track= track->next) {
 +              if((track->flag&TRACK_HAS_BUNDLE)==0)
 +                      continue;
 +
 +              if(flag&DRAW_PICKING)
 +                      glLoadName(base->selcol + (bundlenr<<16));
 +
 +              glPushMatrix();
 +                      glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
 +                      glScalef(v3d->bundle_size/0.05, v3d->bundle_size/0.05, v3d->bundle_size/0.05);
 +
 +                      if(v3d->drawtype==OB_WIRE) {
 +                              glDisable(GL_LIGHTING);
 +                              glDepthMask(0);
 +
 +                              if(TRACK_SELECTED(track)) {
 +                                      if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
 +                                      else UI_ThemeColor(TH_SELECT);
 +                              } else UI_ThemeColor(TH_WIRE);
 +
 +                              drawaxes(0.05f, v3d->bundle_drawtype);
 +
 +                              glDepthMask(1);
 +                              glEnable(GL_LIGHTING);
 +                      } else if(v3d->drawtype>OB_WIRE) {
 +                              if(v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
 +                                      /* selection outline */
 +                                      if(TRACK_SELECTED(track)) {
 +                                              if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
 +                                              else UI_ThemeColor(TH_SELECT);
 +
 +                                              glDepthMask(0);
 +                                              glLineWidth(2.f);
 +                                              glDisable(GL_LIGHTING);
 +                                              glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 +
 +                                              draw_bundle_sphere();
 +
 +                                              glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 +                                              glEnable(GL_LIGHTING);
 +                                              glLineWidth(1.f);
 +                                              glDepthMask(1);
 +                                      }
 +
 +                                      UI_ThemeColor(TH_BUNDLE_SOLID);
 +                                      draw_bundle_sphere();
 +                              } else {
 +                                      glDisable(GL_LIGHTING);
 +                                      glDepthMask(0);
 +
 +                                      if(TRACK_SELECTED(track)) {
 +                                              if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
 +                                              else UI_ThemeColor(TH_SELECT);
 +                                      } else UI_ThemeColor(TH_WIRE);
 +
 +                                      drawaxes(0.05f, v3d->bundle_drawtype);
 +
 +                                      glDepthMask(1);
 +                                      glEnable(GL_LIGHTING);
 +                              }
 +                      }
 +
 +              glPopMatrix();
 +
 +              if((flag & DRAW_PICKING)==0 && (v3d->flag2&V3D_SHOW_BUNDLENAME)) {
 +                      float pos[3];
 +                      unsigned char tcol[4];
 +
 +                      if(TRACK_SELECTED(track)) memcpy(tcol, scol, sizeof(tcol));
 +                      else memcpy(tcol, col, sizeof(tcol));
 +
 +                      mul_v3_m4v3(pos, mat, track->bundle_pos);
 +                      view3d_cached_text_draw_add(pos, track->name, 10, V3D_CACHE_TEXT_GLOBALSPACE, tcol);
 +              }
 +
 +              bundlenr++;
 +      }
 +
 +      if((flag & DRAW_PICKING)==0) {
 +              if(v3d->flag2&V3D_SHOW_CAMERAPATH && clip->tracking.camera.reconnr) {
 +                      int a= 0;
 +                      MovieTrackingCamera *camera= &clip->tracking.camera;
 +                      MovieReconstructedCamera *cur= camera->reconstructed;
 +
 +                      glDisable(GL_LIGHTING);
 +                      UI_ThemeColor(TH_CAMERA_PATH);
 +                      glLineWidth(2.0f);
 +
 +                      glBegin(GL_LINE_STRIP);
 +                              for(a= 0; a<camera->reconnr; a++, cur++) {
 +                                      glVertex3f(cur->mat[3][0], cur->mat[3][1], cur->mat[3][2]);
 +                              }
 +                      glEnd();
 +
 +                      glLineWidth(1.0f);
 +                      glEnable(GL_LIGHTING);
 +              }
 +      }
 +
 +      glPopMatrix();
 +
 +      /* restore */
 +      glShadeModel(GL_FLAT);
 +      glDisable(GL_COLOR_MATERIAL);
 +      glDisable(GL_LIGHTING);
 +
 +      glColor4fv(curcol);
 +
 +      if(flag&DRAW_PICKING)
 +              glLoadName(base->selcol);
 +}
 +
+ #ifdef VIEW3D_CAMERA_BORDER_HACK
+ float view3d_camera_border_hack_col[4];
+ short view3d_camera_border_hack_test= FALSE;
+ #endif
  /* flag similar to draw_object() */
 -static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag)
 +static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int flag)
  {
        /* a standing up pyramid with (0,0,0) as top */
        Camera *cam;