Update of /cvsroot/playerstage/code/stage/libstage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16224

Modified Files:
      Tag: opengl
        Makefile.fl blockgrid.cc model.cc model_laser.cc 
        model_ranger.cc stage.c stage.hh stest.cc world.cc worldgui.cc 
Log Message:
added menu bar to FLTK version, and improved GUI

Index: worldgui.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/worldgui.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** worldgui.cc 17 Nov 2007 23:31:22 -0000      1.1.2.1
--- worldgui.cc 19 Nov 2007 07:40:41 -0000      1.1.2.2
***************
*** 2,5 ****
--- 2,6 ----
  #include "stage.hh"
  #include <FL/fl_draw.H>
+ #include <FL/fl_Box.H>
  #include <FL/Fl_Menu_Button.H>
  
***************
*** 10,13 ****
--- 11,19 ----
  }
  
+ void StgWorldGui::SaveCallback( Fl_Widget* wid, StgWorldGui* world )
+ {
+   world->Save();
+ }
+ 
  void view_toggle_cb(Fl_Widget* w, bool* view ) 
  {
***************
*** 20,586 ****
  
  
- void timer_cb( void* v)
- {
-   StgWorldGui* w = (StgWorldGui*)v;
-   w->redraw();
-   
-   if( w->show_clock )  
-     w->redraw_overlay();
-   
-   Fl::repeat_timeout(0.1, timer_cb, v);
- }
- 
  StgWorldGui::StgWorldGui(int W,int H,const char*L) 
!   : Fl_Gl_Window(0,0,W,H,L)
  {
-   //Fl_Menu_Bar* menubar = new Fl_Menu_Bar(0,0, W, 30);// 640, 30);
-   //menubar->menu(menuitems);  
-   //menubar->show();
- 
-   selected_models = NULL;
    graphics = true;
-   dragging = false;
- 
-   startx = starty = 0;
-   panx = pany = stheta = sphi = 0.0;
-   scale = 15.0;
- 
-   fg = 1.0;
-   bg = 0.0;
-   resizable(this);
-   end();
- 
-   follow_selection = false;
-   show_clock = true;
-   show_quadtree = false;  
-   show_occupancy = false;  
-   show_geom = false;
-   show_boxes = true;
-   show_grid = false;
-   show_data = true;
-   show_cfg = false;
-   show_cmd = false;
-   show_thumbnail = false;
-   show_trails = false;
- 
  
    // build the menus
!   menu = new Fl_Menu_Button( 0,0,0,0 );
!   menu->type( Fl_Menu_Button::POPUP3 );
! 
!   //menu->add( "&File", 0, 0, 0, FL_SUBMENU );
!   //menu->add( "File/&Save File", FL_CTRL + 's', (Fl_Callback *)dummy_cb );
!   //menu->add( "File/Save File &As...", FL_CTRL + FL_SHIFT + 's', 
(Fl_Callback *)dummy_cb, 0, FL_MENU_DIVIDER );
!   //menu->add( "File/E&xit", FL_CTRL + 'q', (Fl_Callback *)dummy_cb, 0 );
    
!   //menu->add( "&View", 0, 0, 0, FL_SUBMENU );
!   menu->add( "Data", FL_CTRL+'z', (Fl_Callback *)view_toggle_cb, &show_data, 
FL_MENU_TOGGLE|FL_MENU_VALUE );  
!   menu->add( "Blocks", FL_CTRL+'b', (Fl_Callback *)view_toggle_cb, 
&show_boxes, FL_MENU_TOGGLE|FL_MENU_VALUE );  
!   //menu->add( "View/Clock", FL_CTRL+'c', (Fl_Callback *)view_toggle_cb, 
&show_clock, FL_MENU_TOGGLE|FL_MENU_VALUE );  
!   menu->add( "Grid",      FL_CTRL + 'c', (Fl_Callback *)view_toggle_cb, 
&show_grid, FL_MENU_TOGGLE|FL_MENU_VALUE );
!   menu->add( "Occupancy", FL_CTRL + 'o', (Fl_Callback *)view_toggle_cb, 
&show_occupancy, FL_MENU_TOGGLE|FL_MENU_VALUE );
!   menu->add( "Tree",      FL_CTRL + 't', (Fl_Callback *)view_toggle_cb, 
&show_quadtree, FL_MENU_TOGGLE|FL_MENU_VALUE );
! 
!   //menu->add( "Help", 0, 0, 0, FL_SUBMENU );
!   //menu->add( "Help/About Stage...", FL_CTRL + 'f', (Fl_Callback *)dummy_cb 
);
!   //menu->add( "Help/HTML Documentation", FL_CTRL + 'g', (Fl_Callback 
*)dummy_cb );
!  
!   show(); // must do this so that the GL context is created before 
configuring GL
!  
!   // set gl state that won't change every redraw
!   glClearColor ( 0.7, 0.7, 0.8, 1.0);
!   glDisable(GL_LIGHTING);
!   glEnable (GL_DEPTH_TEST);
!   glDepthFunc (GL_LESS);
!   glCullFace( GL_BACK );
!   glEnable (GL_CULL_FACE);  
!   glEnable( GL_BLEND );
!   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
!   glEnable( GL_LINE_SMOOTH );
!   glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
!   glDepthMask(GL_TRUE);
! 
!   // install a font
!   gl_font( FL_HELVETICA, 12 );
    
!   // start the timer that causes regular redraws
!   Fl::add_timeout( 0.1, timer_cb, this);
!  }
  
! bool StgWorldGui::RealTimeUpdate()
! {
!   //  puts( "RTU" );
!   bool res = StgWorld::RealTimeUpdate();
!   Fl::check();
!   return res;
! }
  
! bool StgWorldGui::Update()
! {
!   //  puts( "RTU" );
!   bool res = StgWorld::Update();
!   Fl::check();
!   return res;
! }
  
  
! void StgWorldGui::AddModel( StgModel*  mod  )
  {
-   mod->InitGraphics();
-   StgWorld::AddModel( mod );
  }
  
