Revision: 8515
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8515&view=rev
Author:   rtv
Date:     2010-01-19 22:40:54 +0000 (Tue, 19 Jan 2010)

Log Message:
-----------
added option to prevent stacking of models, based on patch #2919630 from RAZOR, 
but on a per-model basis. Thanks RAZOR (I can't find your real name).

Modified Paths:
--------------
    code/stage/trunk/CMakeLists.txt
    code/stage/trunk/libstage/block.cc
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_draw.cc
    code/stage/trunk/libstage/model_getset.cc
    code/stage/trunk/libstage/model_load.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/worlds/pioneer.inc

Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt     2010-01-19 04:25:48 UTC (rev 8514)
+++ code/stage/trunk/CMakeLists.txt     2010-01-19 22:40:54 UTC (rev 8515)
@@ -212,9 +212,9 @@
 ADD_SUBDIRECTORY(assets)
 ADD_SUBDIRECTORY(worlds)
 
-if( WEBSIM_FOUND )
-ADD_SUBDIRECTORY(webstage)              
-endif( WEBSIM_FOUND )
+# if( WEBSIM_FOUND )
+# ADD_SUBDIRECTORY(webstage)            
+# endif( WEBSIM_FOUND )
 
 IF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND )
   ADD_SUBDIRECTORY(libstageplugin)

Modified: code/stage/trunk/libstage/block.cc
===================================================================
--- code/stage/trunk/libstage/block.cc  2010-01-19 04:25:48 UTC (rev 8514)
+++ code/stage/trunk/libstage/block.cc  2010-01-19 22:40:54 UTC (rev 8515)
@@ -24,7 +24,6 @@
   local_z( zmin, zmax ),
   color( color ),
   inherit_color( inherit_color ),
-  glow( 0.0 ),
   rendered_cells( new CellPtrVec ), 
   candidate_cells( new CellPtrVec ),
   gpts()
@@ -460,11 +459,12 @@
       inherit_color = false;
     }
   else
-    inherit_color = true;
-  
-  glow = wf->ReadFloat( entity, "glow", glow );
+    inherit_color = true;  
 }
 
+/////////////////////////////////////////////////////////////////////////////////////////
+// utility functions to ensure block winding is consistent and matches 
OpenGL's default
+
 static
 /// util; puts angle into [0, 2pi)
 void positivize(stg_radians_t& angle)

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2010-01-19 04:25:48 UTC (rev 8514)
+++ code/stage/trunk/libstage/model.cc  2010-01-19 22:40:54 UTC (rev 8515)
@@ -45,6 +45,8 @@
     map_resolution 0.1
     say ""
     alwayson 0
+
+    stack_children 1
     )
     @endverbatim
 
@@ -124,6 +126,12 @@
 
     - gui_move <int>\n if 1, the model can be moved by the mouse in
     the GUI window
+
+    - stack_children <int>\n If non-zero (the default), the coordinate
+      system of child models is offset in z so that its origin is on
+      _top_ of this model, making it easy to stack models together. If
+      zero, the child coordinate system is not offset in z, making it
+      easy to define objects in a single local coordinate system.
 */
 
 // todo
@@ -278,6 +286,7 @@
         rastervis(),
     rebuild_displaylist(true),
     say_string(),
+    stack_children( true ),
     stall(false),       
        subs(0),
        thread_safe( false ),

Modified: code/stage/trunk/libstage/model_draw.cc
===================================================================
--- code/stage/trunk/libstage/model_draw.cc     2010-01-19 04:25:48 UTC (rev 
8514)
+++ code/stage/trunk/libstage/model_draw.cc     2010-01-19 22:40:54 UTC (rev 
8515)
@@ -233,7 +233,7 @@
 {
   glPushMatrix();  
   
-  if( parent )
+  if( parent && parent->stack_children )
     glTranslatef( 0,0, parent->geom.size.z );
   
   Gl::pose_shift( pose );

Modified: code/stage/trunk/libstage/model_getset.cc
===================================================================
--- code/stage/trunk/libstage/model_getset.cc   2010-01-19 04:25:48 UTC (rev 
8514)
+++ code/stage/trunk/libstage/model_getset.cc   2010-01-19 22:40:54 UTC (rev 
8515)
@@ -192,8 +192,8 @@
   // otherwise    
   Pose global_pose = parent->GetGlobalPose() + pose;           
   
-  // we are on top of our parent
-  global_pose.z += parent->geom.size.z;
+  if ( parent->stack_children ) // should we be on top of our parent?
+    global_pose.z += parent->geom.size.z;
   
   return global_pose;
 }

Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc     2010-01-19 04:25:48 UTC (rev 
8514)
+++ code/stage/trunk/libstage/model_load.cc     2010-01-19 22:40:54 UTC (rev 
8515)
@@ -167,6 +167,9 @@
                  }     
     }    
   
+  this->stack_children =
+    wf->ReadInt( wf_entity, "stack_children", this->stack_children );
+  
   stg_kg_t m = wf->ReadFloat(wf_entity, "mass", this->mass );
   if( m != this->mass ) 
         SetMass( m );

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2010-01-19 04:25:48 UTC (rev 8514)
+++ code/stage/trunk/libstage/stage.hh  2010-01-19 22:40:54 UTC (rev 8515)
@@ -824,7 +824,7 @@
     pthread_cond_t threads_done_cond; ///< signalled by last worker thread to 
unblock main thread
     int total_subs; ///< the total number of subscriptions to all models
         unsigned int worker_threads; ///< the number of worker threads to use
-        
+    
   protected:    
 
         std::list<std::pair<stg_world_callback_t,void*> > cb_list; ///< List 
of callback functions and arguments
@@ -1135,9 +1135,6 @@
     Color color;
     bool inherit_color;
         
-        /** experimental - range 0 - 1, render glowing */
-        double glow;
-        
     void DrawTop();
     void DrawSides();
         
@@ -1787,6 +1784,8 @@
         bool rebuild_displaylist; ///< iff true, regenerate block display list 
before redraw
         std::string say_string;   ///< if non-null, this string is displayed 
in the GUI 
                
+    bool stack_children; ///< whether child models should be stacked on top of 
this model or not
+
         stg_bool_t stall;
         int subs;    ///< the number of subscriptions to this model
         /** Thread safety flag. Iff true, Update() may be called in
@@ -1962,7 +1961,7 @@
         /** Causes this model and its children to recompute their global
                  position instead of using a cached pose in
                  Model::GetGlobalPose()..*/
-        void GPoseDirtyTree();
+        //void GPoseDirtyTree();
 
         virtual void Startup();
         virtual void Shutdown();

Modified: code/stage/trunk/worlds/pioneer.inc
===================================================================
--- code/stage/trunk/worlds/pioneer.inc 2010-01-19 04:25:48 UTC (rev 8514)
+++ code/stage/trunk/worlds/pioneer.inc 2010-01-19 22:40:54 UTC (rev 8515)
@@ -1,4 +1,3 @@
-
 # Desc: Device definitions for Activemedia robots.
 # Author: Richard Vaughan, Andrew Howard,  Luis Riazuelo
 # Date: 10 Jun 2002


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

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to