Revision: 8051
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8051&view=rev
Author:   rtv
Date:     2009-07-18 22:28:35 +0000 (Sat, 18 Jul 2009)

Log Message:
-----------
applied Toby's patch 2810731 improving player graphicsXD support

Modified Paths:
--------------
    code/stage/trunk/libstage/color.cc
    code/stage/trunk/libstageplugin/CMakeLists.txt
    code/stage/trunk/libstageplugin/p_driver.cc
    code/stage/trunk/libstageplugin/p_driver.h
    code/stage/trunk/libstageplugin/p_graphics2d.cc
    code/stage/trunk/libstageplugin/p_graphics3d.cc
    code/stage/trunk/worlds/SFU.world
    code/stage/trunk/worlds/pioneer_flocking.world
    code/stage/trunk/worlds/simple.cfg

Modified: code/stage/trunk/libstage/color.cc
===================================================================
--- code/stage/trunk/libstage/color.cc  2009-07-17 15:17:05 UTC (rev 8050)
+++ code/stage/trunk/libstage/color.cc  2009-07-18 22:28:35 UTC (rev 8051)
@@ -31,8 +31,8 @@
        return; // red
   
   static FILE *file = NULL;
-  static GHashTable* table = g_hash_table_new( g_str_hash, g_str_equal );
-  
+  static std::map<std::string,Color> table;
+
   if( file == NULL )
        {
          std::string rgbFile = FileManager::findFile( "rgb.txt" );
@@ -69,28 +69,22 @@
                        int chars_matched = 0;
                        sscanf( line, "%d %d %d %n", &r, &g, &b, &chars_matched 
);
                        
-                       Color* c = new Color( r / 255.0,
-                                                                 g / 255.0,
-                                                                 b / 255.0, 
-                                                                 1.0 );
-
                        // Read the name
-                       char* colorname = strdup( line + chars_matched );
-
+                       const char* colorname = line + chars_matched;
+                       
                        // map the name to the color in the table
-                       g_hash_table_insert( table, (gpointer)colorname, 
(gpointer)c );
+                       table[colorname] = Color( r/255.0, g/255.0, b/255.0 );
                }
-               fclose(file);
+         fclose(file);
        }
   
-  // look up the colorname in the database  
-  //stg_color_t* found = (stg_color_t*)g_hash_table_lookup( table, name );
+  // look up the colorname in the database    
+  Color& found = table[name];
   
-  Color* found = (Color*)g_hash_table_lookup( table, name );  
-  this->r = found->r;
-  this->g = found->g;
-  this->b = found->b;
-  this->a = found->a;
+  this->r = found.r;
+  this->g = found.g;
+  this->b = found.b;
+  this->a = found.a;
 }
 
 bool Color::operator==( const Color& other )

Modified: code/stage/trunk/libstageplugin/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstageplugin/CMakeLists.txt      2009-07-17 15:17:05 UTC 
(rev 8050)
+++ code/stage/trunk/libstageplugin/CMakeLists.txt      2009-07-18 22:28:35 UTC 
(rev 8051)
@@ -15,12 +15,10 @@
             p_speech.cc
             p_aio.cc
             p_dio.cc
+            p_graphics.cc
             stg_time.cc
 )
 
-# TODO
-#           p_graphics3d.cc
-
 add_library( stageplugin MODULE ${stagepluginSrcs} )
 
 

Modified: code/stage/trunk/libstageplugin/p_driver.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_driver.cc 2009-07-17 15:17:05 UTC (rev 
8050)
+++ code/stage/trunk/libstageplugin/p_driver.cc 2009-07-18 22:28:35 UTC (rev 
8051)
@@ -350,13 +350,13 @@
        //        ifsrc = new InterfaceCamera( player_addr,  this, cf, section 
);
        //        break;
 
-       //        case PLAYER_GRAPHICS2D_CODE:
-       //        ifsrc = new InterfaceGraphics2d( player_addr,  this, cf, 
section );
-       //        break;
+       case PLAYER_GRAPHICS2D_CODE:
+               ifsrc = new InterfaceGraphics2d( player_addr,  this, cf, 
section );
+               break;
 
-       //      case PLAYER_GRAPHICS3D_CODE:
-       //              ifsrc = new InterfaceGraphics3d( player_addr,  this, 
cf, section );
-       //              break;
+       case PLAYER_GRAPHICS3D_CODE:
+               ifsrc = new InterfaceGraphics3d( player_addr,  this, cf, 
section );
+               break;
 
 
 
@@ -480,7 +480,7 @@
 
 
 // subscribe to a device
-int StgDriver::Subscribe(player_devaddr_t addr)
+int StgDriver::Subscribe(QueuePointer &queue,player_devaddr_t addr)
 {
   if( addr.interf == PLAYER_SIMULATION_CODE )
     return 0; // ok
@@ -489,7 +489,8 @@
 
   if( device )
     {
-      device->Subscribe();
+         device->Subscribe();
+      device->Subscribe(queue);
       return Driver::Subscribe(addr);
     }
 
@@ -499,7 +500,7 @@
 
 
 // unsubscribe to a device
-int StgDriver::Unsubscribe(player_devaddr_t addr)
+int StgDriver::Unsubscribe(QueuePointer &queue,player_devaddr_t addr)
 {
   if( addr.interf == PLAYER_SIMULATION_CODE )
     return 0; // ok
@@ -508,7 +509,8 @@
 
   if( device )
     {
-      device->Unsubscribe();
+         device->Unsubscribe();
+      device->Unsubscribe(queue);
       return Driver::Unsubscribe(addr);
     }
   else

Modified: code/stage/trunk/libstageplugin/p_driver.h
===================================================================
--- code/stage/trunk/libstageplugin/p_driver.h  2009-07-17 15:17:05 UTC (rev 
8050)
+++ code/stage/trunk/libstageplugin/p_driver.h  2009-07-18 22:28:35 UTC (rev 
8051)
@@ -30,8 +30,8 @@
   virtual int ProcessMessage(QueuePointer &resp_queue,
                             player_msghdr * hdr,
                             void * data);
-  virtual int Subscribe(player_devaddr_t addr);
-  virtual int Unsubscribe(player_devaddr_t addr);
+  virtual int Subscribe(QueuePointer &queue, player_devaddr_t addr);
+  virtual int Unsubscribe(QueuePointer &queue, player_devaddr_t addr);
 
   /// The server thread calls this method frequently. We use it to
   /// check for new commands and configs
@@ -77,9 +77,10 @@
   virtual void Publish( void ){}; // do nothing
   virtual void Subscribe( void ){}; // do nothing
   virtual void Unsubscribe( void ){}; // do nothing
+  virtual void Subscribe( QueuePointer &queue ){}; // do nothing
+  virtual void Unsubscribe( QueuePointer &queue ){}; // do nothing};
 };
 
-
 class InterfaceSimulation : public Interface
 {
  public:
@@ -314,27 +315,38 @@
                        void * data );
 };
 
+class PlayerGraphics2dVis;
+class InterfaceGraphics2d : public InterfaceModel
+{
+ public:
+  InterfaceGraphics2d( player_devaddr_t addr, StgDriver* driver, ConfigFile* 
cf, int section );
+  virtual ~InterfaceGraphics2d( void );
+
+  void Subscribe(QueuePointer &queue);
+  void Unsubscribe(QueuePointer &queue);
+
+  virtual int ProcessMessage( QueuePointer & resp_queue,
+                             player_msghdr * hdr,
+                             void * data );
+
+  PlayerGraphics2dVis * vis;
+};
+
+class PlayerGraphics3dVis;
 class InterfaceGraphics3d : public InterfaceModel
 {
  public:
   InterfaceGraphics3d( player_devaddr_t addr, StgDriver* driver, ConfigFile* 
cf, int section );
   virtual ~InterfaceGraphics3d( void );
 
+  void Subscribe(QueuePointer &queue);
+  void Unsubscribe(QueuePointer &queue);
+
   virtual int ProcessMessage( QueuePointer & resp_queue,
                              player_msghdr * hdr,
                              void * data );
-  virtual void Publish( void );
 
- private:
-
-  void StoreCommand( int type, void* data );
-
-  GList* commands; // list of drawing commands received since the last CLEAR
-  bool rebuild_displaylist;
-  int displaylist;
-
-  // clear the display
-  void Clear( void );
+  PlayerGraphics3dVis * vis;
 };
 
 /** Replaces Player's real time clock object */

Modified: code/stage/trunk/libstageplugin/p_graphics2d.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_graphics2d.cc     2009-07-17 15:17:05 UTC 
(rev 8050)
+++ code/stage/trunk/libstageplugin/p_graphics2d.cc     2009-07-18 22:28:35 UTC 
(rev 8051)
@@ -1,192 +0,0 @@
-/*
- *  Player - One Hell of a Robot Server
- *  Copyright (C) 2004, 2005 Richard Vaughan
- *                      
- * 
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-/*
- * Desc: A plugin driver for Player that gives access to Stage devices.
- * Author: Richard Vaughan
- * Date: 10 December 2004
- * CVS: $Id: p_graphics2d.cc,v 1.2 2008-01-15 01:25:42 rtv Exp $
- */
-
-#include "p_driver.h"
-
-#include <iostream>
-using namespace std;
-
-stg_rtk_fig_t* stg_model_get_fig( stg_model_t* mod, const char* figname );
-stg_rtk_fig_t* stg_model_fig_create( stg_model_t* mod, 
-                                    const char* figname, 
-                                    const char* parentname, 
-                                    int layer );
-
-
-// DOCUMENTATION ------------------------------------------------------------
-
-/** @addtogroup player 
-...@par Graphics2d interface
-- PLAYER_GRAPHICS2D_CMD_CLEAR
-- PLAYER_GRAPHICS2D_CMD_POINTS
-- PLAYER_GRAPHICS2D_CMD_POLYLINE
-- PLAYER_GRAPHICS2D_CMD_POLYGON
-*/
-
-static unsigned int rgb32_pack( player_color_t *pcol )
-{
-  unsigned int col=0;
-  col = pcol->red << 16;
-  col += pcol->green << 8;
-  col += pcol->blue;
-  return col;
-}
-
-InterfaceGraphics2d::InterfaceGraphics2d( player_devaddr_t addr, 
-                           StgDriver* driver,
-                           ConfigFile* cf,
-                           int section )
-  : InterfaceModel( addr, driver, cf, section, NULL )
-{ 
-  // get or create a nice clean figure for drawing
-  this->fig = stg_model_get_fig( mod, "g2d_fig" );
-  
-  if( ! this->fig )
-    this->fig = stg_model_fig_create( mod, "g2d_fig", "top", 99 );
-  
-  stg_rtk_fig_clear( this->fig );
-
-  list = NULL;
-}
-
-InterfaceGraphics2d::~InterfaceGraphics2d( void )
-{ 
-  Clear();
-}
-
-void InterfaceGraphics2d::Clear( void )
-{ 
-  stg_rtk_fig_clear( this->fig );
-
-  // delete all drawlist entries
-  // delete drawlist
-  list = NULL;
-}
-
-int InterfaceGraphics2d::ProcessMessage(MessageQueue* resp_queue,
-                                player_msghdr_t* hdr,
-                                void* data)
-{
-  // printf( "Stage graphics2d interface processing message\n" );
-  
-  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS2D_CMD_CLEAR, 
-                           this->addr))
-    {
-      Clear();      
-      return 0; //ok
-    }
-  
-  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS2D_CMD_POINTS, 
-                           this->addr))
-    {
-      player_graphics2d_cmd_points_t* pcmd = 
-       (player_graphics2d_cmd_points_t*)data;
-      
-      stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->color) );
-      
-      for(unsigned int p=0; p<pcmd->points_count; p++ )        
-       {
-         //printf( "g2d: Drawing point %.2f %.2f\n", pcmd->points[p].px, 
pcmd->points[p].py );
-         stg_rtk_fig_point( this->fig, 
-                            pcmd->points[p].px, 
-                            pcmd->points[p].py );      
-       }
-      return 0; //ok
-    }
-  
-  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS2D_CMD_POLYLINE, 
-                           this->addr))
-    {
-      player_graphics2d_cmd_polyline_t* pcmd = 
-       (player_graphics2d_cmd_polyline_t*)data;
-      
-      stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->color) );
-      
-      if( pcmd->points_count > 1 )
-       for(unsigned int p=0; p<pcmd->points_count-1; p++ )     
-         {
-           //printf( "g2d: Drawing polyline section from [%.2f,%.2f] to 
[%.2f,%.2f]\n", 
-           //    pcmd->points[p].px, pcmd->points[p].py, 
-           //    pcmd->points[p+1].px, pcmd->points[p+1].py );
-           
-           stg_rtk_fig_line( this->fig, 
-                             pcmd->points[p].px, 
-                             pcmd->points[p].py,
-                             pcmd->points[p+1].px, 
-                             pcmd->points[p+1].py );      
-         }
-      else
-       PRINT_WARN( "refusing to draw a polyline with < 2 points" );
-      
-      return 0; //ok
-    }
-
-  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS2D_CMD_POLYGON, 
-                           this->addr))
-    {
-      player_graphics2d_cmd_polygon_t* pcmd = 
-       (player_graphics2d_cmd_polygon_t*)data;
-      
-      
-      double pts[PLAYER_GRAPHICS2D_MAX_POINTS][2];
-      
-      for(unsigned int p=0; p<pcmd->points_count; p++ )        
-       {
-         pts[p][0] = pcmd->points[p].px;
-         pts[p][1] = pcmd->points[p].py;
-       }
-      
-      //printf( "g2d: Drawing polygon of %d points\n", pcmd->count ); 
-      
-      if( pcmd->filled )
-       {
-         stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->fill_color));
-         stg_rtk_fig_polygon( this->fig, 
-                              0,0,0,                      
-                              pcmd->points_count,
-                              pts,
-                              TRUE );
-       }
-      
-      stg_rtk_fig_color_rgb32( this->fig, rgb32_pack( &pcmd->color) );
-      stg_rtk_fig_polygon( this->fig, 
-                          0,0,0,                          
-                          pcmd->points_count,
-                          pts,
-                          FALSE );
-      return 0; //ok
-    }
-  
-  PLAYER_WARN2("stage graphics2d doesn't support message %d:%d.", 
-              hdr->type, hdr->subtype );
-  return -1;
-}