! StgModel* StgWorldGui::Select( int x, int y )
  {
!   // render all models in a unique color
!   make_current(); // make sure the GL context is current
!   glClearColor ( 0,0,0,1 );
!   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
!   glDisable(GL_DITHER);
!   
!   // render all top-level, draggable models in a color that is their
!   // id + a 100% alpha value
!   for( GList* it=StgWorld::children; it; it=it->next )
!     {
!       StgModel* mod = (StgModel*)it->data;      
  
!       if( mod->gui_mask & STG_MOVE_TRANS )
!       {
!         uint32_t col = (mod->id | 0xFF000000);
!         glColor4ubv( (GLubyte*)&col );     
!         mod->DrawPicker();
!       }
!     }
!   
!   // read the color of the pixel in the back buffer under the mouse
!   // pointer
!   GLint viewport[4];
!   glGetIntegerv(GL_VIEWPORT,viewport);
!   
!   uint32_t id;
!   glReadPixels( x,viewport[3]-y,1,1,
!               GL_RGBA,GL_UNSIGNED_BYTE,(void*)&id );
!   
!   // strip off the alpha channel byte to retrieve the model id
!   id &= 0x00FFFFFF;
!   
!   StgModel* mod = (StgModel*)
!     g_hash_table_lookup( models_by_id, &id );
    
!   printf("%p %s %d\n", mod, mod ? mod->Token() : "", id );
    
!   glEnable(GL_DITHER);
!   glClearColor ( 0.7, 0.7, 0.8, 1.0);
    
!   if( mod ) // we clicked on a root model
!     {
!       // if it's already selected
!       if( GList* link = g_list_find( selected_models, mod ) )
!       {
!         // remove it from the selected list
!         selected_models = 
!           g_list_remove_link( selected_models, link );
! 
!         mod->disabled = false;
!       }                         
!       else      
!       {
!         selected_models = g_list_prepend( selected_models, mod );
!         mod->disabled = true;
!       }
!    
!       invalidate();
!     }
! 
!   return mod;
! }
! 
! void StgWorldGui::CanvasToWorld( int px, int py, 
!                                double *wx, double *wy, double* wz )
! {
!   // convert from window pixel to world coordinates
!   //int width = widget->allocation.width;
! 
!   int viewport[4];
!   glGetIntegerv(GL_VIEWPORT, viewport);
  
-   GLdouble modelview[16];
-   glGetDoublev(GL_MODELVIEW_MATRIX, modelview); 
  
!   GLdouble projection[16];    
!   glGetDoublev(GL_PROJECTION_MATRIX, projection);     
  
!   GLfloat pz;
!  
!   glReadPixels( px, h()-py, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pz );
!   gluUnProject( px, w()-py, pz, modelview, projection, viewport, wx,wy,wz );
  
!   //printf( "Z: %.2f\n", pz );
!   //printf( "FINAL: x:%.2f y:%.2f z:%.2f\n",
!   //  *wx,*wy,zz );
  }
  
! int StgWorldGui::handle(int event) 
  {
    
!   switch(event) 
!     {
!     case FL_MOUSEWHEEL:
!       if( selected_models )
!       {
!         // rotate all selected models
!         for( GList* it = selected_models; it; it=it->next )
!           {
!             StgModel* mod = (StgModel*)it->data;
!             mod->AddToPose( 0,0,0, 0.1*(double)Fl::event_dy() );
!           }
!         redraw();
!       }
!       else
!       {
!         scale -= 0.5 * (double)Fl::event_dy();
!         if( scale < 1 )
!           scale = 1;    
!         invalidate();
!       }
!       return 1;
! 
!     case FL_MOVE: // moused moved while no button was pressed
!       //printf( "mouse moved %d %d\n", Fl::event_x(), Fl::event_y() );
!       //printf( "mouse delta %d %d\n", Fl::event_dx(), Fl::event_dy() );
!       
!       if( Fl::event_state( FL_CTRL ) )
!       {          
!         int dx = Fl::event_x() - startx; 
!         int dy = Fl::event_y() - starty;
!           
!         stheta -= 0.01 * (double)dy;
!         sphi += 0.01 * (double)dx;
!         stheta = constrain( stheta, 0, M_PI/2.0 );
!         invalidate();
!       }
! 
!       if( Fl::event_state( FL_ALT ) )
!       {          
!         int dx = Fl::event_x() - startx; 
!         int dy = Fl::event_y() - starty;
!           
!         panx -= dx;
!         pany += dy; 
!         invalidate();
!       }
!       
!       startx = Fl::event_x();
!       starty = Fl::event_y();
!       
!       return 1;
! 
!     case FL_PUSH: // button pressed
!       puts( "PUSH" );
!       switch( Fl::event_button() )
!       {
!       case 1:
!         startx = Fl::event_x();
!         starty = Fl::event_y();
!         if( Select( startx, starty ) )
!           dragging = true;      
!         return 1;
!       case 3:
!         {
!           puts( "POPUP" );
!           menu->popup();
!           return 1;
!         }
!       default:
!         return 0;
!       }    
!       
!     case FL_DRAG: // mouse moved while button was pressed
!       {
!       int dx = Fl::event_x() - startx; 
!       int dy = Fl::event_y() - starty;
!       
!       if( Fl::event_button() == 1 )
!         {
!           if( selected_models && dragging )
!             {
!               double sx,sy,sz;
!               CanvasToWorld( startx, starty,
!                              &sx, &sy, &sz );
!               double x,y,z;
!               CanvasToWorld( Fl::event_x(), Fl::event_y(),
!                              &x, &y, &z );
!               
!               // move all selected models to the mouse pointer
!               for( GList* it = selected_models; it; it=it->next )
!                 {
!                   StgModel* mod = (StgModel*)it->data;
!                   mod->AddToPose( x-sx, y-sy, 0, 0 );
!                 }
!             }
!           else
!             {
!               panx -= dx;
!               pany += dy; 
!             }
!         }
!       
!       startx = Fl::event_x();
!       starty = Fl::event_y();
!       invalidate();
!       }
!       return 1;
!       
!     case FL_RELEASE:   // mouse button released
!       // unselect everyone unless shift is pressed
!       if( ! Fl::event_state( FL_SHIFT ) )
!       {
!         for( GList* it=selected_models; it; it=it->next )
!           ((StgModel*)it->data)->disabled = false;
!         
!         g_list_free( selected_models );
!         selected_models = NULL;
!         dragging = false;
!         invalidate();
!       }
!       return 1;
!     case FL_FOCUS :
!     case FL_UNFOCUS :
!       //.... Return 1 if you want keyboard events, 0 otherwise
!       return 1;
!     case FL_KEYBOARD:
!       switch( Fl::event_key() )
!       {
!       case 'p': // pause
!         paused = !paused;
!         break;
!       case ' ': // space bar
!         sphi = stheta = 0.0;
!         invalidate();
!         break;
!       case FL_Left:  panx += 10; break;
!       case FL_Right: panx -= 10; break;
!       case FL_Down:    pany += 10; break;
!       case FL_Up:  pany -= 10; break;
!       default:
!         return 0; // keypress unhandled
!       }
!       invalidate();
!       return 1;
!       //case FL_SHORTCUT:
!       ///... shortcut, key is in Fl::event_key(), ascii in Fl::event_text()
!       // ... Return 1 if you understand/use the shortcut event, 0 otherwise...
!       //return 1;
!     default:
!       // pass other events to the base class...
!       printf( "EVENT %d\n", event );
!       return Fl_Gl_Window::handle(event);
!     }
! }
! 
! void StgWorldGui::FixViewport(int W,int H) 
! {
!   glLoadIdentity();
!   glViewport(0,0,W,H);
! }
! 
! void StgWorldGui::draw() 
! {
!   if (!valid()) 
!     { 
!       valid(1); 
!       FixViewport(w(), h()); 
!       
!       double zclip = hypot(width, height) * scale;
!       double pixels_width =  w();//canvas->allocation.width;
!       double pixels_height = h();//canvas->allocation.height ;
!       
!       //double width = w() / scale;
!       //double height = h() / scale;
!       
!       glMatrixMode (GL_PROJECTION);
!       glLoadIdentity ();
!       
!       // map the viewport to pixel units by scaling it the same as the window
!       //  glOrtho( 0, pixels_width,
!       //   0, pixels_height,
!       
!       glOrtho( -pixels_width/2.0, pixels_width/2.0,
!              -pixels_height/2.0, pixels_height/2.0,
!              0, zclip );
!       
!       /*   glFrustum( 0, pixels_width, */
!       /*           0, pixels_height, */
!       /*           0.1, zclip ); */
!       
!       glMatrixMode (GL_MODELVIEW);
!       
!       glLoadIdentity ();
!       glTranslatef(  -panx, 
!                    -pany, 
!                    -zclip / 2.0 );
!       
!       glRotatef( RTOD(-stheta), 1,0,0);  
!       
!       //glTranslatef(  -panx * cos(sphi) - pany*sin(sphi), 
!       //       panx*sin(sphi) - pany*cos(sphi), 0 );
!       
!       glRotatef( RTOD(sphi), 0.0, 0.0, 1.0);   // rotate about z - pitch
!       
!       // meter scale
!       glScalef ( scale, scale, scale ); // zoom
!     }      
! 
!   // Clear screen to bg color
!   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
!   // Draw 'X' in fg color
!   //glColor3f(fg, fg, fg);
!   //glBegin(GL_LINE_STRIP); glVertex2f(w(), h()); glVertex2f(-w(),-h()); 
glEnd();
!   //glBegin(GL_LINE_STRIP); glVertex2f(w(),-h()); glVertex2f(-w(), h()); 
glEnd();
! 
!   //gluLookAt( 0,0,10,
!   //   0,0,0,
!   //   0,1,0 );
! 
! /*   gluLookAt( win->panx,  */
! /*         win->pany + win->stheta,  */
! /*         10, */
! /*                 win->panx,  */
! /*         win->pany,   */
! /*         0, */
! /*         sin(win->sphi), */
! /*         cos(win->sphi),  */
! /*         0 ); */
! 
! //   if( follow_selection && selected_models )
! //     {      
! //       glTranslatef(  0,0,-zclip/2.0 );
  
! //       // meter scale
! //       glScalef ( scale, scale, scale ); // zoom
  
! //       // get the pose of the model at the head of the selected models
! //       // list
! //       stg_pose_t gpose;
! //       ((StgModel*)selected_models->data)->GetGlobalPose( &gpose );
  
! //       //glTranslatef( -gpose.x + (pixels_width/2.0)/scale, 
! //       //       -gpose.y + (pixels_height/2.0)/scale,
! //       //       -zclip/2.0 );      
  
! //       // pixel scale  
! //       glTranslatef(  -gpose.x, 
! //                 -gpose.y, 
! //                 0 );
  
! //     }
! //   else
  //     {
!       // pixel scale  
!       //glTranslatef( 0,0, -MAX(width,height) );
! 
!       // TODO - rotate around the mouse pointer or window center, not the
!       //origin  - the commented code is close, but not quite right
!       //glRotatef( RTOD(sphi), 0.0, 0.0, 1.0);   // rotate about z - pitch
!       //glTranslatef( -click_point.x, -click_point.y, 0 ); // shift back      
      //printf( "panx %f pany %f scale %.2f stheta %.2f sphi %.2f\n",
!       //  panx, pany, scale, stheta, sphi );
!       //}
!   
! //   // draw the world size rectangle in white
! //   // draw the floor a little pushed into the distance so it doesn't 
z-fight with the
!   // models
!   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
!   glEnable(GL_POLYGON_OFFSET_FILL);
!   glPolygonOffset(1.0, 1.0);
!   glColor3f( 1,1,1 );
!   glRectf( -width/2.0, -height/2.0,
!          width/2.0, height/2.0 ); 
!   glDisable(GL_POLYGON_OFFSET_FILL);
! 
!   // draw the model bounding boxes
!   //g_hash_table_foreach( models, (GHFunc)model_draw_bbox, NULL);
!   
!   //PRINT_DEBUG1( "Colorstack depth %d",
!   //  colorstack.Length() );
! 
!   if( show_quadtree || show_occupancy )
!      {
!       glDisable( GL_LINE_SMOOTH );
!       glLineWidth( 1 );
! 
!       glPushMatrix();
!       glTranslatef( -width/2.0, -height/2.0, 1 );
!       glScalef( 1.0/ppm, 1.0/ppm, 0 );
!       glPolygonMode( GL_FRONT, GL_LINE );
!       colorstack.Push(1,0,0);
!       
!       if( show_occupancy )
!       this->bgrid->Draw( false );
  
!       if( show_quadtree )
!       this->bgrid->Draw( true );
!       
!       colorstack.Pop();
!       glPopMatrix();  
!       
!       glEnable( GL_LINE_SMOOTH );
!      }
  
!   colorstack.Push( 1, 0, 0 );
!   glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
!   glLineWidth( 4 );
!   
!   for( GList* it=selected_models; it; it=it->next )
!     {
!       ((StgModel*)it->data)->DrawSelected();
!       //((StgModel*)it->data)->DrawPicker();
!     }  
!   colorstack.Pop();
!   
!   glLineWidth( 1 );
!   
!   // draw the models
!   GList* it;
!   if( show_boxes )
!     for( it=StgWorld::children; it; it=it->next )
!       ((StgModel*)it->data)->Draw();
!   
!   // draw the models' data
!   if( show_data )
!     for( it=StgWorld::children; it; it=it->next )
!       ((StgModel*)it->data)->DrawData();
!   
!   // draw anything in the assorted displaylist list
! //   for( it = dl_list; it; it=it->next )
! //     {
! //       int dl = (int)it->data;
! //       printf( "Calling dl %d\n", dl );
! //       glCallList( dl );
! //    }
  }
  
! void StgWorldGui::draw_overlay() 
  {
!   if( show_clock )
!     {
!       char clockstr[50];
!       ClockString( clockstr, 50 );
!       
!       glPushMatrix();
!       glLoadIdentity();
!       
!       colorstack.Push( 0,0,0 ); // black
!       gl_draw( clockstr, -w()/2.0 + 5, -h()/2 + 5 );
!       colorstack.Pop();
!       glPopMatrix();
!     }
  }
  
! 
! void StgWorldGui::resize(int X,int Y,int W,int H) 
  {
!   Fl_Gl_Window::resize(X,Y,W,H);
!   FixViewport(W,H);
!   invalidate();
  }
  
--- 26,155 ----
  
  
  StgWorldGui::StgWorldGui(int W,int H,const char*L) 
!   : Fl_Window(0,0,W,H,L)
  {
    graphics = true;
  
    // build the menus
!   Fl_Menu_Bar* mbar = new Fl_Menu_Bar(0,0, W, 30);// 640, 30);
!   mbar->textsize(12);
    
!   canvas = new StgCanvas( this,0,30,W,H-30 );
!   resizable(canvas);
!   end();
    
!   mbar->add( "&File", 0, 0, 0, FL_SUBMENU );
!   mbar->add( "File/&Save File", FL_CTRL + 's', (Fl_Callback *)SaveCallback, 
this );
!   //mbar->add( "File/Save File &As...", FL_CTRL + FL_SHIFT + 's', 
(Fl_Callback *)dummy_cb, 0, FL_MENU_DIVIDER );
!   mbar->add( "File/E&xit", FL_CTRL + 'q', (Fl_Callback *)dummy_cb, 0 );
!  
!   mbar->add( "&View", 0, 0, 0, FL_SUBMENU );
  
