Revision: 7998
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7998&view=rev
Author:   rtv
Date:     2009-07-11 22:57:40 +0000 (Sat, 11 Jul 2009)

Log Message:
-----------
webstage updates

Modified Paths:
--------------
    code/stage/trunk/CMakeLists.txt
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/libstage/worldgui.cc
    code/stage/trunk/webstage/webstage.cc
    code/stage/trunk/worlds/fasr.world
    code/stage/trunk/worlds/pioneer_flocking.world

Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt     2009-07-11 22:51:27 UTC (rev 7997)
+++ code/stage/trunk/CMakeLists.txt     2009-07-11 22:57:40 UTC (rev 7998)
@@ -31,45 +31,47 @@
 # Determine the operating system in detail
 INCLUDE (${PROJECT_CMAKE_DIR}/internal/FindOS.cmake)
 
-# Enable -Wall by default
+
+# Enable -Wall by default unless on Win or Solaris
 IF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
     # Using -Wall on Windows causes MSVC to produce thousands of warnings in 
its
     # own standard headers, dramatically slowing down the build.
-     #SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g -Wall")
-     #SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -Wall")
-    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall")
-    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall")
+    SET (WALL "-Wall" )
 ENDIF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
 
+#####################################
+# Build type cflags
+SET (CMAKE_CXX_FLAGS_RELEASE " -O3 -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags 
for release" FORCE)
+SET (CMAKE_CXX_FLAGS_DEBUG " -ggdb  ${WALL} " CACHE INTERNAL "C Flags for 
debug" FORCE)
+SET (CMAKE_CXX_FLAGS_PROFILE " -O3 -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags 
for profile" FORCE)
+
+#####################################
+# Set the default build type
+IF (NOT CMAKE_BUILD_TYPE)
+  SET (CMAKE_BUILD_TYPE "release" CACHE STRING 
+    "Choose the type of build, options are: release (default) debug profile" 
FORCE)
+ENDIF (NOT CMAKE_BUILD_TYPE)
+STRING(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
+
+MESSAGE( STATUS "Build type ${CMAKE_BUILD_TYPE}" )
+
 ENABLE_TESTING()
 
 # Create the pkgconfig file
 CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in 
${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
 INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION lib/pkgconfig/)
 
-# Create the config.h file
 SET(RGBFILE ${CMAKE_INSTALL_PREFIX}/share/stage/rgb.txt )
 
+# Create the config.h file
 # config.h belongs with the source (and not in CMAKE_CURRENT_BINARY_DIR as in 
Brian's original version)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in 
                                        ${CMAKE_CURRENT_SOURCE_DIR}/config.h 
@ONLY)
 
-# Enable -Wall by default
-#SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall")
-#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
-SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall")
-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
-
 message( STATUS "Checking for libtool" )
 find_path( LTDL_INCLUDE_DIR ltdl.h DOC "Libtool include dir" )
 find_library( LTDL_LIB ltdl DOC "Libtool lib" )
 
-#IF (${LTDL_LIB} STREQUAL "LTDL_LIB-NOTFOUND")
-#      message( FATAL_ERROR "libtool library not found, aborting" )
-#ELSE (${LTDL_LIB} STREQUAL "LTDL_LIB-NOTFOUND")
-#      message( STATUS "  found" )
-#ENDIF (${LTDL_LIB} STREQUAL "LTDL_LIB-NOTFOUND")
-
 include_directories( 
        ${OPENGL_INCLUDE_DIR}
        ${LTDL_INCLUDE_DIR}

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-07-11 22:51:27 UTC (rev 7997)
+++ code/stage/trunk/libstage/stage.hh  2009-07-11 22:57:40 UTC (rev 7998)
@@ -885,10 +885,12 @@
 
         void CallUpdateCallbacks(); ///< Call all calbacks in cb_list, 
removing any that return true;
 
-    bool paused; ///< the world only updates when this is false
-
   public:
         
+    bool paused; ///< the world only updates when this is false or steps > 0
+       unsigned int steps; ///< When paused, stage updates while steps >
+                                               ///0, decrementing steps with 
each update.
+
     void Start(){ paused = false; };
     void Stop(){ paused = true; };
     void TogglePause(){ paused = !paused; };
@@ -1413,7 +1415,6 @@
     stg_usec_t interval_real;   ///< real-time interval between updates - set 
this to zero for 'as fast as possible
     Fl_Menu_Bar* mbar;
     OptionsDlg* oDlg;
-       unsigned int steps;
     bool pause_time;
     stg_usec_t real_time_of_last_update;
        

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2009-07-11 22:51:27 UTC (rev 7997)
+++ code/stage/trunk/libstage/world.cc  2009-07-11 22:57:40 UTC (rev 7998)
@@ -112,7 +112,8 @@
   update_lists(1),
   updates( 0 ),
   wf( NULL ),
-  paused( false )
+  paused( false ),
+  steps(0)
 {
   if( ! Stg::InitDone() )
     {
@@ -523,8 +524,16 @@
       return true;             
   }
   
-  if( paused ) 
-       return false;
+  if( paused )
+       {
+         if( steps < 1 )        
+               return true;
+         else
+               {
+                 --steps;
+                 printf( "world::update (steps remaining %d)\n", steps );      
          
+               }
+       }
 
   dirty = true; // need redraw 
   

Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc       2009-07-11 22:51:27 UTC (rev 
7997)
+++ code/stage/trunk/libstage/worldgui.cc       2009-07-11 22:57:40 UTC (rev 
7998)
@@ -335,18 +335,8 @@
          pause_time = true;
   }
 
-  bool val = true;
+  bool val = World::Update(); 
   
-  if( paused )  
-        {
-               if( steps > 0 )
-                 {
-                        val = World::Update();
-                        --steps;
-                 }
-        }
-  else
-        val = World::Update();
         
   stg_usec_t interval;
   stg_usec_t timenow;
@@ -363,7 +353,7 @@
                
                double sleeptime = (double)interval_real - (double)interval;
                
-               if( paused ) sleeptime = 20000; // spare the CPU if we're paused
+               if( paused ) sleeptime = 50000; // spare the CPU if we're paused
                
                // printf( "real %.2f interval %.2f sleeptime %.2f\n", 
                //       (double)interval_real,
@@ -627,6 +617,7 @@
 
 void WorldGui::onceCb( Fl_Widget* w, WorldGui* worldGui )
 {
+  puts( "ONCE" );
   worldGui->paused = true;
   worldGui->steps = 1; // number of steps to run  
 }

Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc       2009-07-11 22:51:27 UTC (rev 
7997)
+++ code/stage/trunk/webstage/webstage.cc       2009-07-11 22:57:40 UTC (rev 
7998)
@@ -37,16 +37,30 @@
   
   virtual bool ClockStart()
   {
+       puts( "[WebStage]  Clock start" );
        world->Start();
        return true;
   }
 
   virtual bool ClockStop()
   {
+       puts( "[WebStage]  Clock stop" );
        world->Stop();
        return true;
   }
 
+  virtual bool ClockRunFor( double usec )
+  {
+       puts( "[WebStage]  Clock tick" );
+
+       world->paused = true;
+       // when paused, the world will run while steps > 0, decrementing
+       // steps each cycle.
+       world->steps = (usec * 1e6) / world->GetSimInterval();
+
+       return true;
+  }
+
   void Push( const std::string& name )
   {
        Stg::Model* mod = world->GetModel( name.c_str() );
@@ -590,7 +604,7 @@
   //printf( "WebStage built on %s %s\n", PROJECT, VERSION );
   
   std::string fedfilename = "";
-  std::string host = "192.168.1.210";
+  std::string host = "localhost";
   unsigned short port = 8000;
   
   int ch=0, optindex=0;

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2009-07-11 22:51:27 UTC (rev 7997)
+++ code/stage/trunk/worlds/fasr.world  2009-07-11 22:57:40 UTC (rev 7998)
@@ -15,7 +15,6 @@
 
 resolution 0.02
 
-# extra threads may speed things up a little here depending on available CPU 
cores & workload 
 threads 0
 
 # configure the GUI window

Modified: code/stage/trunk/worlds/pioneer_flocking.world
===================================================================
--- code/stage/trunk/worlds/pioneer_flocking.world      2009-07-11 22:51:27 UTC 
(rev 7997)
+++ code/stage/trunk/worlds/pioneer_flocking.world      2009-07-11 22:57:40 UTC 
(rev 7998)
@@ -10,9 +10,10 @@
 
 paused 1
 
+# 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
+# this is very helpful if you have multiple CPUs - a good value is <number of 
CPU cores> - 1
 # threads 7
 
 # configure the GUI window


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