Modified: code/stage/trunk/libstageplugin/p_graphics3d.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_graphics3d.cc     2009-07-17 15:17:05 UTC 
(rev 8050)
+++ code/stage/trunk/libstageplugin/p_graphics3d.cc     2009-07-18 22:28:35 UTC 
(rev 8051)
@@ -1,322 +0,0 @@
-/*
- *  Stage 
- *  Copyright (C) Richard Vaughan
- *                      
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-/*
- * Desc: A plugin driver for Player that gives access to Stage devices.
- * Author: Richard Vaughan
- * Date: 10 December 2004
- * CVS: $Id: p_graphics3d.cc,v 1.2 2008-01-15 01:25:42 rtv Exp $
- */
-
-#include "p_driver.h"
-
-#include <iostream>
-using namespace std;
-
-#ifdef G_OS_WIN32
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-#endif
-
-//extern GList* dl_list;
-
-// DOCUMENTATION ------------------------------------------------------------
-
-/** @addtogroup player 
-...@par Graphics3d interface
-- PLAYER_GRAPHICS3D_CMD_CLEAR
-- PLAYER_GRAPHICS3D_CMD_DRAW
-- PLAYER_GRAPHICS3D_CMD_TRANSLATE
-- PLAYER_GRAPHICS3D_CMD_ROTATE
-*/
-
-typedef struct
-{
-  int type;
-  void* data;
-} cmd_record_t;
-
-
-InterfaceGraphics3d::InterfaceGraphics3d( player_devaddr_t addr, 
-                           StgDriver* driver,
-                           ConfigFile* cf,
-                           int section )
-  : InterfaceModel( addr, driver, cf, section, MODEL_TYPE_PLAIN )
-{ 
-  // data members
-  commands = NULL;
-  displaylist = glGenLists( 1 );
-
-  //printf( "allocated dl %d\n", displaylist );
- 
-  rebuild_displaylist = FALSE;
-
-  //dl_list = g_list_append( dl_list, (void*)displaylist );
-}
-
-InterfaceGraphics3d::~InterfaceGraphics3d( void )
-{ 
-  Clear();
-  glDeleteLists( displaylist, 1 );
-}
-
-void InterfaceGraphics3d::Clear( void )
-{ 
-  // empty the list of drawing commands
-  GList* it;
-  for( it=commands; it; it=it->next )
-    {
-      cmd_record_t* rec = (cmd_record_t*)it->data;
-
-      assert(rec);
-
-      if( rec->data )
-       g_free( rec->data );
-      
-      g_free( rec );
-    }
-
-  g_list_free( commands );
-  commands = NULL;
-
-  // empty the display list
-  //puts( "CLEARING DISPLAYLIST" );
-  glNewList( displaylist, GL_COMPILE );
-  glEndList();
-}
-
-void InterfaceGraphics3d::StoreCommand( int type, void* cmd )
-{
-  cmd_record_t* rec = g_new( cmd_record_t, 1 );
-  rec->type = type;
-  rec->data = cmd;
-
-  // store this command
-  commands = g_list_append( commands, rec );
-  
-  // trigger display list update on next Publish()
-  rebuild_displaylist = TRUE;
-}
-
-int InterfaceGraphics3d::ProcessMessage( QueuePointer & resp_queue,
-                                        player_msghdr_t* hdr,
-                                        void* data)
-{
-  // TODO queue *all* commands so that tranformations and clearing are
-  // done synchronously
-
-  // test for drawing commands first because they are the most common
-  // by far and we avoid lots of tests
-
-  // THESE COMMANDS HAVE A DATA PAYLOAD
-
-  if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_DRAW, 
-                           this->addr) )
-    {
-      StoreCommand( PLAYER_GRAPHICS3D_CMD_DRAW,
-                   g_memdup( data, sizeof(player_graphics3d_cmd_draw_t)));;
-      return 0; //ok
-    }
-  
-  if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_ROTATE, 
-                           this->addr) )
-    {
-      StoreCommand( PLAYER_GRAPHICS3D_CMD_ROTATE,
-                   g_memdup( data, sizeof(player_graphics3d_cmd_rotate_t)));;
-      return 0; //ok
-    }
-  
-  if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_TRANSLATE, 
-                           this->addr) )
-    {
-      StoreCommand( PLAYER_GRAPHICS3D_CMD_TRANSLATE,
-                   g_memdup( data, 
sizeof(player_graphics3d_cmd_translate_t)));;
-      return 0; //ok
-    }
-
-  // THESE COMMANDS HAVE NO DATA ATTACHED
-
-  if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_PUSH, 
-                           this->addr) )
-    {
-      StoreCommand( PLAYER_GRAPHICS3D_CMD_PUSH, NULL );
-      return 0; //ok
-    }
-  
-  if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_POP, 
-                           this->addr) )
-    {
-      StoreCommand( PLAYER_GRAPHICS3D_CMD_POP, NULL );
-      return 0; //ok
-    }
-  
-  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 
-                           PLAYER_GRAPHICS3D_CMD_CLEAR, 
-                           this->addr) )
-    {
-      Clear(); // empties the display list immediately
-      return 0; //ok
-    }
-      
-  PLAYER_WARN2("stage graphics3d  doesn't support message %d:%d.", 
-              hdr->type, hdr->subtype );
-  return -1;
-}
-
-void InterfaceGraphics3d::Publish( void )
-{
-  // rebuild this device's OpenGL display list
- 
-  if( rebuild_displaylist )
-    {      
-      //printf( "rebuilding display list %d commands\n", 
-      //      g_list_length(commands) );
-      
-      // execute the commands
-      glNewList( displaylist, GL_COMPILE );
-
-      // move into the relevant model's coordinate frame
-      Pose gpose = mod->GetGlobalPose();
-      
-      glPushMatrix();
-      glTranslatef( gpose.x, gpose.y, 0 ); 
-      glRotatef( RTOD(gpose.a), 0,0,1 ); // z-axis rotation 
-      
-      // as long as there's anything on the queue
-      GList* it;
-      for( it=commands; it; it=it->next )
-       {
-         cmd_record_t* rec = (cmd_record_t*)it->data;
-         
-         switch( rec->type )
-           {
-           case PLAYER_GRAPHICS3D_CMD_CLEAR:
-             PRINT_ERR( "clear commands are not supposed to get here" );
-             break;
-             
-           case PLAYER_GRAPHICS3D_CMD_PUSH:
-           case PLAYER_GRAPHICS3D_CMD_POP:
-             puts( "pushing and popping not yet implemented" );
-             break;
-             
-           case PLAYER_GRAPHICS3D_CMD_TRANSLATE:
-             {
-               player_graphics3d_cmd_translate_t* cmd = 
-                 (player_graphics3d_cmd_translate_t*)rec->data;              
-               //printf( "TRANSLATE [%.2f,%.2f,%.2f]n", cmd->x, cmd->y, cmd->z 
);
-               glTranslatef( cmd->x, cmd->y, cmd->z );
-               g_free( cmd );
-             }
-             break;
-             
-           case PLAYER_GRAPHICS3D_CMD_ROTATE:
-             {   
-               player_graphics3d_cmd_rotate_t* cmd = 
-                 (player_graphics3d_cmd_rotate_t*)rec->data;         
-               //printf( "ROTATE %.2f radians about [%.2f,%.2f,%.2f]n", 
-               //cmd->a, cmd->x, cmd->y, cmd->z );
-               glRotatef( RTOD(cmd->a), cmd->x, cmd->y, cmd->z );
-               g_free( cmd );
-             }
-             break;
-             
-           case PLAYER_GRAPHICS3D_CMD_DRAW:
-             {
-
-               player_graphics3d_cmd_draw_t* cmd = 
-                 (player_graphics3d_cmd_draw_t*)rec->data;
-               
-               //printf( "DRAW mode %d with %d points\n", 
-               //cmd->draw_mode, cmd->points_count );
-
-               // player color elements are uint8_t type
-               glColor4ub( cmd->color.red, 
-                           cmd->color.green, 
-                           cmd->color.blue, 
-                           cmd->color.alpha );
-               
-               switch( cmd->draw_mode )
-                 {
-                 case PLAYER_DRAW_POINTS:
-                   glPointSize( 3 );
-                   glBegin( GL_POINTS );
-                   break;            
-                 case PLAYER_DRAW_LINES:
-                   glBegin( GL_LINES );
-                   break;
-                 case PLAYER_DRAW_LINE_STRIP:
-                   glBegin( GL_LINE_STRIP );
-                   break;
-                 case PLAYER_DRAW_LINE_LOOP:
-                   glBegin( GL_LINE_LOOP );
-                   break;
-                 case PLAYER_DRAW_TRIANGLES:
-                   glBegin( GL_TRIANGLES );
-                   break;
-                 case PLAYER_DRAW_TRIANGLE_STRIP:
-                   glBegin( GL_TRIANGLE_STRIP );
-                   break;
-                 case PLAYER_DRAW_TRIANGLE_FAN:
-                   glBegin( GL_TRIANGLE_FAN );
-                   break;
-                 case PLAYER_DRAW_QUADS:
-                   glBegin( GL_QUADS );
-                   break;
-                 case PLAYER_DRAW_QUAD_STRIP:
-                   glBegin( GL_QUAD_STRIP );
-                   break;
-                 case PLAYER_DRAW_POLYGON:
-                   glBegin( GL_POLYGON );
-                   break;
-                   
-                 default:
-                   PRINT_WARN1( "drawing mode %d not handled", 
-                                cmd->draw_mode );       
-                 }
-               
-               unsigned int c;
-               for( c=0; c<cmd->points_count; c++ )
-                 glVertex3f( cmd->points[c].px,
-                               cmd->points[c].py,
-                               cmd->points[c].pz );
-               
-               glEnd();
-             }
-             break;
-             
-           default:
-             PRINT_WARN1( "Unrecognized graphics command type %d\n", 
-                          rec->type );
-           }
-       }
-      
-      glPopMatrix(); // drop out of the model's CS
-      glEndList();
-      
-      //puts("");
-      
-      rebuild_displaylist = FALSE;
-    }
-}