! //    mbar->add( "View/Data", FL_CTRL+'z', (Fl_Callback *)view_toggle_cb, 
&canvas->show_data, FL_MENU_TOGGLE|FL_MENU_VALUE );  
! //    mbar->add( "View/Blocks", FL_CTRL+'b', (Fl_Callback *)view_toggle_cb, 
&canvas->show_boxes, FL_MENU_TOGGLE|FL_MENU_VALUE );  
! //    //mbar->add( "View/Clock", FL_CTRL+'c', (Fl_Callback *)view_toggle_cb, 
&show_clock, FL_MENU_TOGGLE|FL_MENU_VALUE );  
! //    mbar->add( "View/Grid",      FL_CTRL + 'c', (Fl_Callback 
*)view_toggle_cb, &canvas->show_grid, FL_MENU_TOGGLE|FL_MENU_VALUE );
! //    mbar->add( "View/Occupancy", FL_CTRL + 'o', (Fl_Callback 
*)view_toggle_cb, &canvas->show_occupancy, FL_MENU_TOGGLE|FL_MENU_VALUE );
! //    mbar->add( "View/Tree",      FL_CTRL + 't', (Fl_Callback 
*)view_toggle_cb, &canvas->show_quadtree, 
FL_MENU_TOGGLE|FL_MENU_VALUE|FL_MENU_DIVIDER );
! //    mbar->add( "View/Follow selection", FL_CTRL + 'f', (Fl_Callback 
*)view_toggle_cb, &canvas->follow_selection, FL_MENU_TOGGLE|FL_MENU_VALUE );
  
!   mbar->add( "Help", 0, 0, 0, FL_SUBMENU );
!   mbar->add( "Help/About Stage...", FL_CTRL + 'f', (Fl_Callback *)dummy_cb );
!   mbar->add( "Help/HTML Documentation", FL_CTRL + 'g', (Fl_Callback 
*)dummy_cb );
  
+   show();
+  }
  
! StgWorldGui::~StgWorldGui()
  {
  }
  
! void StgWorldGui::Load( const char* filename )
  {
!   PRINT_DEBUG1( "%s.Load()", token );
  
!   StgWorld::Load( filename);
    
!   wf_section = wf->LookupEntity( "window" );
!   if( wf_section < 1) // no section defined
!     return;
    
!   int width =  (int)wf->ReadTupleFloat(wf_section, "size", 0, w() );
!   int height = (int)wf->ReadTupleFloat(wf_section, "size", 1, h() );
!   size( width,height ); // resize this window
    
!   canvas->panx = wf->ReadTupleFloat(wf_section, "center", 0, canvas->panx );
!   canvas->pany = wf->ReadTupleFloat(wf_section, "center", 1, canvas->pany );
!   canvas->stheta = wf->ReadTupleFloat( wf_section, "rotate", 0, 
canvas->stheta );
!   canvas->sphi = wf->ReadTupleFloat( wf_section, "rotate", 1, canvas->sphi );
!   canvas->scale = wf->ReadFloat(wf_section, "scale", canvas->scale );
!   canvas->interval = wf->ReadInt(wf_section, "redraw_interval", 
canvas->interval );
  
  
!   /*  fill_polygons = wf_read_int(wf_section, "fill_polygons", fill_polygons 
); */
! /*   show_grid = wf_read_int(wf_section, "show_grid", show_grid ); */
! /*   show_alpha = wf_read_int(wf_section, "show_alpha", show_alpha ); */
! /*   show_data = wf_read_int(wf_section, "show_data", show_data ); */
! /*   show_thumbnail = wf_read_int(wf_section, "show_thumbnail", win 
->show_thumbnail ); */
  
!   // gui_load_toggle( win, wf_section, &show_bboxes, "Bboxes", "show_bboxes" 
);
! //   gui_load_toggle( win, wf_section, &show_alpha, "Alpha", "show_alpha" );
! //   gui_load_toggle( win, wf_section, &show_grid, "Grid", "show_grid" );
! //   gui_load_toggle( win, wf_section, &show_bboxes, "Thumbnail", 
"show_thumbnail" );
! //   gui_load_toggle( win, wf_section, &show_data, "Data", "show_data" );
! //   gui_load_toggle( win, wf_section, &follow_selection, "Follow", 
"show_follow" );
! //   gui_load_toggle( win, wf_section, &fill_polygons, "Fill Polygons", 
"show_fill" );
  
!   canvas->invalidate(); // we probably changed something
  }
  
! void StgWorldGui::Save( void )
  {
+   PRINT_DEBUG1( "%s.Save()", token );
    
!   wf->WriteTupleFloat( wf_section, "size", 0, w() );
!   wf->WriteTupleFloat( wf_section, "size", 1, h() );
  
!   wf->WriteFloat( wf_section, "scale", canvas->scale );
  
!   wf->WriteTupleFloat( wf_section, "center", 0, canvas->panx );
!   wf->WriteTupleFloat( wf_section, "center", 1, canvas->pany );
  
!   wf->WriteTupleFloat( wf_section, "rotate", 0, canvas->stheta  );
!   wf->WriteTupleFloat( wf_section, "rotate", 1, canvas->sphi  );
  
!   //wf->WriteInt( wf_section, "fill_polygons", show_fill );
!   //wf->WriteInt( wf_section, "show_grid", show_grid );
!   //wf->WriteInt( wf_section, "show_bboxes", show_bboxes );
  
! //   // save the state of the property toggles
! //   for( GList* list = toggle_list; list; list = g_list_next( list ) )
  //     {
! //       stg_property_toggle_args_t* tog = 
! //    (stg_property_toggle_args_t*)list->data;
! //       assert( tog );
! //       printf( "toggle item path: %s\n", tog->path );
  
! //       wf->WriteInt( wf_section, tog->path, 
! //               gtk_toggle_action_get_active(  
GTK_TOGGLE_ACTION(tog->action) ));
! //     }
  
!   StgWorld::Save();
  }
  
! bool StgWorldGui::RealTimeUpdate()
  {
!   //  puts( "RTU" );
!   bool res = StgWorld::RealTimeUpdate();
!   Fl::check();
!   return res;
  }
  
! bool StgWorldGui::Update()
  {
!   //  puts( "RTU" );
!   bool res = StgWorld::Update();
!   Fl::check();
!   return res;
  }
  

Index: stest.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stest.cc,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -C2 -d -r1.1.2.13 -r1.1.2.14
*** stest.cc    17 Nov 2007 23:31:22 -0000      1.1.2.13
--- stest.cc    19 Nov 2007 07:40:41 -0000      1.1.2.14
***************
*** 33,36 ****
--- 33,37 ----
  const int POPSIZE = 10;
  
