Update of /cvsroot/playerstage/code/stage/libstage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15242/libstage
Modified Files:
Makefile.am block.cc canvas.cc gl.cc model.cc model_laser.cc
model_load.cc stage.cc stage.hh
Removed Files:
gl.c
Log Message:
resource transport demo
Index: stage.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/stage.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** stage.cc 27 Feb 2008 22:51:12 -0000 1.4
--- stage.cc 3 Mar 2008 06:02:26 -0000 1.5
***************
*** 585,592 ****
{
stg_color_t col=0;
! col += (stg_color_t)((1.0-a)*256.0)<<24;
! col += (stg_color_t)(r*256.0)<<16;
! col += (stg_color_t)(g*256.0)<<8;
! col += (stg_color_t)(b*256.0);
return col;
--- 585,592 ----
{
stg_color_t col=0;
! col += (stg_color_t)((1.0-a)*255.0)<<24;
! col += (stg_color_t)(r*255.0)<<16;
! col += (stg_color_t)(g*255.0)<<8;
! col += (stg_color_t)(b*255.0);
return col;
***************
*** 596,603 ****
double* r, double* g, double* b, double* a )
{
! if(a) *a = 1.0 - (((col & 0xFF000000) >> 24) / 256.0);
! if(r) *r = ((col & 0x00FF0000) >> 16) / 256.0;
! if(g) *g = ((col & 0x0000FF00) >> 8) / 256.0;
! if(b) *b = ((col & 0x000000FF) >> 0) / 256.0;
}
--- 596,603 ----
double* r, double* g, double* b, double* a )
{
! if(a) *a = 1.0 - (((col & 0xFF000000) >> 24) / 255.0);
! if(r) *r = ((col & 0x00FF0000) >> 16) / 255.0;
! if(g) *g = ((col & 0x0000FF00) >> 8) / 255.0;
! if(b) *b = ((col & 0x000000FF) >> 0) / 255.0;
}
Index: model_laser.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/model_laser.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** model_laser.cc 24 Feb 2008 23:24:40 -0000 1.5
--- model_laser.cc 3 Mar 2008 06:02:26 -0000 1.6
***************
*** 290,347 ****
void StgModelLaser::DataVisualize( void )
{
! if( samples && sample_count )
! {
! glPushMatrix();
! glTranslatef( 0,0, geom.size.z/2.0 ); // shoot the laser beam out at
the right height
!
! // pack the laser hit points into a vertex array for fast rendering
! static float* pts = NULL;
! pts = (float*)g_realloc( pts, 2 * (sample_count+1) * sizeof(float));
!
! pts[0] = 0.0;
! pts[1] = 0.0;
!
! PushColor( 0, 0, 1, 0.5 );
! for( unsigned int s=0; s<sample_count; s++ )
{
! double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
! pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) );
! pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) );
!
! // if the sample is unusually bright, draw a little blob
! if( samples[s].reflectance > 0 )
! {
! glPointSize( 4.0 );
! glBegin( GL_POINTS );
! glVertex2f( pts[2*s+2], pts[2*s+3] );
! glEnd();
! }
!
}
- PopColor();
-
- glEnableClientState( GL_VERTEX_ARRAY );
- glVertexPointer( 2, GL_FLOAT, 0, pts );
-
- glDepthMask( GL_FALSE );
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
- // draw the filled polygon in transparent blue
- PushColor( 0, 0, 1, 0.1 );
- glDrawArrays( GL_POLYGON, 0, sample_count+1 );
-
- // draw the beam strike points in black
- PushColor( 0, 0, 0, 1.0 );
- glPointSize( 1.0 );
- glDrawArrays( GL_POINTS, 0, sample_count+1 );
-
- // reset
- PopColor();
- PopColor();
- glDepthMask( GL_TRUE );
- glPopMatrix();
}
}
--- 290,347 ----
void StgModelLaser::DataVisualize( void )
{
! if( ! (samples && sample_count) )
! return;
!
! glPushMatrix();
! glTranslatef( 0,0, geom.size.z/2.0 ); // shoot the laser beam out at the
right height
!
! // pack the laser hit points into a vertex array for fast rendering
! static float* pts = NULL;
! pts = (float*)g_realloc( pts, 2 * (sample_count+1) * sizeof(float));
!
! pts[0] = 0.0;
! pts[1] = 0.0;
!
! PushColor( 0, 0, 1, 0.5 );
!
! for( unsigned int s=0; s<sample_count; s++ )
! {
! double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
! pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) );
! pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) );
! // if the sample is unusually bright, draw a little blob
! if( samples[s].reflectance > 0 )
{
! glPointSize( 4.0 );
! glBegin( GL_POINTS );
! glVertex2f( pts[2*s+2], pts[2*s+3] );
! glEnd();
}
}
+ PopColor();
+
+
+ glEnableClientState( GL_VERTEX_ARRAY );
+ glVertexPointer( 2, GL_FLOAT, 0, pts );
+
+ glDepthMask( GL_FALSE );
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ // draw the filled polygon in transparent blue
+ PushColor( 0, 0, 1, 0.1 );
+ glDrawArrays( GL_POLYGON, 0, sample_count+1 );
+
+ // draw the beam strike points in black
+ PushColor( 0, 0, 0, 1.0 );
+ glPointSize( 1.0 );
+ glDrawArrays( GL_POINTS, 0, sample_count+1 );
+
+ // reset
+ PopColor();
+ PopColor();
+ glDepthMask( GL_TRUE );
+ glPopMatrix();
}
Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/model.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** model.cc 24 Feb 2008 23:24:40 -0000 1.8
--- model.cc 3 Mar 2008 06:02:26 -0000 1.9
***************
*** 57,62 ****
- specify the color of the object using a color name from the X11 database
(rgb.txt)
- line_count [int]
! - specify the number of lines that make up the model's body
! - line[index] [x1:float y1:float x2:float y2:float]
- creates a line from (x1,y1) to (x2,y2). A set of line_count lines defines
the robot's body for the purposes of collision detection and rendering in the
GUI window.
- bitmap [filename:string}
--- 57,61 ----
- specify the color of the object using a color name from the X11 database
(rgb.txt)
- line_count [int]
! - specify the number of lines that make up the model's body- line[index]
[x1:float y1:float x2:float y2:float]
- creates a line from (x1,y1) to (x2,y2). A set of line_count lines defines
the robot's body for the purposes of collision detection and rendering in the
GUI window.
- bitmap [filename:string}
***************
*** 171,177 ****
bzero( &pose, sizeof(pose));
- pose.x = 5; // prevent creating uncessary superregions
- pose.y = 5;
-
bzero( &global_pose, sizeof(global_pose));
--- 170,173 ----
***************
*** 211,214 ****
--- 207,212 ----
this->callbacks = g_hash_table_new( g_int_hash, g_int_equal );
+ this->flag_list = NULL;
+
bzero( &this->velocity, sizeof(velocity));
***************
*** 251,254 ****
--- 249,282 ----
}
+ void StgModel::AddFlag( StgFlag* flag )
+ {
+ if( flag )
+ flag_list = g_list_append( this->flag_list, flag );
+ }
+
+ void StgModel::RemoveFlag( StgFlag* flag )
+ {
+ if( flag )
+ flag_list = g_list_remove( this->flag_list, flag );
+ }
+
+ void StgModel::PushFlag( StgFlag* flag )
+ {
+ if( flag )
+ flag_list = g_list_prepend( flag_list, flag);
+ }
+
+ StgFlag* StgModel::PopFlag()
+ {
+ if( flag_list == NULL )
+ return NULL;
+
+ StgFlag* flag = (StgFlag*)flag_list->data;
+ flag_list = g_list_remove( flag_list, flag );
+
+ return flag;
+ }
+
+
void StgModel::AddBlock( stg_point_t* pts,
size_t pt_count,
***************
*** 826,829 ****
--- 854,859 ----
}
+
+
void StgModel::Draw( uint32_t flags )
{
***************
*** 850,864 ****
// gl_speech_bubble( 0,0,0, this->say_string );
- if( gui_grid && (flags & STG_SHOW_GRID) )
- DrawGrid();
-
if( flags & STG_SHOW_DATA )
DataVisualize();
// 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*, Draw );
for( GList* it=children; it; it=it->next )
((StgModel*)it->data)->Draw( flags );
--- 880,896 ----
// gl_speech_bubble( 0,0,0, this->say_string );
if( flags & STG_SHOW_DATA )
DataVisualize();
+ if( gui_grid && (flags & STG_SHOW_GRID) )
+ DrawGrid();
+
+ if( flag_list )
+ DrawFlagList();
+
// 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
for( GList* it=children; it; it=it->next )
((StgModel*)it->data)->Draw( flags );
***************
*** 867,870 ****
--- 899,949 ----
}
+ void StgModel::DrawFlagList( void )
+ {
+ glPushMatrix();
+
+
+
+ GLUquadric* quadric = gluNewQuadric();
+ glTranslatef(0,0,1); // jump up
+ stg_pose_t gpose = GetGlobalPose();
+ glRotatef( 180 + rtod(-gpose.a),0,0,1 );
+
+
+ GList* list = g_list_copy( flag_list );
+ list = g_list_reverse(list);
+
+ for( GList* item = list; item; item = item->next )
+ {
+
+ StgFlag* flag = (StgFlag*)item->data;
+
+ glTranslatef( 0, 0, flag->size/2.0 );
+
+
+ PushColor( flag->color );
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ gluQuadricDrawStyle( quadric, GLU_FILL );
+ gluSphere( quadric, flag->size/2.0, 4,2 );
+
+ // draw the edges darker version of the same color
+ double r,g,b,a;
+ stg_color_unpack( flag->color, &r, &g, &b, &a );
+ PushColor( stg_color_pack( r/2.0, g/2.0, b/2.0, a ));
+
+ gluQuadricDrawStyle( quadric, GLU_LINE );
+ gluSphere( quadric, flag->size/2.0, 4,2 );
+
+ PopColor();
+ PopColor();
+
+ glTranslatef( 0, 0, flag->size/2.0 );
+ }
+
+ gluDeleteQuadric( quadric );
+ glPopMatrix();
+ }
+
void StgModel::DrawPicker( void )
{
--- gl.c DELETED ---
Index: gl.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/gl.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gl.cc 21 Feb 2008 23:55:29 -0000 1.2
--- gl.cc 3 Mar 2008 06:02:26 -0000 1.3
***************
*** 25,28 ****
--- 25,29 ----
}
+
void Stg::gl_draw_grid( stg_bounds3d_t vol )
{
Index: model_load.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/model_load.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** model_load.cc 24 Feb 2008 20:48:33 -0000 1.7
--- model_load.cc 3 Mar 2008 06:02:26 -0000 1.8
***************
*** 145,148 ****
--- 145,159 ----
}
+
+ if( wf->PropertyExists( this->id, "color_rgba" ))
+ {
+ double red = wf->ReadTupleFloat( this->id, "color_rgba", 0, 0);
+ double green = wf->ReadTupleFloat( this->id, "color_rgba", 1, 0);
+ double blue = wf->ReadTupleFloat( this->id, "color_rgba", 2, 0);
+ double alpha = wf->ReadTupleFloat( this->id, "color_rgba", 3, 0);
+
+ this->SetColor( stg_color_pack( red, green, blue, alpha ));
+ }
+
if( wf->PropertyExists( this->id, "bitmap" ) )
{
***************
*** 324,328 ****
this->SetMapResolution( wf->ReadFloat(this->id, "map_resolution",
this->map_resolution ));
-
if( wf->PropertyExists( this->id, "ctrl" ))
{
--- 335,338 ----
Index: block.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/block.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** block.cc 18 Feb 2008 03:52:30 -0000 1.4
--- block.cc 3 Mar 2008 06:02:26 -0000 1.5
***************
*** 162,166 ****
(int)pt_count );
! double ppm = mod->World()->ppm;
// update the global coordinate list
--- 162,166 ----
(int)pt_count );
! double ppm = mod->GetWorld()->ppm;
// update the global coordinate list
***************
*** 195,199 ****
stg_render_info_t render_info;
! render_info.world = mod->World();
render_info.block = this;
--- 195,199 ----
stg_render_info_t render_info;
! render_info.world = mod->GetWorld();
render_info.block = this;
***************
*** 215,219 ****
&g_array_index( rendered_points, stg_list_entry_t, p);
- //mod->World()->RemoveBlockPixel( pt->x, pt->y, this );
*pt->head = g_slist_delete_link( *pt->head, pt->link );
--- 215,218 ----
Index: Makefile.am
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Makefile.am 24 Feb 2008 20:46:13 -0000 1.9
--- Makefile.am 3 Mar 2008 06:02:26 -0000 1.10
***************
*** 36,39 ****
--- 36,40 ----
model_blobfinder.cc \
model_props.cc \
+ resource.cc \
stage.cc \
stage.hh \
Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/stage.hh,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** stage.hh 25 Feb 2008 04:45:42 -0000 1.12
--- stage.hh 3 Mar 2008 06:02:26 -0000 1.13
***************
*** 528,531 ****
--- 528,541 ----
void gl_coord_shift( double x, double y, double z, double a );
+ class StgFlag
+ {
+ public:
+ stg_color_t color;
+ double size;
+
+ StgFlag( stg_color_t color, double size );
+ StgFlag* Nibble( double portion );
+ };
+
/** Render a string at [x,y,z] in the current color */
void gl_draw_string( float x, float y, float z, char *string);
***************
*** 1038,1043 ****
void CancelQuitAll(){ quit_all = false; }
- //stg_meters_t Width(){ return width; };
- //stg_meters_t Height(){ return height; };
double Resolution(){ return ppm; };
--- 1048,1051 ----
***************
*** 1055,1059 ****
void ForEachModel( GHFunc func, void* arg )
{ g_hash_table_foreach( models_by_id, func, arg ); };
!
};
--- 1063,1069 ----
void ForEachModel( GHFunc func, void* arg )
{ g_hash_table_foreach( models_by_id, func, arg ); };
!
! long unsigned int GetUpdateCount()
! { return updates; }
};
***************
*** 1224,1227 ****
--- 1234,1239 ----
//ctrlupdate_t* updatefunc;
+ GList* flag_list;
+
public:
***************
*** 1244,1247 ****
--- 1256,1270 ----
void Init();
+
+ void AddFlag( StgFlag* flag );
+ void RemoveFlag( StgFlag* flag );
+
+ void PushFlag( StgFlag* flag );
+ StgFlag* PopFlag();
+
+ int GetFlagCount(){ return g_list_length( flag_list ); }
+
+ void DrawFlagList();
+
virtual void PushColor( stg_color_t col )
{ world->PushColor( col ); }
***************
*** 1279,1283 ****
bool Stall(){ return this->stall; }
int GuiMask(){ return this->gui_mask; };
! StgWorld* World(){ return this->world; }
/// return the root model of the tree containing this model
--- 1302,1306 ----
bool Stall(){ return this->stall; }
int GuiMask(){ return this->gui_mask; };
! StgWorld* GetWorld(){ return this->world; }
/// return the root model of the tree containing this model
Index: canvas.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/canvas.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** canvas.cc 24 Feb 2008 23:24:40 -0000 1.10
--- canvas.cc 3 Mar 2008 06:02:26 -0000 1.11
***************
*** 530,534 ****
world->ClearRays();
! }
}
--- 530,538 ----
world->ClearRays();
! }
!
!
! // find all the flags
! GList* flags = NULL;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit