Update of /cvsroot/playerstage/code/stage/libstage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2459
Modified Files:
Tag: opengl
Makefile Makefile.am Makefile.fl canvas.cc model.cc
model_ranger.cc stage.c stage.hh stest.cc worldgui.cc
Log Message:
fixed basic visualization menus
Index: worldgui.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/worldgui.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** worldgui.cc 19 Nov 2007 07:40:41 -0000 1.1.2.2
--- worldgui.cc 22 Nov 2007 01:36:47 -0000 1.1.2.3
***************
*** 4,9 ****
#include <FL/fl_Box.H>
#include <FL/Fl_Menu_Button.H>
! extern void glPolygonOffsetEXT (GLfloat, GLfloat);
void dummy_cb(Fl_Widget*, void* v)
--- 4,42 ----
#include <FL/fl_Box.H>
#include <FL/Fl_Menu_Button.H>
+ #include <FL/glut.H>
! // some utilities
!
! static const char* MITEM_VIEW_DATA = "View/Data";
! static const char* MITEM_VIEW_BLOCKS = "View/Blocks";
! static const char* MITEM_VIEW_GRID = "View/Grid";
! static const char* MITEM_VIEW_OCCUPANCY = "View/Occupancy";
! static const char* MITEM_VIEW_QUADTREE = "View/Tree";
! static const char* MITEM_VIEW_FOLLOW = "View/Follow";
! static const char* MITEM_VIEW_CLOCK = "View/Clock";
!
! // transform the current coordinate frame by the given pose
! void gl_coord_shift( double x, double y, double z, double a )
! {
! glTranslatef( x,y,z );
! glRotatef( RTOD(a), 0,0,1 );
! }
!
! // transform the current coordinate frame by the given pose
! void gl_pose_shift( stg_pose_t* pose )
! {
! gl_coord_shift( pose->x, pose->y, pose->z, pose->a );
! }
!
! // TODO - this could be faster, but we don't draw a lot of text
! void gl_draw_string( float x, float y, float z, char *str )
! {
! char *c;
! glRasterPos3f(x, y,z);
! for (c=str; *c != '\0'; c++)
! glutBitmapCharacter( GLUT_BITMAP_HELVETICA_12, *c);
! }
!
! /////
void dummy_cb(Fl_Widget*, void* v)
***************
*** 16,26 ****
}
! void view_toggle_cb(Fl_Widget* w, bool* view )
{
! assert(view);
! *view = !(*view);
! Fl_Menu_Item* item = (Fl_Menu_Item*)((Fl_Menu_*)w)->mvalue();
! *view ? item->check() : item->clear();
}
--- 49,70 ----
}
! void view_toggle_cb(Fl_Menu_Bar* menubar, StgCanvas* canvas )
{
! char picked[128];
! menubar->item_pathname(picked, sizeof(picked)-1);
!
! printf("CALLBACK: You picked '%s'\n", picked);
! // this is slow and a little ugly, but it's the least hacky approach I think
! if( strcmp(picked, MITEM_VIEW_DATA ) == 0 ) canvas->InvertView(
STG_SHOW_DATA );
! else if( strcmp(picked, MITEM_VIEW_BLOCKS ) == 0 ) canvas->InvertView(
STG_SHOW_BLOCKS );
! else if( strcmp(picked, MITEM_VIEW_GRID ) == 0 ) canvas->InvertView(
STG_SHOW_GRID );
! else if( strcmp(picked, MITEM_VIEW_FOLLOW ) == 0 ) canvas->InvertView(
STG_SHOW_FOLLOW );
! else if( strcmp(picked, MITEM_VIEW_QUADTREE ) == 0 ) canvas->InvertView(
STG_SHOW_QUADTREE );
! else if( strcmp(picked, MITEM_VIEW_OCCUPANCY ) == 0 ) canvas->InvertView(
STG_SHOW_OCCUPANCY );
! else if( strcmp(picked, MITEM_VIEW_CLOCK ) == 0 ) canvas->InvertView(
STG_SHOW_CLOCK );
! else PRINT_ERR1( "Unrecognized menu item \"%s\" not handled", picked );
!
! //printf( "value: %d\n", item->value() );
}
***************
*** 32,36 ****
// build the menus
! Fl_Menu_Bar* mbar = new Fl_Menu_Bar(0,0, W, 30);// 640, 30);
mbar->textsize(12);
--- 76,80 ----
// build the menus
! mbar = new Fl_Menu_Bar(0,0, W, 30);// 640, 30);
mbar->textsize(12);
***************
*** 39,61 ****
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();
}
--- 83,115 ----
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/Exit", FL_CTRL+'q', (Fl_Callback *)dummy_cb, 0 );
! mbar->add( "View", 0, 0, 0, FL_SUBMENU );
! mbar->add( MITEM_VIEW_DATA, FL_CTRL+'z', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_DATA ? FL_MENU_VALUE
: 0 ));
! mbar->add( MITEM_VIEW_BLOCKS, FL_CTRL+'b', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_BLOCKS ?
FL_MENU_VALUE : 0 ));
! mbar->add( MITEM_VIEW_GRID, FL_CTRL+'c', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_GRID ? FL_MENU_VALUE
: 0 ));
! mbar->add( MITEM_VIEW_OCCUPANCY, FL_CTRL+'o', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_OCCUPANCY ?
FL_MENU_VALUE : 0 ));
! mbar->add( MITEM_VIEW_QUADTREE, FL_CTRL+'t', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_QUADTREE ?
FL_MENU_VALUE : 0 ));
! mbar->add( MITEM_VIEW_FOLLOW, FL_CTRL+'f', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_FOLLOW ?
FL_MENU_VALUE : 0 ));
! mbar->add( MITEM_VIEW_CLOCK, 0, (Fl_Callback*)view_toggle_cb,
(void*)canvas,
! FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_CLOCK ?
FL_MENU_VALUE : 0 ));
!
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 );
+
+ // set the checked state appropriately
+
+
show();
}
***************
*** 86,105 ****
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
}
--- 140,194 ----
canvas->interval = wf->ReadInt(wf_section, "redraw_interval",
canvas->interval );
+ // set the canvas visibilty flags
+ // canvas->SetShowFlag( STG_SHOW_GRID, wf->ReadInt(wf_section,
"show_grid" , flags & STG_SHOW_GRID ));
+ // canvas->SetShowFlag( STG_SHOW_BLOCKS, wf->ReadInt(wf_section,
"show_blocks", flags & STG_SHOW_BLOCKS ));
+ // canvas->SetShowFlag( STG_SHOW_DATA, wf->ReadInt(wf_section,
"show_data", flags & STG_SHOW_DATA ));
+ // canvas->SetShowFlag( STG_SHOW_FOLLOW, wf->ReadInt(wf_section,
"show_follow", flags & STG_SHOW_FOLLOW ));
+ // canvas->SetShowFlag( STG_SHOW_QUADTREE, wf->ReadInt(wf_section,
"show_tree", flags & STG_SHOW_QUADTREE ));
+ // canvas->SetShowFlag( STG_SHOW_OCCUPANCY, wf->ReadInt(wf_section,
"show_occupancy", flags & STG_SHOW_OCCUPANCY ));
+
+ uint32_t flags = canvas->GetShowFlags();
+ uint32_t grid = wf->ReadInt(wf_section, "show_grid", flags & STG_SHOW_GRID
) ? STG_SHOW_GRID : 0;
+ uint32_t data = wf->ReadInt(wf_section, "show_data", flags & STG_SHOW_DATA
) ? STG_SHOW_DATA : 0;
+ uint32_t follow = wf->ReadInt(wf_section, "show_follow", flags &
STG_SHOW_FOLLOW ) ? STG_SHOW_FOLLOW : 0;
+ uint32_t blocks = wf->ReadInt(wf_section, "show_blocks", flags &
STG_SHOW_BLOCKS ) ? STG_SHOW_BLOCKS : 0;
+ uint32_t quadtree = wf->ReadInt(wf_section, "show_tree", flags &
STG_SHOW_QUADTREE ) ? STG_SHOW_QUADTREE : 0;
+ uint32_t clock = wf->ReadInt(wf_section, "show_clock", flags &
STG_SHOW_CLOCK ) ? STG_SHOW_CLOCK : 0;
+
+
+ //canvas->SetShowFlag( STG_SHOW_BLOCKS, wf->ReadInt(wf_section,
"show_blocks", flags & STG_SHOW_BLOCKS ));
+ // canvas->SetShowFlag( STG_SHOW_DATA, wf->ReadInt(wf_section,
"show_data", flags & STG_SHOW_DATA ));
+ //canvas->SetShowFlag( STG_SHOW_FOLLOW, wf->ReadInt(wf_section,
"show_follow", flags & STG_SHOW_FOLLOW ));
+ //canvas->SetShowFlag( STG_SHOW_QUADTREE, wf->ReadInt(wf_section,
"show_tree", flags & STG_SHOW_QUADTREE ));
+ //canvas->SetShowFlag( STG_SHOW_OCCUPANCY, wf->ReadInt(wf_section,
"show_occupancy", flags & STG_SHOW_OCCUPANCY ));
! flags = grid | data | follow | blocks | quadtree | clock;
! canvas->SetShowFlags( flags );
! canvas->invalidate(); // we probably changed something
! // fix the GUI menu checkboxes to match
! flags = canvas->GetShowFlags();
!
! Fl_Menu_Item* item = NULL;
!
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_DATA );
! (flags & STG_SHOW_DATA) ? item->check() : item->clear();
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_GRID );
! (flags & STG_SHOW_GRID) ? item->check() : item->clear();
!
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_BLOCKS );
! (flags & STG_SHOW_BLOCKS) ? item->check() : item->clear();
!
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_FOLLOW );
! (flags & STG_SHOW_FOLLOW) ? item->check() : item->clear();
!
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_OCCUPANCY );
! (flags & STG_SHOW_OCCUPANCY) ? item->check() : item->clear();
!
! item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_QUADTREE );
! (flags & STG_SHOW_QUADTREE) ? item->check() : item->clear();
!
! // TODO - per model visualizations load
}
***************
*** 119,137 ****
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();
--- 208,221 ----
wf->WriteTupleFloat( wf_section, "rotate", 1, canvas->sphi );
! uint32_t flags = canvas->GetShowFlags();
! wf->WriteInt( wf_section, "show_blocks", flags & STG_SHOW_BLOCKS );
! wf->WriteInt( wf_section, "show_grid", flags & STG_SHOW_GRID );
! wf->WriteInt( wf_section, "show_follow", flags & STG_SHOW_FOLLOW );
! wf->WriteInt( wf_section, "show_data", flags & STG_SHOW_DATA );
! wf->WriteInt( wf_section, "show_occupancy", flags & STG_SHOW_OCCUPANCY );
! wf->WriteInt( wf_section, "show_tree", flags & STG_SHOW_QUADTREE );
! wf->WriteInt( wf_section, "show_clock", flags & STG_SHOW_CLOCK );
!
! // TODO - per model visualizations save
StgWorld::Save();
Index: stest.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stest.cc,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -C2 -d -r1.1.2.16 -r1.1.2.17
*** stest.cc 19 Nov 2007 08:30:34 -0000 1.1.2.16
--- stest.cc 22 Nov 2007 01:36:47 -0000 1.1.2.17
***************
*** 81,85 ****
char* base = "r";
sprintf( namebuf, "%s%02d", base, i );
- printf( "finding robot \"%s\"\n", namebuf );
robots[i].position = (StgModelPosition*)world.GetModel( namebuf );
assert(robots[i].position);
--- 81,84 ----
***************
*** 87,92 ****
sprintf( namebuf, "%s%02d.laser:0", base, i );
! robots[i].laser = (StgModelLaser*)world.GetModel( namebuf );
! assert(robots[i].laser);
//robots[i].laser->Subscribe();
--- 86,91 ----
sprintf( namebuf, "%s%02d.laser:0", base, i );
! //robots[i].laser = (StgModelLaser*)world.GetModel( namebuf );
! //assert(robots[i].laser);
//robots[i].laser->Subscribe();
Index: stage.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stage.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** stage.c 19 Nov 2007 07:40:41 -0000 1.1.2.5
--- stage.c 22 Nov 2007 01:36:47 -0000 1.1.2.6
***************
*** 234,300 ****
}
-
-
- /* //////////////////////////////////////////////////////////////////////////
*/
- /* // scale an array of rectangles so they fit in a unit square */
- /* void stg_lines_normalize( stg_line_t* lines, int num ) */
- /* { */
- /* // assuming the rectangles fit in a square +/- one billion units */
- /* double minx, miny, maxx, maxy; */
- /* minx = miny = BILLION; */
- /* maxx = maxy = -BILLION; */
-
- /* int l; */
- /* for( l=0; l<num; l++ ) */
- /* { */
- /* // find the bounding rectangle */
- /* if( lines[l].x1 < minx ) minx = lines[l].x1; */
- /* if( lines[l].y1 < miny ) miny = lines[l].y1; */
- /* if( lines[l].x1 > maxx ) maxx = lines[l].x1; */
- /* if( lines[l].y1 > maxy ) maxy = lines[l].y1; */
- /* if( lines[l].x2 < minx ) minx = lines[l].x2; */
- /* if( lines[l].y2 < miny ) miny = lines[l].y2; */
- /* if( lines[l].x2 > maxx ) maxx = lines[l].x2; */
- /* if( lines[l].y2 > maxy ) maxy = lines[l].y2; */
- /* } */
-
- /* // now normalize all lengths so that the lines all fit inside */
- /* // rectangle from 0,0 to 1,1 */
- /* double scalex = maxx - minx; */
- /* double scaley = maxy - miny; */
-
- /* for( l=0; l<num; l++ ) */
- /* { */
- /* lines[l].x1 = (lines[l].x1 - minx) / scalex; */
- /* lines[l].y1 = (lines[l].y1 - miny) / scaley; */
- /* lines[l].x2 = (lines[l].x2 - minx) / scalex; */
- /* lines[l].y2 = (lines[l].y2 - miny) / scaley; */
- /* } */
- /* } */
-
- /* void stg_lines_scale( stg_line_t* lines, int num, double xscale, double
yscale ) */
- /* { */
- /* int l; */
- /* for( l=0; l<num; l++ ) */
- /* { */
- /* lines[l].x1 *= xscale; */
- /* lines[l].y1 *= yscale; */
- /* lines[l].x2 *= xscale; */
- /* lines[l].y2 *= yscale; */
- /* } */
- /* } */
-
- /* void stg_lines_translate( stg_line_t* lines, int num, double xtrans,
double ytrans ) */
- /* { */
- /* int l; */
- /* for( l=0; l<num; l++ ) */
- /* { */
- /* lines[l].x1 += xtrans; */
- /* lines[l].y1 += ytrans; */
- /* lines[l].x2 += xtrans; */
- /* lines[l].y2 += ytrans; */
- /* } */
- /* } */
-
//////////////////////////////////////////////////////////////////////////
// scale an array of rectangles so they fit in a unit square
--- 234,237 ----
***************
*** 343,380 ****
}
- /* // returns an array of 4 * num_rects stg_line_t's */
- /* stg_line_t* stg_rotrects_to_lines( stg_rotrect_t* rects, int num_rects ) */
- /* { */
- /* // convert rects to an array of lines */
- /* int num_lines = 4 * num_rects; */
- /* stg_line_t* lines = (stg_line_t*)calloc( sizeof(stg_line_t), num_lines
); */
-
- /* int r; */
- /* for( r=0; r<num_rects; r++ ) */
- /* { */
- /* lines[4*r].x1 = rects[r].pose.x; */
- /* lines[4*r].y1 = rects[r].pose.y; */
- /* lines[4*r].x2 = rects[r].pose.x + rects[r].size.x; */
- /* lines[4*r].y2 = rects[r].pose.y; */
-
- /* lines[4*r+1].x1 = rects[r].pose.x + rects[r].size.x;; */
- /* lines[4*r+1].y1 = rects[r].pose.y; */
- /* lines[4*r+1].x2 = rects[r].pose.x + rects[r].size.x; */
- /* lines[4*r+1].y2 = rects[r].pose.y + rects[r].size.y; */
-
- /* lines[4*r+2].x1 = rects[r].pose.x + rects[r].size.x;; */
- /* lines[4*r+2].y1 = rects[r].pose.y + rects[r].size.y;; */
- /* lines[4*r+2].x2 = rects[r].pose.x; */
- /* lines[4*r+2].y2 = rects[r].pose.y + rects[r].size.y; */
-
- /* lines[4*r+3].x1 = rects[r].pose.x; */
- /* lines[4*r+3].y1 = rects[r].pose.y + rects[r].size.y; */
- /* lines[4*r+3].x2 = rects[r].pose.x; */
- /* lines[4*r+3].y2 = rects[r].pose.y; */
- /* } */
-
- /* return lines; */
- /* } */
-
// sets [result] to the pose of [p2] in [p1]'s coordinate system
void stg_pose_sum( stg_pose_t* result, stg_pose_t* p1, stg_pose_t* p2 )
--- 280,283 ----
***************
*** 423,428 ****
void pb_set_rect( GdkPixbuf* pb, int x, int y, int width, int height, uint8_t
val )
{
- //int pbwidth = gdk_pixbuf_get_width(pb);
- //int pbheight = gdk_pixbuf_get_height(pb);
int bytes_per_sample = gdk_pixbuf_get_bits_per_sample (pb) / 8;
int num_samples = gdk_pixbuf_get_n_channels(pb);
--- 326,329 ----
Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model.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
*** model.cc 19 Nov 2007 07:40:41 -0000 1.1.2.13
--- model.cc 22 Nov 2007 01:36:47 -0000 1.1.2.14
***************
*** 662,666 ****
void StgModel::Startup( void )
{
! printf( "Startup model %s\n", this->token );
world->StartUpdatingModel( this );
--- 662,666 ----
void StgModel::Startup( void )
{
! //printf( "Startup model %s\n", this->token );
world->StartUpdatingModel( this );
***************
*** 671,675 ****
void StgModel::Shutdown( void )
{
! printf( "Shutdown model %s\n", this->token );
world->StopUpdatingModel( this );
--- 671,675 ----
void StgModel::Shutdown( void )
{
! //printf( "Shutdown model %s\n", this->token );
world->StopUpdatingModel( this );
***************
*** 703,708 ****
{
glPushMatrix();
! gl_pose_shift( &pose );
gl_pose_shift( &geom.pose );
--- 703,719 ----
{
glPushMatrix();
+
+ glTranslatef( pose.x, pose.y, pose.z );
+
+ stg_pose_t gpose;
+ GetGlobalPose(&gpose);
! char buf[64];
! snprintf( buf, 63, "%s [%.2f,%.2f,%.2f]", token, gpose.x, gpose.y,
RTOD(gpose.a) );
!
! gl_draw_string( 0.5,0.5,0.5, buf );
!
! glRotatef( RTOD(pose.a), 0,0,1 );
!
gl_pose_shift( &geom.pose );
***************
*** 713,717 ****
glRectf( -dx, -dy, dx, dy );
!
glPopMatrix();
}
--- 724,728 ----
glRectf( -dx, -dy, dx, dy );
!
glPopMatrix();
}
Index: Makefile.fl
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile.fl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** Makefile.fl 19 Nov 2007 07:40:40 -0000 1.1.2.2
--- Makefile.fl 22 Nov 2007 01:36:47 -0000 1.1.2.3
***************
*** 12,16 ****
blockgrid.o \
canvas.o \
- gl.o \
glcolorstack.o \
model.o \
--- 12,15 ----
***************
*** 21,26 ****
model_props.o \
model_ranger.o \
- stage.o \
stest.o \
typetable.o \
world.o \
--- 20,25 ----
model_props.o \
model_ranger.o \
stest.o \
+ stage.o \
typetable.o \
world.o \
***************
*** 31,36 ****
LIBS= `fltk-config --use-gl --ldflags` `pkg-config --libs gdk-pixbuf-2.0`
-framework OpenGL
-
#-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
-
all: stagefl
--- 30,33 ----
Index: Makefile
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** Makefile 22 Oct 2007 02:36:33 -0000 1.1.2.4
--- Makefile 22 Nov 2007 01:36:46 -0000 1.1.2.5
***************
*** 42,48 ****
PRE_UNINSTALL = :
POST_UNINSTALL = :
! build_triplet = i386-apple-darwin8.10.1
! host_triplet = i386-apple-darwin8.10.1
! target_triplet = i386-apple-darwin8.10.1
bin_PROGRAMS = stest$(EXEEXT)
subdir = libstage
--- 42,48 ----
PRE_UNINSTALL = :
POST_UNINSTALL = :
! build_triplet = i386-apple-darwin9.1.0
! host_triplet = i386-apple-darwin9.1.0
! target_triplet = i386-apple-darwin9.1.0
bin_PROGRAMS = stest$(EXEEXT)
subdir = libstage
***************
*** 68,75 ****
LTLIBRARIES = $(lib_LTLIBRARIES)
libstage_la_DEPENDENCIES =
! am_libstage_la_OBJECTS = ancestor.lo block.lo cell.lo gl.lo \
! glcolorstack.lo logo.lo model.lo model_callbacks.lo \
! model_laser.lo model_load.lo model_props.lo stage.lo \
! typetable.lo world.lo worldfile.lo worldgtk.lo
libstage_la_OBJECTS = $(am_libstage_la_OBJECTS)
libstage_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
--- 68,75 ----
LTLIBRARIES = $(lib_LTLIBRARIES)
libstage_la_DEPENDENCIES =
! am_libstage_la_OBJECTS = ancestor.lo block.lo blockgrid.lo canvas.lo \
! glcolorstack.lo model.lo model_callbacks.lo model_laser.lo \
! model_load.lo model_position.lo model_ranger.lo model_props.lo \
! stage.lo typetable.lo world.lo worldfile.lo worldgui.lo
libstage_la_OBJECTS = $(am_libstage_la_OBJECTS)
libstage_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
***************
*** 129,135 ****
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
! ECHO = echo
! ECHO_C =
! ECHO_N = -n
ECHO_T =
EGREP = /usr/bin/grep -E
--- 129,135 ----
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
! ECHO = /bin/echo
! ECHO_C = \c
! ECHO_N =
ECHO_T =
EGREP = /usr/bin/grep -E
***************
*** 137,143 ****
F77 =
FFLAGS =
GREP = /usr/bin/grep
! GUI_CFLAGS = -DXTHREADS -I/opt/local/include/gtkglext-1.0
-I/opt/local/lib/gtkglext-1.0/include -I/usr/X11R6/include
-I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include
-I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0
-I/opt/local/lib/glib-2.0/include -I/opt/local/include
-I/opt/local/include/cairo -I/opt/local/include/freetype2
-I/opt/local/include/libpng12 -I/opt/local/include/atk-1.0
! GUI_LIBS = -L/opt/local/lib -L/usr/X11R6/lib -lgtkglext-x11-1.0
-lgdkglext-x11-1.0 -lGLU -lGL -lXmu -lXt -lgtk-x11-2.0 -lpangox-1.0
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -ltiff -ljpeg -lm -lpangocairo-1.0
-lpango-1.0 -lcairo -lSM -lICE -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
-liconv -lfreetype -lz -lfontconfig -lexpat -lpng12 -lXrender -lX11
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
--- 137,144 ----
F77 =
FFLAGS =
+ FLTK_CFLAGS = -I/opt/local/include -I/opt/local/include/FL/images
+ FLTK_LIBS = -L/opt/local/lib -lfltk_gl -framework AGL -framework OpenGL
-lfltk -framework Carbon -framework ApplicationServices
GREP = /usr/bin/grep
! HAVE_FLTK_CONFIG = fltk-config
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
***************
*** 162,165 ****
--- 163,168 ----
PACKAGE_VERSION = 3.0.0
PATH_SEPARATOR = :
+ PIXBUF_CFLAGS = -I/opt/local/include/gtk-2.0 -I/opt/local/include/glib-2.0
-I/opt/local/lib/glib-2.0/include -I/opt/local/include
+ PIXBUF_LIBS = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lintl -liconv
PKG_CONFIG = /opt/local/bin/pkg-config
PLAYER_CFLAGS = -I/Users/vaughan/PS-2.0/include/player-2.0
***************
*** 183,190 ****
am__untar = tar -xf -
bindir = ${exec_prefix}/bin
! build = i386-apple-darwin8.10.1
build_alias =
build_cpu = i386
! build_os = darwin8.10.1
build_vendor = apple
builddir = .
--- 186,193 ----
am__untar = tar -xf -
bindir = ${exec_prefix}/bin
! build = i386-apple-darwin9.1.0
build_alias =
build_cpu = i386
! build_os = darwin9.1.0
build_vendor = apple
builddir = .
***************
*** 195,202 ****
exec_prefix = ${prefix}
have_pkg_config = yes
! host = i386-apple-darwin8.10.1
host_alias =
host_cpu = i386
! host_os = darwin8.10.1
host_vendor = apple
htmldir = ${docdir}
--- 198,205 ----
exec_prefix = ${prefix}
have_pkg_config = yes
! host = i386-apple-darwin9.1.0
host_alias =
host_cpu = i386
! host_os = darwin9.1.0
host_vendor = apple
htmldir = ${docdir}
***************
*** 219,226 ****
srcdir = .
sysconfdir = ${prefix}/etc
! target = i386-apple-darwin8.10.1
target_alias =
target_cpu = i386
! target_os = darwin8.10.1
target_vendor = apple
top_builddir = ..
--- 222,229 ----
srcdir = .
sysconfdir = ${prefix}/etc
! target = i386-apple-darwin9.1.0
target_alias =
target_cpu = i386
! target_os = darwin9.1.0
target_vendor = apple
top_builddir = ..
***************
*** 235,240 ****
# system-wide compile flags - target-specific flags are added to each target
below
! #AM_CFLAGS = -Wall -I. -I$(top_srcdir)/replace -DXTHREADS
-I/opt/local/include/gtkglext-1.0 -I/opt/local/lib/gtkglext-1.0/include
-I/usr/X11R6/include -I/opt/local/include/gtk-2.0
-I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0
-I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include
-I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/freetype2
-I/opt/local/include/libpng12 -I/opt/local/include/atk-1.0 -std=c99
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace -DXTHREADS
-I/opt/local/include/gtkglext-1.0 -I/opt/local/lib/gtkglext-1.0/include
-I/usr/X11R6/include -I/opt/local/include/gtk-2.0
-I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0
-I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include
-I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/freetype2
-I/opt/local/include/libpng12 -I/opt/local/include/atk-1.0
-DRGBFILE=\"$(RGB)\"
# build the stage library
--- 238,242 ----
# system-wide compile flags - target-specific flags are added to each target
below
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace -I/opt/local/include/gtk-2.0
-I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include
-I/opt/local/include -I/opt/local/include -I/opt/local/include/FL/images
-DRGBFILE=\"$(RGB)\"
# build the stage library
***************
*** 251,263 ****
ancestor.cc \
block.cc \
! cell.cc \
colors.h \
- gl.c \
glcolorstack.cc \
- logo.cc \
model.cc \
model_callbacks.cc \
model_laser.cc \
model_load.cc \
model_props.cc \
stage.c \
--- 253,266 ----
ancestor.cc \
block.cc \
! blockgrid.cc \
! canvas.cc \
colors.h \
glcolorstack.cc \
model.cc \
model_callbacks.cc \
model_laser.cc \
model_load.cc \
+ model_position.cc \
+ model_ranger.cc \
model_props.cc \
stage.c \
***************
*** 267,274 ****
worldfile.cc \
worldfile.hh \
! worldgtk.cc
libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir)
! libstage_la_LIBADD = -L/opt/local/lib -L/usr/X11R6/lib -lgtkglext-x11-1.0
-lgdkglext-x11-1.0 -lGLU -lGL -lXmu -lXt -lgtk-x11-2.0 -lpangox-1.0
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -ltiff -ljpeg -lm -lpangocairo-1.0
-lpango-1.0 -lcairo -lSM -lICE -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
-liconv -lfreetype -lz -lfontconfig -lexpat -lpng12 -lXrender -lX11
# TODO fix these and move them to a separate tree?
--- 270,279 ----
worldfile.cc \
worldfile.hh \
! worldgui.cc
!
+ # logo.cc
libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir)
! libstage_la_LIBADD = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lintl -liconv -L/opt/local/lib -lfltk_gl -framework
AGL -framework OpenGL -lfltk -framework Carbon -framework ApplicationServices
# TODO fix these and move them to a separate tree?
***************
*** 282,286 ****
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
! stest_LDADD = libstage.la -L/opt/local/lib -L/usr/X11R6/lib
-lgtkglext-x11-1.0 -lgdkglext-x11-1.0 -lGLU -lGL -lXmu -lXt -lgtk-x11-2.0
-lpangox-1.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -ltiff -ljpeg -lm
-lpangocairo-1.0 -lpango-1.0 -lcairo -lSM -lICE -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -lintl -liconv -lfreetype -lz -lfontconfig -lexpat -lpng12 -lXrender
-lX11
all: all-am
--- 287,291 ----
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
! stest_LDADD = libstage.la
all: all-am
***************
*** 385,397 ****
include ./$(DEPDIR)/ancestor.Plo
include ./$(DEPDIR)/block.Plo
! include ./$(DEPDIR)/cell.Plo
! include ./$(DEPDIR)/gl.Plo
include ./$(DEPDIR)/glcolorstack.Plo
- include ./$(DEPDIR)/logo.Plo
include ./$(DEPDIR)/model.Plo
include ./$(DEPDIR)/model_callbacks.Plo
include ./$(DEPDIR)/model_laser.Plo
include ./$(DEPDIR)/model_load.Plo
include ./$(DEPDIR)/model_props.Plo
include ./$(DEPDIR)/stage.Plo
include ./$(DEPDIR)/stest.Po
--- 390,403 ----
include ./$(DEPDIR)/ancestor.Plo
include ./$(DEPDIR)/block.Plo
! include ./$(DEPDIR)/blockgrid.Plo
! include ./$(DEPDIR)/canvas.Plo
include ./$(DEPDIR)/glcolorstack.Plo
include ./$(DEPDIR)/model.Plo
include ./$(DEPDIR)/model_callbacks.Plo
include ./$(DEPDIR)/model_laser.Plo
include ./$(DEPDIR)/model_load.Plo
+ include ./$(DEPDIR)/model_position.Plo
include ./$(DEPDIR)/model_props.Plo
+ include ./$(DEPDIR)/model_ranger.Plo
include ./$(DEPDIR)/stage.Plo
include ./$(DEPDIR)/stest.Po
***************
*** 399,403 ****
include ./$(DEPDIR)/world.Plo
include ./$(DEPDIR)/worldfile.Plo
! include ./$(DEPDIR)/worldgtk.Plo
.c.o:
--- 405,409 ----
include ./$(DEPDIR)/world.Plo
include ./$(DEPDIR)/worldfile.Plo
! include ./$(DEPDIR)/worldgui.Plo
.c.o:
Index: model_ranger.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/model_ranger.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** model_ranger.cc 19 Nov 2007 07:40:41 -0000 1.1.2.4
--- model_ranger.cc 22 Nov 2007 01:36:47 -0000 1.1.2.5
***************
*** 342,346 ****
//printf( "%.2f %.2f to %.2f %.2f\n",
! // rngr->pose.x, rngr->pose.y, x1, y1 );
glBegin( GL_POLYGON);
--- 342,346 ----
//printf( "%.2f %.2f to %.2f %.2f\n",
! // rngr->pose.x, rngr->pose.y, x1, y1 );
glBegin( GL_POLYGON);
Index: Makefile.am
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/Makefile.am,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** Makefile.am 4 Oct 2007 07:43:21 -0000 1.1.2.3
--- Makefile.am 22 Nov 2007 01:36:46 -0000 1.1.2.4
***************
*** 5,11 ****
# $Id$
- # also build Zoo referees
- #SUBDIRS = referees
-
# install the header file for the Stage library
include_HEADERS = stage.hh
--- 5,8 ----
***************
*** 14,24 ****
pkgdata_DATA = rgb.txt
! CC=g++
RGB=$(datadir)/@PACKAGE@/rgb.txt
# system-wide compile flags - target-specific flags are added to each target
below
! #AM_CFLAGS = -Wall -I. -I$(top_srcdir)/replace @GUI_CFLAGS@ -std=c99
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace @GUI_CFLAGS@
-DRGBFILE=\"$(RGB)\"
# build the stage library
--- 11,20 ----
pkgdata_DATA = rgb.txt
! # CC=g++
RGB=$(datadir)/@PACKAGE@/rgb.txt
# system-wide compile flags - target-specific flags are added to each target
below
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace @PIXBUF_CFLAGS@
@FLTK_CFLAGS@ -DRGBFILE=\"$(RGB)\"
# build the stage library
***************
*** 29,51 ****
bin_PROGRAMS = stest
! # The stage library contains everything you need to build a robot
! # simulation, including graphics and a world description file
! # parser. It does NOT contain a Player interface, so it can not be
! # used as a player plugin. See libstageplugin (below) for good Player
! # satisfaction.
! #
libstage_la_SOURCES = \
../config.h \
ancestor.cc \
block.cc \
! cell.cc \
colors.h \
- gl.c \
glcolorstack.cc \
- logo.cc \
model.cc \
model_callbacks.cc \
model_laser.cc \
model_load.cc \
model_props.cc \
stage.c \
--- 25,43 ----
bin_PROGRAMS = stest
! # The stage library
libstage_la_SOURCES = \
../config.h \
ancestor.cc \
block.cc \
! blockgrid.cc \
! canvas.cc \
colors.h \
glcolorstack.cc \
model.cc \
model_callbacks.cc \
model_laser.cc \
model_load.cc \
+ model_position.cc \
+ model_ranger.cc \
model_props.cc \
stage.c \
***************
*** 55,75 ****
worldfile.cc \
worldfile.hh \
! worldgtk.cc
!
libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir)
! libstage_la_LIBADD = @GUI_LIBS@
!
! # TODO fix these and move them to a separate tree?
! #zoo.c
! #zoo_driver.cc
! #zoo_species.cc
! #zoo_controller.cc
! #zoo_referee.cc
# build a stand-alone test program using libstage
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
!
! stest_LDADD = libstage.la @GUI_LIBS@
! #stest_LDFLAGS =
--- 47,58 ----
worldfile.cc \
worldfile.hh \
! worldgui.cc
+ #logo.cc
libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir)
! libstage_la_LIBADD = @PIXBUF_LIBS@ @FLTK_LIBS@
# build a stand-alone test program using libstage
stest_DEPENDENCIES = libstage.la
stest_SOURCES = stest.cc
! stest_LDADD = libstage.la
Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/stage.hh,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -C2 -d -r1.1.2.15 -r1.1.2.16
*** stage.hh 19 Nov 2007 07:40:41 -0000 1.1.2.15
--- stage.hh 22 Nov 2007 01:36:47 -0000 1.1.2.16
***************
*** 48,53 ****
#include <string.h>
#include <glib.h>
! //#include <glib-object.h>
! //#include <gtk/gtk.h>
// todo: consider moving these out
--- 48,59 ----
#include <string.h>
#include <glib.h>
!
! #ifdef __APPLE__
! #include <OpenGl/gl.h>
! #include <OpenGl/glu.h>
! #else
! #include <GL/gl.h>
! #include <GL/glu.h>
! #endif
// todo: consider moving these out
***************
*** 352,472 ****
/[EMAIL PROTECTED]/
- // TODO - cut
- /* // POLYLINES --------------------------------------------------------- */
-
- /* /\** @ingroup libstage */
- /* @defgroup stg_polyline Polylines */
- /* Defines a line defined by multiple points. */
- /* @{ */
- /* *\/ */
-
- /* /\** define a polyline: a set of connected vertices *\/ */
- /* typedef struct */
- /* { */
- /* stg_point_t* points; ///< Pointer to an array of points */
- /* size_t points_count; ///< Number of points in array */
- /* } stg_polyline_t; */
-
- /* /[EMAIL PROTECTED]/ */
-
-
- // end property typedefs -------------------------------------------------
-
-
- // WORLD --------------------------------------------------------
-
- /** @ingroup libstage
- @defgroup stg_world Worlds
- Implements a world - a collection of models and a matrix.
- @{
- */
-
- /** \struct stg_world_t
- Opaque data structure implementing a world.
- Use the documented stg_world_<something> functions to manipulate
- worlds. Do not modify the structure directly unless you know
- what you are doing.
- */
-
- /** Create a new world, to be configured and populated
- manually. Usually this function is not used directly; use the
- function stg_world_create_from_file() to create a world based on
- a worldfile instead.
- */
- /* stg_world_t* stg_world_create( stg_id_t id, */
- /* const char* token, */
- /* int sim_interval, */
- /* int real_interval, */
- /* int gui_interval, */
- /* double ppm, */
- /* double width, */
- /* double height ); */
-
- /* /\** Create a new world as described in the worldfile */
- /* [worldfile_path] */
- /* *\/ */
- /* stg_world_t* stg_world_create_from_file( stg_id_t id, const char*
worldfile_path ); */
-
- /* /\** Destroy a world and everything it contains */
- /* *\/ */
- /* void stg_world_destroy( stg_world_t* world ); */
-
- /* /\** Stop the world clock */
- /* *\/ */
- /* void stg_world_stop( stg_world_t* world ); */
-
- /* /\** Start the world clock */
- /* *\/ */
- /* void stg_world_start( stg_world_t* world ); */
-
- /* /\** Run one simulation step in world [world]. If [sleepflag] is */
- /* non-zero, and the simulation update takes less than one */
- /* real-time step, the simulation will nanosleep() for a while to */
- /* reduce CPU load. Returns 0 if all is well, or a positive error */
- /* code. */
- /* *\/ */
- /* int stg_world_update( stg_world_t* world, int sleepflag ); */
-
- /* /\** Configure the world by reading from the current world file *\/ */
- /* void stg_world_load( stg_world_t* world ); */
-
- /* /\** Save the state of the world to the current world file *\/ */
- /* void stg_world_save( stg_world_t* world ); */
-
- /* /\** Reload the state of the world as saved in the current world */
- /* file *\/ */
- /* void stg_world_reload( stg_world_t* world ); */
-
- /* /\** print human-readable information about the world on stdout */
- /* *\/ */
- /* void stg_world_print( stg_world_t* world ); */
-
- /* /\** Writes a human-readable simulation time into the string, to a */
- /* maximum number of characters. The string should be preallocated */
- /* to at least maxlen bytes long. */
- /* *\/ */
- /* void stg_world_clockstring( stg_world_t* world, char* str, size_t maxlen
); */
-
- /* /\** Set the title of the world, usually displayed by the GUI in the
window titlebar. */
- /* *\/ */
- /* void stg_world_set_title( stg_world_t* world, char* txt ); */
-
- /* /\** Set the duration in milliseconds of each simulation update step */
- /* *\/ */
- /* void stg_world_set_interval_real( stg_world_t* world, unsigned int val
); */
-
- /* /\** Set the real time in intervals that Stage should attempt to take */
- /* for each simulation update step. If Stage has too much */
- /* computation to do, it might take longer than this. *\/ */
- /* void stg_world_set_interval_sim( stg_world_t* world, unsigned int val );
*/
-
- /* /\** look up a pointer to a model in [world] from the model's unique */
- /* ID [mid]. *\/ */
- /* //stg_model_t* stg_world_get_model( stg_world_t* world, stg_id_t mid );
*/
-
- /* /\** look up a pointer to a model from from the model's name. *\/ */
- /* //stg_model_t* stg_world_model_name_lookup( stg_world_t* world, const
char* name ); */
-
- /* /[EMAIL PROTECTED]/ */
// MODEL --------------------------------------------------------
--- 358,361 ----
***************
*** 687,699 ****
#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
--- 576,587 ----
#define STG_SHOW_BLOCKS 1
! #define STG_SHOW_DATA 2
! #define STG_SHOW_GEOM 4
! #define STG_SHOW_GRID 8
! #define STG_SHOW_OCCUPANCY 16
! #define STG_SHOW_TRAILS 32
! #define STG_SHOW_FOLLOW 64
! #define STG_SHOW_CLOCK 128
! #define STG_SHOW_QUADTREE 256
// STAGE INTERNAL
***************
*** 714,726 ****
! //#define STG_DEFAULT_WINDOW_WIDTH 400
! //#define STG_DEFAULT_WINDOW_HEIGHT 440
#define STG_DEFAULT_WINDOW_WIDTH 800
#define STG_DEFAULT_WINDOW_HEIGHT 840
- //#ifdef __cplusplus
- //extern "C" {
- //#endif
-
GHashTable* stg_create_typetable( void );
--- 602,609 ----
!
#define STG_DEFAULT_WINDOW_WIDTH 800
#define STG_DEFAULT_WINDOW_HEIGHT 840
GHashTable* stg_create_typetable( void );
***************
*** 734,737 ****
--- 617,625 ----
void gl_pose_shift( stg_pose_t* pose );
void gl_coord_shift( double x, double y, double z, double a );
+
+ /** Render a string at [x,y,z] in the current color */
+ void gl_draw_string( float x, float y, float z, char *string);
+
+
void stg_block_list_scale( GList* blocks,
stg_size_t* size );
***************
*** 810,953 ****
- // MATRIX
-----------------------------------------------------------------------
-
- /** @ingroup libstage_internal
- @defgroup stg_matrix Matrix occupancy quadtree
- Occupancy quadtree underlying Stage's sensing and collision models.
- @{
- */
-
- // typedef enum {
- // STG_SPLIT_NONE=0,
- // STG_SPLIT_X,
- // STG_SPLIT_Y
- // } stg_split_t;
-
-
-
- // /** A node in the occupancy quadtree */
- // class StgCell
- // {
- // friend class StgWorld;
-
- // private:
- // void Split(); ///< split the cell into children
-
- // /** list of models that have been AddBlock()ed into this
- // cell */
- // GSList* list;
-
- // /** extent of the cell */
- // int32_t width, height;
-
- // /** bounding box */
- // int32_t xmin,ymin,xmax,ymax;
-
- // /** direction of split for this cell */
- // stg_split_t split;
-
- // /** links for BSP tree */
- // StgCell *left, *right;
-
- // /** links for BSP tree */
- // StgCell* parent;
-
- // public:
- // StgCell( StgCell* parent,
- // int32_t xmin, int32_t xmax,
- // int32_t ymin, int32_t ymax );
-
- // ~StgCell();
-
- // /** Return the root of the tree that contains this cell */
- // StgCell* Root();
-
- // /** Remove block from the cell. This method is static as it may
- // destroy the cell. */
- // static void RemoveBlock( StgCell* cell, StgBlock* block );
-
- // /** Add a pointer to block to the list of this cells contents */
- // void AddBlock( StgBlock* block );
-
- // /** Return the first block in the cell that matches the comparison
- // function */
- // StgBlock* FindBlock( stg_block_match_func_t, const void* arg );
-
- // /** Draw the cell into the current OpenGL context */
- // void Draw();
-
- // /** Draw the cell and all its descendents in the current OpenGL
- // context. If leaf_only is true, only occupied leaf nodes are
- // drawn */
- // void DrawTree( bool leaf_only );
-
- // /** Print a human-readable description of the cell on stdout,
- // prefixed by the string prefix. */
- // void Print( char* prefix );
-
- // /** returns true iff the cell is a unit square (ie. as small as it
- // can be */
- // bool Atomic();
-
- // /** Returns true iff the cell contains the point <x,y> */
- // bool Contains( int32_t x, int32_t y );
-
- // /** returns the smallest currently existing cell that contains point
- // <x,y>. Does not create new cells. */
- // StgCell* Locate( int32_t x, int32_t y );
-
- // /** returns a unit cell that contains <x,y>, creating cells if
- // necessary */
- // StgCell* LocateAtom( int32_t x, int32_t y );
- // };
-
-
-
- /** @} */
-
- /** @ingroup libstage_internal
- @defgroup worldfile worldfile C wrappers
- @{
- */
-
- // C wrappers for C++ worldfile functions
- /* void wf_warn_unused( void ); */
- /* int wf_property_exists( int section, char* token ); */
- /* int wf_read_int( int section, char* token, int def ); */
- /* double wf_read_length( int section, char* token, double def ); */
- /* double wf_read_angle( int section, char* token, double def ); */
- /* double wf_read_float( int section, char* token, double def ); */
- /* const char* wf_read_tuple_string( int section, char* token, int index,
char* def ); */
- /* double wf_read_tuple_float( int section, char* token, int index, double
def ); */
- /* double wf_read_tuple_length( int section, char* token, int index, double
def ); */
- /* double wf_read_tuple_angle( int section, char* token, int index, double
def ); */
- /* const char* wf_read_string( int section, char* token, char* def ); */
-
- /* void wf_write_int( int section, char* token, int value ); */
- /* void wf_write_length( int section, char* token, double value ); */
- /* void wf_write_angle( int section, char* token, double value ); */
- /* void wf_write_float( int section, char* token, double value ); */
- /* void wf_write_tuple_string( int section, char* token, int index, char*
value ); */
- /* void wf_write_tuple_float( int section, char* token, int index, double
value ); */
- /* void wf_write_tuple_length( int section, char* token, int index, double
value ); */
- /* void wf_write_tuple_angle( int section, char* token, int index, double
value ); */
- /* void wf_write_string( int section, char* token, char* value ); */
-
- /* void wf_save( void ); */
- /* void wf_load( char* path ); */
- /* int wf_section_count( void ); */
- /* const char* wf_get_section_type( int section ); */
- /* int wf_get_parent_section( int section ); */
- /* const char* wf_get_filename( void); */
-
- /** @} */
-
-
- /** @} */
- // end of libstage_internal documentation
-
-
- // end documentation group stage
- /[EMAIL PROTECTED]/
--- 698,701 ----
***************
*** 1776,1788 ****
- //#if _INCLUDE_GTK // TODO - conditional compilation of the GUI
-
- #include <gl.h>
- #include <glu.h>
- //#include <GL/glext.h>
- //#include <glx.h> // for XFont for drawing text from X fonts
- //#include <gtk/gtk.h>
- //#include <gtk/gtkgl.h>
-
// COLOR STACK CLASS
class GlColorStack
--- 1524,1527 ----
***************
*** 2008,2012 ****
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
--- 1747,1750 ----
***************
*** 2021,2025 ****
void FixViewport(int W,int H);
virtual void draw();
- virtual void draw_overlay();
virtual int handle( int event );
void resize(int X,int Y,int W,int H);
--- 1759,1762 ----
***************
*** 2039,2042 ****
--- 1776,1793 ----
{ colorstack.Pop(); }
+ void InvertView( uint32_t invertflags );
+
+ uint32_t GetShowFlags()
+ { return showflags; };
+
+ void SetShowFlags( uint32_t flags )
+ { showflags = flags; };
+
+ // set the bit indicated by flag to the value indicated by val
+ //void SetShowFlag( uint32_t flag, bool val )
+ // {
+ //val ? (showflags |= flag) : (showflags ^= flag );
+ //}
+
static void TimerCallback( StgCanvas* canvas );
};
***************
*** 2052,2055 ****
--- 1803,1807 ----
StgCanvas* canvas;
+ Fl_Menu_Bar* mbar;
// overload inherited methods
Index: canvas.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/canvas.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
*** canvas.cc 19 Nov 2007 08:30:34 -0000 1.1.2.3
--- canvas.cc 22 Nov 2007 01:36:47 -0000 1.1.2.4
***************
*** 4,7 ****
--- 4,9 ----
#include <FL/fl_Box.H>
#include <FL/Fl_Menu_Button.H>
+ #include <FL/glut.H>
+
void StgCanvas::TimerCallback( StgCanvas* c )
***************
*** 34,39 ****
rotating = false;
! showflags = STG_SHOW_CLOCK | STG_SHOW_DATA | STG_SHOW_BLOCKS |
STG_SHOW_GRID;
! //showflags = STG_SHOW_CLOCK | STG_SHOW_BLOCKS | STG_SHOW_GRID;
// start the timer that causes regular redraws
--- 36,40 ----
rotating = false;
! showflags = STG_SHOW_CLOCK | STG_SHOW_BLOCKS | STG_SHOW_GRID;
// start the timer that causes regular redraws
***************
*** 47,50 ****
--- 48,67 ----
}
+ void StgCanvas::InvertView( uint32_t invertflags )
+ {
+ showflags = (showflags ^ invertflags);
+
+ printf( "flags %u data %d grid %d blocks %d follow %d clock %d tree %d occ
%d\n",
+ showflags,
+ showflags & STG_SHOW_DATA,
+ showflags & STG_SHOW_GRID,
+ showflags & STG_SHOW_BLOCKS,
+ showflags & STG_SHOW_FOLLOW,
+ showflags & STG_SHOW_CLOCK,
+ showflags & STG_SHOW_QUADTREE,
+ showflags & STG_SHOW_OCCUPANCY );
+
+ }
+
StgModel* StgCanvas::Select( int x, int y )
{
***************
*** 320,354 ****
FixViewport(w(), h());
! // 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 );
- // 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 );
-
double zclip = hypot(world->width, world->height) * scale;
double pixels_width = w();
--- 337,356 ----
FixViewport(w(), h());
! // 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 );
double zclip = hypot(world->width, world->height) * scale;
double pixels_width = w();
***************
*** 366,369 ****
--- 368,373 ----
glLoadIdentity ();
+
+
glTranslatef( -panx,
-pany,
***************
*** 383,387 ****
--- 387,407 ----
// Clear screen to bg color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+ if( showflags & STG_SHOW_CLOCK )
+ {
+ glPushMatrix();
+ glLoadIdentity();
+
+ char clockstr[50];
+ world->ClockString( clockstr, 50 );
+
+ colorstack.Push( 0,0,0 ); // black
+ gl_draw_string( -w()/2+4, -h()/2+4, 0, clockstr );
+ colorstack.Pop();
+
+ glPopMatrix();
+ }
+
if( (showflags & STG_SHOW_FOLLOW) && last_selection )
{
***************
*** 398,402 ****
--- 418,424 ----
// and put it in the center of the window
+ //glRotatef( -RTOD(gpose.a), 0,0,1 );
glTranslatef( -gpose.x, -gpose.y, 0 );
+
}
***************
*** 439,446 ****
for( GList* it=selected_models; it; it=it->next )
- {
((StgModel*)it->data)->DrawSelected();
! // ((StgModel*)it->data)->DrawPicker();
! }
colorstack.Pop();
--- 461,466 ----
for( GList* it=selected_models; it; it=it->next )
((StgModel*)it->data)->DrawSelected();
!
colorstack.Pop();
***************
*** 453,473 ****
for( it=world->children; it; it=it->next )
((StgModel*)it->data)->Draw( showflags );
-
- if( showflags && STG_SHOW_CLOCK )
- redraw_overlay();
- }
-
- void StgCanvas::draw_overlay()
- {
- char clockstr[50];
- world->ClockString( clockstr, 50 );
-
- glPushMatrix();
- glLoadIdentity();
-
- colorstack.Push( 0,0,0 ); // black
- gl_draw( clockstr, -w()/2.0 + 5, -h()/2 + 5 );
- colorstack.Pop();
- glPopMatrix();
}
--- 473,476 ----
-------------------------------------------------------------------------
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