+ 
  int main( int argc, char* argv[] )
  { 
***************
*** 44,56 ****
  
  
-   StgWorld::Init( &argc, &argv );
-     
-   StgWorldGui world(800, 700, "Stage Test Program");
-   
    // initialize libstage
    //StgWorld world;
! 
!   //StgWorldGtk::Init( &argc, &argv );
!   //StgWorldGtk world;
  
    world.Load( argv[1] );
--- 45,52 ----
  
  
    // initialize libstage
+   StgWorld::Init( &argc, &argv );
    //StgWorld world;
!   StgWorldGui world(800, 700, "Stage Test Program");
  
    world.Load( argv[1] );
***************
*** 96,100 ****
         robots[i].ranger = (StgModelRanger*)world.GetModel( namebuf );
         assert(robots[i].ranger);
!        //robots[i].ranger->Subscribe();
      }
     
--- 92,96 ----
         robots[i].ranger = (StgModelRanger*)world.GetModel( namebuf );
         assert(robots[i].ranger);
!        robots[i].ranger->Subscribe();
      }
     
***************
*** 113,116 ****
--- 109,115 ----
      //   while( world.Update() )
      {
+ 
+       //}
+       //{
        //       nothing
        //while( ! laser->DataIsFresh() )

Index: model_laser.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model_laser.cc,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** model_laser.cc      17 Nov 2007 23:31:21 -0000      1.1.2.10
--- model_laser.cc      19 Nov 2007 07:40:41 -0000      1.1.2.11
***************
*** 112,123 ****
  }
  
! void StgModelLaser::InitGraphics()
! {
!   StgModel::InitGraphics();
  
!   dl_debug_laser = glGenLists( 1 );
!   glNewList( dl_debug_laser, GL_COMPILE );
!   glEndList();
! }
  
  void StgModelLaser::SetSampleCount( unsigned int count )
--- 112,123 ----
  }
  
! // void StgModelLaser::InitGraphics()
! // {
! //   StgModel::InitGraphics();
  
! //   dl_debug_laser = glGenLists( 1 );
! //   glNewList( dl_debug_laser, GL_COMPILE );
! //   glEndList();
! // }
  
  void StgModelLaser::SetSampleCount( unsigned int count )
***************
*** 183,198 ****
    double sample_incr = fov / (double)(sample_count-1);  
  
!   if( debug )
!     {
!       glNewList( this->dl_debug_laser, GL_COMPILE );
!       glPushMatrix();
  
!       // go into global coords
!       stg_pose_t gpose;
!       GetGlobalPose( &gpose );
!       //gl_coord_shift( -gpose.x, -gpose.y, 0, -gpose.a );
!       glRotatef( RTOD(-gpose.a), 0,0,1 );
!       glTranslatef( -gpose.x, -gpose.y, 0 );
!     }
  
    for( unsigned int t=0; t<sample_count; t += resolution )
--- 183,198 ----
    double sample_incr = fov / (double)(sample_count-1);  
  
! //   if( debug )
! //     {
! //       glNewList( this->dl_debug_laser, GL_COMPILE );
! //       glPushMatrix();
  
! //       // go into global coords
! //       stg_pose_t gpose;
! //       GetGlobalPose( &gpose );
! //       //gl_coord_shift( -gpose.x, -gpose.y, 0, -gpose.a );
! //       glRotatef( RTOD(-gpose.a), 0,0,1 );
! //       glTranslatef( -gpose.x, -gpose.y, 0 );
! //     }
  
    for( unsigned int t=0; t<sample_count; t += resolution )
***************
*** 243,251 ****
       }
     
!    if( debug )
!      {
!        glPopMatrix();
!        glEndList();
!      }
  
     data_dirty = true;
--- 243,251 ----
       }
     
! //    if( debug )
! //      {
! //        glPopMatrix();
! //        glEndList();
! //      }
  
     data_dirty = true;
***************
*** 322,326 ****
  {
    // rebuild the graphics for this data
!   glNewList( dl_data, GL_COMPILE );
    
    if( samples && sample_count )
--- 322,326 ----
  {
    // rebuild the graphics for this data
!   //glNewList( dl_data, GL_COMPILE );
    
    if( samples && sample_count )
***************
*** 389,396 ****
      }
    
!   if( this->debug )
!     glCallList( this->dl_debug_laser );
  
!   glEndList();
  }
  
--- 389,396 ----
      }
    
!   //if( this->debug )
!   //glCallList( this->dl_debug_laser );
  
!   //glEndList();
  }
  

Index: stage.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stage.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** stage.c     30 Oct 2007 01:01:48 -0000      1.1.2.4
--- stage.c     19 Nov 2007 07:40:41 -0000      1.1.2.5
***************
*** 15,19 ****
  #include <gdk-pixbuf/gdk-pixbuf.h>
  
! #define DEBUG
  
  #include "stage.hh"
--- 15,19 ----
  #include <gdk-pixbuf/gdk-pixbuf.h>
  
! //#define DEBUG
  
  #include "stage.hh"

Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model.cc,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -C2 -d -r1.1.2.12 -r1.1.2.13
*** model.cc    17 Nov 2007 23:31:21 -0000      1.1.2.12
--- model.cc    19 Nov 2007 07:40:41 -0000      1.1.2.13
***************
*** 232,243 ****
  }
  
- void StgModel::InitGraphics()
- {
-   this->dl_body = glGenLists(1);
-   this->dl_data = glGenLists(1);
-   this->dl_grid = glGenLists(1);  
- }
- 
- 
  StgModel::~StgModel( void )
  {
--- 232,235 ----
***************
*** 708,737 ****
  }
   
- void StgModel::DrawData( void )
- {
-   if( this->data_dirty )
-     {
-       this->DataVisualize();
-       this->data_dirty = false;
-     }
- 
-   glPushMatrix();
-   
-   // move into this model's local coordinate frame
-   gl_pose_shift( &this->pose );
-   gl_pose_shift( &this->geom.pose );
-   
-   glCallList( this->dl_data );
-   glCallList( this->dl_raytrace );
-   
-   // shift up the CS to the top of this model
-   gl_coord_shift(  0,0, this->geom.size.z, 0 );
-   
-   // recursively draw the tree below this model 
-   LISTMETHOD( this->children, StgModel*, DrawData );
- 
-   glPopMatrix(); // drop out of local coords
- }
- 
  void StgModel::DrawSelected()
  {
--- 700,703 ----
***************
*** 751,755 ****
  }
  
! void StgModel::Draw( void )
  {
    //PRINT_DEBUG1( "Drawing %s", token );
--- 717,721 ----
  }
  