Modified: code/stage/trunk/worlds/SFU.world
===================================================================
--- code/stage/trunk/worlds/SFU.world   2009-07-17 15:17:05 UTC (rev 8050)
+++ code/stage/trunk/worlds/SFU.world   2009-07-18 22:28:35 UTC (rev 8051)
@@ -9,14 +9,10 @@
 interval_sim 100  # simulation timestep in milliseconds
 interval_real 0  # real-time interval between simulation updates in 
milliseconds 
 
-quit_time 1
-
 paused 0
-
 resolution 0.1
+threads 0
 
-threads 7
-
 # configure the GUI window
 window
 (

Modified: code/stage/trunk/worlds/pioneer_flocking.world
===================================================================
--- code/stage/trunk/worlds/pioneer_flocking.world      2009-07-17 15:17:05 UTC 
(rev 8050)
+++ code/stage/trunk/worlds/pioneer_flocking.world      2009-07-18 22:28:35 UTC 
(rev 8051)
@@ -13,7 +13,7 @@
 # low resolution gives fast raytracing. set this only as small as you need for 
your application
 resolution 0.1
 
-# this is very helpful if you have multiple CPUs - a good value is <number of 
CPU cores> - 1
+# this is very helpful if you have multiple CPUs - a good value is <number of 
CPU cores> - 
 # threads 7
 
 # configure the GUI window

Modified: code/stage/trunk/worlds/simple.cfg
===================================================================
--- code/stage/trunk/worlds/simple.cfg  2009-07-17 15:17:05 UTC (rev 8050)
+++ code/stage/trunk/worlds/simple.cfg  2009-07-18 22:28:35 UTC (rev 8051)
@@ -22,7 +22,7 @@
 driver
 ( 
   name "stage"
-  provides [ "position2d:0" "laser:0" "speech:0" ]
+  provides [ "position2d:0" "laser:0" "speech:0" "graphics2d:0" "graphics3d:0" 
]
   model "r0" 
 )
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to