! void StgModel::Draw( uint32_t flags )
  {
    //PRINT_DEBUG1( "Drawing %s", token );
***************
*** 760,779 ****
    gl_pose_shift( &this->pose );
    gl_pose_shift( &this->geom.pose );
    
!   if( this->body_dirty )
!     {
!       this->DrawBody();
!       this->body_dirty = false;
!     }
!   
!   glCallList( this->dl_body );
!   
!   
    //if( this->say_string )
    // gl_speech_bubble( 0,0,0, this->say_string );
! 
!   // Call my various display lists
!   //if( this->gui_grid )
!   //glCallList( this->dl_grid );
  
    // shift up the CS to the top of this model
--- 726,748 ----
    gl_pose_shift( &this->pose );
    gl_pose_shift( &this->geom.pose );
+ 
+   // draw all the blocks
+   if( flags & STG_SHOW_BLOCKS )
+     LISTMETHOD( this->blocks, StgBlock*, Draw );
    
!   if( flags & STG_SHOW_DATA )
!     this->DataVisualize();
! 
!   //if( flags & STG_SHOW_GEOM )
!     //this->DataVisualize();
! 
!   // etc
! 
    //if( this->say_string )
    // gl_speech_bubble( 0,0,0, this->say_string );
!   
!   
!   if( gui_grid && (flags & STG_SHOW_GRID) )
!     DrawGrid();
  
    // shift up the CS to the top of this model
***************
*** 781,789 ****
    
    // recursively draw the tree below this model 
!   LISTMETHOD( this->children, StgModel*, Draw );
  
    glPopMatrix(); // drop out of local coords
- 
-   //glCallList( this->dl_debug );
  }
  
--- 750,758 ----
    
    // recursively draw the tree below this model 
!   //LISTMETHOD( this->children, StgModel*, Draw );
!   for( GList* it=children; it; it=it->next )
!     ((StgModel*)it->data)->Draw( flags );
  
    glPopMatrix(); // drop out of local coords
  }
  
***************
*** 812,826 ****
  
  
- // call this when the local physical appearance has changed
- void StgModel::DrawBody( void )
- {
-   //printf( "%s::GuiGenerateBody()\n", this->token );
-   
-   // draw blocks
-   glNewList( dl_body, GL_COMPILE );  
-   LISTMETHOD( this->blocks, StgBlock*, Draw );
-   glEndList();
- }
-   
  void StgModel::DataVisualize( void )
  {
--- 781,784 ----
***************
*** 828,886 ****
  }
  
  
! 
! // void StgModel::GuiGenerateGrid( void )
! // {
! //   glNewList( dl_grid, GL_COMPILE );
! 
! //   push_color_rgba( 0.8,0.8,0.8,0.8 );
! 
! //   double dx = geom.size.x;
! //   double dy = geom.size.y;
! //   double sp = 1.0;
   
! //   int nx = (int) ceil((dx/2.0) / sp);
! //   int ny = (int) ceil((dy/2.0) / sp);
    
! //   if( nx == 0 ) nx = 1.0;
! //   if( ny == 0 ) ny = 1.0;
    
! //   glBegin(GL_LINES);
  
! //   // draw the bounding box first
! //   glVertex2f( -nx, -ny );
! //   glVertex2f(  nx, -ny );
  
! //   glVertex2f( -nx, ny );
! //   glVertex2f(  nx, ny );
  
! //   glVertex2f( nx, -ny );
! //   glVertex2f( nx,  ny );
  
! //   glVertex2f( -nx,-ny );
! //   glVertex2f( -nx, ny );
  
! //   int i;
! //   for (i = -nx+1; i < nx; i++)
! //     {
! //       glVertex2f(  i * sp,  - dy/2 );
! //       glVertex2f(  i * sp,  + dy/2 );
! //       //snprintf( str, 64, "%d", (int)i );
! //       //stg_rtk_fig_text( fig, -0.2 + (ox + i * sp), -0.2 , 0, str );
! //     }
    
! //   for (i = -ny+1; i < ny; i++)
! //     {
! //       glVertex2f( - dx/2, i * sp );
! //       glVertex2f( + dx/2,  i * sp );
! //       //snprintf( str, 64, "%d", (int)i );
! //       //stg_rtk_fig_text( fig, -0.2, -0.2 + (oy + i * sp) , 0, str );
! //     }
    
! //   glEnd();
    
! //   pop_color();
! //   glEndList();
! // }
  
  void StgModel::GetVelocity( stg_velocity_t* dest )
--- 786,840 ----
  }
  
+ void StgModel::DrawGrid( void )
+ {
+   PushColor( 0,0,0,0.1 );
  
!   double dx = geom.size.x;
!   double dy = geom.size.y;
!   double sp = 1.0;
   
!   int nx = (int) ceil((dx/2.0) / sp);
!   int ny = (int) ceil((dy/2.0) / sp);
    
!   if( nx == 0 ) nx = 1.0;
!   if( ny == 0 ) ny = 1.0;
    
!   glBegin(GL_LINES);
  
!   // draw the bounding box first
!   glVertex2f( -nx, -ny );
!   glVertex2f(  nx, -ny );
  
!   glVertex2f( -nx, ny );
!   glVertex2f(  nx, ny );
  
!   glVertex2f( nx, -ny );
!   glVertex2f( nx,  ny );
  
!   glVertex2f( -nx,-ny );
!   glVertex2f( -nx, ny );
  
!   char str[16];
!   int i;
!   for (i = -nx+1; i < nx; i++)
!     {
!       glVertex2f(  i * sp,  - dy/2 );
!       glVertex2f(  i * sp,  + dy/2 );
!       snprintf( str, 16, "%d", (int)i );
!       //gl_draw( str, -0.2 + (nx + i * sp), -0.2 , 1 );
!     }
    
!   for (i = -ny+1; i < ny; i++)
!     {
!       glVertex2f( - dx/2, i * sp );
!       glVertex2f( + dx/2,  i * sp );
!       snprintf( str, 16, "%d", (int)i );
!       //gl_draw( str, -0.2, -0.2 + (ny + i * sp) , 1 );
!     }
    
!   glEnd();
    
!   PopColor();
! }
  
  void StgModel::GetVelocity( stg_velocity_t* dest )

Index: Makefile.fl
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile.fl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** Makefile.fl 17 Nov 2007 23:31:21 -0000      1.1.2.1
--- Makefile.fl 19 Nov 2007 07:40:40 -0000      1.1.2.2
***************
*** 11,14 ****
--- 11,15 ----
      block.o \
      blockgrid.o \
+     canvas.o \
      gl.o \
      glcolorstack.o \

Index: world.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/world.cc,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -C2 -d -r1.1.2.14 -r1.1.2.15
*** world.cc    17 Nov 2007 23:31:22 -0000      1.1.2.14
--- world.cc    19 Nov 2007 07:40:41 -0000      1.1.2.15
***************
*** 606,654 ****
  
  
! void draw_voxel( int x, int y, int z )
! {
!   glTranslatef( x,y,z );
    
!   glBegin(GL_QUADS);          // Draw The Cube Using quads
!     glColor3f(0.0f,1.0f,0.0f);        // Color Blue
!     glVertex3f( 1.0f, 1.0f,-1.0f);    // Top Right Of The Quad (Top)
!     glVertex3f(-1.0f, 1.0f,-1.0f);    // Top Left Of The Quad (Top)
!     glVertex3f(-1.0f, 1.0f, 1.0f);    // Bottom Left Of The Quad (Top)
!     glVertex3f( 1.0f, 1.0f, 1.0f);    // Bottom Right Of The Quad (Top)
!     glColor3f(1.0f,0.5f,0.0f);        // Color Orange
!     glVertex3f( 1.0f,-1.0f, 1.0f);    // Top Right Of The Quad (Bottom)
!     glVertex3f(-1.0f,-1.0f, 1.0f);    // Top Left Of The Quad (Bottom)
!     glVertex3f(-1.0f,-1.0f,-1.0f);    // Bottom Left Of The Quad (Bottom)
!     glVertex3f( 1.0f,-1.0f,-1.0f);    // Bottom Right Of The Quad (Bottom)
!     glColor3f(1.0f,0.0f,0.0f);        // Color Red    
!     glVertex3f( 1.0f, 1.0f, 1.0f);    // Top Right Of The Quad (Front)
!     glVertex3f(-1.0f, 1.0f, 1.0f);    // Top Left Of The Quad (Front)
!     glVertex3f(-1.0f,-1.0f, 1.0f);    // Bottom Left Of The Quad (Front)
!     glVertex3f( 1.0f,-1.0f, 1.0f);    // Bottom Right Of The Quad (Front)
!     glColor3f(1.0f,1.0f,0.0f);        // Color Yellow
!     glVertex3f( 1.0f,-1.0f,-1.0f);    // Top Right Of The Quad (Back)
!     glVertex3f(-1.0f,-1.0f,-1.0f);    // Top Left Of The Quad (Back)
!     glVertex3f(-1.0f, 1.0f,-1.0f);    // Bottom Left Of The Quad (Back)
!     glVertex3f( 1.0f, 1.0f,-1.0f);    // Bottom Right Of The Quad (Back)
!     glColor3f(0.0f,0.0f,1.0f);        // Color Blue
!     glVertex3f(-1.0f, 1.0f, 1.0f);    // Top Right Of The Quad (Left)
!     glVertex3f(-1.0f, 1.0f,-1.0f);    // Top Left Of The Quad (Left)
!     glVertex3f(-1.0f,-1.0f,-1.0f);    // Bottom Left Of The Quad (Left)
!     glVertex3f(-1.0f,-1.0f, 1.0f);    // Bottom Right Of The Quad (Left)
!     glColor3f(1.0f,0.0f,1.0f);        // Color Violet
!     glVertex3f( 1.0f, 1.0f,-1.0f);    // Top Right Of The Quad (Right)
!     glVertex3f( 1.0f, 1.0f, 1.0f);    // Top Left Of The Quad (Right)
!     glVertex3f( 1.0f,-1.0f, 1.0f);    // Bottom Left Of The Quad (Right)
!     glVertex3f( 1.0f,-1.0f,-1.0f);    // Bottom Right Of The Quad (Right)
!   glEnd();                    // End Drawing The Cube
! 
!   glTranslatef( -x, -y, -z );
! }
! 
! 
  
! // int stg_hash3d( int x, int y, int z )
! // {
! //   return (x+y+z);
  // }
  
--- 606,647 ----
  
  
! // void draw_voxel( int x, int y, int z )
! // {
! //   glTranslatef( x,y,z );
    
! //   glBegin(GL_QUADS);               // Draw The Cube Using quads
! //     glColor3f(0.0f,1.0f,0.0f);     // Color Blue
! //     glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top)
! //     glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top)
! //     glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
! //     glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)
! //     glColor3f(1.0f,0.5f,0.0f);     // Color Orange
! //     glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom)
! //     glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom)
! //     glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom)
! //     glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom)
! //     glColor3f(1.0f,0.0f,0.0f);     // Color Red    
! //     glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
! //     glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
! //     glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front)
! //     glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front)
! //     glColor3f(1.0f,1.0f,0.0f);     // Color Yellow
! //     glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back)
! //     glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back)
! //     glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back)
! //     glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back)
! //     glColor3f(0.0f,0.0f,1.0f);     // Color Blue
! //     glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
! //     glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left)
! //     glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left)
! //     glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left)
! //     glColor3f(1.0f,0.0f,1.0f);     // Color Violet
! //     glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right)
! //     glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
! //     glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right)
! //     glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right)
! //   glEnd();                 // End Drawing The Cube
  
! //   glTranslatef( -x, -y, -z );
  // }
  

Index: model_ranger.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model_ranger.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** model_ranger.cc     1 Nov 2007 07:18:53 -0000       1.1.2.3
--- model_ranger.cc     19 Nov 2007 07:40:41 -0000      1.1.2.4
***************
*** 356,360 ****
  {
    // recreate the display list for this data
!   glNewList( this->dl_data, GL_COMPILE );
    
    if( sensors && sensor_count ) 
--- 356,360 ----
  {
    // recreate the display list for this data
!   //glNewList( this->dl_data, GL_COMPILE );
    
    if( sensors && sensor_count ) 
***************
*** 374,378 ****
        glDepthMask( GL_TRUE ); 
      }
!   glEndList();
  }
     
--- 374,379 ----
        glDepthMask( GL_TRUE ); 
      }
! 
!   //glEndList();
  }
     

Index: blockgrid.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/blockgrid.cc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** blockgrid.cc        1 Nov 2007 07:18:53 -0000       1.1.2.5
--- blockgrid.cc        19 Nov 2007 07:40:41 -0000      1.1.2.6
***************
*** 15,20 ****
    this->bheight = height >> NBITS;
    
!   printf( "Creating StgBlockGrid of [%u,%u](%u,%u) elements\n", 
!         width, height, bwidth, bheight );
    
    trashstack = NULL;
--- 15,20 ----
    this->bheight = height >> NBITS;
    
!   //printf( "Creating StgBlockGrid of [%u,%u](%u,%u) elements\n", 
!   //  width, height, bwidth, bheight );
    
    trashstack = NULL;

Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stage.hh,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -C2 -d -r1.1.2.14 -r1.1.2.15
*** stage.hh    17 Nov 2007 23:31:22 -0000      1.1.2.14
--- stage.hh    19 Nov 2007 07:40:41 -0000      1.1.2.15
***************
*** 686,689 ****
--- 686,700 ----
  #define LTE(A,B) ((lrint(A*PRECISION))<=(lrint(B*PRECISION)))
  
+ #define STG_SHOW_BLOCKS       1
+ #define STG_SHOW_DATA         1<<1
+ #define STG_SHOW_GEOM         1<<2
+ #define STG_SHOW_GRID         1<<3
+ #define STG_SHOW_OCCUPANCY    1<<4
+ #define STG_SHOW_TRAILS       1<<5
+ #define STG_SHOW_FOLLOW       1<<6
+ #define STG_SHOW_CLOCK        1<<7
+ #define STG_SHOW_QUADTREE     1<<8
+ //#define STG_SHOW_   1<<
+ 
  // STAGE INTERNAL
  
***************
*** 1144,1147 ****
--- 1155,1160 ----
  class StgAncestor
  {
+   friend class StgCanvas; // allow StgCanvas access to our private members
+   
  protected:
    GList* children;
***************
*** 1159,1163 ****
    virtual void AddChild( StgModel* mod );
    virtual void RemoveChild( StgModel* mod );
-   
    virtual void GetGlobalPose( stg_pose_t* gpose );  
    
--- 1172,1175 ----
***************
*** 1165,1172 ****
    { return this->token; }
    
!   // todo - should these be pure virtual?
!   virtual void PushColor( stg_color_t col ){} // does nothing
!   virtual void PushColor( double r, double g, double b, double a ){} // does 
nothing
!   virtual void PopColor(){} // does nothing
  };
  
--- 1177,1184 ----
    { return this->token; }
    
!   // PURE VIRTUAL - descendents must implement
!   virtual void PushColor( stg_color_t col ) = 0;
!   virtual void PushColor( double r, double g, double b, double a ) = 0;
!   virtual void PopColor() = 0; // does nothing
  };
  
***************
*** 1401,1405 ****
    
    // display lists
!   int dl_body, dl_data, dl_cmd, dl_cfg, dl_grid, dl_debug, dl_raytrace;
    //GList* raytrace_dl_list;
  
--- 1413,1417 ----
    
    // display lists
!   //int dl_body, dl_data, dl_cmd, dl_cfg, dl_grid, dl_debug, dl_raytrace;
    //GList* raytrace_dl_list;
  
***************
*** 1435,1445 ****
    /** save the state of the model to the current world file */
    virtual void Save( void );
!   virtual void Draw( void );
    virtual void DrawPicker( void );
!   virtual void DrawBody( void );
!   virtual void DrawData( void );
    virtual void DataVisualize( void );
    virtual void DrawSelected(void);
!   virtual void InitGraphics(void); // called by a world that supports
                                   // graphics
  
--- 1447,1458 ----
    /** save the state of the model to the current world file */
    virtual void Save( void );
!   virtual void Draw( uint32_t flags );
    virtual void DrawPicker( void );
!   //virtual void DrawBody( void );
!   //virtual void DrawData( void );
    virtual void DataVisualize( void );
+   void DrawGrid();
    virtual void DrawSelected(void);
!   //virtual void InitGraphics(void); // called by a world that supports
                                   // graphics
  
***************
*** 1972,2023 ****
  #include <FL/Fl.H>
  #include <FL/Fl_Window.H>
  #include <FL/Fl_Value_Slider.H>
  #include <FL/Fl_Menu_Button.H>
  #include <FL/Fl_Gl_Window.H>
  #include <FL/gl.h>
  
! class StgGlWindow;
! 
! class StgWorldGui : public StgWorld, public Fl_Gl_Window 
  {
! protected:
    GlColorStack colorstack;
    double scale;
-   
-   double fg;                       // foreground brightness
-   double bg;                       // background brightness
    double panx, pany, stheta, sphi;
-   
    int startx, starty;
    bool dragging;
! 
!   //int overlay_sides;
!   //bool ctrl_down;
! 
!   GList* selected_models; ///<   a list of models that are currently selected 
by the user 
! 
! public:
!   StgWorldGui(int W,int H,const char*L=0);
!   StgGlWindow* gl;        
!   //Fl_Menu_Bar* menubar;  
! 
    bool follow_selection;
!   bool show_quadtree;  
!   bool show_occupancy;  
!   bool show_geom;
!   bool show_boxes;
!   bool show_grid;
!   bool show_data;
!   bool show_cfg;
!   bool show_cmd;
!   bool show_thumbnail;
!   bool show_trails;
!   bool show_clock;
! 
!   //bool show_bboxes;
!   //bool show_alpha;
!   //bool show_fill;
  
    bool graphics;
    void FixViewport(int W,int H);
    virtual void draw();
--- 1985,2022 ----
  #include <FL/Fl.H>
  #include <FL/Fl_Window.H>
+ #include <FL/Fl_Double_Window.H>
  #include <FL/Fl_Value_Slider.H>
+ #include <FL/Fl_Menu_Bar.H>
  #include <FL/Fl_Menu_Button.H>
  #include <FL/Fl_Gl_Window.H>
  #include <FL/gl.h>
+ #include <Fl/Fl_Box.H>
  
! class StgCanvas : public Fl_Gl_Window
  {
!   friend class StgWorldGui; // allow access to private members
! 
! private:
    GlColorStack colorstack;
    double scale;
    double panx, pany, stheta, sphi;
    int startx, starty;
    bool dragging;
!   bool rotating;
!   GList* selected_models; ///< a list of models that are currently
!                         ///selected by the user
!   StgModel* last_selection; ///< the most recently selected model
!                           ///(even if it is now unselected).
    bool follow_selection;
!   uint32_t showflags;
!   stg_msec_t interval; // window refresh interval in ms
  
+ public:
+   StgCanvas( StgWorld* world, int x, int y, int W,int H);
+   ~StgCanvas();
+   
+   StgWorld* world;
    bool graphics;
+ 
    void FixViewport(int W,int H);
    virtual void draw();
***************
*** 2025,2052 ****
    virtual int handle( int event );
    void resize(int X,int Y,int W,int H);
    
!   //Fl_Menu_Item* menuitems;
!   Fl_Menu_Button* menu;
  
!   void PopupMenu( int x, int y);
  
!   // overloaded StgWorld methods
    virtual bool RealTimeUpdate();
    virtual bool Update();
-   virtual void AddModel( StgModel* mod );
  
!   void CanvasToWorld( int px, int py, 
!                     double *wx, double *wy, double* wz );
! 
!   StgModel* Select( int x, int y );
    
    virtual void PushColor( stg_color_t col )
!   { colorstack.Push( col ); } 
    
    virtual void PushColor( double r, double g, double b, double a )
!   { colorstack.Push( r,g,b,a ); }
    
    virtual void PopColor()
!   { colorstack.Pop(); } 
  };
  
--- 2024,2074 ----
    virtual int handle( int event );
    void resize(int X,int Y,int W,int H);
+ 
+   void CanvasToWorld( int px, int py, 
+                     double *wx, double *wy, double* wz );
+ 
+   StgModel* Select( int x, int y );
    
!   inline void PushColor( stg_color_t col )
!   { colorstack.Push( col ); } 
!   
!   inline void PushColor( double r, double g, double b, double a )
!   { colorstack.Push( r,g,b,a ); }
!   
!   inline void PopColor()
!   { colorstack.Pop(); } 
!   
!   static void TimerCallback( StgCanvas* canvas );
! };
  
! class StgWorldGui : public StgWorld, public Fl_Window 
! {
! private:
!   int wf_section;
  
! public:
!   StgWorldGui(int W,int H,const char*L=0);
!   ~StgWorldGui();
! 
!   StgCanvas* canvas;
!   
!   // overload inherited methods
    virtual bool RealTimeUpdate();
    virtual bool Update();
  
!   virtual void Load( const char* filename );
!   virtual void Save();
!   
!   // static callback functions
!   static void SaveCallback( Fl_Widget* wid, StgWorldGui* world );
    
    virtual void PushColor( stg_color_t col )
!   { canvas->PushColor( col ); } 
    
    virtual void PushColor( double r, double g, double b, double a )
!   { canvas->PushColor( r,g,b,a ); }
    
    virtual void PopColor()
!   { canvas->PopColor(); } 
  };
  
***************
*** 2228,2232 ****
      virtual void Print( char* prefix );
      virtual void DataVisualize( void );
!     virtual void InitGraphics(void);
  
      void SetSampleCount( unsigned int count );
--- 2250,2254 ----
      virtual void Print( char* prefix );
      virtual void DataVisualize( void );
!     //    virtual void InitGraphics(void);
  
      void SetSampleCount( unsigned int count );


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to